Skip to Content
author's profile photo Former Member
Former Member

INSERT Statement Problem

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Oct 03, 2005 at 08:24 PM

    Use MODIFY dbtab FROM TABLE itab.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 03, 2005 at 08: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 03, 2005 at 08: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.