PDF Merge - ABAP Program
PDF Merge - ABAP Program
*&&-- Below are the 5 different Adobe form names created for Contract
CONSTANTS: lc_form_cover TYPE fpname VALUE 'ZFI_CP_COVER_LETTER',
lc_form_agreement TYPE fpname VALUE 'ZFI_CP_LOAN_AGREEMENT',
lc_form_debit TYPE fpname VALUE 'ZFI_CP_DIRECT_DEBIT',
lc_form_third_party TYPE fpname VALUE 'ZFI_CP_THIRD_PARTY',
lc_form_terms TYPE fpname VALUE 'ZFI_CP_TERMS_CONDITION'.
lwa_outputparams-nodialog = abap_true.
lwa_outputparams-dest = 'LOCL'.
lwa_outputparams-getpdf = 'M'.
lwa_outputparams-bumode = 'M'. " Bundle Mode Multiple
*&---------------------------------------------------------------------*
*& Form Processing: Call Form - Open
*&---------------------------------------------------------------------*
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = lwa_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
" Suitable Error Handling
ENDIF.
CATCH cx_fp_api.
ENDTRY.
IF sy-subrc <> 0.
ENDIF.
REFRESH: lt_formoutput.
lwa_formoutput-pdf = lv_merged_document.
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
client = sy-mandt
logical_path = 'ZFI_CUSTSTMT_PATH'
file_name = lv_name
IMPORTING
file_name_with_path = lv_file_name
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*PDF Upload
IF lwa_formoutput-pdf IS NOT INITIAL.
lt_pdfcontent = cl_document_bcs=>xstring_to_solix( ip_xstring = lwa_formoutput-
pdf ).
IF sy-subrc = 0.
REFRESH lt_pdfcontent.
ENDIF.
ENDIF.