SELECT DISTINCT B.BUSINESS_UNIT_GL , B.LEDGER , D.DISTRIBUTION_TYPE , (CASE WHEN D.DISTRIBUTION_TYPE='FA' AND B.IMPAIR_FLG='Y' AND D.COST_TYPE=B.IMP_COST_TYPE THEN 'Y' ELSE 'N' END) ,D.ACCOUNT , D.ALTACCT , A.SETID , A.CHARTFIELD FROM PS_BU_BOOK_TBL B , PS_SET_CNTRL_REC S , PS_CNAO_GL_RULE A , PS_SET_CNTRL_REC S1 , PS_DIST_TMPLLN_TBL D WHERE B.DISTRIBUTION_SW='Y' AND S.SETCNTRLVALUE=B.BUSINESS_UNIT_GL AND S.RECNAME='CNAO_GL_RULE' AND S.SETID=A.SETID AND S1.SETCNTRLVALUE=B.BUSINESS_UNIT AND S1.RECNAME='DIST_TMPL_TBL' AND S1.SETID= D.SETID AND D.ACCT_ENT_TMPL_ID=B.ACCT_ENT_TMPL_ID AND D.DISTRIBUTION_TYPE IN ('AD','FA')
|