rijdz
2/15/2019 - 8:01 AM

ABAP - Get Field of Structure

DATA: LO_STRUCT TYPE REF TO CL_ABAP_STRUCTDESCR,
      LI_COMP   TYPE ABAP_COMPONENT_TAB,
      LW_COMP   TYPE ABAP_COMPONENTDESCR.

LO_STRUCT ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( imi_table ).
LI_COMP = LO_STRUCT->GET_COMPONENTS( ).

LOOP AT LI_COMP INTO LW_COMP.
  WRITE: / LW_COMP-NAME.
ENDLOOP.