SAP Tutorial - Convert Spool Request to PDF File using RSTXPDFT4 ABAP Report
You want to export the contents of a spool request as a PDF file to a directory of your choice, and print the file as required.
The PDF file contains the print data in the format in which it would be output by the printer.
In order to generate PDF files instead of printing output from a printer, you can use the ABAP report RSTXPDFT4.
First of all, you should generate a spool request for the document you want to create pdf file for.
You can list the spool requests for your current transaction or other sessions' spool requests by using the filter in SAP transaction code SP01 screen.
In the below SP01 SAP screen, you can see a short list of spool requests that are in que waiting instead of being printed.
You can note down the spool number of the document which you want to export as pdf file.
Now, we can run the ABAP report RSTXPDFT4, using SAP transaction SE38 in an other SAP session.
In SE38 screen, we can enter the ABAP RSTXPDFT4 program name in the input textbox and then run the report by using the F8 shortcut.
The first screen in the displayed RSTXPDFT4 report window is "Converting SAPscript (OTF) or ABAP List Spool Job to PDF" screen.
In this screen you will define the spool job which you want to convert it to PDF.
Using the first SP01 screen where we have listed available spool requests, we can enter SAP spool request number into the "Spool Request" textbox.
Also we can define the file folder or the directory where we want to download and save the the PDF file.
You can enter a storage folder and the name for PDF file download into the "PDF file name" textbox.
It is important that the "Download PDF File" checkbox is selected and marked.
"Actual width" option is default selected and works fine for my example cases.
In this screen next thing we will do is Executing the convertion by F8 shortcut.
After you have supplied the spool request number and the pdf file folder and the pdf file name, the RSTXPDFT4 will confirm the PDF conversion and will ask you if you want the PDF conversion to take place in the background.
It is important that you select "NO" to this question.
You have to continue to the converting SAP Smartforms or SAPScript output into PDF with the NO option.
Selecting NO option will activate the file download and file save dialog screen and will enable SAP users or ABAP developers save the spool request as PDF file.
Online PDF conversion may take some time according to the size of the spool request you want to convert into PDF file format.
ABAP program RSTXPDF4 will end up with a file "Save as" dialog screen where you can once more define or change the storage folder and the file name of the converted PDF file of the spool request.
Save the PDF conversion file on your computer.
Finally, a log report will display the final status of the PDF conversion using the RSTXPDF4 ABAP report.
If the SAP system can convert PDF successfully, it will display a message like "Function CONVERT_OTFSPOOLJOB_2_PDF successful"
You have now the converted pdf file in the download folder and open, display and print the pdf output from spool if you want.