Merge Multiple Adobe Forms into 1 PDF Content
Merge Multiple Adobe Forms into 1 PDF Content
Merge Multiple Adobe Forms into 1 PDF Content: Sometimes we get requirements from clients to combine multiple PDF output documents into 1 document similar to PDF Merge functionality provided by 3rd party tools. This blogs talks about the steps to achieve the same without storing the files on Application server and running UNIX commands to run a script to merge them.
Step1:
Call the FP_JOB_OPEN function module with below parameters
* Call abode with structure gs_frm_interface and get the PDF
fp_outputparams–device = ‘PRINTER’.
fp_outputparams–dest = ‘PDF’.
fp_outputparams–nodialog = abap_true.
fp_outputparams–preview = abap_false.
fp_outputparams–getpdf = abap_true.
fp_outputparams–reqnew = abap_true.
fp_outputparams–preview = ‘ ‘.
fp_outputparams–assemble = ‘X’.
fp_outputparams–bumode = ‘M’. ” This is Bundle Mode
fp_outputparams–getpdf = ‘M’. ” This should be set to M, compare to regular value X being ” passed
* Sets the output parameters and opens the spool job
CALL FUNCTION ‘FP_JOB_OPEN’ “& Form Processing: Call Form
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy–subrc <> 0.
*
ENDIF.
STEP2:
Get the Adobe Form function Module using FP_FUNCTION_MODULE_NAME and Call the function module for your 1st Adobe Form.
STEP3:
Get the Adobe Form function Module using FP_FUNCTION_MODULE_NAME and Call the function module for your 2nd Adobe Form.
Make sure you call all the Adobe form Function module, as many as you want here.
STEP4:
Call the FP_JOB_OPEN as you would do normally
Step 5:
Use the Function module ‘FP_GET_PDF_TABLE’ to get the Merged PDF content, as shown below
DATA pdf_table TYPE tfpcontent.
DATA la_pdf LIKE LINE OF pdf_table.
CALL FUNCTION ‘FP_GET_PDF_TABLE’
IMPORTING
e_pdf_table = pdf_table.
READ TABLE pdf_table INTO la_pdf INDEX 1.
IF sy–subrc EQ 0.
e_pdf_content = la_pdf.
ELSE.
* Raise Appropriate Error
ENDIF.
The PDF content will now have all the Adobe forms PDF content merged into 1 PDF content, and this can used to display in Webdynpro or downloaded to you desktop.
New NetWeaver Information at SAP.com
Very Helpfull