I am trying to remove rows that have empty values in one column segment
. The table is declared dynamically so it does not have a standard type that I can use in DATA declaration like I used to do (DATA table_x TYPE BSEG
).
I tried to create structure based of the imported table but I receive an error:
The data object "LS_DYN_TABLE" does not have a structure and therefore does not have a component called "SEGMENT"
Is there any way to declare dynamically a structure so I can loop through a table, remove rows and pass filtered table further?
DATA:
dy_table TYPE REF TO data.
FIELD-SYMBOLS:
<dyn_table> TYPE STANDARD TABLE,
<fs_segment> TYPE any.
IF ID = '1234'.
me->method_that_import_desired_table( IMPORTING et_table = dy_table ).
ASSIGN dy_table->* TO <dyn_table>.
DATA(ls_dyn_table) = dy_table.
LOOP AT <dyn_table> ASSIGNING FIELD-SYMBOL(<fs_row>).
IF ls_dyn_table-segment IS INITIAL.
CONTINUE.
ENDIF.
ENDLOOP.
ENDIF.