2010 Apr 01 1:44 PM
hi
i have an internal table ITAB
data:begin of itab
quarters(2),
end of itab. that has contents
-
Q1
Q2
Q3
Q4
-
I would like to have a ITAB2 like this
data:begin of itab
Q1(2),
Q2(2),
Q3(2),
Q4(2)
end of itab.
-
Q1 Q2 Q3 Q4 Q5
-
any ideas guys..........
thanks
raghu.
2010 Apr 01 1:56 PM
*******************************************
REPORT z_test.
Transpose itab1 to itab2.
TYPES: BEGIN OF ty_1,
first,
second,
third,
fourth,
END OF ty_1.
TYPES: BEGIN OF ty_2,
first,
second,
third,
END OF ty_2.
FIELD-SYMBOLS: <fs> TYPE ANY,
<fs2> TYPE ANY.
DATA: itab1 TYPE TABLE OF ty_1 WITH HEADER LINE,
itab2 TYPE TABLE OF ty_1 WITH HEADER LINE,
curr_line TYPE sy-tabix.
itab1-first = '1'.
itab1-second = '2'.
itab1-third = '3'.
itab1-fourth = '4'.
APPEND itab1.
itab1-first = '1'.
itab1-second = '2'.
itab1-third = '3'.
itab1-fourth = '4'.
APPEND itab1.
itab1-first = '1'.
itab1-second = '2'.
itab1-third = '3'.
itab1-fourth = '4'.
APPEND itab1.
LOOP AT itab1.
CLEAR itab2.
ASSIGN COMPONENT sy-tabix OF STRUCTURE itab2 TO <fs>.
curr_line = sy-tabix.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE itab1 TO <fs2>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF curr_line = 1.
<fs> = <fs2>.
APPEND itab2.
ELSE.
READ TABLE itab2 INDEX sy-index.
<fs> = <fs2>.
MODIFY itab2 INDEX sy-index.
ENDIF.
ENDDO.
ENDLOOP.
LOOP AT itab2.
WRITE:/ itab2.
ENDLOOP.
**************************************************
Please find the above code for the same.
Regards
Ramesh.
hi
i have an internal table ITAB
data:begin of itab
quarters(2),
end of itab. that has contents
-
Q1
Q2
Q3
Q4
-
I would like to have a ITAB2 like this
data:begin of itab
Q1(2),
Q2(2),
Q3(2),
Q4(2)
end of itab.
-
Q1 Q2 Q3 Q4 Q5
-
any ideas guys..........
thanks
raghu.
2010 Apr 01 1:56 PM
*******************************************
REPORT z_test.
Transpose itab1 to itab2.
TYPES: BEGIN OF ty_1,
first,
second,
third,
fourth,
END OF ty_1.
TYPES: BEGIN OF ty_2,
first,
second,
third,
END OF ty_2.
FIELD-SYMBOLS: <fs> TYPE ANY,
<fs2> TYPE ANY.
DATA: itab1 TYPE TABLE OF ty_1 WITH HEADER LINE,
itab2 TYPE TABLE OF ty_1 WITH HEADER LINE,
curr_line TYPE sy-tabix.
itab1-first = '1'.
itab1-second = '2'.
itab1-third = '3'.
itab1-fourth = '4'.
APPEND itab1.
itab1-first = '1'.
itab1-second = '2'.
itab1-third = '3'.
itab1-fourth = '4'.
APPEND itab1.
itab1-first = '1'.
itab1-second = '2'.
itab1-third = '3'.
itab1-fourth = '4'.
APPEND itab1.
LOOP AT itab1.
CLEAR itab2.
ASSIGN COMPONENT sy-tabix OF STRUCTURE itab2 TO <fs>.
curr_line = sy-tabix.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE itab1 TO <fs2>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF curr_line = 1.
<fs> = <fs2>.
APPEND itab2.
ELSE.
READ TABLE itab2 INDEX sy-index.
<fs> = <fs2>.
MODIFY itab2 INDEX sy-index.
ENDIF.
ENDDO.
ENDLOOP.
LOOP AT itab2.
WRITE:/ itab2.
ENDLOOP.
**************************************************
Please find the above code for the same.
Regards
Ramesh.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |