Code: Alles auswählen.
DATA:
oDescrTable TYPE REF TO cl_abap_tabledescr,
oDescrStruc TYPE REF TO cl_abap_strucdescr,
itab TYPE TABLE OF xxx, "Definierte Tabelle
iFieldTab TYPE TABLE OF yyy. "Tabelle mit Feldbz.
Field-Symbols:
<fs_FieldTab> TYPE yyy,
<fsCompStruc> TYPE abap_compdescr.
oDescrTable ?= cl_abap_tabledescr=>describe_by_data( itab ).
oDescrStruc ?= oDescrTable->get_table_line_type( ).
loop at iFieldTab assigning <fs_FieldTab>.
loop at oDescrStruc->components assigning <fsCompStruc>.
IF <fsCompStruc>-name = <fs_FieldTab>-name.
write: / <fsCompStruc>-name.
ENDIF.
endloop.
endloop.
loop at itab into wa_itab.
Code: Alles auswählen.
DATA: feldname(30).
DATA: feldbeschreibung TYPE dfies OCCURS 1.
DATA: my_data TYPE typ_ausgabeliste_t510s.
DATA: descr_ref TYPE REF TO cl_abap_structdescr.
FIELD-SYMBOLS:
<comp_wa> TYPE abap_compdescr.
descr_ref ?= cl_abap_typedescr=>describe_by_data( my_data ).
LOOP AT descr_ref->components ASSIGNING <comp_wa>.
feldname = <comp_wa>-name.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = 'T510S'
fieldname = feldname
langu = sy-langu
* LFIELDNAME = ' '
* ALL_TYPES = ' '
* IMPORTING
* X030L_WA =
* DDOBJTYPE =
* DFIES_WA =
* LINES_DESCR =
TABLES
dfies_tab = feldbeschreibung
* FIXED_VALUES =
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
...
ENDLOOP.