Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding internal table

Former Member
0 Likes
334

Hi All,

Is it possible to add a column to a dynamic internal table as a first column?.My requirement is...i have a dynamic internal table ..now i have to add(enchancement) a column as first to this dynamic internal table. if possible ...suggest me how to proceed?

Thanks in advance,

Padmasri.

Edited by: Padmasri on Dec 17, 2007 8:12 AM

2 REPLIES 2
Read only

Former Member
0 Likes
317

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 this is helpful, Do reward.

Read only

asik_shameem
Active Contributor
0 Likes
317

Hi,

when u create a internal table structure, instead of append use insert statement and specify the position of that particular field. then u can use it as a first field r whatever.