美文网首页SAPSAP技术干货
Smartforms 打印PDF格式

Smartforms 打印PDF格式

作者: Mmm_余安 | 来源:发表于2017-07-17 16:25 被阅读33次
    DATA:L_FM_NAME          TYPE RS38L_FNAM,
          OUTPUT             TYPE SSFCOMPOP,
          CONTROL_PARAMETERS TYPE SSFCTRLOP,
          LW_SSFCRESCL       TYPE SSFCRESCL,
          OPTION             TYPE SSFCRESCL,
          GT_PDFTAB TYPE TABLE OF TLINE,
          G_BINFILESIZE TYPE I.```
    
    ----------------------------用来传值-----------------------------------
    ```DATA :LS_ZZS_11 TYPE  ZTEST_14062.
     DATA :GT_L TYPE TABLE OF  ZTEST_14062,
           GS_L TYPE ZTEST_14062.```
    
    ```CONTROL_PARAMETERS-LANGU = '1'.```
    
    ```  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
            EXPORTING
              FORMNAME                 = 'ZSF_14062' "smartfroms的名字
           IMPORTING
             FM_NAME                  = L_FM_NAME.```
    
    
     ``` "打印设置                                                                                          CONTROL_PARAMETERS-GETOTF = 'X'."表示不真的打印```
    *------------------------  打印数据传值 --------------------------
    ```loop                                                                                                        endloop```
    
    

    CALL FUNCTION l_fm_name
    EXPORTING
    control_parameters = control_parameters
    output_options = output
    user_settings = 'X' "和直接打印不同的点
    zsf_14062 = ls_zzs_11
    page_num = page_num
    IMPORTING
    job_output_info = option
    TABLES
    gt_14062 = gt_l
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4.```

    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                  = 'PDF'
      IMPORTING
        bin_filesize            = g_binfilesize
      TABLES
        otf                     = option-otfdata
        lines                   = gt_pdftab
      EXCEPTIONS
        err_max_linewidth       = 1
        err_format              = 2
        err_conv_not_possible   = 3
        err_bad_otf             = 4
        OTHERS                  = 5.```
    
    

    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    bin_filesize = g_binfilesize
    filename = 'D:\TEST.PDF'
    filetype = 'BIN'
    TABLES
    data_tab = gt_pdftab.```

    点击打印会生在D盘生成一个TEST.PDF的文件,和预览时的样子一致。

    注意:

    样式中的字体必须为宋体,不然保存PTF会变为#。

    相关文章

      网友评论

        本文标题:Smartforms 打印PDF格式

        本文链接:https://www.haomeiwen.com/subject/hbfqkxtx.html