Skip to Content
author's profile photo Former Member
Former Member

Printing contents of an internal table

Hello everyone!

How do I print contents of an internal table (I don't need to do special formatting, well, except coloring maybe)? It'd be nice to produce the same results that ALV Grid delivers (I'd do it using ALV Grid Control, but I'd like it not scaring users 😊 ).

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2007 at 02:17 PM

    Some time ago, Rich Heilman posted an answer to a similar question. His code looked something like:

    REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 255.
    
    TYPE-POOLS: slis.
    
    DATA: sel TYPE  slis_selfield.
    DATA: it001 TYPE TABLE OF t001 WITH HEADER LINE.
    SELECT * INTO CORRESPONDING FIELDS OF TABLE it001
                 FROM t001.
    
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
      EXPORTING
        i_title          = 'Test Popup'
        i_selection      = 'X'
        i_tabname        = 'T001'
        i_structure_name = 'T001'
      IMPORTING
        es_selfield      = sel
      TABLES
        t_outtab         = it001.
    

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2007 at 11:27 AM

    Hi,

    if you want to print the Internal table in a Normal report.

    Just Loop the Internal table and print the values.

    LOOP AT ITAB

    wRITE:/ 10 itab-Field1, 20 Itab-field2.

    ENDLOOP.

    you know how to use the colors, just the keyword COLOR 3, or COLOR 4 after the field

    See the DEMO program also <b>demo_list_format_color_2</b>

    Regards

    Sudheer

    Message was edited by:

    Sudheer Junnuthula

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2007 at 11:38 AM

    <b>IGNORE THIS</b>

    execute and check
    
    REPORT zex12 .
    
    DATA : BEGIN OF itab OCCURS 0.
            INCLUDE STRUCTURE t001.
    DATA : END OF itab.
    
    DATA : v_var TYPE i.
    
    
    SELECT * FROM t001 INTO TABLE itab.
    
    LOOP AT itab.
      v_var = sy-tabix MOD 2.
      IF v_var EQ 0.
        FORMAT COLOR 1.
        WRITE : / itab-bukrs , itab-butxt.
      ELSE.
        FORMAT COLOR 2.
        WRITE : / itab-bukrs , itab-butxt.
      ENDIF.
    
    ENDLOOP.

    Message was edited by:

    Chandrasekhar Jagarlamudi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2007 at 11:45 AM

    Hi,

    After getting the output you have the Option to print the output directly from the Output,

    If you want it in programetically, then use the Function module <b>K_MD_PRINTLIST</b> or <b>ASSORT_LIST_PRINT_START</b>

    or else, you can use the GET_PRINT_PARAMETERS or SET_PRINT_PARAMETERS function modules also.

    <b>Setting Print Parameters from within the Program</b>

    NEW-PAGE PRINT ON

    SUBMIT ... TO SAP-SPOOL

    CALL FUNCTION 'JOB-SUBMIT'

    See the Below link also

    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba56d35c111d1829f0000e829fbfe/content.htm

    Regards

    Sudheer

    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.