当前位置: 代码迷 >> 综合 >> smartform的参数分析和转PDF
  详细解决方案

smartform的参数分析和转PDF

热度:79   发布时间:2024-02-01 01:26:44.0

smartform有许多的参数,了解这个参数所代表的含义对我们在赋值的时候有很重要的意义。

Tdimmed ( print immdiately ),tddelete ( delete after printing ),tdlifetime ( spool retention period ) , tddest ( output device spool ) , tdprinter ( device type name ),No_dialog ( general indicator ), preview ( print preview ),device ( output device )

ssfctrlop -getotf  = 'X'. 此参数必须,负责不会导出PDF而是直接显示smartform

 (若是需要要记录Smartform 打印的次数和打印的内容

w_OUTPUT_OPTIONS-TDIEXIT = 'X'.  "预览打印后直接退出,

w_job_output_info-OUTPUTDONE = 'X'. “ 是否输出到打印机 )

若是不需要打开pdf预览,而是直接down PDF文件到本地,则不需要 function SSF_OPEN,

    CLEAR w_outoptions.REFRESH:t_otf[].w_cparam-no_dialog = 'X'.
*  w_cparam-preview = 'X'.
*  w_cparam-no_open = 'X'.w_cparam-preview = space.w_cparam-no_close = ' '.w_cparam-getotf  = 'X'.w_outoptions-tdimmed = abap_true.w_outoptions-tdnewid = abap_true.w_outoptions-tdfinal = abap_true.
*  w_outoptions-bcs_langu = '1'.w_outoptions-tddest = 'SAP'.CALL FUNCTION w_fmoduleEXPORTINGcontrol_parameters = w_cparamoutput_options     = w_outoptionsuser_settings      = spacelist_header        = lds_headerIMPORTINGjob_output_info    = t_otf_from_fmTABLESlist_detail        = ldt_detail_per2EXCEPTIONSformatting_error   = 1internal_error     = 2send_error         = 3user_canceled      = 4OTHERS             = 5.IF sy-subrc <> 0.
*      MESSAGE e000 WITH 'Call Smart Form Fail.'.MESSAGE 'Call Smart Form Fail.' TYPE 'S' DISPLAY LIKE 'S'.RETURN.ENDIF.APPEND LINES OF t_otf_from_fm-otfdata TO at_otf.t_otf[] = at_otf[].lv_time = lv_time + 1.ENDDO.CALL FUNCTION 'CONVERT_OTF'EXPORTINGformat                = 'PDF'max_linewidth         = 132IMPORTINGbin_filesize          = w_bin_filesizebin_file              = ex_bin_fileTABLESotf                   = t_otf[]lines                 = t_pdf_tabEXCEPTIONSerr_max_linewidth     = 1err_format            = 2err_conv_not_possible = 3err_bad_otf           = 4OTHERS                = 5.IF sy-subrc <> 0.MESSAGE 'Smart Form Transfer PDF Fail.' TYPE 'S' DISPLAY LIKE 'S'.EXIT.ENDIF.LOOP AT t_otf." INTO W_OTF .CONCATENATE t_otf-tdprintcom t_otf-tdprintparINTO w_pdf.APPEND w_pdf TO i_content_txt.ENDLOOP.CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'EXPORTINGformat_src      = 'OTF'format_dst      = 'PDF'
*       ADDR_TYPE       =devtype         = 'PDFUC' "'TWPDF'
*       FUNCPARA        =CHANGINGtransfer_bin    = tran_resultcontent_txt     = i_content_txtcontent_bin     = lt_binobjhead         = obj_headlen             = lenEXCEPTIONSerr_conv_failed = 1OTHERS          = 2.CONDENSE len.l_filesize = len.CALL FUNCTION 'GUI_DOWNLOAD'EXPORTINGbin_filesize                    = l_filesizefilename                        = lv_fullpathfiletype                        = 'BIN'
*     WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
*     SHOW_TRANSFER_STATUS            = ABAP_TRUE
*     VIRUS_SCAN_PROFILE              = '/SCET/GUI_DOWNLOAD'
*   IMPORTING
*     FILELENGTH                      =TABLESdata_tab                        = lt_bin "l_pdf_tab "
*     FIELDNAMES                      =EXCEPTIONSfile_write_error                = 1no_batch                        = 2gui_refuse_filetransfer         = 3invalid_type                    = 4no_authority                    = 5unknown_error                   = 6header_not_allowed              = 7separator_not_allowed           = 8filesize_not_allowed            = 9header_too_long                 = 10dp_error_create                 = 11dp_error_send                   = 12dp_error_write                  = 13unknown_dp_error                = 14access_denied                   = 15dp_out_of_memory                = 16disk_full                       = 17dp_timeout                      = 18file_not_found                  = 19dataprovider_exception          = 20control_flush_error             = 21OTHERS                          = 22.

一般 打印的文件会在spool list中,怎么从spool list 中读取PDF到服务器上,

GET_PRINT_PARAMETERS  创建一组打印或存档的参数”spool list id

打印语句一般有:NEW-PAGE PRINT ON ,submit program_name to sap-spool

CONVERT_OTFSPOOLJOB_2_PDF (读取文件,然后可以download下来)

  相关解决方案