smartform的参数分析和转PDF

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'.  "预览打印后直接退出,  传出参数 outputdone会不会被赋值

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_fmodule
        EXPORTING
          control_parameters = w_cparam
          output_options     = w_outoptions
          user_settings      = space
          list_header        = lds_header
        IMPORTING
          job_output_info    = t_otf_from_fm
        TABLES
          list_detail        = ldt_detail_per2
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 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'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = w_bin_filesize
        bin_file              = ex_bin_file
      TABLES
        otf                   = t_otf[]
        lines                 = t_pdf_tab
      EXCEPTIONS
        err_max_linewidth     = 1
        err_format            = 2
        err_conv_not_possible = 3
        err_bad_otf           = 4
        OTHERS                = 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-tdprintpar
      INTO w_pdf.
      APPEND w_pdf TO i_content_txt.
    ENDLOOP.

    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
      EXPORTING
        format_src      = 'OTF'
        format_dst      = 'PDF'
*       ADDR_TYPE       =
        devtype         = 'PDFUC' "'TWPDF'
*       FUNCPARA        =
      CHANGING
        transfer_bin    = tran_result
        content_txt     = i_content_txt
        content_bin     = lt_bin
        objhead         = obj_head
        len             = len
      EXCEPTIONS
        err_conv_failed = 1
        OTHERS          = 2.

    CONDENSE len.
    l_filesize = len.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        bin_filesize                    = l_filesize
        filename                        = lv_fullpath
        filetype                        = 'BIN'
*     WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
*     SHOW_TRANSFER_STATUS            = ABAP_TRUE
*     VIRUS_SCAN_PROFILE              = '/SCET/GUI_DOWNLOAD'
*   IMPORTING
*     FILELENGTH                      =
      TABLES
        data_tab                        = lt_bin "l_pdf_tab "
*     FIELDNAMES                      =
      EXCEPTIONS
        file_write_error                = 1
        no_batch                        = 2
        gui_refuse_filetransfer         = 3
        invalid_type                    = 4
        no_authority                    = 5
        unknown_error                   = 6
        header_not_allowed              = 7
        separator_not_allowed           = 8
        filesize_not_allowed            = 9
        header_too_long                 = 10
        dp_error_create                 = 11
        dp_error_send                   = 12
        dp_error_write                  = 13
        unknown_dp_error                = 14
        access_denied                   = 15
        dp_out_of_memory                = 16
        disk_full                       = 17
        dp_timeout                      = 18
        file_not_found                  = 19
        dataprovider_exception          = 20
        control_flush_error             = 21
        OTHERS                          = 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下来)

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值