I want to dynamically get the structure of a dynamic table. Getting the table is no problem, but I stuck with getting the structure of the table.
DATA: lo_dynamic_table TYPE REF TO data.
FIELD-SYMBOLS: <lt_table_structure> TYPE table,
<ls_table_structure> TYPE any.
CREATE DATA lo_dynamic_table TYPE TABLE OF (lv_my_string_of_table).
ASSIGN lo_dynamic_table->* TO <lt_table_structure>.
// some code assigning the structure
Now I want to execute this command:
SELECT SINGLE * FROM (lv_my_string_of_table) INTO <ls_table_structure> WHERE (lv_dynamid_where_field).
If there is any other solution, I will be okay with that.
This code worked for my case:
DATA: table_name type string,
lo_dynamic_table TYPE REF TO data,
lo_dynamic_line TYPE REF TO data.
FIELD-SYMBOLS: <lt_table_structure> TYPE table,
<ls_table_structure> TYPE any.
table_name = 'yourtablename'.
CREATE DATA lo_dynamic_table TYPE TABLE OF (table_name).
ASSIGN lo_dynamic_table->* TO <lt_table_structure>.
CREATE DATA lo_dynamic_line LIKE LINE OF <lt_table_structure>.
ASSIGN lo_dynamic_line->* TO <ls_table_structure>.