Get Example source ABAP code based on a different SAP table
ID UPDATE • UPDATE dbtab ABAP_STATEMENT_OSQL
UPDATE dbtab> Short Reference >
ABAP_SYNTAX UPDATE target> $[ connection>$] source> $[ MAPPING FROM ENTITY>>$].>
What does it do? The AB-SQL > statement UPDATE> changes the content of one or more rows of the DDIC database table specified in target>>. The specifications in source>> determine which columns of which rows are changed, and how they are changed. BEGIN_SECTION VERSION 5 OUT The addition connection>> can be used to specify a secondary connection >. END_SECTION VERSION 5 OUT The addition MAPPING FROM ENTITY> is used to handle structures and internal tables that are typed with BDEF derived types>. Find more information in the topic ABAP SQL Statements with MAPPING FROM ENTITY>>. 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 that are not linked with writer streams were not yet written to the database, and instead are passed when the stream is closed at latest. Whether this situation occurs or not depends on the database system. See LOB handles>. 4When SET> or a work area was specified 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 suitable row was found, or because the change would create a row that would lead to 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 at the next database commit>. Until that point, they can still be undone using a database rollback>. The current isolation level> defines whether the modified data can no longer be read into other database LUWs > before or only after the database commit.
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>.
The statement UPDATE> sets a database lock> as an exclusive lock> until the next database commit or rollback. NON_V5_HINTS
If used incorrectly, this can produce a deadlock>. ABAP_HINT_END
ABAP_EXAMPLE_VX5 The statement UPDATE> overwrites the content of the columns of a DDIC database table row specified by a key with values from a work area created using the value operator VALUE>. ABEXA 00753 ABAP_EXAMPLE_END