一次只准打印一份,怪怪需求....
Step1:
运行该报表-> 点击系统打印按钮 -> 光标放到 Number of copies -> F1 -> 点击 "Technical info"
-> 找到 'Program name: SAPLSPRI','Screen number: 0100','Data element: SYPRCOP'
Step2:
Create a new session -> T-code: cmod ->Goto -> Text enhancements -> Field exits
Step3:
在Step2 中画面的菜单 "Field exits" -> Create -> Data element输入 SYPRCOP -> 点击"Continue"
->Fld. Exit 输入 1(表示version), Program 输入"SAPLSPRI", Screen输入"0100" ->系统自动生成
Function module "FIELD_EXIT_SYPRCOP_1"
Step4:
编辑Function Module 函数如下(手动添加代码):
FUNCTION FIELD_EXIT_SYPRCOP_1.
*以下注释的代码为系统自动生成
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(INPUT)
*" EXPORTING
*" REFERENCE(OUTPUT)
*"----------------------------------------------------------------------
*以下代码为手动添加,在Table zf002中控制一次只能打印一份的report
data: value1 like SY-pRCOP,
numcopy(3) type n,
$copy type i.
value1 = input.
utput = value1.
if value1 gt 1.
select single * from zf002 where ZZCD_TYPE eq 'BC03'
and ZZCD_KEY eq sy-cprog.
if sy-subrc eq 0.
numcopy = zf002-ZZBIG_CODE.
$copy = numcopy.
if value1 gt numcopy.
message e001(zg) with 'This report can be printed only'
$copy 'copys !'.
* message e001(zg) with 'You can only Print' $copy 'copys !'.
endif.
endif.
endif.
ENDFUNCTION.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9333231/viewspace-350576/ ,如需转载,请注明出处,否则将追究法律责任。