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

Spool

Former Member
0 Likes
469

Hi,

Please give me a brief idea about spool. how to send print layout to spool and get the print out from spool?

How to send a report & ALV output to spool?

Thanks

ANUPAM

2 REPLIES 2
Read only

Former Member
0 Likes
433

Hi,

Spool is basically to hold the output data while run in batch mode. This cna be later used for printing as well.

Spool is created when you run a program in background

here all characteristics of a print are stored: layout, device, status, etc. etc.

a sample code

FORM SEND_TO_SPOOL.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING DESTINATION = 'LOCL'

COPIES = COUNT

LIST_NAME = 'FBL1N'

LIST_TEXT = 'SUBMIT ... TO SAP-SPOOL'

IMMEDIATELY = ' '

RELEASE = ' '

NEW_LIST_ID = 'X'

EXPIRATION = DAYS

LINE_SIZE = 170

LINE_COUNT = 58

LAYOUT = 'X_58_170'

SAP_COVER_PAGE = ' '

COVER_PAGE = ' '

RECEIVER = 'SAP*'

DEPARTMENT = 'System'

SAP_OBJECT = 'RS'

AR_OBJECT = 'TEST'

ARCHIVE_ID = 'XX'

ARCHIVE_INFO = 'III'

ARCHIVE_TEXT = 'Description'

NO_DIALOG = 'X'

IMPORTING OUT_PARAMETERS = PARAMS

OUT_ARCHIVE_PARAMETERS = ARPARAMS

VALID = VALID.

IF VALID SPACE.

SUBMIT RFITEMAP USING SELECTION-SET VARIANT

TO SAP-SPOOL

SPOOL PARAMETERS PARAMS

ARCHIVE PARAMETERS ARPARAMS

WITHOUT SPOOL DYNPRO

AND RETURN.

ENDIF.

ENDFORM.

Chk this link for more details:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7a5f4061-0a01-0010-c9bc-a4e4cb10...

https://forums.sdn.sap.com/click.jspa?searchID=10931477&messageID=3828786

https://forums.sdn.sap.com/click.jspa?searchID=10931477&messageID=4802103

Regards

Kiran Sure

Read only

venkat_o
Active Contributor
0 Likes
433

Hi Anupam Dutta Roy, You can print ALV report without displaying on Screen by passing print parameters through function module REUSE_ALV_GRID_DISPLAY. Check the procedure. 1. Define print parameters structure.

" Workareas
DATA:
   w_print            TYPE slis_print_alv.
2.Build w_print structure. double click on slis_print_alv structure, u will come to know what are the parameters u can pass using that structure.
w_print-print = 'X'.
3. Pass w_print structure through REUSE_ALV_GRID_DISPLAY.
DATA:
        l_program TYPE sy-repid.
  l_program = sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = l_program
      is_layout          = w_layout
      it_fieldcat        = i_fieldcat
      it_events          = i_events
      is_print           = w_print
    TABLES
      t_outtab           = i_t001
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSEIF sy-subrc = 0.
 "sy-spono gives u spool no..

  ENDIF.
4. Once u know the spool no .. u can get the spool using the below function module.
"Variables
  DATA:
      l_no_of_bytes TYPE i,
      l_pdf_spoolid LIKE tsp01-rqident,
      l_jobname     LIKE tbtcjob-jobname,
      l_jobcount    LIKE tbtcjob-jobcount.

  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid              = g_spool_no
      no_dialog                = ' '
    IMPORTING
      pdf_bytecount            = l_no_of_bytes
      pdf_spoolid              = l_pdf_spoolid
      btc_jobname              = l_jobname
      btc_jobcount             = l_jobcount
    TABLES
      pdf                      = i_pdf
    EXCEPTIONS
      err_no_abap_spooljob     = 1
      err_no_spooljob          = 2
      err_no_permission        = 3
      err_conv_not_possible    = 4
      err_bad_destdevice       = 5
      user_cancelled           = 6
      err_spoolerror           = 7
      err_temseerror           = 8
      err_btcjob_open_failed   = 9
      err_btcjob_submit_failed = 10
      err_btcjob_close_failed  = 11
      OTHERS                   = 12.
Let me know if u need anything .. try to get it .. Regards, Venkat.O