Skip to Content

print the content fo internal table as coloumn wise

hi

i want to print the rows of the internal table columnwise in ALV before printing it.

like eg.

itab1:

a 1 5

b 2 6

c 3 7

itab2:

a b c

1 2 3

5 6 7

i tried to do the same with fields symbol but when i am implementing in the main program it is giving a dump

please help

Regards

Swarnali

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 08:00 AM

    Hi

    The problem is the type of the fields: it's always same?

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 08:49 AM

    Hai,

    Go through this thread, it might be helpful for you.

    display-the-output-in-horizontally-insted-of-verti

    Best Regards,

    rama

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 09:31 AM

    try this sample code..

    *&---------------------------------------------------------------------*
    *& Report  ZROWSCOL
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  ZROWSCOL.
    
    *Convert Rows of internal table to Columns
    
    TYPES: BEGIN OF ty_1,
    first(2),
    second(2),
    third(2),
    END OF ty_1.
    
    TYPES: BEGIN OF ty_2,
    first(2),
    second(2),
    third(2),
    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 = 'a1'.
    itab1-second = 'a2'.
    itab1-third = 'a3'.
    APPEND itab1.
    
    itab1-first = 'b1'.
    itab1-second = 'b2'.
    itab1-third = 'b3'.
    APPEND itab1.
    
    itab1-first = 'c1'.
    itab1-second = 'c2'.
    itab1-third = 'c3'.
    APPEND itab1.
    
    **itab1-first = 'd'.
    **itab1-second = 'd'.
    **itab1-third = 'd'.
    **APPEND itab1.
    
    WRITE / 'BEFORE TRANSPOSE'.
      WRITE /.
    LOOP AT itab1.
      WRITE: ITAB1-first, ITAB1-second, ITAB1-third.
      WRITE /.
      ENDLOOP.
    
    
      WRITE /.WRITE /.WRITE /.
    
    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.
    
    WRITE / 'AFTER TRANSPOSE'.
      WRITE /.
    LOOP AT itab2.
      WRITE: ITAB2-first, ITAB2-second, ITAB2-third.
      WRITE /.
      ENDLOOP.

    Edited by: Sumit Nene on Jul 22, 2009 11:36 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 13, 2009 at 12:24 PM

    HI

    i have solved the problem myself, using field symbols. thanks to all who have tried to help.

    Regards

    Swarnali

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.