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

copying internal tables

Former Member
0 Likes
1,190

If I want to copy full contents of one internal table itab1 to another itab2, what is the best method?

I see,

Loop at itab1.

Append itab1 to itab2.

clear itab1.

endloop.

is ok. Is there any other simpler method using assigning etc?

Thanks.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,164

If they are exactly the same structure.

itab2[] = itab1[].

Regards,

Rich heilman

If I want to copy full contents of one internal table itab1 to another itab2, what is the best method?

I see,

Loop at itab1.

Append itab1 to itab2.

clear itab1.

endloop.

is ok. Is there any other simpler method using assigning etc?

Thanks.

9 REPLIES 9
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,165

If they are exactly the same structure.

itab2[] = itab1[].

Regards,

Rich heilman

Read only

0 Likes
1,164

Thanks.

I have a couple of internal tables which I need to copy all of them to one main itab.

So in that case, do I have to use 'loop'?

any other simpler method than that?

Thanks again.

Message was edited by: nuren hm

Read only

0 Likes
1,164

Try this instead.

append lines of itab1 to itab_FINAL.
append lines of itab2 to itab_FINAL.
append lines of itab3 to itab_FINAL.
append lines of itab4 to itab_FINAL.
append lines of itab5 to itab_FINAL.

Regards,

Rich Heilman

Read only

0 Likes
1,164

Hello nuren,

Loop at tab1.

move-corresponing tab1 to tabmain.

append tabmain.

ENDLOOP.

Make sure user small and big table have same fields name.

Thanks,

Amit

Read only

0 Likes
1,164

hi Nuren,

1. One way is

itab2[] = itab1[].

2. The other way is

Loop at itab1.
move-corresponding itab1 to itab2.
append itab2.
Endloop.

Regards,

Santosh

Read only

0 Likes
1,164

Hi Nuren. Please remember to award points for helpful answers and mark your post as solved when solved completely. Please also make sure to visit the other posts you have created today and do the same. You have gotton some good answers there as well. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
1,164

hi nuren,

loop at it_final.

move-corresponding itab1 to it_final.

move-corresponding itab2 to it_final.

append it_final.

endloop.

regards,

keerthi.

Read only

0 Likes
1,164

Hi Rich,

Sorry for being late. Variety of reasons because sometimes I just wait for all my questions and I award points at the end of the day otherwise I tend to forget awarding for some questions. And sometimes very busy working on the tasks and sometimes I would n't be even starting the task related to the question (in this case, I may mistakenly award points to the solutions which may not be right and thus would be a problem for future browsers). So, normally I shall tend not to forget by the end of the day to award points..

But thanks for reminding me and trying to keeping this place professional. It is just due to one of you guys that these forums are runnning smoothly.

Regards,

Nuren

Read only

0 Likes
1,164

Thanks for you help in keeping this community a good one.

Regards,

Rich Heilman