How to get info of system table or the type we defined in program?
Please refer follwing codes i wrote, we can leverage two FM.
REPORT zdavid_component .
TYPES: BEGIN OF t_typ,
line TYPE char100,
END OF t_typ.
DATA: wa_typ TYPE t_typ,
it_typ TYPE TABLE OF t_typ,
it_data TYPE TABLE OF t_typ.
wa_typ-line = '1111'.
APPEND wa_typ TO it_typ.
DATA: tbl_name TYPE x030l-tabname,
it_flds TYPE TABLE OF rfc_fields.
tbl_name = 'MARA'.
CALL FUNCTION 'DP_GET_FIELDS_FROM_TABLE'
EXPORTING
tabname = tbl_name
TABLES
data = it_data
fields = it_flds
EXCEPTIONS
dp_invalid_table = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: it_components TYPE TABLE OF rstrucinfo.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = sy-repid
fieldname = 'wa_typ'
TABLES
components = it_components.
WRITE 'End'.