Snowfun

导航

 

以下是本应在TEMP中处理,目前是写到FP_CHECK_SAP_DATA中

 

 ----JIT物料在途未清PO作为供给 add by landor on 20180809
    INSERT INTO SAP_INVENTORY_PO(EBELN,EBELP,ETENR,WERKS,MATNR,MENGE,MEINS)
    SELECT EKET.EBELN,LPAD(EKET.EBELP,5,'0') EBELP, LPAD(EKET.ETENR,4,'0') ETENR,MARC.WERKS,MARC.MATNR,EKET.MENGE-EKET.WAMNG MENGE,EKET.MEINS 
    FROM SAP_MARC MARC 
    JOIN SAP_EKET  EKET ON MARC.MATNR=EKET.MATNR   AND MARC.WERKS= EKET.WERKS
    WHERE NOT EXISTS(SELECT NULL FROM SAP_INVENTORY_PO A WHERE A.EBELN=EKET.EBELN AND A.EBELP=LPAD(EKET.EBELP,5,'0') AND A.MATNR=MARC.MATNR)
          AND EKET.MENGE-EKET.WAMNG >0 AND MARC.FABKZ='1' ;
    COMMIT;

此逻辑是先写到SAP_INVENTORY_PO表,然后会执行SAP_PO将数据写入IN_PO,最后再写入IN_INVENTORY

posted on 2018-08-09 15:05  Snowfun  阅读(474)  评论(0编辑  收藏  举报