Application Development and Automation 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: 
Read only

how to write internal table data vertically . Records vertically.

Former Member
0 Likes
1,055

Hi pals,

How to write internal table records vertically .

suppose the records are

a1 a2 a3

b1 b2 b3

we need to display

a1 b1

a2 b2

a3 b3

Thanks in advance.

balaji.T

3 REPLIES 3
Read only

Former Member
0 Likes
578

You have to write a small program.

LOOP AT int_horizontal.

AT NEW row.

loc_cnt = 1.

ENDAT.

CASE loc_cnt.

WHEN 1.

int_vertical-a1 = int_horizontal- value.

WHEN 2.

int_vertical-a2= int_horizontal- value.

WHEN 3.

int_vertical-a3_size = int_horizontal-value.

.

.

.

.

ENDCASE.

loc_cnt = loc_cnt + 1.

AT END OF row .

APPEND int_vertical.

CLEAR int_vertical.

ENDAT.

ENDLOOP.

You will have to know the number of columns of your horizontal table.

Regards,

Subhasish

Read only

Former Member
0 Likes
578

Hi,

Take a look at this thread, it has got two solutions.

The one I have given is dynamic and will work for any no. of columns and rows.

Regards,

Ravi

Note : Please mark the helpful answers

Read only

Former Member
0 Likes
578

Just check the code

DATA: BEGIN OF itab OCCURS 0,

f1 TYPE i,

f2 TYPE i,

f3 TYPE i,

END OF itab.

DATA pos TYPE i.

"Define your lines where you want to print here...

DATA line1 TYPE i VALUE 10.

DATA line2 TYPE i VALUE 12.

DATA line3 TYPE i VALUE 14.

itab-f1 = '1'.

itab-f2 = '10'.

itab-f3 = '100'.

APPEND itab.

itab-f1 = '2'.

itab-f2 = '20'.

itab-f3 = '200'.

APPEND itab.

itab-f1 = '3'.

itab-f2 = '30'.

itab-f3 = '300'.

APPEND itab.

itab-f1 = '4'.

itab-f2 = '40'.

itab-f3 = '400'.

APPEND itab.

loop at itab.

write : / itab-f1,itab-f2,itab-f3.

endloop.

LOOP AT itab.

pos = pos + 10.

SKIP TO LINE line1.

POSITION pos.

WRITE itab-f1.

SKIP TO LINE line2.

POSITION pos.

WRITE itab-f2.

SKIP TO LINE line3.

POSITION pos.

WRITE itab-f3.

ENDLOOP.