Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  Open SQL →  Open SQL - Writes →  MODIFY dbtab 

MODIFY dbtab - source

Short Reference

Other versions: 7.31 | 7.40 | 7.54


... FROM wa|{TABLE itab}. 


1. ... FROM wa
2. ... FROM TABLE itab


A wa data object that is not table-like or an itab internal table can be specified after FROM. On the one hand the content of the data objects determines whether the row(s) are inserted or changed, and on the other hand, which values are inserted or used for changes. The escape character @ should precede the workarea name or the internal table name (as should be the case with every host variable).


Host variables without the escape character @ are obsolete. The escape character @ must be specified in the strict modes of the syntax check from Release 7.40, SP05.

Alternative 1

... FROM wa


When a work area wa that is not table-like that meets the requirements for use in Open SQL statements is specified, 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 a row like this is not found, a new row is inserted according to the same rules as for the statement INSERT.

If a row like this is found, this row is overwritten in accordance with the same rules as for the statement UPDATE.

If the change would lead to a double entry in a unique secondary index, then it is not executed and sy-subrc is set to 4.

By default, an automatic client handling is performed, which means that a client identifier specified in wa is not considered, but the current client is used instead. The content of wa is not affected. Automatic client handling can be switched off using the addition CLIENT SPECIFIED.


  • The wa work area should always be declared with reference to the database table or the view in ABAP Dictionary. For the derivation of LOB handle structures, there are special additions of the statements TYPES and [CLASS-]DATA.
  • If the database table or view is specified statically, a short form can be specified outside of classes. This means that the work area specified using FROM wa can be omitted. The prerequisite is that a table work area dbtab for the respective database table or the view is declared using the statement TABLES. The system enhances the MODIFY statement implicitly with the addition FROM dbtab.


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, it will be 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. 

Alternative 2

... FROM TABLE itab


If an internal table itab is specified, the system processes all the rows of the internal table in accordance with the rules for the work area wa, with the exception that when specifying an internal table, locators are used as a source but read streams cannot be created.

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 produce a duplicate 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. However sy-subrc is still set to 0. The system field sy-dbcnt is set to the number of rows that are actually processed.