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

REGARDING "modify and update"

dear experts

can u please tell me whats difference Modify & Update statements

thnx

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:40 AM

    <b>UPDATE target source.</b>

    Effect:

    The statement UPDATE changes the content of one or more lines of the database table specified in target. The entries in source determine which columns of which lines are changed, and how they are changed.

    System fields

    The statement UPDATE sets the values of the system fields sy-subrc and sy-dbcnt.

    sy-subrc Meaning

    0 At least one line has been changed.

    4 At least one line was not able to be changed, either because no appropriate line was found, or because the change would generate a line that leads to double entries in the primary key or a unique secondary index in the database table.

    The statement UPDATE sets sy-dbcnt to the number of changed lines.

    <b>MODIFY dbtab</b>

    Syntax

    MODIFY target FROM source.

    Effect

    The MODIFY statement inserts one or several lines specified in source in the database table specified in target, or overwrites existing lines.

    System fields

    The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.

    sy-subrc Meaning

    0 At least one line is inserted or changed.

    4 At least one line could not be processed since there is already a line with the same unique name secondary index in the database table.

    The MODIFY statement sets sy-dbcnt to the number of processed lines.

    Regards,

    Pavan.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:39 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:39 AM

    Hi,

    Modify:

    If the value of key fields in the internal table matches with the key fields values in database table,modify will update the existing entry.Otherwise,it will insert new entry.

    Update:

    To update db table,it is mandatory that the value of key fields in internal table should match with database table.

    Update - updates the existing records.

    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/update.htm

    Modify - modifys the existing records or creates a new record if the primary key does not match.

    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/modify_d.htm

    Regards,

    Priyanka.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:40 AM

    Hi,

    <b>UPDATE target source.</b>

    Effect:

    The statement UPDATE changes the content of one or more lines of the database table specified in target. The entries in source determine which columns of which lines are changed, and how they are changed.

    System fields

    The statement UPDATE sets the values of the system fields sy-subrc and sy-dbcnt.

    sy-subrc Meaning

    0 At least one line has been changed.

    4 At least one line was not able to be changed, either because no appropriate line was found, or because the change would generate a line that leads to double entries in the primary key or a unique secondary index in the database table.

    The statement UPDATE sets sy-dbcnt to the number of changed lines.

    <b>MODIFY dbtab</b>

    Syntax

    MODIFY target FROM source.

    Effect

    The MODIFY statement inserts one or several lines specified in source in the database table specified in target, or overwrites existing lines.

    System fields

    The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.

    sy-subrc Meaning

    0 At least one line is inserted or changed.

    4 At least one line could not be processed since there is already a line with the same unique name secondary index in the database table.

    The MODIFY statement sets sy-dbcnt to the number of processed lines.

    Regards,

    Padmam.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:42 AM

    Hi Prakash,

    MODIFY - If the record is already there it will MODIFY it, but if record is not there it will create the new record.

    UPDATE - If the record is already there it will MODIFY (UPDATE) it , but if record is not there then it will do nothing (sy-subrc = 4)

    Regards,

    Atish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:44 AM

    HI,

    <b>UPDATE</b>

    The Open SQL statement for changing data in a database table is:

    UPDATE <target> <lines>.

    It allows you to change one or more lines in the database table <target>. You can only change lines in an ABAP Dictionary view if it only contains fields from one table, and its maintenance status is defined as Read and change. You may specify the database table <target> either statically or dynamically.

    <b>MODIFY</b>

    To insert lines into a database table regardless of whether there is already a line in the table with the same primary key, use the following:

    MODIFY <target> <lines>.

    If the database table contains no line with the same primary key as the line to be inserted, MODIFY works like INSERT, that is, the line is added.

    If the database already contains a line with the same primary key as the line to be inserted, MODIFY works like UPDATE, that is, the line is changed.

    For performance reasons, you should use MODIFY only if you cannot distinguish between these two options in your ABAP program.

    You can add or change one or more lines <lines> in a database table <target>. You can only insert or change lines in an ABAP Dictionary view if it only contains fields from one table, and its maintenance status is defined as Read and change. You may specify the database table <target> either statically or dynamically.

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:44 AM

    Hi,

    SELECT - It reads data from database tables.

    INSERT - It adds rows to database tables.

    UPDATE - It changes the contents of rows of database tables.

    MODIFY - It inserts rows into database tables or changes the content of existing rows.

    DELETE - It deletes rows from database tables.

    OPEN CURSOR, FETCH, CLOSE CURSOR - It reads rows of database tables using the cursor.

    Refer this link

    http://aspalliance.com/1136_Database_Access_using_Advanced_Business_Application_Programming_ABAP

    Regards

    Gaurav

    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.