Hi,
You can use both..But all the other fields (other than the two fields) needs to have the old value to store the correct values in the table..
Otherwise..You can use this..
UPDATE ZTABLE SET FIELD1 = 'ASDF'
FIELD2 = 'ADSF'
WHERE KEY_FIELD = 'DF'.
For the above statement you don't require the other field values..
Thanks,
Naren
Hi,
From SAP help:
MODIFY inserts new lines or updates existing lines in dadatabase table). If a linewith the specified primary key already exists, an UPDATE is executed. Otherwise, an INSERT is performed.
Krzys
Hi,
Check this..
data: itab like ztable occurs 0 with header line.
Select * from ztable into table ITAB.
For updating
READ TABLE itab index 1.
itab-field1 = 'ABC'.
MODIFY itab index 1.
For Inserting..
ITAB-KEY_FIELD = 'ASD'.
ITAB-FIELD1 = 'ASDF'.
APPEND ITAB.
To update the database table.
MODIFY ZTABLE FROM TABLE ITAB.
For the records that are already there it will be updated..If the record is not there then it will be inserted...That is how MODIFY works..
Thanks,
Naren
Add a comment