Variants
1. MODIFY dbtab. or MODIFY *dbtab. or MODIFY (dbtabname) ... . .
2. MODIFY dbtab FROM TABLE itab. or MODIFY (dbtabname) FROM TABLE itab.
3. MODIFY dbtab VERSION vers. or MODIFY *dbtab VERSION vers.
Effect
Inserts new lines or updates existing lines in a database table . If a line with the specified primary key already exists, an INSERT is executed. Otherwise, an UPDATE is performed. You can specify the name of the database table either in the program itself in the form MODIFY dbtab ... or at runtime as the contents of the field dbtabname in the form MODIFY (dbtabname) ... .
In both cases, the database table must be defined in the ABAP/4 Dictionary. If the program contains the name of the database table, it must also have a corresponding TABLES statement. Normally, records are inserted or updated only in the current client. Data can only be inserted or updated using a view , if the view refers to a single table and was created in the ABAP/4 Dictionary with the maintenance status "No restriction".
MODIFY belongs to the Open SQL command set. When the statement has been executed, the system field SYDBCNT contains the number of edited lines.
The return code value is set as follows:
SY-SUBRC = 0 All lines were successfully inserted or updated.
Any other result causes a runtime error.
Automatic definition of INSERT and UPDATE is expensive. You should therefore use MODIFY only if you cannot define the INSERT and UPDATE cases yourself in the program.
Since the MODIFY statement does not perform authority checks , you have to program them yourself.
Variant 1
MODIFY dbtab. or
MODIFY *dbtab. or
MODIFY (dbtabname) ... .
Additions
1. ... FROM wa
2. ... CLIENT SPECIFIED
Effect
Inserts a new line or updates an existing line in a database table. If you specify the name of the database table yourself, the primary key for identifying the line to be inserted or updated and the relevant values are taken from the table work area dbtab or *dbtab . If the name of the database table is not determined until runtime, you need to use the addition ... FROM wa .
Example
Insert or change data of the customer Robinson in the current client:
TABLES SCUSTOM.
SCUSTOM-ID = '12400177'.
SCUSTOM-NAME = 'Robinson'.
SCUSTOM-POSTCODE = '69542'.
SCUSTOM-CITY = 'Heidelberg'.
SCUSTOM-CUSTTYPE = 'P'.
SCUSTOM-DISCOUNT = '003'.
SCUSTOM-TELEPHONE = '06201/44889'.
MODIFY SCUSTOM.
FORM PART TWO
FORMAT
FORMAT PART TWO
FORMAT PART THREE
FREE
1. MODIFY dbtab. or MODIFY *dbtab. or MODIFY (dbtabname) ... . .
2. MODIFY dbtab FROM TABLE itab. or MODIFY (dbtabname) FROM TABLE itab.
3. MODIFY dbtab VERSION vers. or MODIFY *dbtab VERSION vers.
Effect
Inserts new lines or updates existing lines in a database table . If a line with the specified primary key already exists, an INSERT is executed. Otherwise, an UPDATE is performed. You can specify the name of the database table either in the program itself in the form MODIFY dbtab ... or at runtime as the contents of the field dbtabname in the form MODIFY (dbtabname) ... .
In both cases, the database table must be defined in the ABAP/4 Dictionary. If the program contains the name of the database table, it must also have a corresponding TABLES statement. Normally, records are inserted or updated only in the current client. Data can only be inserted or updated using a view , if the view refers to a single table and was created in the ABAP/4 Dictionary with the maintenance status "No restriction".
MODIFY belongs to the Open SQL command set. When the statement has been executed, the system field SYDBCNT contains the number of edited lines.
The return code value is set as follows:
SY-SUBRC = 0 All lines were successfully inserted or updated.
Any other result causes a runtime error.
Automatic definition of INSERT and UPDATE is expensive. You should therefore use MODIFY only if you cannot define the INSERT and UPDATE cases yourself in the program.
Since the MODIFY statement does not perform authority checks , you have to program them yourself.
Variant 1
MODIFY dbtab. or
MODIFY *dbtab. or
MODIFY (dbtabname) ... .
Additions
1. ... FROM wa
2. ... CLIENT SPECIFIED
Effect
Inserts a new line or updates an existing line in a database table. If you specify the name of the database table yourself, the primary key for identifying the line to be inserted or updated and the relevant values are taken from the table work area dbtab or *dbtab . If the name of the database table is not determined until runtime, you need to use the addition ... FROM wa .
Example
Insert or change data of the customer Robinson in the current client:
TABLES SCUSTOM.
SCUSTOM-ID = '12400177'.
SCUSTOM-NAME = 'Robinson'.
SCUSTOM-POSTCODE = '69542'.
SCUSTOM-CITY = 'Heidelberg'.
SCUSTOM-CUSTTYPE = 'P'.
SCUSTOM-DISCOUNT = '003'.
SCUSTOM-TELEPHONE = '06201/44889'.
MODIFY SCUSTOM.
FORM PART TWO
FORMAT
FORMAT PART TWO
FORMAT PART THREE
FREE
No comments :
Post a Comment