0

i created a copy of SAP database table SFLIGHT called ZFLIGHT99, but i need to copy a data from original table too. I tried to copy by report like

DATA itab1 TYPE TABLE OF SFLIGHT.
DATA itab2 TYPE TABLE OF ZFLIGHT99.
itab2[] = itab1[].

But it doesn't work. I know that i can use loop at, but in this case i have to write all fields from this table. Is there any other solution for that?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Abapito
  • 73
  • 7

2 Answers2

2

Please check the documentation for database insert. What you are doing is a copy of the internal table.
The most performant way will be INSERT FROM SELECT (relevant docu). In contast to your own answer, this will not transfer data to the application server just to transfer it back to the database again. So this is more performant.

INSERT zpfli99 FROM ( SELECT * spfli ).
peterulb
  • 2,869
  • 13
  • 20
0

Ok i found the solution :)

DATA itab1 TYPE TABLE OF SFLIGHT.
SELECT * FROM SPFLI INTO TABLE itab1.
INSERT ZPFLI99 FROM TABLE itab1 ACCEPTING DUPLICATE KEYS.

Maybe someone will also look for this solution :)

Abapito
  • 73
  • 7