2005 Oct 03 9:17 PM
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
2005 Oct 03 9:24 PM
2005 Oct 03 9:21 PM
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
2005 Oct 03 9:40 PM
Thanks Jagraj and Srinivas. It is a fast response.
I had awarded you both the points. Thanks.
2005 Oct 03 9:24 PM
2005 Oct 03 9:40 PM
Hi
Use MODIFY statament in the same way of INSERT:
SELECT * FROM <TAB1> INTO TABLE ITAB1
WHERE .......
MODIFY <TAB2> FROM TABLE ITAB1.
Max
2005 Oct 03 9:41 PM
Hi Max,
Thanks for the answer. I will award you the points also.
Thanks.