data: lf_fm_name type rs38l_fnam.
when '&PRT'."打印
read table gt_output with key sel = 'X'.
if sy-subrc <> 0.
message w895(m7) with '您没有选择任何数据!'.
endif.
data: lc_control_parameters type ssfctrlop.
lc_control_parameters-no_dialog = ''.
lc_control_parameters-no_open = 'X'.
lc_control_parameters-no_close = 'X'.
lc_control_parameters-preview = 'X'.
*---get function into lf_fm_name
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSDBATCHPRT01'
importing
fm_name = lf_fm_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
*---ssf_open
call function 'SSF_OPEN' "打开打印窗口
exporting
control_parameters = lc_control_parameters
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
loop at gt_output where sel = 'X'.
perform get_print_data using gt_output-vbeln.
call function lf_fm_name "smartform中获取数据
exporting
control_parameters = lc_control_parameters
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
endloop.
*---ssf_close "关闭打印窗口,如点打印预览会关闭此窗口
call function 'SSF_CLOSE'
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
others = 4.
评论