2007 Jul 12 11:27 AM
CAN MODIFY AND UPDATE OPERATIONS CAN BE DONE ON PRIMARY-KEY
OR NON-PRIMARY KEY.
2007 Jul 12 11:33 AM
YOU CAN WRITE UPDATE AND MODIFY ON PRIMARY AND NON-PRIMARY KEYS
<u>UPDATE</u>
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.
The changes are definitively copied to the database with the next database commit. Until that point, they can still be undone using a database rollback.
<u>MODIFY</u>
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.
The changes are transferred finally to the database table with the next database commit. Up to that point, they can be reversed using a database rollback.
2007 Jul 12 11:31 AM
2007 Jul 12 11:33 AM
YOU CAN WRITE UPDATE AND MODIFY ON PRIMARY AND NON-PRIMARY KEYS
<u>UPDATE</u>
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.
The changes are definitively copied to the database with the next database commit. Until that point, they can still be undone using a database rollback.
<u>MODIFY</u>
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.
The changes are transferred finally to the database table with the next database commit. Up to that point, they can be reversed using a database rollback.
2007 Jul 12 12:01 PM
CAN U EXPLAIN
THESE OPERATIONS WILL BE DONE ON PRIMARY KEY
OR
NON-PRIMARY KEY
2007 Jul 12 12:04 PM
2007 Jul 12 12:06 PM
IT CAN BE ON ANY KEYS
IF USE ON PRIMARY KEYS IT WILL BE VERY FAST
IF U DO THIS FOR NON-PRIMARY IT WILL BE SOME WHAT SLOW
2007 Jul 12 12:12 PM
Hi Ashok ,
That operation can be done only on non primary key .
for example you have a header table with key field X .
now you want to print detail(item) of that header item X .
you will use for all entries in table header .and print the same but if you want to delete field X from detail(item) table you can't do . due to data base constraints .
Reward points if helpful .
Regards ,
Amber S
2007 Jul 12 12:15 PM
THANKS AMBER
FOR YOUR ANSWER
SOME ARE TELLING THAT IT CAN BE DONE ON PRIMARY KEY ALSO
THATS THE REASON I GOT CONFUSED