SAP MODIFY SOURCE ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• TABLE MODIFY dbtab
• ( SELECT ... ) MODIFY dbtab

MODIFY dbtab, source
Short Reference

ABAP_SYNTAX
... @wa$|@( expr )
$| ${ TABLE @itab$|@( expr ) $}
$| ( SELECT subquery_clauses $[ UNION$|INTERSECT$|EXCEPT ...$] ) ...

ABAP_ALTERNATIVES:
1 ... @wa$|@( expr )
2 ... TABLE @itab$|@( expr )
3 ... ( SELECT subquery_clauses $[UNION$|INTERSECT$|EXCEPT ...$] ) ...

What does it do?
A non-table-like data object wa can be specified after FROM in the statement MODIFY and an internal table or a parenthesized subquery can be specified after TABLE. The work area and the internal table can be specified as a host variable or a host expression. On one hand, the content of the data objects or the result set of the subquery determines whether the rows are inserted or changed, and on the other hand, which values are inserted or used for changes.



Latest notes:

NON_V5_HINTS
Host variables without the escape character @ are obsolete. The escape character @ must be specified in the strict modes of the syntax check from ABAP_RELEASE ABAP_740_SP05 .
ABAP_HINT_END

ABAP Alternative 1 ... @wa$|@( expr )

What does it do?
When a non-table-like work area that meets the requirements for use in AB-SQL statements is specified as a host variable @wa or host expression @( expr ), a row is searched in the DDIC database table
BEGIN_SECTION VERSION 5 OUT or view
END_SECTION VERSION 5 OUT that has the same content in the primary key as the corresponding initial part of the work area.
If a row like this is found, this row is overwritten in accordance with the same rules as for the statement UPDATE .
If a row like this is not found, a new row is inserted according to the same rules as for the statement INSERT.
If the change would produce a duplicate entry in a unique secondary index, it is not executed and sy-subrc is set to 4.