Reputation: 2111
It seems, there once was an ABAP statement like COPY table TO table.
that is so obsolete, it isn't mentioned in the ABAP keyword documentation anymore. Anyone having information or examples?
We are writing a tool in Java that parses and transforms ABAP code. We therefore have no intention to write new ABAP code but our tool has to handle all of ABAP, even obsolete statements. Furthermore, I'm not an ABAP expert.
Upvotes: 0
Views: 353
Reputation: 5
Assuming your tables are same types and the first one is not empty You can do: itab2[] = itab1[]
or, if you have to append rows: append lines itab1 to itab2
If the table are different you can do: Loop at itab1 into wa1. move-corresponding wa1 to wa2. append wa2 to itab2. clear wa2. endloop.
or: Loop at itab1 into wa1. wa2-field1 = wa1-field2 ... and so on ... append wa2 to itab2. clear wa2. endloop.
or you can use a field-symbols: field-symbol: like line of itab1.
Loop at itab1 assigning (if the system is 730, you can declare field symbol in line with assigning field-symbols()) wa2-field1 = -field2 ... and so on ... append wa2 to itab2. clear wa2. endloop.
Upvotes: 0
Reputation: 69783
The ABAP language follows the design philosophy that old language constructs might be declared obsolete, or might be illegal in combination with new features. For example, when object-oriented programming was introduced, a lot of older statements became illegal if used within a method of a class.
But the ABAP language development group at SAP always followed the credo that a program which was once legal will always be legal.
Even keywords which were obsolete for ages can still be found in the documentation, just in case someone has to work with legacy code which still uses those language features. But there is no keyword COPY
in the alphabetic index. There is only the <tt:copy>
node for XML transformations, but that does not seem to be what you are looking for.
So it seems to me that this keyword never existed.
Perhaps you are confusing it with the obsolete MOVE
keyword?
MOVE table1 TO table2.
which is an archaic form of writing
table2 = table1.
Upvotes: 4