02-14-2007 1:13 PM
I have created a dynamic internal table. I want to add one more column in the dynamic internal table which should be table type or need to create one table type while creating dynamic internal table.
Any suggestions plzz.
Thx,
Klad.
02-15-2007 9:06 PM
If i understand you correctly you are looking to take a table generated dynamically and add another column to it.
Given that you already have a field-symbol pointing at your original type named: <orgTable> and it also assumes that your table's row type is a structure, it wouldn't be too hard to modify it to support other types of line types. The following should work (although haven't tried it in the ABAP ide):
data lineType type ref to cl_abap_structdescr.
data tableType type ref to cl_abap_tabledescr.
data componentTable type component_table..
tableType ?= cl_abap_tabledescr=>describe_by_data( <orgType> ).
lineType ?= tableType->get_table_line_type( ).
componentTable = lineType->get_components( ).
* append your additional type here.
* append fooType to componentTable.
lineType ?= cl_abap_structDescr=>create( componentTable ).
tableType = cl_abap_tabledescr=>create( lineType ).
* now create your new data area.
data newTable type ref to data.
field-symbol <newTable> type standard table.
create data newTable handle tableType.
assign newTable->* to <newTable>.
hope that helps you out.