Code: Alles auswählen.
ASSIGN rd_struct->* TO <fs_struc>.
ASSIGN rd_tab->* TO <fs_tab>.
Code: Alles auswählen.
feld
Tabelle
Feld
Feld
Feld
Tabelle
Feld
Feld
Feld
Tabelle
Feld
Feld
Feld
Tabelle
Feld
Tabelle
Feld
Feld
Code: Alles auswählen.
TYPE-POOLS: sydes.
DATA:
desc TYPE sydes_desc.
DESCRIBE FIELD <fs> INTO desc.
Hi black_adept.black_adept hat geschrieben:Lies mal die Doku zu der Klasse CL_ABAP_STRUCTDESCR. Damit solltest du weiterkommen.
Da bekommst du auch deine Feldnamen in korrekter Schreibweise ( in der SYDES-Tabelle werden längere Feldnamen nämlich über 2 Tabellenzeilen verteilt- probier es einfach mal aus )
Code: Alles auswählen.
DATA:
descr_ref TYPE REF TO cl_abap_structdescr,
descr_ref2 TYPE REF TO cl_abap_structdescr.
FIELD-SYMBOLS:
<comp_wa> TYPE abap_compdescr,
<comp_wa2> TYPE abap_compdescr.
descr_ref ?= cl_abap_typedescr=>describe_by_data( <fs_struc> ).
WRITE: / 'Typename :', descr_ref->absolute_name.
WRITE: / 'Kind :', descr_ref->type_kind.
WRITE: / 'Length :', descr_ref->length.
WRITE: / 'Decimals :', descr_ref->decimals.
WRITE: / 'Struct Kind :', descr_ref->struct_kind.
WRITE: / 'Components'.
WRITE: / 'Name Kind Length Decimals'.
LOOP AT descr_ref->components ASSIGNING <comp_wa>.
IF <comp_wa>-type_kind EQ 'u'.
descr_ref2 ?= cl_abap_typedescr=>describe_by_data( <comp_wa> ).
LOOP AT descr_ref2->components ASSIGNING <comp_wa2>.
WRITE: / <comp_wa2>-name, <comp_wa2>-type_kind,
<comp_wa2>-length, <comp_wa2>-decimals.
ENDLOOP.
ELSE.
WRITE: / <comp_wa>-name, <comp_wa>-type_kind,
<comp_wa>-length, <comp_wa>-decimals.
ENDIF.
ENDLOOP.
Code: Alles auswählen.
descr_ref ?= cl_abap_typedescr=>describe_by_data( <fs_struc> ).
LOOP AT descr_ref->components ASSIGNING <comp_wa>.
IF <comp_wa>-type_kind = 'u'.
ASSIGN COMPONENT sy-tabix OF STRUCTURE <fs_struc> TO <gubbel>.
descr_ref2 ?= cl_abap_typedescr=>describe_by_data( <gubbel> ).
LOOP AT descr_ref2->components ASSIGNING <comp_wa2>.
IF <comp_wa2>-type_kind = 'u'.
ASSIGN COMPONENT sy-tabix OF STRUCTURE <gubbel> TO <gubbel2>.
descr_ref3 ?= cl_abap_typedescr=>describe_by_data( <gubbel2> ).
LOOP AT descr_ref3->components ASSIGNING <comp_wa3>.
WRITE: / <comp_wa3>-name, <comp_wa3>-type_kind,
<comp_wa3>-length, <comp_wa3>-decimals.
ENDLOOP.
ELSE.
WRITE: / <comp_wa2>-name, <comp_wa2>-type_kind,
<comp_wa2>-length, <comp_wa2>-decimals.
ENDIF.
ENDLOOP.
ELSE.
WRITE: / <comp_wa>-name, <comp_wa>-type_kind,
<comp_wa>-length, <comp_wa>-decimals.
ENDIF.
ENDLOOP.