SAP Tutorials Blog


 

"Inserting a single row into a database table


INSERT dbtab FROM @row.


"Alternative syntax, same effect

INSERT INTO dbtab VALUES @row.


"Line is created inline using the VALUE operator as part of a host expression


INSERT dbtab FROM @( VALUE #( comp1 = ... comp2 = ... ) ).


"Inserting multiple lines from an internal table into a database table.

"Make sure that the internal table does not contain a line having the same key

"as an existing row in the database table. Otherwise, a runtime error occurs.


INSERT dbtab FROM TABLE @itab.


"Inserting lines from a table declared inline using the VALUE operator

"as part of a host expression


INSERT dbtab FROM TABLE @( VALUE #( ( comp1 = ... comp2 = ... )

                                    ( comp1 = ... comp2 = ... ) ) ).


"ACCEPTING DUPLICATE KEYS addition: To avoid the runtime error mentioned above,

"all lines that would produce duplicate entries in the database table

"regarding the keys are discarded and sy-subrc is set to 4.


INSERT dbtab FROM TABLE @itab ACCEPTING DUPLICATE KEYS.


"Inserting the result set of an embedded subquery

"Here, multiple result sets can be joined, e. g. using UNION.


INSERT dbtab FROM ( SELECT ... ).


Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com