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: 

Need to copy data from database1 to database2 table

Former Member
0 Kudos

Hi All,

Iam teed techinical fessibility to copy data from one database table to another except few fields.

Iam having Ztable1 with 1- 15 fields .Iam also having Ztable2 of 1- 10 fields .The difference of fields is 11-15 is missing in the table 2.so now i need to copy data of table 1-10 fields from table 1 to tables2 .The both table is having same fields from 1- 10 (fields).

Can any one guide me how to code this ?

Regards with many thanks,

Sri

3 REPLIES 3

Former Member
0 Kudos

>

> Hi All,

> Iam teed techinical fessibility to copy data from one database table to another except few fields.

> Iam having Ztable1 with 1- 15 fields .Iam also having Ztable2 of 1- 10 fields .The difference of fields is 11-15 is missing in the table 2.so now i need to copy data of table 1-10 fields from table 1 to tables2 .The both table is having same fields from 1- 10 (fields).

>

> Can any one guide me how to code this ?

>

>

> Regards with many thanks,

> Sri

hi sri ram,

create two internal tables for ztable1 and ztable2.

Data: it_tab1 type standard table of ztable1,
         wa_tab1 like line of it_tab1,
        it_tab2  type standard table of ztable2,
         wa_tab2 like line of it_tab2.

get data into the first internal table.

select * from ztable1 into table it_tabl1 .

after getting the data populate the data into second internal table

loop at ztable1 into wa_tab1.
move-corresponding wa_tab1 to wa_tab2.
append wa_tab2 to it_tab2.
clear wa_Tab2.
endloop.

after populating update the table2.

update ztable2 from table it_tab2.

Former Member
0 Kudos

Hi,

You have to declare one internal table(itab1) with work area(wa1)

of type ztable1 and another of type ztable2 suppose itab2

with work area(wa2).

If you have data present in table ztable1 then,

you can do:



select fields required from ztable1 into itab1.

loop at itab1 into wa1.

move corresponding wa1 to wa2.

append wa2 to itab2.


endloop.

modify ztable2 from itab2.

Hope it helps

Regards

Mansi

0 Kudos

use

append lines of internal_tab1 to internal_tabl2.

data will be copied to another internal table by one above statement