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

Hi Exiting Record Update....

Hi Friends ,

I have written a select query which can update the record not add but it is simply adding the new row. How can I prevent this one ?How can I Update already exiting data in the table by using select query..?

My requirement is I have table which maintains all the sales orders numbers and their deliver dates. When ever the user changes the data by using va02 we have to run our program so that we are giving the order no.. so that it should take the data from the vbak table....

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 02:50 PM

    Hi ,use modify statement,

    what is does is it modifies if a record exists or it inserts a record if it doesn't exist.

    Mind you its checks for primary key for insertion and modification.

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 02:53 PM

    select data from vbak into itab based on conditions.

    now using itab u can modify the table...say ztable.

    loop at itab.

    ztable-keyfield = itab-keyfield.

    ztable-field1 = itab-field1.

    ztable-field2 = itab-field2.

    update ztable where keyfield = itab-keyfield

    endloop.

    This will update exitising records..

    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.