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: 

INSERT Statement Problem

Former Member
0 Kudos

Hi,

I have two tables where i need to copy from one table to another table.

I am retrieving the data using the select statement from the first table into

internal table i_tab1.

now, i need to copy it to second table.

i did use insert statement but its not working if i have duplicate records in the second table.

can i use update statement?

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use MODIFY dbtab FROM TABLE itab.

5 REPLIES 5

former_member185931
Participant
0 Kudos

you can use MODIFY instead of Insert, as this will update the record if it is already their in the 2nd table.

Syntax : Loop at I_TAB1.

move-corresponding i_tab1 to <2ndtable name>

modify <2ndtable name>

endloop.

or you can delete the entires from the 2nd table and use this commant

insert <2nd table name> from table <1st table name>

Message was edited by: Jagraj Dhillon

0 Kudos

Thanks Jagraj and Srinivas. It is a fast response.

I had awarded you both the points. Thanks.

Former Member
0 Kudos

Use MODIFY dbtab FROM TABLE itab.

Former Member
0 Kudos

Hi

Use MODIFY statament in the same way of INSERT:

SELECT * FROM <TAB1> INTO TABLE ITAB1

WHERE .......

MODIFY <TAB2> FROM TABLE ITAB1.

Max

0 Kudos

Hi Max,

Thanks for the answer. I will award you the points also.

Thanks.