Syntax for Modify data base table part two

This post is in continuation with modify data base syntax part one.Going through that post will give you more convenience in understanding the present topic.

Addition 1

... FROM wa


The values for the line to be inserted or updated are not taken from the table work area dbtab , but from the explicitly specified work area wa . When doing this, the data is read from left to right according to the structure of the table work area dbtab . Since the structure of wa is not taken into account, the work area wa must be at least as wide as the table work area dbtab and the alignment of the work area wa must correspond to the alignment of the table work area. Otherwise, a run time error occurs.

If a work area is not explicitly specified, the values for the line to be inserted or updated are also taken from the table work area dbtab if the statement is in a FORM or FUNCTION where the table work area is stored in a formal parameter or local variable of the same name.

Addition 2



Switches off automatic client handling. This allows you to edit data across all clients even when dealing with client-specific tables. The client field is treated like a normal table field that can be programmed to accept values in the table work area dbtab or *dbtab where the line to be edited occurs.

The addition CLIENT SPECIFIED must be specified immediately after the name of the database table.

Variant 2

MODIFY dbtab FROM TABLE itab. or MODIFY (dbtabname) FROM TABLE itab.




Mass modify: Inserts new lines or updates existing lines of a database table. The primary keys for identifying the lines to be inserted or updated and the relevant values are taken from the internal table itab . The lines of the internal table itab must satisfy the same conditions as the work area wa in addition 1 to variant 1.

If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0.




As for variant 1.

Variant 3

MODIFY dbtab VERSION vers. or MODIFY *dbtab VERSION vers.


Inserts a new line or updates an existing line in a database table, the name of which is taken from the field vers at run time.If no line exists with the specified primary key, an INSERT is executed. Otherwise, an UPDATE is performed. The database table must be defined in the ABAP/4 Dictionary and its name must conform to the naming conventions for R/2 ATAB tables.

These stipulate that the name must begin with 'T' and may contain up to four further characters. The field vers must contain the table name without the leading 'T'. Only lines in the current client are inserted or updated. The line to be inserted is taken from the statically specified table work area dbtab or *dbtab .

SY-SUBRC is set to 0 if the line is successfully inserted or updated. SY-SUBRC <> 0 is not possible since any other result causes a run time error.






No comments :

Post a Comment