Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

fieladnames and fieldvalues

Former Member
0 Kudos

Hi,

I have a requirement, wherein I need to design a function module, to which i need to pass the tablename in the calling program. Based on the table name passed to the function module, the function module has to display all the field names and field contents on the output screen. Only single entry need to be fetched from the table passed to the function module.. On the output screen there should be only two columns, fieldname and fieldvalue. Under the fieldname column all the table fileds should be dispalyed. Under the fieldvalue column contents of the fields should be displayed.

Please let me know how to proceed with this

Thanks in advance

Rama Devi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check the function module in se37 itself , it is working or not...

4 REPLIES 4

Former Member
0 Kudos

Hi,

Check the function module in se37 itself , it is working or not...

Former Member
0 Kudos

Hello,

You can use the FM " DDIC_DATA_DESCRIPTION_SCAN" to get the field names.

loop on the value table and read the filedinfo table and append in to the diplay table.

Regards,

Sachinkumar Mehta

p190355
Active Contributor
0 Kudos

Hello,

Check FM : DDIF_FIELDINFO_GET


DATA :
BEGIN OF str_tab,
  field TYPE   fieldname,
  value TYPE  ddtext,
END OF str_tab.

DATA it_tab LIKE TABLE OF str_tab.
DATA wa_tab LIKE str_tab.

PARAMETERS p_tab LIKE dcobjdef-name.
*-------------------------------------------------------------------------
CALL FUNCTION 'DDIF_FIELDINFO_GET'
  EXPORTING
    tabname        = p_tab
    langu          = sy-langu
  TABLES
    dfies_tab      = itab
  EXCEPTIONS
    not_found      = 1
    internal_error = 2
    OTHERS         = 3.

IF sy-subrc EQ 0.
  LOOP AT itab FROM 2. "-- Skip Mandt
    wa_tab-field = itab-fieldname.
    BREAK-POINT.
    SELECT SINGLE (itab-fieldname)
            FROM (itab-tabname)
            INTO wa_tab-value.

    APPEND wa_tab TO it_tab.
"-- Modify your ZTable
  ENDLOOP.
ENDIF.

Also check how this FM handles Date based fields.

Cheers,

Remi

Former Member
0 Kudos

Hi,

Use these Function modules.

DDIF_FIELDINFO_GET

MINI_TABLE_FOR_DISPLAY

First by giving the table name you will get all the fields in that table.

Based on that use the second FM to get the data of that fields.

Aswarth