*&---------------------------------------------------------------------* *& Report ZRICO_25 *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* report ztest_pdf2spool. include fp_utilities. "#EC INCL_OK data gv_cust_id type s_customer. data: content type fpcontent. data gs_outputparams type sfpoutputparams. data: total_pages type fppagecount. parameters: fpages type i modif id upl. initialization. start-of-selection. perform upload_data. perform set_outpars. perform send_pdf_to_spool. form send_pdf_to_spool. data: size type i. data: total_size type i. data: spoolid type rspoid. data: copies type rspocopies. data: lifetime. size = xstrlen( content ). add size to total_size. copies = gs_outputparams-copies. lifetime = gs_outputparams-lifetime. call function 'ADS_CREATE_PDF_SPOOLJOB' exporting dest = gs_outputparams-dest pages = total_pages pdf_data = content name = gs_outputparams-dataset suffix1 = gs_outputparams-suffix1 suffix2 = gs_outputparams-suffix2 copies = copies immediate_print = gs_outputparams-reqimm auto_delete = gs_outputparams-reqdel titleline = gs_outputparams-covtitle receiver = gs_outputparams-receiver division = gs_outputparams-division authority = gs_outputparams-authority lifetime = lifetime importing spoolid = spoolid exceptions no_data = 1 not_pdf = 2 wrong_devtype = 3 operation_failed = 4 cannot_write_file = 5 device_missing = 6 no_such_device = 7 others = 8. if sy-subrc <> 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. message s060(ssfcomposer) with spoolid. endform. " SEND_PDF_To_SPOOL form upload_data. include fp_spool_constants. data: name type string, filetype type char10, filetable type filetable, rc type i, guiobj type ref to cl_gui_frontend_services, uact type i. data: datatab type table of ssfdata. data: extension type string. data: bin_filesize type i. data: buffer type xstring. extension = c_file_ext_pdf. filetype = 'BIN'. concatenate '*' extension into name. create object guiobj. call method guiobj->file_open_dialog exporting default_filename = name changing file_table = filetable rc = rc user_action = uact exceptions file_open_dialog_failed = 1 cntl_error = 2 error_no_gui = 3. if uact = guiobj->action_cancel. leave program. endif. read table filetable index 1 into name. check sy-subrc = 0. call function 'GUI_UPLOAD' exporting filename = name filetype = filetype importing filelength = bin_filesize tables data_tab = datatab exceptions file_open_error = 1 file_read_error = 2 invalid_type = 3 no_batch = 4 others = 5. if sy-subrc <> 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. leave program. endif. "#EC * *CALL FUNCTION 'WS_DOWNLOAD' * EXPORTING * BIN_FILESIZE = '80400' ** CODEPAGE = DATA_SIZE * FILENAME = 'C:\Users\itstudy\Desktop\aaaa2.txt' * FILETYPE = 'ASC' ** MODE = ' ' ** WK1_N_FORMAT = ' ' ** WK1_N_SIZE = ' ' ** WK1_T_FORMAT = ' ' ** WK1_T_SIZE = ' ' ** COL_SELECT = ' ' ** COL_SELECTMASK = ' ' ** NO_AUTH_CHECK = ' ' ** IMPORTING ** FILELENGTH = DATA_SIZE * TABLES * data_tab = datatab ** FIELDNAMES = * EXCEPTIONS * FILE_OPEN_ERROR = 1 * FILE_WRITE_ERROR = 2 * INVALID_FILESIZE = 3 * INVALID_TYPE = 4 * NO_BATCH = 5 * UNKNOWN_ERROR = 6 * INVALID_TABLE_WIDTH = 7 * GUI_REFUSE_FILETRANSFER = 8 * CUSTOMER_ERROR = 9 * NO_AUTHORITY = 10 * OTHERS = 11 * . call function 'SCMS_BINARY_TO_XSTRING' exporting input_length = bin_filesize importing buffer = buffer tables binary_tab = datatab exceptions failed = 1 others = 2. if sy-subrc <> 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. leave program. endif. content = buffer. total_pages = fpages. endform. form set_outpars . data: ls_outpars type sfpoutpar. call function 'FPCOMP_SHOW_DIALOG' changing ie_outpar = ls_outpars exceptions cancel = 1 usage_error = 2 system_error = 3 internal_error = 4 others = 5. if sy-subrc <> 0. message id sy-msgid type 'S' number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. leave program. else. move-corresponding ls_outpars to gs_outputparams. endif. endform.