首页 > 其他分享 >SAP MM 获取在规定时间内发生过收获的采购订单信息

SAP MM 获取在规定时间内发生过收获的采购订单信息

时间:2024-10-13 21:20:58浏览次数:15  
标签:MM EKBE LIFNR EBELN 收获 采购 SAP EKKO EKPO

采购订单 EKKO  EKPO 

采购凭证历史:EKBE

发生过收获:移动类型101 Z99  161 

业务逻辑

第一步:获取对应的采购订单

第二步:检查采购订单是否发生过收货   且是直接参考采购订单收获

如果是进入下一步业务逻辑

如果不是则抛弃此条数据

那我直接获取对应发生过参考采购订单收获的采购订单呢

S4环境下的SQL逻辑

SELECT EKKO~EBELN,  EKKO~LIFNR,  LFA1~NAME1,  BEDAT,  EKKO~ERNAM,  EKGRP,  EBELP,  EKPO~MATNR,
  MENGE,  MEINS,  BPRME,  PEINH,  NETPR,  MWSKZ,  MAKTX,  EKPO~RETPO
  FROM EKKO JOIN LFA1 ON ( EKKO~LIFNR = LFA1~LIFNR )
  JOIN EKPO ON EKPO~EBELN = EKKO~EBELN
  JOIN MAKT ON MAKT~MATNR = EKPO~MATNR AND MAKT~SPRAS = '1'
  WHERE
  EKKO~BUKRS IN @BUKRS AND"公司代码
  EKKO~LIFNR IN @LIFNR AND
  EKGRP IN @EKGRP AND
  EKKO~EBELN IN @EBELN AND
  BEDAT IN @BEDAT AND PSTYP NE '2' AND RETPO IN @RETPO AND EKPO~WERKS IN @WERKS AND
  EKKO~ERNAM IN @ERNAM AND
    CONCAT( EKKO~EBELN , EBELP ) IN
    ( SELECT CONCAT( EKBE~EBELN , EKBE~EBELP )
  FROM EKBE WHERE BUDAT IN @BUDAT AND
  VGABE EQ '1' AND EKBE~BELNR = EKBE~LFBNR AND EKBE~BUZEI = EKBE~LFPOS AND
  BWART IN ('101','161','Z99') )
    INTO CORRESPONDING FIELDS OF TABLE @ITAB.

看下执行效果

从原来的9108s 降导了 3321s  提升了 60% 

标签:MM,EKBE,LIFNR,EBELN,收获,采购,SAP,EKKO,EKPO
From: https://blog.csdn.net/xiaofei2008gxh/article/details/142761468

相关文章