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

Inserting lines into internal table.

Former Member
0 Likes
3,977

Hi please consider the foll pseudo code:

Loop at itab1.

Validations on itab1.

If true.

Move certain fields of itab1 to itab2.

*Then how do I insert these records at the END of itab2?

**Will simply "INSERT itab2" work?

endif.

Endloop.

6 REPLIES 6
Read only

Former Member
0 Likes
1,342

1. INSERT [wa INTO|INITIAL LINE INTO] itab [INDEX idx].

2. INSERT [wa INTO|INITIAL LINE INTO] TABLE itab.

3. INSERT LINES OF itab1 [FROM idx1] [TO idx2]

INTO itab2 [INDEX idx3].

4. INSERT LINES OF itab1 [FROM idx1] [TO idx2]

INTO TABLE itab2.

http://help.sap.com/saphelp_46c/helpdata/en/34/8e72c56df74873e10000009b38f9b8/content.htm

simply insert itab.

else.

wa .

insert itab from wa.

null

Read only

Former Member
0 Likes
1,342

hi,

if u want to put the records at the end of the itab,

use append stmt.

or else if u want to put the records in the specified position

use insert stmt.

<b><i>Reward points if useful</i></b>

Chandra

Read only

Former Member
0 Likes
1,342

append wa to itab2.

Read only

Former Member
0 Likes
1,342

HI

if use workarea then you can do like this

APPEND WA_OUTPUT TO IT_OUTPUT.

clear WA_OUTPUT.

<b>Reward if usefull</b>

Read only

Former Member
0 Likes
1,342

Hi Anand,

Try this

  • If Itab1 is with header line

Loop at itab1.

if <condition>.

append itab1 to itab2.

endif.

endloop.

( Or )

*if itab1 is with out header line

data fs_itab1 like line of itab1.

Loop at itab1 into fs_itab1.

if <condition>.

append fs_itab1 to itab2.

endif.

endloop.

Reward if Help,

Mahi.

Read only

Former Member
0 Likes
1,342

Hi

Loop at itab1.

Validations on itab1.

If true.

APPEND ITAB1 TO ITAB2.

endif.

Endloop.

Hope this Helps.

Praveen