SELECT A.BUSINESS_UNIT ,A.COMMON_ID ,x.ITEM_TYPE ,x.LANGUAGE_CD ,x.DESCR FROM PS_ITEM_SF A ,PS_ITEM_TYPE_TBL B ,PS_BUS_UNIT_TBL_SF C ,PS_ITEM_LINE_SF D , PS_ITEM_TYPE_LNG x WHERE A.BUSINESS_UNIT=C.BUSINESS_UNIT AND A.ITEM_TYPE=B.ITEM_TYPE AND A.BUSINESS_UNIT = D.BUSINESS_UNIT AND A.COMMON_ID = D.COMMON_ID AND A.SA_ID_TYPE = D.SA_ID_TYPE AND A.ITEM_NBR = D.ITEM_NBR AND A.SA_ID_TYPE = 'P' AND B.SETID=( SELECT D.SETID FROM PS_SET_CNTRL_REC D WHERE D.RECNAME='ITEM_TYPE_TBL' AND D.SETCNTRLVALUE=C.INSTITUTION) AND B.EFFDT=( SELECT MAX(EFFDT) FROM PS_ITEM_TYPE_TBL Y WHERE Y.SETID=B.SETID AND Y.ITEM_TYPE=B.ITEM_TYPE AND Y.EFFDT <= %CurrentDateIn AND Y.EFF_STATUS = 'A') AND (A.ITEM_TYPE_CD = 'C' OR A.ITEM_TYPE_CD = 'B' OR A.ITEM_TYPE_CD = 'H' OR A.ITEM_TYPE_CD = 'A' OR A.ITEM_TYPE_CD = 'I' OR A.ITEM_TYPE_CD = 'T' ) AND b.setid = x.setid AND b.item_type=x.item_type AND b.effdt = x.effdt
|