2009 Mar 24 8:23 AM
Hello I have an internal table:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
After execution the data should be transposed to display as
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16.
Is there any way I can code this or create a dynamic table?
Please help me in this.
Thanks
Hello I have an internal table:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
After execution the data should be transposed to display as
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16.
Is there any way I can code this or create a dynamic table?
Please help me in this.
Thanks
2009 Mar 24 8:30 AM
Hi,
This is possible only when it is n*n strcuture...I mean... If there are 4 flds in an itab, then the data should also be of 4 records...
Suppose.. if...data is like this,,
fld1 fld2 fld3 fld4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
Now how can you transpose it?
Please give a little clear requirement..in this situation
2009 Mar 24 8:33 AM
No I am not able to transpose it any ways.. I have just quoted an example.
2009 Mar 24 8:42 AM
declare another table.
loop at itab1 into wa_itab1.
split wa_itab1 at '' into table itab2 .
endloop.
2009 Mar 24 8:44 AM
do like this.
read the internal table line by line, each field and concatenate into a string, or an internal table having only one line,
then read the line by index in multiples of 4,like read first entry then 5th and 9th so on
2009 Mar 24 8:47 AM
Thanks kartik,
Already tried this. What if I have n number of columns and rows?
2009 Mar 24 9:18 AM
Hi Dishant,
Here's the logic to transpose rows into columns for n...of
data: begin of itab occurs 0,
word(100),
word1(100),
end of itab.
data: begin of jtab occurs 0,
word(100),
word1(100),
end of jtab.
itab-word = 'field1'.
itab-word1 = 'value1'.
append itab.
itab-word = 'field2'.
itab-word1 = 'value2'.
append itab.
itab-word = 'field3'.
itab-word1 = 'value3'.
append itab.
itab-word = 'field4'.
itab-word1 = 'value4'.
append itab.
loop at itab.
concatenate jtab-word itab-word into jtab-word separated bY SPACE.
concatenate jtab-word1 itab-word1 into jtab-word1 separated bY SPACE.
endloop.
append jtab.
loop at jtab.
write:/ jtab-word, jtab-word1.
endloop.thanks\
Mahesh
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |