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

creating spool before displaying output

Hi,

I want to create spool while executing the program in online ( NOT IN BACKGROUND OR BACTCH JOB) and before displaying out put ( list ).

Means before writing or displaying the output from final internal table. I want create a spool for final internal table.

Please provide sample code to create spool for normal report online report ( not background )

we required created spool number also

Thanks,

Raju

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 17, 2009 at 07:00 AM

    Hi Raju, Just execute the sample program and see the result. It works how u want.

    REPORT ztest_notepad.
    
    "Variables
    DATA:
       l_lay    TYPE pri_params-paart,
       l_lines  TYPE pri_params-linct,
       l_cols   TYPE pri_params-linsz,
       l_val    TYPE c.
    *Types
    TYPES:
       t_pripar TYPE pri_params,
       t_arcpar TYPE arc_params.
    "Work areas
    DATA:
       lw_pripar TYPE t_pripar,
       lw_arcpar TYPE t_arcpar.
    
    l_lay   = 'X_65_132'.
    l_lines = 65.
    l_cols  = 132.
    "Read, determine, change spool print parameters and archive parameters
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        in_archive_parameters  = lw_arcpar
        in_parameters          = lw_pripar
        layout                 = l_lay
        line_count             = l_lines
        line_size              = l_cols
        no_dialog              = 'X'
      IMPORTING
        out_archive_parameters = lw_arcpar
        out_parameters         = lw_pripar
        valid                  = l_val
      EXCEPTIONS
        archive_info_not_found = 1
        invalid_print_params   = 2
        invalid_archive_params = 3
        OTHERS                 = 4.
    IF l_val <> space AND sy-subrc = 0.
      lw_pripar-prrel = space.
      lw_pripar-primm = space.
      NEW-PAGE PRINT ON
        NEW-SECTION
        PARAMETERS lw_pripar
        ARCHIVE PARAMETERS lw_arcpar
        NO DIALOG.
    ENDIF.
    
    WRITE 'Get Spool no'.
    
    NEW-PAGE PRINT OFF.
    CALL FUNCTION 'ABAP4_COMMIT_WORK'.
    
    write sy-spono.
    Thanks Venkat

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 17, 2009 at 06:51 AM

    Hi Raju,

    Use this sample code to solve your problem.

    TYPE-POOLS: slis.

    TYPES: BEGIN OF str_mara,

    matnr TYPE mara-matnr,

    ersda TYPE mara-ersda,

    ernam TYPE mara-ernam,

    laeda TYPE mara-laeda,

    aenam TYPE mara-aenam,

    vpsta TYPE mara-vpsta,

    END OF str_mara.

    DATA: i_mat TYPE TABLE OF str_mara,

    wa_mat LIKE LINE OF i_mat.

    DATA:params LIKE pri_params.

    DATA: days(1) TYPE n VALUE 2,

    valid TYPE c.

    DATA: obj TYPE REF TO cl_salv_table.

    SELECT matnr

    ersda

    ernam

    laeda

    aenam

    vpsta

    UP TO 10 ROWS FROM mara INTO CORRESPONDING FIELDS OF TABLE i_mat.

    TRY.

    CALL METHOD cl_salv_table=>factory

    IMPORTING

    r_salv_table = obj

    CHANGING

    t_table = i_mat.

    CATCH cx_salv_msg .

    ENDTRY.

    CALL FUNCTION 'GET_PRINT_PARAMETERS'

    EXPORTING

    • destination = 'QAS'

    list_name = 'ZTEST_VERTEX'

    list_text = 'TEST'

    no_dialog = 'X'

    immediately = ' '

    expiration = days

    IMPORTING

    • OUT_ARCHIVE_PARAMETERS =

    out_parameters = params

    valid = valid

    • VALID_FOR_SPOOL_CREATION =

    EXCEPTIONS

    archive_info_not_found = 1

    invalid_print_params = 2

    invalid_archive_params = 3

    OTHERS = 4

    .

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    TRY .

    NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.

    CATCH cx_sy_nested_print_on .

    ENDTRY.

    CALL METHOD obj->display.

    NEW-PAGE PRINT OFF.

    Regards,

    Vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 17, 2009 at 06:52 AM

    Hi,

    Refer to these link..

    sending-an-internal-table-to-the-spool

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 17, 2009 at 06:56 AM

    CALL FUNCTION 'GET_PRINT_PARAMETERS'

    EXPORTING

    no_dialog = 'X'

    user = sy-uname

    IMPORTING

    out_parameters = ls_pri_param

    valid = lv_valid

    EXCEPTIONS

    archive_info_not_found = 1

    invalid_print_params = 2

    invalid_archive_params = 3

    OTHERS = 4.

    IF sy-subrc = 0.

    ls_pri_param-primm = ' '.

    ENDIF.

    "To submit to spool so spool will be created

    SUBMIT prog_name

    TO SAP-SPOOL

    WITHOUT SPOOL DYNPRO

    SPOOL PARAMETERS ls_pri_param

    AND RETURN.

    SELECT * FROM tsp01 INTO TABLE lt_tsp01

    WHERE rqowner EQ sy-uname

    AND rq2name EQ ls_pri_param-plist

    ORDER BY rqident DESCENDING.

    " globale Spool-Nr. speichern

    READ TABLE lt_tsp01 INTO ls_tsp01 INDEX 1. "for getting spool number

    gv_spool_nr = ls_tsp01-rqident.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 17, 2009 at 07:05 AM

    Hi

    • OPEN THE SPOOL.

    CALL FUNCTION 'RSPO_OPEN_SPOOLREQUEST' EXPORTING

    dest = ' '

    immediate_print = 'X'

    titleline = text-027

    IMPORTING

    handle = l_handle

    rc = l_rc.

    IF l_rc IS NOT INITIAL.

    MESSAGE e000 WITH text-038.

    ELSE.

    • WRITE THE SPOOL.

    LOOP AT i_spool INTO wg_spool.

    CALL FUNCTION 'RSPO_WRITE_SPOOLREQUEST'

    EXPORTING

    handle = l_handle

    text = wg_spool-message

    EXCEPTIONS

    handle_not_valid = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE e000 WITH text-036.

    ENDIF.

    ENDLOOP.

    ENDIF.

    • CLOSE THE SPOOL.

    CALL FUNCTION 'RSPO_CLOSE_SPOOLREQUEST' EXPORTING

    handle = l_handle

    EXCEPTIONS

    handle_not_valid = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE e000 WITH text-037.

    ENDIF.

    Regards,

    Sreeram

    Edited by: Sreeram Kumar Madisetty on Jul 17, 2009 9:05 AM

    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.