|Difference Between Modify and Update Statement
What is the difference between Modify and Update statement and when do we use which statement?
MODIFY - Will update the table, if the data already exists, if NOT inserts new rows.
UPDATE - Will update the table, errors out if the data is not found.
In case of MODIFY the sy-subrc is always 0 so you would't know whether the data is actually updated or not.
INSERT - Inserting Data in Database Tables
2. INSERT dbtab [CLIENT SPECIFIED] FROM TABLE itab.
3. INSERT dbtab [CLIENT SPECIFIED]. oder INSERT *dbtab [CLIENT SPECIFIED]. oder INSERT (dbtabname) [CLIENT SPECIFIED] ... .
Effect Adds new records to a database table (see relational database). You can specify the name of the database table either directly in the program in the form dbtab or at runtime as the contents of the field dbtabname. In either case, the database table must be declared in the ABAP Dictionary. You can only insert data using a view if the view refers to a single table and has the maintenance status "No restriction" in the ABAP Dictionary.
By default, data is only inserted in the current client.
However, if you use the CLIENT SPECIFIED addition, you can switch off the automatic client handling. This enables you to enter data for any client in a cross-client table, not just in the client in which you are logged on. In this case, the client field is treated like a normal field to which you can assign a value in the work area.
MODIFY - Change a database table
1. MODIFY dbtab. or
2. MODIFY dbtab FROM TABLE itab. or
3. MODIFY dbtab VERSION vers. or
Effect Inserts new lines or updates existing lines in a database table
(s. relational database). If a line with the specified primary key already
exists, an UPDATE is executed.
Normally, records are inserted or updated only in the current client. Data can only be inserted or updated using a view, if the view refers to a single table and was created in the ABAP Dictionary with the maintenance status "No restriction".
MODIFY belongs to the Open SQL command set.
When the statement has been executed, the system field SY-DBCNT contains the number of edited lines.
(c) www.gotothings.com All material on this site is