It is a very common requirement to have the print output from smartforms or sap scripts saved as a local PDF file in the front end.
The different ways in which this can be accomplished are :-
- Create a spool request for the print and use the report RSTXPDFT4 to save its content as a PDF file in the frontend.
- Use ABAP coding to obtain the OTF data of the print and use Function modules CONVERT_OTF_2_PDF, GUI_DOWNLOAD (or OOPs Front end services) to convert and save the OTF data as a PDF file in the frontend system.
- Configure a PDF printer output device in SPAD and maintain corresponding FILE printer in the front end systems. Print outputs can be routed to this output device for saving the print output as PDF file in the frontend system.
In this document we will be dwelving into the third option mentioned above which is the simplest way of meeting the requirement.
SAP notes associated with this option are :-
- 317851 : Creating PDF format via spooler in 4.6C/4.6B/4.5B
- 576973 : Creating a file printer on a Windows PC
- 323736 : Restrictions with “PDF print” through spooler
What is a FILE printer: Printers that use the FILE port(instead of LPT1, COM1 etc) can be added to the frontend system. These printers can be used for saving the print output as a local file. Click the “Add printer” task in the “Printers and Faxes” folder to start the Add printer wizard and add a new FILE printer as per the screenshots below:-
Configuring the PDF printer in SPAD transaction.
SAP printing process basically involves the spool work process transferring the output data to a host spool system (operating system spooler) which in turn prints the output on the printer attached to it. There are various combinations(printing method) for this depending on where the host spool system resides. SAPLPD is the transfer program which accepts print data and forwards it to the host spooler on Microsoft Windows platforms. Host spooler in the frontend system is used for downloading PDF files. Add a new output device using the SPAD transaction with device type set to PDF1. Other device types maybe required for PDF files containing characters from languages like chinese, arabic etc. Create an output device as shown in the screenshots below. In this case “PDF_printer” value is maintained in “Host printer” field of the access method tab since the FILE printer we just created was named so.. If this FILE printer has been set as the default printer in the frontend system then value “_DEFAULT” can be maintained in this field irrespective of the name given to the printer.
Hereafter, for saving print outputs as PDF file, in the print dialog select the output device ZPDF and click print. This will invoke the SAPLPD program and prompt for a file name for saving the file.. Enter the filename with full path and click ok to save the pdf file in the mentioned path.