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: 

Transpose Internal table

Former Member
0 Kudos

Hi,

I want the logic how to transpose the internal table i.e colums to rows and rows to columns.

for example I have a internal table like



A B C D E F
a b c d  e f
1 2 3 4 5 6 


I want it as

A a 1
B b c
C c 3
D d 4
E e 5
F f 6

How to do the Same.

The problem is that I dont know until the run time the number of rows

I know its asked but I couldnt find them

Regards

Edited by: SAP LEARNER on Apr 20, 2009 2:43 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You need to use Field Symbols to achevie this...Refer to this link..http://docs.google.com/Doc?id=dfv2hmgs_5d6bcxqgp&hl=en

4 REPLIES 4

Former Member
0 Kudos

Hi,

You need to use Field Symbols to achevie this...Refer to this link..http://docs.google.com/Doc?id=dfv2hmgs_5d6bcxqgp&hl=en

Former Member
0 Kudos

As the number of fileds in the internal table is decided at runtime, its better to use Filed Group instead of Internal Table

0 Kudos

hi ,

You can try this code, Hope this helps you.

REPORT ZTRANSPOSE_PAV.

data : BEGIN OF itab OCCURS 0,

a(10) type c,

b(10) type c,

c(10) type c,

d(10) type c,

e(10) type c,

END OF itab.

itab-a = 'A'.

itab-b = 'B'.

itab-c = 'C'.

itab-d = 'D'.

itab-e = 'E'.

APPEND itab.

itab-a = 'a'.

itab-b = 'b'.

itab-c = 'c'.

itab-d = 'd'.

itab-e = 'e'.

APPEND itab.

itab-a = '1'.

itab-b = '2'.

itab-c = '3'.

itab-d = '4'.

itab-e = '5'.

APPEND itab.

LOOP AT itab. " Just for Displaying the Internal Table

WRITE 😕 itab-a,itab-b,itab-c,itab-d,itab-e.

ENDLOOP.

skip 5.

*********************Logic to Transpose Internal Table********************

loop at itab.

write itab-a.

ENDLOOP.

skip.

loop at itab.

write itab-b.

ENDLOOP.

skip.

loop at itab.

write itab-b.

ENDLOOP.

skip.

loop at itab.

write itab-d.

ENDLOOP.

skip.

loop at itab.

write itab-e.

ENDLOOP.

0 Kudos

HI... Its not for printing yar... I have to use the data again...

any way the Link solved my problem.....

Regards