Dynamic Table Creation 1678324785
Dynamic Table Creation 1678324785
REPORT zrg_dynamic3.
SELECT * FROM makt USING CLIENT '110' INTO TABLE @<fs_itab> UP TO 10 ROWS.
"If we use new CAST then we dont need to declarre lo_data reference at all.
"that's why I always prefer new syntax because why we need extra lines of
"code when we can use it implicitly.
*lo_struct = CAST #( lo_table2->get_table_line_type( ) ).
DATA(lt_components) = lo_struct->get_components( ).
APPEND INITIAL LINE TO lt_components ASSIGNING FIELD-SYMBOL(<fs_comp>).
<fs_comp>-name = 'MTART'.
<fs_comp>-type = cl_abap_elemdescr=>get_c( 4 ).
"In this dynamic table, you will have extra column with field name 'MTART'.
ASSIGN itab_new->* TO <fs_tab_new>.
"Happy Learning