To insert lines into a database table regardless of whether there is already a line in the table with the same primary key, use the following: MODIFY If the database table contains no line with the same primary key as the line to be inserted, MODIFY works like INSERT, that is, the line is added. If the database already contains a line with the same primary key as the line to be inserted, MODIFY works like UPDATE, that is, the line is changed. For performance reasons, you should use MODIFY only if you cannot distinguish between these two options in your ABAP program. You can add or change one or more lines
Specifying a Database Table
To specify the database table statically, enter the following for
MODIFY
where
To specify the database table dynamically, enter the following for
MODIFY (
where the field
You can use the CLIENT SPECIFIED addition to disable automatic client handling.
Inserting or Changing Single Lines
To insert or change a single line in a database table, use the following:
MODIFY
The contents of the work area
If the database table does not already contain a line with the same primary key as specified in the work area, a new line is inserted. If the database table does already contain a line with the same primary key as specified in the work area, the existing line is overwritten. SY-SUBRC is always set to 0.
A shortened form of the above statement is:
MODIFY
In this case, the contents of the table work area
Inserting or Changing Several Lines
To insert or change several lines in a database table, use the following:
MODIFY
Those lines of the internal table
SY-SUBRC is always set to 0. SY-DBCNT is set to the number of lines in the internal table.
No comments:
Post a Comment