Zananias Dynamic Table
Zananias Dynamic Table
TYPES:
*Feldtyp
BEGIN OF t_fld.
INCLUDE STRUCTURE dd03p AS dd03p.
TYPES:
mark LIKE rsdxx-mark,
type_icon TYPE dd02d-datatype,
shlporigin_text LIKE dd07t-ddtext,
fkexi(1),
mod(1),
actf(1),
f_display,
switch_id,
END OF t_fld.
START-OF-SELECTION.
ls_components-name = wa_fields-fieldname.
ls_components-type ?= cl_abap_elemdescr=>describe_by_name( wa_fields-rollname )
.
APPEND ls_components TO p_components.
ENDLOOP.
TRY .
p_struct_result = cl_abap_structdescr=>create( p_components = p_components ).
p_table_result = cl_abap_tabledescr=>create( p_line_type =
p_struct_result ).
CATCH cx_sy_struct_creation. "
CATCH cx_sy_table_creation.
ENDTRY.
END-OF-SELECTION.
CREATE DATA: gtt_table TYPE HANDLE p_table_result,
gs_struct TYPE HANDLE p_struct_result.
ASSIGN gtt_table->* TO <itab>.
ASSIGN gs_struct->* TO <ls_struct>.
IF <itab> IS ASSIGNED.
SELECT (field_list) FROM (p_tab) INTO CORRESPONDING FIELDS OF TABLE <itab>.
ENDIF.
lv_file = p_file.