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: 

Copy content of one table to another

Former Member
0 Kudos

Hi,

Hi have two Z tables that I created (Z1 and Z2), and I fill the Z1 in a program. Then, I want to copy the content of Z1 to Z2 in another ABAP program.

Is there any faster way to do it than making:

select * from Z1

into Z1_aux.

insert Z2 from table Z1_aux.

Thanks.

BR,

Sónia Goncalves

4 REPLIES 4

Former Member
0 Kudos

Hi,

If both the table structures are same...Then you can use the following..

select * from Z1

into table Z1_aux.

MODIFY Z2 from table Z1_aux.

Thanks,

Naren

ferry_lianto
Active Contributor
0 Kudos

Hi,

If both two ztables have the same structures then you can try this.


select * from Z1 
into Z1_aux.

Z2[] = Z1[].

If they don't have the same structures then please try this.


select * from Z1 
into Z1_aux.

loop at Z1.
  move-corresponding Z1 to Z2.
  append Z2.
endloop.

Regards,

Ferry Lianto

Former Member
0 Kudos

Hi Sonia,

Use the statement

<b>Z2[] = Z1[].</b>

If you want move the content of Z1_AUX into Z2 then

<b>Z2[] = Z1_AUX[].</b>

Thanks,

Vinay

0 Kudos

If both tables have the same structure.

Z2[] = Z1[].

If therz a mismatch in the structure then

loop at Z1 into wa_Z1.

move-correponding wa_z1 to wa_z2.

append wa_z2 to z2.

clear : wa_z1,

wa_z2.

endloop.