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: 

horizontal printing in list

Former Member
0 Kudos

hi,

can any one tell me how to print the records of a internal table horizontaly . i mean that all the records of the first row will be printed in 1st column, second row wiil be printed in the next column and so on.....

please help me....

4 REPLIES 4

Former Member
0 Kudos

HI,

Refer to this link..

former_member194669
Active Contributor
0 Kudos

How many records do you expect in the internal table ? and maximum number of columns do you need to print in a page?

0 Kudos

let the no of rows be 15 or more...

0 Kudos

Hi Debashis,

As far I know i have a small suggesion,

when you are saying 15 rows.... the you need output in 15 Clolumns,,,

for ex: in your internal table there may be atleast one text column(40 Char) or atleast quantity(17 Char 13.3)

It means it takes the maximum size of the column for aligning the data. then you rresult will be

17 * 15 = 255 (if atleast one space between columns then >255) which will be a very great problem for printing,,,

If you still need that then Do like this,

TYPES: BEGIN OF ty_1,

first,

second,

third,

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 = 'a'.

itab1-second = 'a'.

itab1-third = 'a'.

APPEND itab1.

itab1-first = 'b'.

itab1-second = 'b'.

itab1-third = 'b'.

APPEND itab1.

itab1-first = 'c'.

itab1-second = 'c'.

itab1-third = 'c'.

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.

Thanks & regards,

Dileep .C