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 =
internal_error =
send_error =
user_canceled =
OTHERS = .
IF sy-subrc <> .
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 =
no_function_module =
OTHERS = .
IF sy-subrc <> .
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 =
internal_error =
send_error =
user_canceled =
OTHERS = .
IF sy-subrc <> .
* 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 =
internal_error =
send_error =
OTHERS = .
IF sy-subrc <> .
* Implement suitable error handling here
ENDIF.
*&---------------------------------------------------------------------*
* 标记打印标识,当点击打印预览的时候不标记
*----------------------------------------------------------------------*
IF w_job_output_options-tdpreview <>'X'.
"当点击打印时的执行 ENDIF.