sapdev logo background
sapdev logo sapdev logo
Comments

ABAP UPDATE Statement syntax, information and example SAP source code



Return to Statement index



UPDATE dbtab

Short Reference

ABAP Syntax UPDATE target source .

What does it do? The statement UPDATE changes the content of one or more rows of the database table specified in
target . The entries in source determine which columns of which rows 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 When SET was specified in source , at least one row was changed. When a work area was specified in source , the specified row was changed. When an internal table was specified in
source , all specified rows were changed or the internal table is empty.
2If a LOB handle structure with a component for writer streams or a reference variable for writer streams was specified after SET , the components which are not associated with writer streams were not yet written to the database, but instead are passed when the stream is closed at latest. Whether this situation occurs or not depends on the database. Refer to
LOB handle s .
4When SET or a work area was specifed in source , no row was changed; or when an internal table was specified in source
, not all specified rows were changed. This is either because no appropriate row was found, or because the change would generate a row that produces duplicate 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 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).

Latest notes: The changes are committed to the database by the next database commit . Until that point, they can still be undone using a
database rollback
The statement UPDATE sets a
database lock until the next database commit or rollback. If used incorrectly, this can produce deadlock
.
The number of rows that can be modified in the tables of a database within a database LUW is limited, since a database system can only manage a limited amount of locks and data in the rollback area.
The statement UPDATE cannot be applied to the system table
TRDIR .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




UNPACK
UPDATE_OBSOLETE




comments powered by Disqus