Monday, February 19, 2007

Copy table structure and content (data)

I just started to read the book 'Sams Teach Yourself ABAP/4® in 21 Days', the first problem I ran into is how to copy table structure and content(data) from a standard table to a z_table. I found partial of the answer here:
How can I copy a standard table to make my own z_table. Go to transaction SE11. Then there is one option to copy table. Press that button. Enter the name of the standard table and in the Target table enter Z table name and press enter.
However, that is only partial answer to the question, it only copied the table structure, but without the content-data of the table, to copy the content(data), you may need to write small ABAP program to achieve the goal:

tables lfa1.
select * from lfa1.
insert ztxlfa1 from lfa1.
write 'data copied.'.

No comments: