ABAP顾问
分类:
2007-06-05 16:25:45
TYPES:
BEGIN OF my_struct,
comp_a TYPE i,
comp_b TYPE f,
END OF my_struct.
DATA:
my_data TYPE my_struct,
descr_ref TYPE REF TO cl_abap_structdescr.
DATA: BEGIN OF itab OCCURS 0 ,
f1 ,
f2 ,
END OF itab.
FIELD-SYMBOLS:
START-OF-SELECTION.
descr_ref ?= cl_abap_typedescr=>describe_by_data( my_data ).
LOOP AT descr_ref->components ASSIGNING
WRITE: /
ENDLOOP.
descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).
LOOP AT descr_ref->components ASSIGNING
WRITE: /
ENDLOOP.