cancel
Showing results for 
Search instead for 
Did you mean: 

Converting multiple files in a PDF-spool-job into one sinlge PDF

Former Member
0 Kudos

Hello

I am producing spool jobs containing thousands of PDF-Files in the part list using Adobe Interactive Forms. I now need to extract this output and convert it into one single PDF file that I can send to the printer-office for processing.

There is a report RSTXPDFT4 that does just about this for ABAP- and SAP Script-Output but this report does not work for PDF-spooljobs.

I heard that there is also a report für PDF-spooljobs but nobody was able to tell me the name of this program.

Can anybody help me out?

Cheers

Markus

Accepted Solutions (0)

Answers (6)

Answers (6)

OttoGold
Active Contributor
0 Kudos

Awesome!! Thank you for sharing:)) Regards, Otto

Former Member
0 Kudos

Hi,

I am correct , what i am saying is convert PDF to Binary and append two binary files together and download to application server.

" you append both binary files in gt_lines and download to t_path(.pdf) it will show nice pdf format"

Thanks,

Hari

Sandra_Rossi
Active Contributor
0 Kudos

Too nice to be true (generally it never works with binary files, word, excel, etc.) : I have just tested, I merged 2 very simple PDF files 1 page each into one PDF, and when I open it with Acrobat Reader it displays only the 1st page.

Former Member
0 Kudos

Hi

In the release Notes of Netweaver 7.01 I found the following promising lines (source: http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/40638d89-66ae-2b10-bd8b-dd665e28f906&override... 😞

Output of multiple form templates in a single PDF

Rather than creating several PDFs, it can be more convenient to create a single PDF for all the form templates u2013 for example, related documents to be attached to an email. ADS can now be instructed by the print program to return a single PDF.

This sounds rather good. Has anybody an idea of how to make this work?

cheers

peter_wanschou2
Explorer
0 Kudos

Hi all,

I had the same problem but i found a very simple tricky way to do it.

I use the java tool http://www.pdfsam.org/ for the concatenation. I installed it on the sap server and ´create an operation system command (TA sm69) (pdfsam -concat).

All my documents (pdf stream) i put in an document class and add the method concat to it. In the concat method i place the two binary stream into 2 files and concat them with the operation system command. The two files are the parameter of the command. After exection i read the result stream into my object and all works fine - including the deletion of the temporary files. I think it is a tricky solution but it works fine.

A better solution will be to write a java -service with pdfsam components to concat. The service can run on the java stack as a webservice, but for my need the solution was perfect and fast to implement.

Best regards,

Peter Wanschou

Edited by: Peter Wanschou on Dec 29, 2009 9:53 PM

Edited by: Peter Wanschou on Dec 29, 2009 9:54 PM

Former Member
0 Kudos

Hi Amit,

I found one you can download to your PC as a PDF.

But you need to convert PDF to binary both files and append each then convert pdf download in local drive.

report zfile_access.

data : g_path(128),

t_path type string.

data : begin of gt_lines occurs 0,

line type x,

end of gt_lines.

data : lt_value like tline occurs 0 with header line.

g_path = 'P:\FEMS_ABC\2850_specs.pdf'.

t_path = 'c:\temp\2850_specs.pdf'.

open dataset g_path for input in binary mode.

if sy-subrc = 0.

clear : lt_value.

refresh : lt_value.

do.

read dataset g_path into gt_lines-line.

if sy-subrc = 0.

append gt_lines.

else.

exit.

endif.

enddo.

endif.

close dataset g_path.

you append both binary files in gt_lines and download to t_path(.pdf) it will show nice pdf format.

call function 'GUI_DOWNLOAD'

exporting

filename = t_path

filetype = 'BIN'

tables

data_tab = gt_lines[].

Sandra_Rossi
Active Contributor
0 Kudos

Hi Harikiran, tell me if I'm wrong : your code just copies a PDF file from an application server to the frontend ?

This does not answer the question to merge several PDF files into one.

I guess you just posted in the wrong thread

Edited by: Sandra Rossi on Oct 1, 2009 1:46 PM

Sandra_Rossi
Active Contributor
0 Kudos

your question was already asked in other threads, but no "good" answer was given (what I am aware of). I guess SAP cannot do it (ADS maybe? but from java side), and third-party sofware surely (I saw project PDFCM for example).

Can't you generate one big PDF at generation time instead? (by repeating subforms)

Former Member
0 Kudos

Hi Markus,

your generating multiple spools those spools have pdf format inside? or your converting spools to pdf format the merging?

if your generating multiple spools in program just pass the control parameters that in loop that first record generate spool and form the next onward no spool at last no_close = ' '.

If your calling any FM FM_Name, pass

importing

job_output_info = tab_otf_data

tab_otf_data type ssfcrescl.

wa_rspoid type rspoid,

read table tab_otf_data-spoolids index 1 into wa_rspoid.

wa_rspoid contains one spool id.

submit rstxpdft4

with spoolno = wa_rspoid

with p_file = p_file

and return.

please check if it works.

Thanks,

hari

chintan_virani
Active Contributor
0 Kudos

Markus,

I am no expert for Print forms but see if this [wiki|https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=134545580] helps.

Chintan

Former Member
0 Kudos

Hi Chintan

Thanks for your Answer but this does not solve my problem, since your coding also only works for SAP Script-Output but not for Spooljobs containing PDF files.