SAP OO OBS ITAB INSERT 1

Get Example source ABAP code based on a different SAP table
  


ABAP Code Snippet
ARTICLE

Compatible Line Types When Using the INSERT INTO TABLEStatement
When you insert lines from one internal table in another, in ABAP Objects, the line types must be compatible.

In ABAP Objects, the following syntax causes an error message:

DATA: itab TYPE SORTED TABLE OF f
WITH UNIQUE KEY table_line,
jtab TYPE HASHED TABLE OF i
WITH UNIQUE KEY table_line.

INSERT LINES OF itab INTO TABLE jtab.
Correct syntax:

DATA: itab TYPE SORTED TABLE OF f
WITH UNIQUE KEY table_line,
jtab TYPE HASHED TABLE OF f
WITH UNIQUE KEY table_line.

INSERT LINES OF itab INTO TABLE jtab.
Cause:

In any generic insert operation - that is, inserting lines into any type of table - the lines that are to be inserted must be compatible with the line type of the target table. The above statement has been adapted to fit these semantics.