ABAP:VA02销售订单保存前增强

VA02销售订单保存前增强:

SE38:MV45AFZZ

ENHANCEMENT 2  ZCD_SO_SAVE_CHECK.    "active version
***** ADD BY ZJ 20221026 START 检查非源头订单禁止修改
  DATA:ls_zsdt031 TYPE zsdt031,
       lv_zrfcid TYPE zrfcid,
       lt_zsdt008 TYPE TABLE OF zsdt008,
       ls_zsdt008 TYPE zsdt008.
  IF ( sy-tcode = 'VA02' OR sy-tcode = 'VA03' ).
    SELECT SINGLE * INTO ls_zsdt008 FROM zsdt008 WHERE objkey = vbak-vbeln
                                                          AND objtype = 'SO'.

    IF sy-subrc = 0.

      SELECT SINGLE objkey INTO @DATA(lv_objkey) FROM zsdt008 WHERE zrfcid = @ls_zsdt008-zrfcid
                                                                AND canum = '0010'.
      IF sy-subrc = 0.
        SELECT SINGLE bukrs INTO @DATA(lv_bukrs) FROM ekko WHERE ebeln = @lv_objkey.
        IF sy-subrc = 0.
          SELECT SINGLE zbs INTO @DATA(lv_zbs) FROM zsdt031 WHERE bukrs = @lv_bukrs
                                                              AND objtype = 'PO'.
          IF lv_zbs = 'Y'.
             IF ls_zsdt008-canum > 10.
               MESSAGE '非源头订单不能够更改' TYPE 'E'.
             ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.

*    SELECT SINGLE * FROM zsdt031 INTO ls_zsdt031 WHERE bukrs = vbak-vkorg
*                                                 AND objtype = 'SO'.
*    IF ls_zsdt031-zbs = 'Y'.
*      SELECT SINGLE * INTO ls_zsdt008 FROM zsdt008 WHERE objkey = vbak-vbeln
*                                                   AND objtype = 'SO'.
*      IF sy-subrc = 0.
*        IF ls_zsdt008-canum > 10.
*          MESSAGE '非源头订单不能够更改' TYPE 'E'.
*        ENDIF.
*      ENDIF.
*    ENDIF.
  ENDIF.

***** ADD BY ZJ 20221026 END 检查非源头订单禁止修改
ENDENHANCEMENT.

 

posted @ 2022-12-19 12:41  阿胖的阿多  阅读(404)  评论(0编辑  收藏  举报