错误案例:
SELECT DEMANDLINEID,SUPPLYORDERID,DEMANDORDERID,QTYALLOCATED,ITEM, A.* FROM ABPPMGR.SUPPLYDMDPEGPLAN A WHERE ITEM='000000102004000186CA';
错误案例:
SELECT * FROM IN_SFCHEADER where so_id='6900001939'; --and so_line_id='40'; SELECT * FROM IN_MO where so_id='6900001939' and so_line_id='40'; SELECT PRODUCTIONORDID,BOMID,ITEM,QTYORDERED,REQUIREDDATE,ROUTINGID,UDF_MO_FACTORY FROM ABPPMGR.PRODUCTIONORDERS WHERE PRODUCTIONORDID like'001100875141%';
SELECT DEMANDLINEID,SUPPLYORDERID,DEMANDORDERID,QTYALLOCATED,ITEM,A.* FROM ABPPMGR.SUPPLYDMDPEGPLAN A WHERE ITEM='000000101002024569'; SELECT DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,ITEM,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='6900001939' AND DEMANDLINEID='40_1') OR SUPPLYORDERID like'001100875141%' ;
绑定成功案例1:
--SO:5000151987已经创建了成品MO:001100858168,成品MO号供给者为半成品MO:001201126738 SELECT DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,ITEM,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000151987' AND DEMANDLINEID='60_1') OR SUPPLYORDERID='001201126738' ;
SELECT * FROM IN_MO where so_id='5000151987';
绑定成功案例2:
--SO:5000156623未创建成品工单,系统自动创建虚拟工单5000156623/70_1-MFG001,虚拟工单绑定半成品工单号001201126508 SELECT DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,ITEM,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000156623' AND DEMANDLINEID='70_1') OR SUPPLYORDERID='001201126508' ;
SELECT ATTRIBUTE,DEMANDLINEID,DEMANDORDERID,ITEM,SUPPLYORDERID FROM ABPPMGR.SUPPLYDMDPEG_P WHERE DEMANDORDERID='5000156623' AND DEMANDLINEID='70_1';
SELECT DEMANDLINEID,SUPPLYORDERID,DEMANDORDERID,QTYALLOCATED,ITEM FROM ABPPMGR.SUPPLYDMDPEGPLAN A WHERE ITEM='000000102002000845CZ' and DEMANDORDERID like '5000156623/70_1%';
SELECT * FROM IN_SFCHEADER where so_id='5000156623' and so_line_id='70';
SELECT ITEM,PRODUCTIONORDERID,BOMID,PROPERTY,ROUTINGID FROM ABPPMGR.SFCHEADER WHERE ITEM='000000102002000845CZ' AND PRODUCTIONORDERID='001201126508';
SELECT PRODUCTIONORDERID,PROPERTY,QTYINRUN FROM ABPPMGR.SFCLINE WHERE PRODUCTIONORDERID='001201126508'
对比成功与错误案例分析如下 :
查看SAP_MO存储过程发现是因为TEMP_ZFIN_MO中没有该SO的数据。
业务:已开成品MO的可以绑定成功;对于已开半成品MO,但还没开成品MO的数据就会出现异常,没法出现 在此表中,没法绑定成功
INSERT INTO TEMP_ZFIN_MO(VBELN,POSNR,ZFIN_AUFNR) SELECT trim(KDAUF) KDAUF,KDPOS,AUFNR FROM (SELECT AFKO.KDAUF,AFKO.KDPOS,AFKO.AUFNR,ROW_NUMBER() OVER(PARTITION BY AFKO.KDAUF,AFKO.KDPOS ORDER BY AFKO.KDAUF,AFKO.KDPOS,AFKO.AUFNR) RN FROM SAP_AFKO AFKO JOIN SAP_MARA MARA ON AFKO.PLNBEZ = MARA.MATNR WHERE TRIM(MARA.MTART) = 'Z001') WHERE RN = 1 and KDAUF in ('5000151987','5000156018');
案例一:
正确的显示应该只有一行数据,工单001201107483只供给给5000154378/1090_1这个,而不应该又产生了一个MFG
案例二: