10-17-2019 1:36 PM
Hi Mr.Abaper's
I'm getting multiple PDF attachments I want to convert into a single pdf.
Regards,
Srinivas
SELECT gjahr belnr FROM ekbe
INTO TABLE it_ekbe
WHERE ebeln = p_ebeln .
LOOP AT it_ekbe INTO it_ekbe_line .
** Concatenate Material Document Number and Year to Instance Id
CONCATENATE it_ekbe_line-belnr
it_ekbe_line-gjahr
INTO lwa_lporb-instid.
** Type of Object
lwa_lporb-typeid = lc_typeid.
** Category Of Object
lwa_lporb-catid = lc_catid.
REFRESH lt_links.
** Call Method to read relationship records for instance(GR)
TRY.
CALL METHOD cl_binary_relation=>read_links_of_binrel
EXPORTING
is_object = lwa_lporb
ip_relation = lc_rel_typ
IMPORTING
et_links = lt_links.
CATCH cx_obl_parameter_error.
CLEAR sy-subrc.
CATCH cx_obl_internal_error.
CLEAR sy-subrc.
CATCH cx_obl_model_error.
CLEAR sy-subrc.
ENDTRY.
IF lt_links[] IS NOT INITIAL.
SORT lt_links BY utctime DESCENDING.
LOOP AT lt_links INTO lwa_links.
REFRESH lt_contents_hex.
** Instance Id in Busness Objects
lv_docid = lwa_links-instid_b.
** Call Function Module to read contents of attached document
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_docid
* filter = 'X '
IMPORTING
document_data = lwa_docdata
TABLES
contents_hex = lt_contents_hex
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
IF sy-subrc EQ 0 AND lt_contents_hex IS NOT INITIAL.
CLEAR: lv_length,
lv_file_content.
DESCRIBE TABLE lt_contents_hex LINES lv_lin.
lv_length = lv_lin * sy-tleng.
CONCATENATE 'C:\Users\BPSH066\Desktop/multitest'
sy-uzeit
'.pdf'
INTO lv_path.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = lv_length
filename = lv_path
filetype = 'BIN'
TABLES
data_tab = lt_contents_hex.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
10-18-2019 1:24 PM
Please check the standard program "RSPO_TEST_MERGE_PDF_FILES". In the subroutine merge_pdf, class "cl_rspo_pdf_merge" is used to merge multiple PDFs.
Thanks,
Gourab
10-17-2019 1:43 PM
A PDF is not a flat file, if you are running under linux you cannot do cat pdf1 > pdf cat pdf2 >> pdf.
there is a header, with header information, there is global definition ....
so merging pdf need a dedicated application
10-17-2019 2:48 PM
> so merging pdf need a dedicated application
Not sure if that's what is been asked, but sejda.org might be just such a tool!
10-18-2019 1:24 PM
Please check the standard program "RSPO_TEST_MERGE_PDF_FILES". In the subroutine merge_pdf, class "cl_rspo_pdf_merge" is used to merge multiple PDFs.
Thanks,
Gourab