Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP - Database Accesses →  Open SQL →  Open SQL - Write Accesses 

UPDATE dbtab

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


UPDATE target source. 

Effect

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

sy-subrc Meaning
0 When SET was specified in source, at leastone row was changed. When a work area was specified in source, the specifiedrow was changed. When an internal table was specified in source, all specified rows were changed or the internal table is empty.
2 If a LOB handle structure with a component forwriter streams or a referencevariable for writer streams was specified after SET, the components whichare 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 toLOB handles.
4 When SET or a work area was specifed in source,no row was changed; or when an internal table was specified in source, notall 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 theprimary key or a uniquesecondary 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).


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.

Continue

UPDATE dbtab - target

UPDATE dbtab - source

UPDATE dbtab - set_expression