博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SAP销售订单状态修改(审核) 计划行自动产生需求,产生MD04需求
阅读量:4943 次
发布时间:2019-06-11

本文共 8563 字,大约阅读时间需要 28 分钟。

不知道业务怎么配置的,创建销售单时,一堆计划行类别,什么CN,DN。。。都有,但是审核后需要计划行变更为CP,这样在MD04才能看到需求。

原有逻辑是弄个后台程序,审核后调一下,更新一下计划行,这样是会有需求的。。。

但是,业务有个习惯喜欢VA02直接审,或者是交货后还来修改等等。。。这时候就需要在VA02里做增强。,

原本的开发还是调程序。。。这就产生了很多问题。后来我自己写增强审核的时候自动修改计划行类别,巴特,不产生需求。。。这特么鬼,后来各种找,各种DEBUG,找到根源了。。。

 

Now,来个增强,实现:MV45AFZZ  USEREXIT_SAVE_DOCUMENT_PREPARE

IF ( i_stonO = '20' AND i_stonN = '30' ).       LOOP AT XVBEP INTO GX_VBEP.         LY_I = SY-TABIX.         CASE VBAK-AUART.             WHEN 'ZOR' .            IF GX_VBEP-ETTYP <> 'CP' AND GX_VBEP-ETTYP <> 'ZD'.              GX_VBEP-ETTYP = 'CP'.              IF SY-TCODE = 'VA01'.                ELSEIF SY-TCODE = 'VA02'.                  GX_VBEP-UPDKZ = 'U'.                  GX_VBEP-BEDSD = 'X'.                  GX_VBEP-BDAALT = '05'.                  GX_VBEP-BDART = '05'.                  GX_VBEP-PLART = '0'.                  IF XVBBE[] IS INITIAL.                    GW_VBBE-MANDT = SY-MANDT.                    GW_VBBE-VBELN = GX_VBEP-VBELN.                    GW_VBBE-POSNR = GX_VBEP-POSNR.                    GW_VBBE-ETENR = GX_VBEP-ETENR.                    GW_VBBE-MBDAT = GX_VBEP-EDATU.                    GW_VBBE-VBTYP = 'C'.                    GW_VBBE-BDART = '05'.                    GW_VBBE-PLART = '0'.                    GW_VBBE-UPDKZ = 'I'.                    GW_VBBE-OMENG = GX_VBEP-LMENG.                    GW_VBBE-VMENG = GX_VBEP-BMENG.                    GW_VBBE-MEINS = GX_VBEP-VRKME.                    GW_VBBE-PZMNG = GX_VBEP-LMENG.                    GW_VBBE-AUART = XVBAK-AUART.                    GW_VBBE-KUNNR = XVBAK-KUNNR.                     READ TABLE XVBAP INTO GX_VBAP WITH KEY POSNR = GX_VBEP-POSNR.                     IF SY-SUBRC = 0.                       LY_J = SY-TABIX.                       GX_VBAP-SUMBD = 'A'.                       GX_VBAP-UPDKZ = 'U'.                       GX_VBAP-BEDUP = 'X'.                       MODIFY XVBAP FROM GX_VBAP INDEX LY_J TRANSPORTING SUMBD UPDKZ BEDUP.                      GW_VBBE-MATNR = GX_VBAP-MATNR.                      GW_VBBE-WERKS = GX_VBAP-WERKS.                      GW_VBBE-LGORT = GX_VBAP-LGORT.                      GW_VBBE-CHARG = GX_VBAP-CHARG.                      GW_VBBE-AWAHR = GX_VBAP-AWAHR.                      GW_VBBE-VPZUO = GX_VBAP-VPZUO.                     ENDIF.                     INSERT GW_VBBE INTO XVBBE INDEX GX_VBEP-ETENR.                  ENDIF.              ENDIF.            ENDIF.          WHEN 'ZKB' .            IF GX_VBEP-ETTYP <> 'E1'.              GX_VBEP-ETTYP = 'E1'.              IF SY-TCODE = 'VA01'.                ELSEIF SY-TCODE = 'VA02'.                  GX_VBEP-UPDKZ = 'U'.                  GX_VBEP-BEDSD = 'X'.                  GX_VBEP-BDAALT = '05'.                  GX_VBEP-BDART = '05'.                  GX_VBEP-PLART = '0'.                  IF XVBBE[] IS INITIAL.                    GW_VBBE-MANDT = SY-MANDT.                    GW_VBBE-VBELN = GX_VBEP-VBELN.                    GW_VBBE-POSNR = GX_VBEP-POSNR.                    GW_VBBE-ETENR = GX_VBEP-ETENR.                    GW_VBBE-MBDAT = GX_VBEP-EDATU.                    GW_VBBE-VBTYP = 'C'.                    GW_VBBE-BDART = '05'.                    GW_VBBE-PLART = '0'.                    GW_VBBE-UPDKZ = 'I'.                    GW_VBBE-OMENG = GX_VBEP-LMENG.                    GW_VBBE-VMENG = GX_VBEP-BMENG.                    GW_VBBE-MEINS = GX_VBEP-VRKME.                    GW_VBBE-PZMNG = GX_VBEP-LMENG.                    GW_VBBE-AUART = XVBAK-AUART.                    GW_VBBE-KUNNR = XVBAK-KUNNR.                     READ TABLE XVBAP INTO GX_VBAP WITH KEY POSNR = GX_VBEP-POSNR.                     IF SY-SUBRC = 0.                       LY_J = SY-TABIX.                       GX_VBAP-SUMBD = 'A'.                       GX_VBAP-UPDKZ = 'U'.                       GX_VBAP-BEDUP = 'X'.                       MODIFY XVBAP FROM GX_VBAP INDEX LY_J TRANSPORTING SUMBD UPDKZ BEDUP.                      GW_VBBE-MATNR = GX_VBAP-MATNR.                      GW_VBBE-WERKS = GX_VBAP-WERKS.                      GW_VBBE-LGORT = GX_VBAP-LGORT.                      GW_VBBE-CHARG = GX_VBAP-CHARG.                      GW_VBBE-AWAHR = GX_VBAP-AWAHR.                      GW_VBBE-VPZUO = GX_VBAP-VPZUO.                     ENDIF.                     INSERT GW_VBBE INTO XVBBE INDEX GX_VBEP-ETENR.                  ENDIF.              ENDIF.            ENDIF.             WHEN 'ZSP' .            READ TABLE XVBAP INTO GX_VBAP WITH KEY POSNR = GX_VBEP-POSNR.            IF SY-SUBRC = 0.              IF GX_VBAP-PSTYV = 'ZSNN' AND GX_VBEP-ETTYP <> 'ZN'.                GX_VBEP-ETTYP = 'ZN'.                IF SY-TCODE = 'VA01'.                ELSEIF SY-TCODE = 'VA02'.                  GX_VBEP-UPDKZ = 'U'.                  GX_VBEP-BEDSD = 'X'.                  GX_VBEP-BDAALT = '05'.                  GX_VBEP-BDART = '05'.                  GX_VBEP-PLART = '0'.                  IF XVBBE[] IS INITIAL.                    GW_VBBE-MANDT = SY-MANDT.                    GW_VBBE-VBELN = GX_VBEP-VBELN.                    GW_VBBE-POSNR = GX_VBEP-POSNR.                    GW_VBBE-ETENR = GX_VBEP-ETENR.                    GW_VBBE-MBDAT = GX_VBEP-EDATU.                    GW_VBBE-VBTYP = 'C'.                    GW_VBBE-BDART = '05'.                    GW_VBBE-PLART = '0'.                    GW_VBBE-UPDKZ = 'I'.                    GW_VBBE-OMENG = GX_VBEP-LMENG.                    GW_VBBE-VMENG = GX_VBEP-BMENG.                    GW_VBBE-MEINS = GX_VBEP-VRKME.                    GW_VBBE-PZMNG = GX_VBEP-LMENG.                    GW_VBBE-AUART = XVBAK-AUART.                    GW_VBBE-KUNNR = XVBAK-KUNNR.                     READ TABLE XVBAP INTO GX_VBAP WITH KEY POSNR = GX_VBEP-POSNR.                     IF SY-SUBRC = 0.                       LY_J = SY-TABIX.                       GX_VBAP-SUMBD = 'A'.                       GX_VBAP-UPDKZ = 'U'.                       GX_VBAP-BEDUP = 'X'.                       MODIFY XVBAP FROM GX_VBAP INDEX LY_J TRANSPORTING SUMBD UPDKZ BEDUP.                      GW_VBBE-MATNR = GX_VBAP-MATNR.                      GW_VBBE-WERKS = GX_VBAP-WERKS.                      GW_VBBE-LGORT = GX_VBAP-LGORT.                      GW_VBBE-CHARG = GX_VBAP-CHARG.                      GW_VBBE-AWAHR = GX_VBAP-AWAHR.                      GW_VBBE-VPZUO = GX_VBAP-VPZUO.                     ENDIF.                     INSERT GW_VBBE INTO XVBBE INDEX GX_VBEP-ETENR.                  ENDIF.              ENDIF.              ELSEIF GX_VBAP-PSTYV = 'ZSAN' AND GX_VBEP-ETTYP <> 'CP'.                GX_VBEP-ETTYP = 'CP'.                IF SY-TCODE = 'VA01'.                ELSEIF SY-TCODE = 'VA02'.                  GX_VBEP-UPDKZ = 'U'.                  GX_VBEP-BEDSD = 'X'.                  GX_VBEP-BDAALT = '05'.                  GX_VBEP-BDART = '05'.                  GX_VBEP-PLART = '0'.                  IF XVBBE[] IS INITIAL.                    GW_VBBE-MANDT = SY-MANDT.                    GW_VBBE-VBELN = GX_VBEP-VBELN.                    GW_VBBE-POSNR = GX_VBEP-POSNR.                    GW_VBBE-ETENR = GX_VBEP-ETENR.                    GW_VBBE-MBDAT = GX_VBEP-EDATU.                    GW_VBBE-VBTYP = 'C'.                    GW_VBBE-BDART = '05'.                    GW_VBBE-PLART = '0'.                    GW_VBBE-UPDKZ = 'I'.                    GW_VBBE-OMENG = GX_VBEP-LMENG.                    GW_VBBE-VMENG = GX_VBEP-BMENG.                    GW_VBBE-MEINS = GX_VBEP-VRKME.                    GW_VBBE-PZMNG = GX_VBEP-LMENG.                    GW_VBBE-AUART = XVBAK-AUART.                    GW_VBBE-KUNNR = XVBAK-KUNNR.                     READ TABLE XVBAP INTO GX_VBAP WITH KEY POSNR = GX_VBEP-POSNR.                     IF SY-SUBRC = 0.                       LY_J = SY-TABIX.                       GX_VBAP-SUMBD = 'A'.                       GX_VBAP-UPDKZ = 'U'.                       GX_VBAP-BEDUP = 'X'.                       MODIFY XVBAP FROM GX_VBAP INDEX LY_J TRANSPORTING SUMBD UPDKZ BEDUP.                      GW_VBBE-MATNR = GX_VBAP-MATNR.                      GW_VBBE-WERKS = GX_VBAP-WERKS.                      GW_VBBE-LGORT = GX_VBAP-LGORT.                      GW_VBBE-CHARG = GX_VBAP-CHARG.                      GW_VBBE-AWAHR = GX_VBAP-AWAHR.                      GW_VBBE-VPZUO = GX_VBAP-VPZUO.                     ENDIF.                     INSERT GW_VBBE INTO XVBBE INDEX GX_VBEP-ETENR.                  ENDIF.              ENDIF.              ENDIF .            ENDIF.             WHEN OTHERS.         ENDCASE.         MODIFY XVBEP FROM GX_VBEP.       ENDLOOP.     ENDIF.

 

转载于:https://www.cnblogs.com/sapSB/p/5569636.html

你可能感兴趣的文章
ORA-3136
查看>>
算法笔记_145:拓扑排序的应用(Java)
查看>>
JS获取农历日期
查看>>
PHP中的HTTP协议
查看>>
CSS给文字描边实现发光文字
查看>>
Java WebService入门实例
查看>>
css样式之补充
查看>>
结构与联合
查看>>
关于JS历史
查看>>
软件架构师工作流程
查看>>
将txt文本转换为excel格式
查看>>
BUPT复试专题—众数(2014)
查看>>
css-sprite切割图片(加快网页加载速度)
查看>>
20145316 《信息安全系统设计基础》第十四周学习总结
查看>>
Liferay7 BPM门户开发之18: 理解ServiceContext
查看>>
从零开始学区块链(3)
查看>>
Intel Galileo development documentation
查看>>
Jquery特效
查看>>
web服务器
查看>>
EV: Workaround to Allow Only One Instance or Window of outlook
查看>>