• 通过SMATFORMS打印程序的参考模板


    REPORT  ydemo_rick_print.

    CONSTANTS: c_lable_smartforms TYPE tdsfname VALUE 'ZCUSTOMER'.  "标签smartforms
    DATA: wa_control_parameters LIKE ssfctrlop,
         wa_options TYPE ssfcompop,
         wa_job_output_info TYPE ssfcrescl,
         m_name TYPE rs38l_fnam.
    
    DATA: w_job_output_options TYPE ssfcresop.
    DATA: ls_zwmt018head TYPE zwmt018head,
          ls_zwmt018item TYPE zwmt018item.
    DATA: ls_print TYPE zcustomer_print.
    CLEAR ls_print.
    ***对传入结构字段进行赋值
     
    CLEAR wa_control_parameters.
    CLEAR wa_options.
    CLEAR wa_job_output_info.
    
    wa_control_parameters-no_open  = 'X'.
    wa_control_parameters-no_close = 'X'.
    wa_control_parameters-langu    = sy-langu.
    *wa_control_parameters-no_dialog = 'X'."取消弹出窗口
    *wa_control_parameters-preview = 'X'."显示打印预览
    ******
    wa_options-tddest     = 'LP01'."默认打印机
    wa_options-rqposname = 'BTP'.  " 清单打印机-系统默认打印机
    wa_options-tdimmed    = 'X'. " 立即打印
    wa_options-tddelete   = 'X'."打印后删除
    *wa_options-tdnoprev   = 'X'.是否有打印预览按钮
    
    CALL FUNCTION 'SSF_OPEN'
      EXPORTING
        user_settings      = ''
        output_options     = wa_options
        control_parameters = wa_control_parameters
      IMPORTING
        job_output_options = w_job_output_options
      EXCEPTIONS
        formatting_error   = 1
        internal_error     = 2
        send_error         = 3
        user_canceled      = 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.
      EXIT.
    ENDIF.
    
    CLEAR m_name.
    *smartform打印
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname           = c_lable_smartforms
        variant            = ' '
        direct_call        = ' '
      IMPORTING
        fm_name            = m_name
      EXCEPTIONS
        no_form            = 1
        no_function_module = 2
        OTHERS             = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *smartform打印
    CALL FUNCTION m_name
      EXPORTING
        control_parameters = wa_control_parameters
        ih_print           = ls_print
      EXCEPTIONS
        formatting_error   = 1
        internal_error     = 2
        send_error         = 3
        user_canceled      = 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.
    ENDIF.
    *    EXIT.
    
    CALL FUNCTION 'SSF_CLOSE'
    *    IMPORTING
    *      job_output_info  = wa_job_output_info
    
      EXCEPTIONS
        formatting_error = 1
        internal_error   = 2
        send_error       = 3
        OTHERS           = 4.
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.
    *&---------------------------------------------------------------------*
    * 标记打印标识,当点击打印预览的时候不标记
    *----------------------------------------------------------------------*
    IF w_job_output_options-tdpreview <>'X'.
      "当点击打印时的执行
    
    ENDIF.
  • 相关阅读:
    SQL Server 自动备份数据脚本
    数据库还原,System.Data.SqlClient.SqlError: 因为数据库正在使用,所以无法获得对数据库的独占访问权。 (Microsoft.SqlServer.SmoExtended)
    AD 域中给AD 用加登录本地计算的权限
    share point CSOM 客户端模式 创建表 增删改查
    .net 修改AD域中的密码
    ES6——Object.assign() 对象的合并
    nodeJs —— 从零搭建一个koa项目
    nodeJs —— mongoose学习及案例
    nodeJs —— koa 常用中间件
    js计算舍入误差解决办法
  • 原文地址:https://www.cnblogs.com/ruingy/p/3445067.html
Copyright © 2020-2023  润新知