SAP_ABAP_SD_BADI清单案例教程——销售订单取消开票_SD_CIN_LV60AU02_VF11

SAP ABAP 顾问(开发工程师)能力模型_Terry谈企业数字化的博客-CSDN博客文章浏览阅读315次。目标:基于对SAP abap 顾问能力模型的梳理,给一年左右经验的abaper 快速成长为三年经验提参考ALV/REPORT|SMARTFROM|SCREEN|OLE|BAPI|BDC|PI|IDOC|RFC|API|WEBSERVICE|Enhancement|UserExits|Badi|Debughttps://blog.csdn.net/java_zhong1990/article/details/132469977

一 背景说明

1.1 BADI的概念

        SAP BADI(Business Application Development Interface)是SAP在标准程序中为客户自定义逻辑所预留的接口(属于第三代增强),在技术本质上是一个interface,通过实现类的向上继承,完成用户逻辑的调用。

1.2 BADI清单

采购申请创建 | 采购订单创建 | 采购订单审批 | 采购订单收货 | 采购发票校验 

销售订单取消开票凭证

生产订单收货 |

采购申请创建 ME_PROCESS_REQ_CUST SAP_MM_ABAP_BADI清单案例教程——PR采购申请创建_ME_PROCESS_REQ_CUST_ME51N_Terry谈企业数字化的博客-CSDN博客
采购订单创建 ME_PROCESS_PO_CUST SAP_MM_ABAP_BADI清单案例教程——PO采购订单创建_ME_PROCESS_PO_CUST_ME21N-CSDN博客
采购订单审批

ZME_PURCHDOC_POSTED

SAP_MM_ABAP_BADI清单案例教程——PO采购订单审批_ME_PURCHDOC_POSTED_ME29N-CSDN博客
采购订单收货 MB_MIGO_BADI SAP_MM_ABAP_BADI清单案例教程——PO采购订单收货_MB_MIGO_BADI_MIGO_Terry谈企业数字化的博客-CSDN博客
采购发票校验

INVOICE_UPDATE

SAP_MM_ABAP_BADI清单案例教程——PO采购发票校验_INVOICE_UPDATE_MIRO-CSDN博客
销售订单取消开票凭证 SD_CIN_LV60AU02 https://blog.csdn.net/java_zhong1990/article/details/134116241
生产订单收货

ZMB_DOCUMENT_BADI

SAP_MM_ABAP_BADI清单案例教程——生产订单收货_MB_DOCUMENT_BADI_MB1B_Terry谈企业数字化的博客-CSDN博客

二 实施步骤

2.1 BADI名称 SD_CIN_LV60AU02

2.2 实施BADI,输入Tcode SE19 

SAP_ABAP_SD_BADI清单案例教程——销售订单取消开票_SD_CIN_LV60AU02_VF11_第1张图片

  METHOD if_ex_sd_cin_lv60au02~excise_invoice_create.

    DATA:lflag TYPE n.
    lflag = 0.
    CASE sy-tcode.
      WHEN 'VF11'.
        LOOP AT xvbrk ASSIGNING FIELD-SYMBOL().

          IF -fkdat+0(4) IS NOT INITIAL.

            SELECT COUNT(*) INTO @DATA(lcount1) FROM t001b
              WHERE bukrs = @-bukrs AND mkoar = '+' AND frye1 = @-fkdat+0(4) AND frpe1 = @-fkdat+4(2).
            SELECT COUNT(*) INTO @DATA(lcount2) FROM t001b
              WHERE bukrs = @-bukrs AND mkoar = 'D' AND frye1 = @-fkdat+0(4) AND frpe1 = @-fkdat+4(2).
            SELECT COUNT(*) INTO @DATA(lcount3) FROM t001b
              WHERE bukrs = @-bukrs AND mkoar = 'S' AND frye1 = @-fkdat+0(4) AND frpe1 = @-fkdat+4(2).

            IF lcount1 + lcount2 + lcount3 < 3.
              lflag = 1.
            ENDIF.
            CLEAR: lcount1,lcount2,lcount3.
          ELSE.
            lflag = 0.
          ENDIF.
        ENDLOOP.
        IF lflag > 0 .
          MESSAGE e899(v1) WITH '存在账期未打开,不允许保存!' .
        ENDIF.
      WHEN OTHERS.
    ENDCASE.

  ENDMETHOD.

三 实现效果

SAP_ABAP_SD_BADI清单案例教程——销售订单取消开票_SD_CIN_LV60AU02_VF11_第2张图片

你可能感兴趣的:(Abap编程,SAP,BAPI,SD)