04-20-2009 1:42 PM
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
04-20-2009 1:44 PM
Hi,
You need to use Field Symbols to achevie this...Refer to this link..http://docs.google.com/Doc?id=dfv2hmgs_5d6bcxqgp&hl=en
04-20-2009 1:44 PM
Hi,
You need to use Field Symbols to achevie this...Refer to this link..http://docs.google.com/Doc?id=dfv2hmgs_5d6bcxqgp&hl=en
04-20-2009 1:47 PM
As the number of fileds in the internal table is decided at runtime, its better to use Filed Group instead of Internal Table
04-20-2009 2:17 PM
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.
04-20-2009 5:28 PM
HI... Its not for printing yar... I have to use the data again...
any way the Link solved my problem.....
Regards