I have an UPDATE
statement in ABAP which looks like :
UPDATE zicstt099 FROM TABLE lt_zicstt099
The Update is failing every time with sy-subrc eq 4
.
The database Table ZICSTT099
has three primary keys : WEB_USER_ID
& EMAIL_ID
along with MANDT
field.
I am trying to change the EMAIL_ID
value but the same is not getting Updated.
Kindly help.
The statement UPDATE sets sy-dbcnt to the number of changed rows. If an overflow occurs because the number or rows is greater than 2,147,483,647, sy-dbcnt is set to -1. If sy-subrc is 2, sy-dbcnt is also set to the value -1 (for undefined). The changes are committed to the database by the next database commit.
The MODIFY statement inserts one or more rows specified in source in the database table or classic view specified in target, or overwrites existing rows. The statement MODIFY sets the values of the system fields sy-subrc and sy-dbcnt. When a work area was declared in source, the specified row was inserted or modified.
You can use update/modify statements. UPDATE dbtab SET f1 = value1 where condition. UPDATE dbtab FROM TABLE itab. Here from itab internal table, you can update the ztable.
You cannot change primary key fields using the UPDATE <target> FROM <wa>.
and UPDATE <target> FROM TABLE <itab>.
statements, since they use the primary key to lookup the record(s) they must update.
Use the UPDATE <target> SET <set1> ... WHERE ...
statement instead.
You can find the specifics over here: https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/abapupdate_source.htm#!ABAP_ALTERNATIVE_1@1@
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With