想在ME21N保存前做一些数据检查,
可以做一个增强功能,
运行 CMOD 新增, 增强接口 输入 MM06E005 ( EXIT_SAPMM06E_012 ) ,在 NCLUDE ZXM06U43 . 里写代码功能。
例子如下:
*&---------------------------------------------------------------------*
*& 包括 ZXM06U43
*&---------------------------------------------------------------------*
TABLES: EKPO.
DATA: e_message(200) TYPE c.
DATA: SPSTYP LIKE EBAN-PSTYP.
DATA: SBANFN LIKE TEKPO-BANFN.
DATA: t_msg(200) TYPE c.
DATA: t_answer(1) TYPE c.
data: iflag type i.
IF I_EKKO-BSART = 'KSUB' OR I_EKKO-BSART = 'EUB'.
iflag = 0.
LOOP AT TEKPO.
SPSTYP = 0.
SBANFN = TEKPO-BANFN.
SELECT SINGLE * FROM EBAN WHERE BANFN = SBANFN.
IF SY-SUBRC = 0.
SPSTYP = EBAN-PSTYP.
ENDIF.
if SPSTYP = 3.
iflag = iflag + 1.
if iflag = 1.
CONCATENATE '注意:请购单' SBANFN INTO t_msg.
else.
CONCATENATE t_msg '/' SBANFN INTO t_msg.
endif.
endif.
ENDLOOP.
if iflag > 0.
CALL FUNCTION 'POPUP_WITH_2_BUTTONS_TO_CHOOSE'
EXPORTING
* DEFAULTOPTION = '1'
DIAGNOSETEXT1 = t_msg
* DIAGNOSETEXT2 = ' '
* DIAGNOSETEXT3 = ' '
TEXTLINE1 = '是: L 类型的请购单允许转为 U 类型的采购单'
TEXTLINE2 = '否: L 类型的请购单不允许转为 U 类型的采购单,先删除再保存'
* TEXTLINE3 = ' '
TEXT_OPTION1 = '是'
TEXT_OPTION2 = '否'
TITEL = '选择'
IMPORTING
ANSWER = t_answer.
IF t_answer = 2.
CONCATENATE '申请单:' SBANFN '是L类型,与当前类型不符!' INTO e_message.
message e_message type 'E'.
endif.
endif.
ENDIF.
这个功能会弹出一个用户选择的小窗口:
如果选择“是” ,系统会继续保存,“否” 则出现错误提示,不能保存。
转载自:http://blog.csdn.net/heng0757/article/details/7071080