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

Print using spool number

Former Member
0 Likes
2,382

HI all,

I have the spool number. Using the spool number, how can i print the output to a particular printer.

Suggestions please,

Rajesh.

9 REPLIES 9
Read only

Former Member
0 Likes
1,621

Go to T-Code : SP01.

Read only

Former Member
0 Likes
1,621

check SP02 ---> for a given spool number --->double click on spoll number --->here u can change printers.

Regards

Prabhu

Read only

Former Member
0 Likes
1,621

I retrieve the spool number from table tsp01. How can I print the output from my abap program.

Thanks,

Rajesh.

Message was edited by:

Rajesh Kumar.

Read only

0 Likes
1,621

Take help of the following code:

v_print = 'X' only for printing else it is space
first setup print parameters..
* Setup the Print Parmaters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
AUTHORITY = SPACE
IMMEDIATELY = V_PRINT
NEW_LIST_ID = C_X
NO_DIALOG = C_X
USER = SY-UNAME
IMPORTING
OUT_PARAMETERS = V_PRINT_PARMS
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.

IF SY-SUBRC NE 0.
CLEAR : V_PRINT_PARMS.
ENDIF.

* The printer destination has to be set up
IF V_PRINT_PARMS-PDEST = SPACE.
V_PRINT_PARMS-PDEST = LC_LOCL.
ENDIF.
* Explicitly set line width, and output format so that
* the PDF conversion comes out OK
V_PRINT_PARMS-LINSZ = C_LINSZ.
V_PRINT_PARMS-PAART = LC_PAART.

then u need to write the below comand..


NEW-PAGE PRINT ON PARAMETERS V_PRINT_PARMS NO DIALOG.
perform output_display.
NEW-PAGE PRINT OFF.

Read only

0 Likes
1,621

Otherwise you can take the help of the following standard program:

<b>RSTXPDFT4</b>

Read only

Former Member
0 Likes
1,621

Hi abhisek,

Where are you passing the spool number to printed, in your program.

Thanks,

rajesh.

Read only

0 Likes
1,621

IN the report:RSTXPDFT4

There is a option "Spool request" on the selectionscreen.

Read only

0 Likes
1,621

In the above report. It using a FM 'CONVERT_OTFSPOOLJOB_2_PDF' . Here you can pass the spool no to Exporting parameter SRC_SPOOLID.

CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'        
    EXPORTING                                    
      <b>SRC_SPOOLID                    = spoolno  </b> 
      NO_DIALOG                      = ' '       
      DST_DEVICE                     =           
      PDF_DESTINATION                =           
    IMPORTING                                    
      PDF_BYTECOUNT                  = numbytes  
      PDF_SPOOLID                    = pdfspoolid
      OTF_PAGECOUNT                  =           
      BTC_JOBNAME                    = jobname   
      BTC_JOBCOUNT                   = jobcount  
    TABLES                                       
      PDF                            = pdf       
    EXCEPTIONS                                   
      ERR_NO_OTF_SPOOLJOB            = 1         
      ERR_NO_SPOOLJOB                = 2         
      ERR_NO_PERMISSION              = 3         
      ERR_CONV_NOT_POSSIBLE          = 4         
      ERR_BAD_DSTDEVICE              = 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.      

Read only

Former Member
0 Likes
1,621

Hi Abishek,

Sorry for the delay in reply.

The Function module is to generate a pdf file. I want to print a particular spool data to a particular printer.

Thanks,

Rajesh.