Application Development 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: 

Print PDF document from SAP server

Former Member
0 Kudos
2,490

Hello Guru's,

I need to print some pdf documents store on my sap server (not created by SAP programs).

Is this is possible and how ?

Thanks a lot.

JC

1 ACCEPTED SOLUTION

0 Kudos
975

Hello Jean-Claude,

actually there is a possibility to use "normal" SAP backend printers to print PDF files from SAP spooler. The prerequisite for this is that these printers are attached to SAP backend appserver via a Windows print server which runs the SAPSprint print service software (i.e. you need to print via the SAPSprint service, not directly to the printer).

There is an optional software component PDFPRINT which allows SAPsprint to convert an incoming PDF to printer output using the Windows Printer driver. You can find the information on how to get PDFPRINT in SAP note 1444342.

What you actually need to do on the application side is to create a spool request (which contains your PDF file) which "looks like" a PDF spool request created from SAP Interactive Forms by Adobe (IFbA). I believe this is what FP_JOB_OPEN...FP_JOB_CLOSE mentioned above are about, but these are internal funcs and I cannot advise on how to use them.

In newer versions of SAP NW 7xx (newer SPs) you can find the new function module ADS_CREATE_PDF_SPOOLJOB which does all the required work for you.

Best regards,

  Alexander

18 REPLIES 18

former_member201275
Active Contributor
0 Kudos
975

refer answer at bottom of this link:

http://scn.sap.com/thread/2007634

0 Kudos
975

Thanks Glen,

"To print PDF to a SAP printer is not directly possible but to a frontend printer will be."

But this solution is not possible, we are working only in batch mode, and we have no frontend printer define in our project

Is there another possibility ?

Thanks a lot.

JC

0 Kudos
975

Apologies, I don't know of any other way.

Hopefully one of the others here can provide solution.

Former Member
0 Kudos
975

You can use OPEN DATASET, WRITE TO...., CLOSE DATASET...

-Sowmya

0 Kudos
975

Thanks Sowmya,

But the write is not working for PDF, do you have another idea ?

Thanks a lot.

JC

0 Kudos
975

This is how I've used and it is working for me..

DATA: w_output_record(700)    TYPE c.

“p_ofile is the Output File Path

IF p_ofile IS NOT INITIAL.

    OPEN DATASET p_ofile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    IF sy-subrc NE 0.

      WRITE: / 'Could not open file ', p_ofile.

      STOP.

    ENDIF.

  ELSE.

    WRITE: / 'No file'.

    STOP.

  ENDIF.

WRITE: '$$LW00PMFF[ATEST$$' TO w_output_record. "ASCII/EBDCIC Files

    TRANSFER w_output_record TO p_ofile.

CLOSE DATASET p_ofile.

  IF NOT sy-subrc IS INITIAL.

    MESSAGE e999(z1) WITH 'Could not close file:' p_ofile.

  ENDIF.

Regards,

Sowmya

0 Kudos
975

Thanks Sowmya,

It seemes that your code is not working for me, I only need to print de PDF and add it to an existing spool.

Thanks

0 Kudos
975

Hi,

You can solve your problem using following steps.

(1) Use OPEN DATASET ...... CLOSE DATASET (For Communication with Server)

Between OPEN DATASET and CLOSE DATASET, You have to use following Function Modules

(2) Use GUI_UPLOAD Function Module (For Reading(Upload) PDF data in Internal Table)

(3) Use GUI_DOWNLOAD Function Module (For Writing(Download) PDF data on Presentation Server)

With Thanks & Regards,

Tushar Trivedi.

0 Kudos
975

Hello Tushar,

The PDF files is not on presentation server, and all the process will be in background, thus GUI FM are not working

Thanks for yur help.

JC

0 Kudos
975

Hi Jean,

Hope the link might be useful.

http://scn.sap.com/thread/2114729.

Revert back if it is not working.

With Regards,

Giriesh M

0 Kudos
975

Thanks Giriesh,

This is not the solution for me, because we need only print in background, and thus avoid the gui function or object.

Thanks.

JC

Former Member
0 Kudos
975

Hi,

If you are using a costume program to generate the form then may be you are using FP_JOB_OPEN function module. In that pass the changing parameter ie_outputparams with  REQNEW = 'X'. It will create a spool for you. If you are not using FP_JOB_OPEN then please let me know how you are generating the PDF then may be I can give you alternate solution.

Regards,

Supratik

0 Kudos
975

Hello Supratik,

The PDF files are coming from different sources (scan document, mail attach, ..., and are store temporaly on a work folder on my SAP folder.

I need to add those files to a existing spool.

I have already managed the field REQNEW in the print of the document to allow the adding of new documents in the spool.

But how can ake my PDF file from my SAP server, and add it to the spool.

Thanks a lot.

JC

0 Kudos
975

Hi JC,

If you want to add that to a existing spool then no need to use REQNEW ,as it will create a new spool for that. In that case just pass the existing spool number to SPOOLID of ie_outputparams. Hope this helps.

Regards,

Supratik

0 Kudos
975

Hi Supratik,

My question is : how to send a pdf file from sap server to spool ?

How to print a pdf document file ?

Thanks a lot.

JC

0 Kudos
976

Hello Jean-Claude,

actually there is a possibility to use "normal" SAP backend printers to print PDF files from SAP spooler. The prerequisite for this is that these printers are attached to SAP backend appserver via a Windows print server which runs the SAPSprint print service software (i.e. you need to print via the SAPSprint service, not directly to the printer).

There is an optional software component PDFPRINT which allows SAPsprint to convert an incoming PDF to printer output using the Windows Printer driver. You can find the information on how to get PDFPRINT in SAP note 1444342.

What you actually need to do on the application side is to create a spool request (which contains your PDF file) which "looks like" a PDF spool request created from SAP Interactive Forms by Adobe (IFbA). I believe this is what FP_JOB_OPEN...FP_JOB_CLOSE mentioned above are about, but these are internal funcs and I cannot advise on how to use them.

In newer versions of SAP NW 7xx (newer SPs) you can find the new function module ADS_CREATE_PDF_SPOOLJOB which does all the required work for you.

Best regards,

  Alexander

0 Kudos
975

Thanks Alexander,

I have to install the OSS Note 1855522 to have this FM.

I'll let you know if it works.

Thanks and regards

JC

0 Kudos
975

Dear Alexander,

You are the king, now it works fine after implementing the oss Note 1855522.

Thanks a lot.

JC