I am attempting to write a class that can accept a table name, add a couple of extra columns for data ingestion purposes, then generate a CSV. I have it working for a table by sending in a table name as a parameter:
" Get the data dictionary object for the table
table_type ?= cl_abap_typedescr=>describe_by_name( table ).
" Create a table description object with the line type
table_descr = cl_abap_tabledescr=>create( p_line_type = table_type ).
" Declare the internal table using the generic type
create data gt_data type handle table_descr.
This generic code gets me home to then create a SQL call via cl_sql_statement and fill the gt_data object. My question is:
Can I add a column to the generic type? I wanted to add a timestamp column to the front of the object as to when I have extracted the data from the system.
I also may want to run queries with a JOIN where I may need a single field from another table that the generic type doesn't handle, so I may need to add a single extra column. How can this be done?