2007 Sep 11 9:58 AM
Hi Friends,
I want to copy a portion of an internal table to another.
Help me out on that.
2007 Sep 11 6:34 PM
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.
2007 Sep 11 10:10 AM
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
2007 Sep 11 10:14 AM
2007 Sep 11 1:15 PM
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
2007 Sep 11 6:34 PM
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.