帮助同事搞smartforms
起因:在预览后按打印按钮,或者弹出来打印框时候的打印按钮时候需要记录下来打印次数,预览时候不需记录
解决办法:
smartfoms调用后传递 参数
测试后结果为:
data jobinfo type ssfcrescl.
call function 'SSF_CLOSE'
importing
job_output_info = jobinfo
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
others = 4
.
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.
if jobinfo-outputdone = 'X'.
message '打印了' type 'I'.
else.
message '没有打印' type 'I'.
endif.
搞定,恭喜:)
直接预览的参数
以下举个例子
FORM printdata .
DATA: lf_fm_name TYPE rs38l_fnam.
DATA: ls_control_param TYPE ssfctrlop.
DATA: ls_composer_param TYPE ssfcompop.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
DATA: lf_formname TYPE tdsfname.
DATA: outopt TYPE ssfcresop.
DATA: otfitab TYPE tsfotf.
DATA: pdfitab LIKE tline OCCURS 1000 WITH HEADER LINE.
DATA: i_job_output_info TYPE ssfcrescl.
DATA: length TYPE i.
DATA: cancel(1).
lf_formname = 'ZFI002'.
ls_control_param-preview = 'X'.
ls_control_param-NO_DIALOG = 'X'.”直接预览 如果个人数据没有维护打印机及预览数据的话 仍旧会弹出窗口
ls_control_param-langu = sy-langu.
ls_control_param-no_open = 'X'.
ls_control_param-no_close = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
IF sy-subrc = 4.
EXIT.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE 'Call SSF_FUNCTION_MODULE_NAME Error' TYPE 'E'.
ENDIF.
CALL FUNCTION lf_fm_name
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
user_settings = ' '
* belnr = dtab-belnr
* EXCEPTIONS
* FORMATTING_ERROR = 1
* INTERNAL_ERROR = 2
* SEND_ERROR = 3
* USER_CANCELED = 4
* OTHERS = 5.
.
IF sy-subrc <> 0.
DATA : c TYPE c.
c = sy-subrc.
MESSAGE '打印出问题!' TYPE 'I'.
EXIT.
ENDIF.
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE '打印出问题!' TYPE 'I'.
EXIT.
ENDIF.
ENDFORM. " printdata