SELECT DISTINCT A.BUSINESS_UNIT , A.SHIP_ID FROM PS_IN_DEMAND A WHERE A.SHIP_ID IN ( SELECT A1.SHIP_ID FROM PS_IN_DEMAND A1 , PS_DMD_IU_DEF_INV B , PS_INSTALLATION_IN IIN WHERE A1.BUSINESS_UNIT = B.BUSINESS_UNIT AND A1.IN_FULFILL_STATE='70' AND A1.DESTIN_BU = B.DESTIN_BU AND A1.INTERUNIT_FLG = 'Y' AND A1.DEMAND_SOURCE <> 'OM' AND A1.SHIP_ID<> ' ' AND A.BUSINESS_UNIT = A1.BUSINESS_UNIT AND B.INTERCOMPANY_FLG = 'Y' AND IIN.IUNIT_VALUES IN ('2','3') AND NOT EXISTS ( SELECT 'X' FROM PS_IN_DEMAND_BI BI WHERE %Join (COMMON_KEYS, IN_DEMAND_BI BI, IN_DEMAND A1) )) OR A.SHIP_ID IN ( SELECT A2.SHIP_ID FROM PS_IN_DEMAND A2 , PS_INIU_TRANOPT_VW B , PS_INSTALLATION_IN IIN , PS_INSTALLATION_FS IFS WHERE A2.BUSINESS_UNIT = B.SOURCE_BUS_UNIT AND A2.IN_FULFILL_STATE='70' AND A2.SHIP_ID<> ' ' AND A2.DESTIN_BU = B.DESTIN_BU AND A2.INTERUNIT_FLG = 'Y' AND A2.DEMAND_SOURCE <> 'OM' AND A.BUSINESS_UNIT = A2.BUSINESS_UNIT AND B.INTERCOMPANY_FLG = 'Y' AND IIN.IUNIT_VALUES IN ('1','3') AND IFS.IU_METHOD IN ('D','I') AND NOT EXISTS ( SELECT 'X' FROM PS_IN_DEMAND_BI BI WHERE %Join (COMMON_KEYS, IN_DEMAND_BI BI, IN_DEMAND A2))) OR A.SHIP_ID IN ( SELECT A3.SHIP_ID FROM PS_IN_DEMAND A3 , PS_INIU_TRANPR_VW B , PS_INSTALLATION_IN IIN , PS_INSTALLATION_FS IFS WHERE A3.BUSINESS_UNIT = B.SOURCE_BUS_UNIT AND A3.IN_FULFILL_STATE='70' AND A3.DESTIN_BU = B.DESTIN_BU AND A3.SHIP_ID<> ' ' AND A3.INTERUNIT_FLG = 'Y' AND A3.DEMAND_SOURCE <> 'OM' AND A.BUSINESS_UNIT = A3.BUSINESS_UNIT AND B.INTERCOMPANY_FLG = 'Y' AND IIN.IUNIT_VALUES IN ('1','3') AND IFS.IU_METHOD = 'P' AND NOT EXISTS ( SELECT 'X' FROM PS_IN_DEMAND_BI BI WHERE %Join (COMMON_KEYS, IN_DEMAND_BI BI, IN_DEMAND A3)))
|