公众号:SAP Technical
本文作者:matinal
 

【MM系列】SAP 采购订单收货后不能修改价格的增强-LMLPHP

前言部分

大家可以关注我的公众号,公众号里的排版更好,阅读更舒适。

正文部分

采购订单收货后不能修改价格的增强

增强名:MM06E005

出口:EXIT_SAPMM06E_012

IF SY-TCODE <> 'ME22N' AND SY-TCODE  <> 'ME22' AND  SY-TCODE <> 'ME23N' AND SY-TCODE  <> 'ME23'.
  EXIT.
ENDIF.
DATA T_NETPR TYPE EKPO-NETPR.
DATA TT_SUM   TYPE EKBE-BPMNG.
DATA T_SUM    TYPE EKBE-BPMNG.
DATA T_SHKZG  TYPE EKBE-SHKZG.
LOOP AT TEKPO.

SELECT SINGLE NETPR INTO T_NETPR FROM EKPO WHERE EBELN = TEKPO-EBELN
                                             AND EBELP = TEKPO-EBELP.

IF TEKPO-NETPR <> T_NETPR.
    SELECT BPMNG SHKZG INTO (T_SUM,T_SHKZG) FROM EKBE WHERE EBELN = TEKPO-EBELN
                                      AND   EBELP = TEKPO-EBELP
                                      AND   BEWTP = 'E'.
      IF T_SHKZG = 'S'.
        TT_SUM = TT_SUM + T_SUM.
      ELSE.
        TT_SUM = TT_SUM - T_SUM.
      ENDIF.

ENDSELECT.
    IF TT_SUM <> 0.
      MESSAGE E899(MM) WITH TEKPO-EBELN TEKPO-EBELP '由于已收货,不允许修改价格'.
    ENDIF.
  ENDIF.

CLEAR T_NETPR.
  CLEAR TT_SUM.
  CLEAR T_SUM.
ENDLOOP.

05-11 05:16