This Insert data into table is in continuation with previous post .
Variant 2
INSERT dbtab. or
INSERT *dbtab. or
INSERT (dbtabname) ...
Additions
1. ... FROM wa
2. ... CLIENT SPECIFIED
Effect
These are the SAP -specific short forms for the statements explained under variant 1.
The return code value is set as follows:
SY-SUBRC = 0 Line successfully inserted.
SY_SUBRC = 4 Line could not be inserted, since a line with the same key already exists.
Example
Add a line to a database table:
TABLES SAIRPORT.
SAIRPORT-ID = 'NEW'.
SAIRPORT-NAME = 'NEWPORT APT'.
INSERT SAIRPORT.
Addition 1
... FROM wa
Effect
The values for the line to be inserted are not taken from the table work area dbtab , but from the explicitly specified work area wa . The work area wa must also satisfy the conditions described in variant 1. As with this variant, the addition allows you to specify the name of the database table directly or indirectly.
If a work area is not explicitly specified, the values for the line to be inserted are 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
... CLIENT SPECIFIED
Effect
As for variant 1.
Variant 3
INSERT dbtab FROM TABLE itab. or
INSERT (dbtabname) FROM TABLE itab.
Additions
... CLIENT SPECIFIED
... ACCEPTING DUPLICATE KEYS
Effect
Mass insert: Inserzts all lines of the internal table itab in a single operation. The lines of itab must satisfy the same conditions as the work area wa in variant 1.
When the command has been executed, the system field SYDBCNT contains the number of inserted lines.
If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0 after the call.
Addition 1
... CLIENT SPECIFIED
Effect
As for variant 1.
Addition 2
... ACCEPTING DUPLICATE KEYS
Effect
If a line cannot be inserted, the processing does not terminate with a runtime error, but the return code value of SY-SUBRC is merely set to 4. All the remaining lines are inserted when the
command is executed.
The return code value is set as follows:
SY-SUBRC = 0 All lines successfully inserted. Any other result causes a runtime error .(82.6)
Related Post
You can go through entire syntax check here.
Check SAP SCRIPTS AND SMART FORMS BDC HERE COMPLETELY.
Learn object oriented approach of SAP ABAP HERE COMPLETELY.
ABAP ALE CONFIGURATION
BADI Complete Series and BAPI complete course
Other Programming Courses :
ASP.NET part one and two
Programming with C and C Sharp
Dot Net Complete Course Part one and two
Interview Questions in dot net and asp.net part one part two
Software Testing Complete course part one and two
Interview Questions in software Testing
V model Software Testing
COMMENT HERE and thank you for sparing your valuable time.
Thank you for visiting SAP ABAP.If you liked the post, please subscribe to RSS FEED or get the updates directly into your mail box through EMAIL SUBSCRIPTION.If you want to contact me click here.
Request you to share this page on your favorite book mark site.

Variant 2
INSERT dbtab. or
INSERT *dbtab. or
INSERT (dbtabname) ...
Additions
1. ... FROM wa
2. ... CLIENT SPECIFIED
Effect
These are the SAP -specific short forms for the statements explained under variant 1.
- · INSERT INTO dbtab VALUES dbtab. or
- · INSERT INTO dbtab VALUES *dbtab. or
- · INSERT INTO (dbtabname) VALUES wa.
The return code value is set as follows:
SY-SUBRC = 0 Line successfully inserted.
SY_SUBRC = 4 Line could not be inserted, since a line with the same key already exists.
Example
Add a line to a database table:
TABLES SAIRPORT.
SAIRPORT-ID = 'NEW'.
SAIRPORT-NAME = 'NEWPORT APT'.
INSERT SAIRPORT.
Addition 1
... FROM wa
Effect
The values for the line to be inserted are not taken from the table work area dbtab , but from the explicitly specified work area wa . The work area wa must also satisfy the conditions described in variant 1. As with this variant, the addition allows you to specify the name of the database table directly or indirectly.
If a work area is not explicitly specified, the values for the line to be inserted are 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
... CLIENT SPECIFIED
Effect
As for variant 1.
Variant 3
INSERT dbtab FROM TABLE itab. or
INSERT (dbtabname) FROM TABLE itab.
Additions
... CLIENT SPECIFIED
... ACCEPTING DUPLICATE KEYS
Effect
Mass insert: Inserzts all lines of the internal table itab in a single operation. The lines of itab must satisfy the same conditions as the work area wa in variant 1.
When the command has been executed, the system field SYDBCNT contains the number of inserted lines.
If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0 after the call.
Addition 1
... CLIENT SPECIFIED
Effect
As for variant 1.
Addition 2
... ACCEPTING DUPLICATE KEYS
Effect
If a line cannot be inserted, the processing does not terminate with a runtime error, but the return code value of SY-SUBRC is merely set to 4. All the remaining lines are inserted when the
command is executed.
The return code value is set as follows:
SY-SUBRC = 0 All lines successfully inserted. Any other result causes a runtime error .(82.6)
Related Post
You can go through entire syntax check here.
Check SAP SCRIPTS AND SMART FORMS BDC HERE COMPLETELY.
Learn object oriented approach of SAP ABAP HERE COMPLETELY.
ABAP ALE CONFIGURATION
BADI Complete Series and BAPI complete course
Other Programming Courses :
ASP.NET part one and two
Programming with C and C Sharp
Dot Net Complete Course Part one and two
Interview Questions in dot net and asp.net part one part two
Software Testing Complete course part one and two
Interview Questions in software Testing
V model Software Testing
COMMENT HERE and thank you for sparing your valuable time.
Thank you for visiting SAP ABAP.If you liked the post, please subscribe to RSS FEED or get the updates directly into your mail box through EMAIL SUBSCRIPTION.If you want to contact me click here.
Request you to share this page on your favorite book mark site.


0 comments
Post a Comment