Application Development and Automation 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: 
Read only

converting columns to row

Former Member
0 Likes
451

Hi,

I have 6 columns and 4 rows and i want to convert it into 6 rows and 4 columns and want to display in table control.

plz help me in this ....

Hi,

I have 6 columns and 4 rows and i want to convert it into 6 rows and 4 columns and want to display in table control.

plz help me in this ....

1 REPLY 1
Read only

Former Member
0 Likes
423

Hi Kinjal,

Question is not clear. You want to change the internal table values with 6 columns & 4 rows to 4 columns & 6 rows?

If my understanding is correct, check the bleow logic:

loop at itab1.

case sy-tabix.

when 1.

itab2-c1 = itab1-c1.

append itab2.

itab2-c1 = itab1-c2.

append itab2.

itab2-c1 = itab1-c3.

append itab2.

itab2-c1 = itab1-c4.

append itab2.

itab2-c1 = itab1-c5.

append itab2.

itab2-c1 = itab1-c6.

append itab2.

when 2.

itab2-c2 = itab1-c1.

modify itab2 transporting c2 index 1.

itab2-c2 = itab1-c2.

modify itab2 transporting c2 index 2.

itab2-c2 = itab1-c3.

modify itab2 transporting c2 index 3.

itab2-c2 = itab1-c4.

modify itab2 transporting c2 index 4.

itab2-c2 = itab1-c5.

modify itab2 transporting c2 index 5.

itab2-c2 = itab1-c6.

modify itab2 transporting c2 index 6.

when 3.

itab2-c3 = itab1-c1.

modify itab2 transporting c3 index 1.

....

....

when 4.

itab2-c4 = itab1-c1.

modify itab2 transporting c4 index 1.

....

....

Endloop.

Finally you will get 6 rows with 4 coulmns.