Skip to Content
Apr 23, 2015 at 07:25 AM

Create table like SAP Query generated structure


Hi guys

I am trying to enhance a SAP query by adding some code and i am failing to create a table to replicate the entries in the query generated table. SAP generates a table %dtab which i found out by looking at the generated program. Now i want to replicate the contents of that table in another table but i am failing to do so. I have tried using the runtime type classes but i cannot seem to get it correct always getting a runtime error TYPE_NOT_FOUND.

what i have tried:

constants: lc_tab type string value '%dtab'.
data: lt_data type ref to data.
field-symbols: <lt_data> type any table.

create data lt_data like (lc_tab).
assign lt_data->* to <lt_data>. "crashes here if FS is typed to ANY TABLE

also tried

    lo_struc_type ?= cl_abap_tabledescr=>describe_by_name( lc-tab ).
 data(lt_comp_tab) = lo_struc_type->get_components( ).

Is there a way i could create a replica of the table?


Prince Isaac