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: 

move dat from itab1 to itab2

Former Member
0 Kudos
172

hallow

what is the <b>best</b> way to move data from itab1 to itab2

regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos
136

Hi Antonio,

Try

itab2[] = itab1[].

if it doesn't work, you have to do this:

loop at itab1.

move-corresponding itab1 to itab2.

append itab2.

clear itab2.

endloop.

Hope this resolves your query.

Reward all the helpful answers.

Regards

6 REPLIES 6

former_member223537
Active Contributor
0 Kudos
136

Hi,

itab2[] = itab1[].

Best regards,

Prashant

Former Member
0 Kudos
136

Hi,

ITAB1[] = ITAB2[]

if both have same structure

or in the loop of one ITAb, read the other ITBA and append the data or use

Move-corresponding from Itab1 to ITAB2. append itab.

reagrds,

Anji

Former Member
0 Kudos
136

itab2[] = itab1[]

Or you can use Move corresponding

Former Member
0 Kudos
137

Hi Antonio,

Try

itab2[] = itab1[].

if it doesn't work, you have to do this:

loop at itab1.

move-corresponding itab1 to itab2.

append itab2.

clear itab2.

endloop.

Hope this resolves your query.

Reward all the helpful answers.

Regards

former_member181962
Active Contributor
0 Kudos
136

AT a table level,

If they have same structures, then

itab2[] = itab1[]. is the best.

If they have different structures, you have no other way but to move field by field.

Regards,

Ravi

Former Member
0 Kudos
136

Let's assume itab1 and itab2 have the same structure. The best way to move data depends on whether you are trying to move all data or just some of the data. If you are trying to move all of the data from itab1 to itab2, then you should use either

itab2[] = itab1[]. "use if itab2 is empty beforehand

or

append lines of itab1 to itab2. "use if itab2 already has data in it

If you only want to move records from itab1 that meet certain conditions, then use this:

loop at itab1 where condition1 and condition2.

move-corresponding itab1 to itab2.

endloop.

I hope this helps.

- April King