Application Development 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: 

Internal Table

Former Member
0 Kudos

Hi Friends,

I want to copy a portion of an internal table to another.

Help me out on that.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

There are two ways to do that: append line and insert line.

By using append line the rows of a table are copied to the end of another table.

By using insert line the rows of a table are copied to any position other than the end of another table.

Both are written before loop at statement.

To insert a single line into a database table, use the following:

insert into itab values wa.

The contents of the work area wa are written to the database table dbtab. It is a good idea to define the work area with reference to the structure of the database table.

To insert several lines into a database table, use the following:

insert wa from table into itab.

This writes all lines of the internal table itab to the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.

Hope this will help you out.

4 REPLIES 4

Former Member
0 Kudos

Hi,

loop at itab assigning <curr_itab_line> where field = value.
append <curr_itab_line> to newITab.
endloop.

or

do n times.
read bla bla.
append bla bla.
enddo.

Was this your requirement??

Regards,

Gianpietro

Former Member
0 Kudos

Hi,

use move-corresponding

this will work

Regards

Shiva

Former Member
0 Kudos

append lines of <itb1> to <itb2> willl do..

if u need to copy complete <itb1> data to <itb2>

Else

loop at <itb1>.

move-corresponding <itb1> to <itb2>.

append <itb2>.

endloop.

<b>Please reward points if it helps.</b>

Thanks,

Phani.

Message was edited by:

Phani Shankar

Former Member
0 Kudos

Hi,

There are two ways to do that: append line and insert line.

By using append line the rows of a table are copied to the end of another table.

By using insert line the rows of a table are copied to any position other than the end of another table.

Both are written before loop at statement.

To insert a single line into a database table, use the following:

insert into itab values wa.

The contents of the work area wa are written to the database table dbtab. It is a good idea to define the work area with reference to the structure of the database table.

To insert several lines into a database table, use the following:

insert wa from table into itab.

This writes all lines of the internal table itab to the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.

Hope this will help you out.