创建采购申请时对行项目需求跟踪号做必输检查

需求描述:ME51N(创建)或ME52N(更改)采购申请时,当采购申请类型为“NB”,工厂为“2300”,创建标识为“R”时,点击“保存”时对需求跟踪号做必输检查。

需求说明.png

解决方法:首先找到增强位置,在函数组XM02的函数模块EXIT_SAPLMEREQ_005下
然后在这个出口函数中写入增强代码:

FORM frm_check_bednr USING i_reqitem TYPE mereq_item
                      CHANGING  ct_message TYPE mereq_t_bapiret2.
  DATA: lwa_message TYPE LINE OF mereq_t_bapiret2,
        lv_message  TYPE bapiret2-message_v1,
        lv_bnfpo    TYPE CHAR5.
  IF i_reqitem-bsart = 'NB' AND i_reqitem-werks = 2300 AND i_reqitem-estkz = 'R'
    AND i_reqitem-bednr IS INITIAL.
    lwa_message-type = 'E'.
    lwa_message-id = 'Z_1'.
    lwa_message-number = '500'.
    lv_message = '请输入需求跟踪号'.
    WRITE i_reqitem-bnfpo TO lv_bnfpo.
    SHIFT lv_bnfpo LEFT DELETING LEADING '0'."去前导零
    CONCATENATE '项目' lv_bnfpo lv_message INTO lv_message.
    lwa_message-message_v1 = lv_message.
    APPEND lwa_message TO ct_message.
  ENDIF.
ENDFORM. 

点击“保存”时,效果如图:
增强后的效果.png

你可能感兴趣的:(创建采购申请时对行项目需求跟踪号做必输检查)