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

Copy data between dbtables

Former Member
0 Likes
770

Hi experts,

Is it correct? I want to copy the data to another dbtables:

select *

from /BIC/AZ99OS03300

INTO Z99BW033A

where GL_ACCOUNT between '5200000000' and '5299999999'

AND COMP_CODE ='S00'.

MODIFY Z99BW033A FROM /BIC/AZ99OS03300.

endselect.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
747

Hi Marc,

data: itab like Z99BW033A occurs 0.

select *

from /BIC/AZ99OS03300

INTO table itab

where GL_ACCOUNT between '5200000000' and '5299999999'

AND COMP_CODE ='S00'.

if sy-subrc = 0.

MODIFY Z99BW033A FROM table itab.

endif.

Regards,

Vidya.

6 REPLIES 6
Read only

Former Member
0 Likes
747

Hi

If both the DB tables are having same fields the you can use

select *

from /BIC/AZ99OS03300

INTO <b>IT_Z99BW033A</b>

where GL_ACCOUNT between '5200000000' and '5299999999'

AND COMP_CODE ='S00'.

<b>MODIFY Z99BW033A FROM it_Z99BW033A</b>.

endselect.

Reward points if useful

Regards

Anji

Read only

alex_m
Active Contributor
0 Likes
747

If both the table having smae fields then your select statement is valid. But u have to add TABLES statement in top for the work area.

Read only

Former Member
0 Likes
748

Hi Marc,

data: itab like Z99BW033A occurs 0.

select *

from /BIC/AZ99OS03300

INTO table itab

where GL_ACCOUNT between '5200000000' and '5299999999'

AND COMP_CODE ='S00'.

if sy-subrc = 0.

MODIFY Z99BW033A FROM table itab.

endif.

Regards,

Vidya.

Read only

Former Member
0 Likes
747

Hi,

Donot use endselect as it raises a performance issue.

select *

from /BIC/AZ99OS03300

INTO table it_Z99BW033A

where GL_ACCOUNT between '5200000000' and '5299999999'

AND COMP_CODE ='S00'.

MODIFY Z99BW033A FROM it_Z99BW033A.

Read only

Former Member
0 Likes
747

Hi Marc

Change your query to

select *

from /BIC/AZ99OS03300

INTO <b>it_Z99BW033A</b>

where GL_ACCOUNT between '5200000000' and '5299999999'

AND COMP_CODE ='S00'.

MODIFY Z99BW033A FROM <b>it_Z99BW033A</b>.

Regards,

Atish

Read only

dev_parbutteea
Active Contributor
0 Likes
747

HI,

you are selecting from /BIC/AZ99OS03300 into Z99BW033A. so, why do you want to modify Z99BW033A which has not been modified .