‎2007 Jan 11 8:06 AM
what is the difference between modify and update ?giv me with example?
‎2007 Jan 11 8:20 AM
Hi
Please go through the followong url
u will get more information
modify
<a href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/modify_d.htm">http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/modify_d.htm</a>
update
<a href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/update.htm">http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/update.htm</a>
Thanks
Shiva
‎2007 Jan 11 8:07 AM
<b>Modify:</b>
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.
<b>Update:</b>
To update db table,it is mandatory that the value of key fields in internal table should match with database table.
go through this link...
Regards,
Santosh
‎2007 Jan 11 8:10 AM
HI,
UPDAT: just updates the non-key fields if the record already exists in table.
MODIFY: will update the record if it already exists other wise add the record in the database.
‎2007 Jan 11 8:14 AM
1) Update will only update the record in teh database table ,depending upon the condition u specified in the updata command.
it will fail if the record does not exists in the table..mean to say it wil return Sy-subrc as zero then.
2) Modify - will do an update if record exists otherwise it wil create a new record in db table if record does not exists.
Press F1 in ur code on Update or MOdify ,u will find more on tht
amit
‎2007 Jan 11 8:20 AM
Hi
Please go through the followong url
u will get more information
modify
<a href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/modify_d.htm">http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/modify_d.htm</a>
update
<a href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/update.htm">http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/update.htm</a>
Thanks
Shiva
‎2007 Jan 11 8:28 AM
Hi sunil,
1. MODIFY is SMARTER compared to update.
2. When we use modify,
and if the records with the same key does not exist,
then it AUTOMATICALLY adds the record.
3. Whereas Update, simply updates the record if found,
otherwise gives error.
4. So, for normal usage,
its always better to use MODIFY.
regards,
amit m.
‎2007 Jan 11 10:36 AM
Update:
when u r trying to update a recored in data base table....if the record exists with the given conditions it will updates the recod.
Modify:
when u r trying to Modify a recored in data base table....if the record exists with the given conditions it will updates the recod if it not found any record then it will creates(inserts) a new record..
u can say MODIFY = UPDATE + INSERT (for easy remember).
Ramesh.
‎2007 Jan 11 10:41 AM
Update will update the existing records in table.
Modify will update the existing records aswell insert the new records if the Primary key doesnt match.
‎2007 Jan 11 10:47 AM
Hi,
Update statement change the records in database table.
Modify statement will insert the records if the same does not exist[thro' primary key values,it will check whether the record exists].If the record exists,it will change the records.Modify should be used if you are not sure about the record exists in database.
Check this link.
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/modify_d.htm
‎2007 Jun 29 8:14 PM
PLz check
Update database table command will insert a new entry. But MODIFY will check if record already exist, if it exist then it will modify existing record else it will insert new record in db table.
For more details here is screenshot from F1 help -
INSERT - Inserting Data in Database Tables
Variants:
1. INSERT INTO dbtab [CLIENT SPECIFIED] VALUES wa.
INSERT INTO (dbtabname) [CLIENT SPECIFIED] VALUES wa.
2. INSERT dbtab [CLIENT SPECIFIED] FROM TABLE itab. oder
INSERT (dbtabname) [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
Variants:
1. MODIFY dbtab. or
MODIFY *dbtab. or
MODIFY (dbtabname) ... ..
2. MODIFY dbtab FROM TABLE itab. or
MODIFY (dbtabname) FROM TABLE itab.
3. MODIFY dbtab VERSION vers. or
MODIFY *dbtab VERSION vers.
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. Otherwise,
an INSERT is performed. You can specify the name of the
database table either in the program itself in the form MODIFY
dbtab ... or at runtime as the contents of the field dbtabname
in the form MODIFY (dbtabname) ... . In both cases, the
database table must be defined in the ABAP Dictionary.
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.