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: 

Printing remote PDF

Former Member
0 Kudos

Hi,

Is it possible to automatically print a PDF file which is located on a different server (like http://www.myserver/mypdf.pdf).

I have build a small program for opening it with method "CALL METHOD cl_gui_frontend_services=>execute..." but my user want to do mass printing.

Is it any way to do it ?

Thx.

10 REPLIES 10

OttoGold
Active Contributor
0 Kudos

Hello, I am ready to help, but please clarify the scenario.

Will you use ADS - Adoe forms integration? Or what kind of PDF printing?

How and where do you have/ get the data?

What is the connection between the systems?

Both systems are SAP systems?

Otto

Former Member
0 Kudos

Hi,

Sorry for late answer, yes we have ADS for PDF form generation (on SAP Side).

But for my problem (printing external PDF) i have PDF files located on a different server (not a SAP system).

I can access for example to this file with url access like http://www.myserver/mypdf.pdf.

What is my requirement (or my whish), it's from an ABAP programm, to get the file located on http addr. http://www.myserver/mypdf.pdf and send it to the SAP spool (or to create a spool request with it).

Actually i have found a solution to open it from an ABAP programm to a web browser with this simple code

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

document = url_to_open

EXCEPTIONS

OTHERS = 1.

This programm is call during the printing of an invoice (with TC NACE i have build a condition for output control) but it's not usefull for end user because they want to print directly this external PDF and not open it.

Help is welcome.

Thx.

0 Kudos

Hello, it should be easy to solve this. Don´t be afraid.

The scenario will work like this:

1. download the form (I mean get the data stream of the PDF file)

2. I don´t say how to implement 1), but a straightforward option would be to create a dedicated folder on the server and download the file there every time the file is a) asked b) template is changed (or any other event you like)

3. get the template data into ABAP

4. create a XML data file, you have some options here, for example use simple transformation (in SE80 others: transformation: simple) where you will define the XML file according to the form structure (which you can get from the trace file: SFP: options: very detailed trace, then attachments left bottom in the Adobe reader when you display the form)

5. use FP_PDF_TEST_19 as an exmaple how to merge a template and a XML data file

I feel like I will blog about it, because I feel the question was asked few times and I don´t remember if any suitable answer was provided. I hope I will not forget to add a reference here.

Regards Otto

0 Kudos

check the blog here: /people/otto.gold/blog/2010/08/19/how-to-print-a-form-from-the-external-template

regards Otto

Former Member
0 Kudos

Thx a lot for this, but the pdf file located on an other server is not generated by SAP, it's a stupid PDF generated by Word (for example).

In addition i have investigate programm FP_PDF_TEST_04, which allow to convert PDF file to PS file... on this programm i can open/read the content of the PDF.

Is there any option to send directly the PDF content (in raw format) to the printer ?

i have try with a stupid txt content and RSPO_WRITE_SPOOLREQUEST but it doesn't work.

0 Kudos

not generated by SAP, it's a stupid PDF generated by Word (for example).

You cannot change it in any way in SAP. At least I am not aware of any way you could do it. If it is "stupid", than it has no internal structure, so there is no way you could manipulate the content, because the system would not understand what part do you want to change and how (it has no internal structure!).

In addition i have investigate programm FP_PDF_TEST_04, which allow to convert PDF file to PS file... on this programm i can open/read the content of the PDF.

I am afraid I don´t understand why would you use such program? But if you would be able to load the form successfully into the memory (like create an object filled with the loaded form), then there could be a print method of the pdf object. But i doubt it works with totally stupid external PDF files.

I must add my personal opinion: I don´t understand the process at all. Is that all only because you want to "register" some external print under a SAP user? Or to use SAP as a central printer? Man, it is not worth the time, I have no idea if that is even possible. But sounds like weird task...

Regards Otto

p.s.: you can ask under ABAP Printing, I saw some similar questions there, I think.

Former Member
0 Kudos

my problem It's simple, on SAP side my user edit 3 SAP document. They should edit an other one which is not a SAP document but a simple PDF file located on an other server.

To avoid my user to connect to a shared folder, open this PDF file and print it, i would like, inside an ABAP programm to open/read this PDF file (located on a shared folder) and send it to the printer.

So, to resume, when printing the 3 SAP document, i would like in addition to open a foreign PDF document and send it to the printer. At the end 4 document will be printed.

It's not a form it's a PDF file, you can consider that it could be a text file, or word file, etc...

0 Kudos

They should edit an other one which is not a SAP document but a simple PDF file located on an other server.

You cannot edit a stupid PDF file, I think. How is that document created? Why do you want to edit it anyway? If that is word file exported to PDF, change the word file and export again. If that is some kind of a template, then recreate it as a real Adobe form, not a plain PDF. In SAP or in LCD outside SAP. Then either a human (in Reader) or a machine (like sap program) can edit the content easily.

The rest, about downloading and printing the documents, is not PDF related problem. So I cannot help regarding this part.

Otto

Former Member
0 Kudos

, you don't understand me, or sorry it's me who don't explain correctly...

When i speak about "edit", i mean "print", i want to print from an abap programm a PDF file which is located on a shared folder (or uploaded by a screen selection), that all...

0 Kudos

This message was moderated.