Hi, there is a class called cl_rspo_pdf_merge. With the help of this class, you can combine pdfs into a single file.
Below is sample code.
*&---------------------------------------------------------------------* *& Report ZTEST *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ztest2. DATA: lv_rc TYPE i. DATA: it_files TYPE filetable. DATA: lv_action TYPE i. SELECT * FROM ekko INTO TABLE @DATA(lt_ekko) UP TO 10 ROWS. DATA: fp_outputparams TYPE sfpoutputparams, lf_formname TYPE fpname, ls_function TYPE funcname, fp_interfacetype TYPE fpinterfacetype, fp_docparams TYPE sfpdocparams, os_formout TYPE fpformoutput. lf_formname = 'ZZ_MM_TEKLIFTALEBI_TR_F'. fp_outputparams-getpdf = 'X'. fp_outputparams-getpdl = 'X'. fp_outputparams-getxml = 'X'. fp_outputparams-nodialog = 'X'. CALL FUNCTION 'FP_JOB_OPEN' CHANGING ie_outputparams = fp_outputparams EXCEPTIONS cancel = 1 usage_error = 2 system_error = 3 internal_error = 4 OTHERS = 5. CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' EXPORTING i_name = lf_formname IMPORTING e_funcname = ls_function e_interface_type = fp_interfacetype. DATA(o_pdf_merger) = NEW cl_rspo_pdf_merge( ). LOOP AT lt_ekko INTO DATA(ls_ekko). CALL FUNCTION ls_function EXPORTING /1bcdwb/docparams = fp_docparams is_ekko = ls_ekko IMPORTING /1bcdwb/formoutput = os_formout EXCEPTIONS usage_error = 1 system_error = 2 internal_error = 3 OTHERS = 4. o_pdf_merger->add_document( os_formout-pdf ). ENDLOOP. o_pdf_merger->merge_documents( IMPORTING merged_document = DATA(lv_merged_pdf) rc = lv_rc ). IF lv_rc = 0. DATA: lv_filename TYPE string. DATA: lv_fullpath TYPE string. DATA: lv_path TYPE string. * SaveDialog cl_gui_frontend_services=>file_save_dialog( EXPORTING default_extension = 'pdf' default_file_name = 'merged.pdf' file_filter = |pdf (*.pdf)\|*.pdf\|{ cl_gui_frontend_services=>filetype_all }| prompt_on_overwrite = abap_true CHANGING filename = lv_filename " dosya adı path = lv_path " dosya yolu fullpath = lv_fullpath " dosya yolu + dosya adı user_action = lv_action ). " sy-ucomm gibi IF lv_action EQ cl_gui_frontend_services=>action_ok. * xstring -> solix DATA(it_bin_data_merged) = cl_bcs_convert=>xstring_to_solix( lv_merged_pdf ). DATA(lv_size_merged) = xstrlen( lv_merged_pdf ). * dosyayı bilgisayara indir cl_gui_frontend_services=>gui_download( EXPORTING filename = lv_fullpath filetype = 'BIN' bin_filesize = lv_size_merged CHANGING data_tab = it_bin_data_merged ). ENDIF. ENDIF. CALL FUNCTION 'FP_JOB_CLOSE' EXCEPTIONS usage_error = 1 system_error = 2 internal_error = 3 OTHERS = 4.