06-01-2009 8:33 AM
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
06-01-2009 8:40 AM
Hi,
Check the function module in se37 itself , it is working or not...
06-01-2009 8:40 AM
Hi,
Check the function module in se37 itself , it is working or not...
06-01-2009 8:46 AM
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
06-01-2009 9:30 AM
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
06-01-2009 9:32 AM
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