SELECT DISTINCT SII.SOURCE_BUS_UNIT , SII.ORDER_NO FROM PS_IN_DEMAND SII , PS_SHIP_OM_EXS_LN EXSLN WHERE SII.DEMAND_SOURCE = 'OM' AND SII.IN_FULFILL_STATE = '70' AND SII.OMB_PROCESS_DATE IS NOT NULL AND %Join(COMMON_KEYS, IN_DEMAND SII, SHIP_OM_EXS_LN EXSLN) AND NOT EXISTS ( SELECT 'X' FROM PS_EXD_SHP_INV_HDR EXDHDR , PS_EXD_SHP_INV_LN EXDLN WHERE EXDHDR.BUSINESS_UNIT = EXDLN.BUSINESS_UNIT AND EXDHDR.EXD_DOC_NBR_SER = EXDLN.EXD_DOC_NBR_SER AND EXDHDR.EXD_INVOICE_NO = EXDLN.EXD_INVOICE_NO AND EXDHDR.EXD_INV_STATUS IN ('C','N') AND SII.BUSINESS_UNIT = EXDLN.BUSINESS_UNIT AND SII.DEMAND_SOURCE = EXDLN.DEMAND_SOURCE AND SII.SOURCE_BUS_UNIT = EXDLN.SOURCE_BUS_UNIT AND SII.ORDER_NO = EXDLN.ORDER_NO AND SII.ORDER_INT_LINE_NO = EXDLN.ORDER_INT_LINE_NO AND SII.SCHED_LINE_NBR = EXDLN.SCHED_LINE_NBR AND SII.INV_ITEM_ID = EXDLN.INV_ITEM_ID AND SII.DEMAND_LINE_NO = EXDLN.DEMAND_LINE_NO)
|