Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Can we move the column and it's data of the internal table?

former_member189009
Active Participant
0 Kudos

Dear ,

      I have one internal table, which have 5 field: A B C D E, and this internal table have many data. Now I want to change this internal table as this: still have 5 field, but it's sort is :  A  E  D  B  C, and also move the data into the right place.

      such as:    A   B    C    D   E                   A       E      D     B    C

                      1    2     3    4    5                   1        5       4      2    3

      How to realize this function ?

      Thanks for your sincerely answer!

3 REPLIES 3

archanapawar
Contributor
0 Kudos

Hi Zhang,

I am unable to understand your issue. You want to move your data from 1 internal table to other internal table?

If so, use MOVE-Corresponding and make sure internal table field name are same.

If this is not your question. Then please explain your requirement.

former_member458055
Participant
0 Kudos

Hi,

you can loop the first internal table.

Loop at itab1.

move-coressponding itab1 to itab2.

append itab2.

endloop.

i suppose you mean moving the data from one internal table to other with same field but in different order.

Regards-

Makarand

claudia_bolch
Explorer
0 Kudos

Hi,

first, why do you want to do that? Is it for displaying? Then using a special layout variant would probably be a better solution.

If you really want to tansfer the content of table1 to table2, then you have to do a loop at table1, write the content of the current line to a line with the type of table2 and append this line to table2.

If the columns of your tables are named the same, than you can use the MOVE-CORRESPONDING statement. Otherwise you have to transfer each column using = or MOVE.

For big tables you could think about using a field-symbol for the loop. (LOOP AT table1 ASSIGNING <struc>).

Regards

Claudia