SELECT A.BUSINESS_UNIT , A.INV_ITEM_ID , D.LANGUAGE_CD , D.DESCR FROM PS_SET_CNTRL_REC C , PS_BU_ITEMS_INV A , PS_MASTER_ITEM_TBL B , PS_MASTER_ITM_LANG D WHERE C.RECNAME = 'MASTER_ITEM_TBL' AND A.BUSINESS_UNIT = C.SETCNTRLVALUE AND B.SETID = C.SETID AND D.SETID = C.SETID AND B.INV_ITEM_ID = A.INV_ITEM_ID AND D.INV_ITEM_ID = A.INV_ITEM_ID AND( ( A.INVENTORY_ITEM = 'Y' OR (A.INVENTORY_ITEM = 'N' AND A.SOURCE_CODE = '6')) AND EXISTS ( SELECT 'X' FROM PS_BU_ITEMS_INV B , PS_PL_ITEM_ATTRIB D WHERE B.BUSINESS_UNIT = C.SETCNTRLVALUE AND B.INV_ITEM_ID = A.INV_ITEM_ID AND D.INV_ITEM_ID = A.INV_ITEM_ID AND D.BUSINESS_UNIT = C.SETCNTRLVALUE AND (B.SOURCE_CODE = '1' OR B.SOURCE_CODE = '2' OR B.SOURCE_CODE = '6' ) AND D.PLANNED_BY <> '4') OR ((A.INVENTORY_ITEM = 'N' AND A.NON_OWN_FLAG = 'N' AND A.CONSIGNED_FLAG <> 'Y') OR A.SOURCE_CODE = '6'))
|