MODIFY dbtab - source
Short Reference
ABAP Syntax ... FROM wa|{TABLE itab}.
ABAP_ALTERNATIVES:
1 ... FROM wa
2 ... FROM TABLE itab
What does it do? A wa data object that is not table-like or an
itab internal table can be specified after FROM . The content
of the data objects determines whether the row(s) are inserted or
changed as well as which values are inserted or used for changes.
ABAP_ALTERNATIVE_1 ... FROM wa
What does it do? When a wa work area is specified that is not
table-like and meets the prerequisites for use
in Open SQL statements, a row is searched for in the database
table that has the same content in the
primary key as the corresponding beginning part of the work area.
If such a row is not found, a new row is inserted according to the
same rules as for the INSERT statement.
If such a row is found, it is overwritten according to the same rules
as for the UPDATE statement.
If the change would lead to a double entry in a unique secondary
index, it is not executed and sy-subrc is set to 4.
Automatic client handling is performed by default, which means that a
client identifier specified in
wa is not taken into account; the current client is used instead.
The content of wa is not affected. You can deactivate automatic
client handling with addition CLIENT
SPECIFIED .
Latest notes: The wa work area should always be declared with
reference to the database table or the view in
the ABAP Dictionary. For the derivation of
lob handle structures ,
there are special additions to statements
TYPES and [CLASS-]DATA .
If the database table or view is specified statically, the
specification of the work area using FROM wa can be omitted both
outside of classes and for one short form if
a dbtab
table work area is declared for the corresponding database table or
for the view using the TABLES statement. The system supplements
the MODIFY statement implicitly to include the FROM dbtab
addition.
Example ABAP Coding
Create or change a message in database
table T100 . If there is no message
with the number 100 in the MYMSGCLASS message class in English,
this is created. Otherwise, only the text is changed.
DATA message_wa TYPE t100.
message_wa-sprsl = 'EN'.
message_wa-arbgb = 'MYMSGCLASS'.
message_wa-msgnr = '100'.
message_wa-text = 'Some new message ...'.
MODIFY t100 FROM message_wa.
ABAP_ALTERNATIVE_2 ... FROM TABLE itab
What does it do? If an itab internal table is specified, the system
processes all rows in the internal table according to the rules for the
wa work area. However, if an internal table is specified,
locators are used as the source but
cannot generate writer streams .
The row type of the internal table must fulfill the
prerequisites for use in Open SQL
statements.
If the change to a row in the internal table would lead to a double
entry in a unique secondary index, the corresponding row is not inserted
and sy-subrc is set to 4. If the internal table is empty, no rows
are processed and sy-subrc is set to 0. The sy-dbcnt
system field is always set to the number of rows that were actually
processed.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved