Get Example source ABAP code based on a different SAP table
ID MODIFY-DBTAB • MODIFY dbtab ABAP_STATEMENT_OSQL • FROM MODIFY dbtab
MODIFY dbtab> Short Reference >
ABAP_SYNTAX MODIFY target> $[ connection>$] FROM source > $[MAPPING FROM ENTITY>>$].>
What does it do? The AB-SQL > statement MODIFY> inserts one or more rows specified in source> into the DDIC database table BEGIN_SECTION VERSION 5 OUT or DDIC table view> END_SECTION VERSION 5 OUT specified in target>, or overwrites existing rows. 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 MODIFY> sets the values of the system fields sy-subrc> and sy-dbcnt>. sy-subrc>>Meaning> 0When a work area was specified in source>, the specified row was inserted or modified. When an internal table was specified in source>, all specified rows were inserted or modified, or the internal table is empty. 2When a LOB handle structure> was specified with a component for writer streams>, the non-LOB handle components were not yet written to the database, and instead are passed when the stream is closed at the latest. Whether this situation occurs or not depends on the database. See LOB handles>. 4When a work area or a subquery was specified in source >, no rows were processed, or when an internal table was specified in source>, not all specified rows were processed because there is already a row with the same unique secondary index> in the database table. The statement MODIFY> sets sy-dbcnt> to the number of processed rows. If an overflow occurs because the number of 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 finally applied 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 inserted or 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.
Once rows have been inserted into a global temporary table>, this table must be emptied again explicitly before the next implicit database commit> using the AB-SQL statement DELETE FROM>> without WHERE > or using an explicit database commit> or database rollback>. If not, the runtime error COMMIT_GTT_ERROR> is produced.
The statement MODIFY dbtab FROM wa> has the statement MODIFY itab FROM wa>> with identical syntax. If an internal table has the same name as a DDIC database table, a statement like this accesses the internal table.
The statement MODIFY> sets a database lock> as an exclusive lock> until the next database commit or rollback. NON_V5_HINTS
If used incorrectly, setting the lock can produce a deadlock>. ABAP_HINT_END
ABAP_EXAMPLE_VX5 The first MODIFY> statement inserts a row into an empty table. The second MODIFY> statement modifies the values of the non-key fields of this row and inserts two additional rows. ABEXA 00422 ABAP_EXAMPLE_END