cancel
Showing results for 
Search instead for 
Did you mean: 

Merging two PDFs into one PDF

Former Member
0 Kudos

Hi Guys,

The requirement is to resend a previous month's bill to customer with an additional cover letter.

The existing bill is in PDF format, we developed the cover letter but want to merge the existing bill(which is a PDF present in the application server) with the cover letter and send it to customer.

Is there a way to merge a PDF(cover letter) output with another existing PDF(previous bill)?

Looking forward to your valuable answers.

Thanks

MS

Edited by: Mahesh Sahu on Apr 30, 2010 12:56 AM

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi, MS.

Have you ever used some 3rd party PDF processors to deal with the PDF merging projects? I am testing about the related projects these days. Do you have any ideas about it? Or any good suggestion? Thanks in advance.

Best regards,

Arron

0 Kudos

If you system is linux/unix you can also use the preinstaled opensource unix comand ghostscript ( the comand is "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite (...)" . it works but if you are merging 10pdfs it will take some time writing and reading from disk.

Best regards

Miguel

OttoGold
Active Contributor
0 Kudos

Hello,

1) the functionality is not available in the current ADS and I know many people who are looking forward to the day SAP will implement this for us

2) there is a workaround using the external program, check this thread:

3) Have you ever considered paying back the people who helped you on SDN and help somebody yourself? That would be awesome, there are always the newbies, you can help.

Regards Otto

Former Member
0 Kudos

Hi Mahesh.

Try Like this, Get all your data in one final table and do looping your data in PDf Functionl Module.

For Example.

LOOP AT it_header INTO wa_header.

REFRESH it_item1.

CLEAR:wa_item.

LOOP AT it_item INTO wa_item WHERE dc_no = wa_header-dc_no.

APPEND wa_item TO it_item1.

CLEAR wa_item.

ENDLOOP.

CALL FUNCTION lv_fname

EXPORTING

control_parameters = st_control_parameters

output_options = st_output_options

user_settings = ' '

wa_header = wa_header

IMPORTING

document_output_info = st_document_output_info

job_output_info = st_job_output_info

job_output_options = st_job_output_options

TABLES

it_item = it_item1

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CLEAR wa_pdf.

LOOP AT st_job_output_info-otfdata INTO wa_pdf.

APPEND wa_pdf TO it_pdf.

ENDLOOP.

CLEAR wa_header.

ENDLOOP.

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = v_bin_filesize

TABLES

otf = it_pdf

doctab_archive = it_docs

lines = it_lines

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'

EXPORTING

i_otf = it_pdf

EXCEPTIONS

convert_otf_to_pdf_error = 1

cntl_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CONCATENATE 'REJECTION' '-' 'RETURN' '.pdf' INTO v_name.

CREATE OBJECT v_guiobj.

CALL METHOD v_guiobj->file_save_dialog

EXPORTING

default_extension = 'pdf'

default_file_name = v_name

file_filter = v_filter

CHANGING

filename = v_name

path = v_path

fullpath = v_fullpath

user_action = v_uact.

IF v_uact = v_guiobj->action_cancel.

EXIT.

ENDIF.

david_liu1
Advisor
Advisor
0 Kudos

Hello,

I am sorry to say but such functionality is not available in ADS.

We can not merge PDF files.

Regards,

David