1、业务需求
需要对来料检验增加“合格数量”和“不合格数量”字段,涉及三个增强开发
2、QE01\QE02\QE03\QE51N屏幕增强
增强表
增强点BADI:QEEM_SUBSCREEN_5000
创建程序,包含子屏幕,在增强点中调用
在程序屏幕中绘制字段
在输出流中可以通过事务代码控制字段编辑和必输效果
"--------------------@斌将军--------------------
MODULE status_9001 OUTPUT.
DATA:lv_input TYPE char1,
lv_req TYPE char1.
"可编辑设置
IF sy-tcode = 'QE01' OR sy-tcode = 'QE02'.
lv_input = '1'.
lv_req = '1'.
ELSEIF sy-tcode = 'QA11' OR sy-tcode = 'QA12'.
lv_input = '1'.
lv_req = '0'.
ELSE.
lv_input = '0'.
ENDIF.
LOOP AT SCREEN.
IF screen-name = 'QALS-ZHGSL' OR screen-name = 'QALS-ZBHGSL'.
screen-input = lv_input.
screen-required = lv_req.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
"--------------------@斌将军--------------------
在保存数据时,需要实现增强BADI:QE_SAVE
代码如下:
IS_ACTIVE
"--------------------@斌将军--------------------
METHOD if_ex_qe_save~is_active.
IF sy-ucomm = 'BU'.
rv_active = abap_true.
ENDIF.
ENDMETHOD.
"--------------------@斌将军--------------------
TABLES_IN_OPERATION
"--------------------@斌将军--------------------
METHOD if_ex_qe_save~tables_in_operation.
IF sy-tcode = 'QE01' OR sy-tcode = 'QE02'.
MODIFY qals FROM is_qals.
ev_saving_allowed = abap_true.
ENDIF.
ENDMETHOD.
"--------------------@斌将军--------------------
效果如下
3、QA11\QA12\QA13\QA14屏幕增强
BADI:QEVA_SUBSCREEN_1101
创建程序,包含子屏幕,在增强点中调用。此处共用了ZQM003程序
4、QA0\QA02\QA03屏幕增强
增强点CMOD:QPL10004
在TOP中定义变量
在屏幕100中绘制字段
输出流控制字段编辑
"--------------------@斌将军--------------------
MODULE status_0100 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
LOOP AT SCREEN.
IF screen-name = 'QALS_CUST-ZHGSL' OR screen-name = 'QALS_CUST-ZBHGSL'.
IF gv_display = 'X'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ENDMODULE.
"--------------------@斌将军--------------------
在EXIT_SAPLQPL1_004中展示数据
"--------------------@斌将军--------------------
*&---------------------------------------------------------------------*
*& 包含 ZXQPLU04
*&---------------------------------------------------------------------*
DATA: l_trtyp LIKE t160-trtyp,
l_fs_c(30) TYPE c VALUE '(SAPLQPL1)G_T185F_AKTI'.
FIELD-SYMBOLS: <l_fs>.
ASSIGN (l_fs_c) TO <l_fs>.
IF sy-subrc = 0.
l_trtyp = <l_fs>.
CASE l_trtyp.
WHEN 'A'.
gv_display = 'X'.
WHEN OTHERS.
gv_display = ''.
ENDCASE.
ENDIF.
MOVE-CORRESPONDING i_qals TO qals_cust.
"--------------------@斌将军--------------------
在EXIT_SAPLQPL1_006中存储数据
"--------------------@斌将军--------------------
*&---------------------------------------------------------------------*
*& 包含 ZXQPLU06
*&---------------------------------------------------------------------*
MOVE-CORRESPONDING qals_cust TO e_qals_cust.
e_active = 'X'.
"--------------------@斌将军--------------------
欢迎关注,定期更文