SELECT C.BUSINESS_UNIT , C.INV_ITEM_ID FROM PS_IN_DEMAND B , PS_DEMAND_PHYS_INV C WHERE B.IN_FULFILL_STATE BETWEEN '30' AND '40' AND B.CONFIRMED_FLAG='Y' AND B.BUSINESS_UNIT = C.BUSINESS_UNIT AND B.DEMAND_SOURCE = C.DEMAND_SOURCE AND B.SOURCE_BUS_UNIT = C.SOURCE_BUS_UNIT AND B.ORDER_NO = C.ORDER_NO AND B.ORDER_INT_LINE_NO = C.ORDER_INT_LINE_NO AND B.SCHED_LINE_NBR = C.SCHED_LINE_NBR AND B.INV_ITEM_ID = C.INV_ITEM_ID AND B.DEMAND_LINE_NO = C.DEMAND_LINE_NO GROUP BY C.BUSINESS_UNIT, C.DEMAND_SOURCE, C.SOURCE_BUS_UNIT,C.ORDER_NO, C.ORDER_INT_LINE_NO, C.SCHED_LINE_NBR, C.INV_ITEM_ID,C.DEMAND_LINE_NO HAVING ( MAX(B.QTY_ALLOC_BASE) > 0 AND MAX(B.QTY_ALLOC_BASE) <> SUM(C.QTY_BASE) ) OR ( MAX(B.QTY_ALLOC_BASE) = 0 AND MAX(B.QTY_REQUESTED) <> SUM(C.QTY_PICKED) )
|