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: 

Convert Internal table Rows into columns of another internal table

Former Member
0 Kudos

Hi,

i have one internal table <b>itab1</b> . this have 5 rows and 7 columns.

now i want this same data will be populated into another internal table <b>itab2</b>

like 7 rows and 5 columns.

How to convert the rows of one internal table data into columns of another internal table. how to populate that data. ??

1 ACCEPTED SOLUTION

Former Member
0 Kudos

chk this ALV example where it is transposed which is the same requirement as urs

http://www.geocities.com/mpioud/Z_ALV_LIST_TRANSPOSED.html

2 REPLIES 2

Former Member
0 Kudos

Hi Rai,

Refer sample code. It writes <b>Horizontal fields in Vertical pattern.</b> You may have to append into another internal table instead of Writing.

<b>Copy this program and execute in Debug mode.. Will Undrestand better.</b>

Report YTEST8.

types: begin of ty_itab,

Document type char4,

type1 type char4,

type2 type char4,

type3 type char4,

type4 type char4,

type5 type char4,

end of ty_itab.

data: wa_itab type ty_itab,

wa_itab1 type ty_itab,

itab type standard table of ty_itab,

value1 type char4,

value2 type char4.

  • cnt type char3,

  • ws_line type char3.

wa_itab-document = '1001'.

wa_itab-type1 = 'A1'.

wa_itab-type2 = 'A2'.

wa_itab-type3 = 'B1'.

wa_itab-type4 = 'B2'.

wa_itab-type5 = 'B3'.

append wa_itab to itab.

clear wa_itab.

wa_itab-document = '1002'.

wa_itab-type1 = 'A3'.

wa_itab-type2 = 'A4'.

wa_itab-type3 = 'B1'.

wa_itab-type4 = 'B2'.

wa_itab-type5 = 'B3'.

append wa_itab to itab.

clear wa_itab.

*describe table itab lines ws_line.

loop at itab into wa_itab."

*cnt = cnt + 1.

DO VARYING value1 FROM wa_itab-type1 next wa_itab-type2

VARYING value2 FROM wa_itab-type1 next wa_itab-type2.

write:/ wa_itab-document,value1.

if value2 = 'B3'.

exit.

endif.

enddo.

endloop.

Reward points if this Helps.

Manish

Former Member
0 Kudos

chk this ALV example where it is transposed which is the same requirement as urs

http://www.geocities.com/mpioud/Z_ALV_LIST_TRANSPOSED.html