Code: Alles auswählen.
LOOP AT lt_structure INTO ls_structure.
ls_dyn_fcat-col_pos = ls_structure-pos.
ls_dyn_fcat-fieldname = ls_structure-fieldname.
ls_dyn_fcat-rollname = ls_structure-rollname.
ls_dyn_fcat-outputlen = ls_structure-expleng.
APPEND ls_dyn_fcat TO lt_dyn_fcat.
ENDLOOP.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
* i_style_table = 'X'
it_fieldcatalog = lt_dyn_fcat
IMPORTING
ep_table = lt_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN lt_dyn_table->* TO <fs_table>.
CREATE DATA ps_line LIKE LINE OF <fs_table>.
Folgende Benutzer bedankten sich beim Autor Tron für den Beitrag:
PeterPaletti
Code: Alles auswählen.
DATA: lr_rtti_struc TYPE REF TO cl_abap_structdescr.
DATA: lr_rtti_data TYPE REF TO cl_abap_datadescr.
DATA: lt_comp TYPE cl_abap_structdescr=>component_table.
DATA: ls_comp LIKE LINE OF lt_comp.
LOOP AT lt_structure INTO ls_structure.
lr_rtti_data ?= cl_abap_datadescr=>describe_by_name( ls_structure-rollname ).
IF lr_rtti_data IS BOUND.
ls_comp-name = ls_structure-fieldname.
ls_comp-type = lr_rtti_data.
APPEND ls_comp TO lt_comp.
ENDIF.
ENDLOOP.
lr_rtti_struc = cl_abap_structdescr=>create( p_components = lt_comp ).
CREATE DATA ps_line TYPE HANDLE lr_rtti_struc.
Folgende Benutzer bedankten sich beim Autor ewx für den Beitrag:
PeterPaletti