SELECT DISTINCT A.BUSINESS_UNIT , B.LEDGER , B.SETID , D.LEDGER , A.LEDGER_GROUP , C.LEDGER_GROUP , A.BASE_CURRENCY FROM PS_BU_LED_GRP_TBL A , PS_LED_GRP_LED_TBL B , PS_BU_LED_GRP_TBL C , PS_LED_GRP_LED_TBL D , PS_LED_DEFN_TBL E , PS_LED_TMPLT_TBL F WHERE B.LEDGER_GROUP = A.LEDGER_GROUP AND A.BUSINESS_UNIT = C.BUSINESS_UNIT AND A.LEDGER_TYPE = C.LEDGER_TYPE AND B.SETID = D.SETID AND C.LEDGER_GROUP = D.LEDGER_GROUP AND A.BASE_CURRENCY = C.BASE_CURRENCY AND A.CALENDAR_ID = C.CALENDAR_ID AND ((B.INHERIT_BASE_CUR = 'Y' AND D.INHERIT_BASE_CUR = 'Y') OR (B.INHERIT_BASE_CUR = 'N' AND D.INHERIT_BASE_CUR = 'N' AND B.BASE_CURRENCY = D.BASE_CURRENCY ) OR (B.INHERIT_BASE_CUR = 'Y' AND D.INHERIT_BASE_CUR = 'N' AND A.BASE_CURRENCY = D.BASE_CURRENCY) OR (B.INHERIT_BASE_CUR = 'N' AND D.INHERIT_BASE_CUR = 'Y' AND B.BASE_CURRENCY = A.BASE_CURRENCY)) AND B.SETID=( SELECT SETID FROM PS_SET_CNTRL_REC WHERE SETCNTRLVALUE = A.BUSINESS_UNIT AND RECNAME = 'LED_DEFN_TBL') AND E.SETID = D.SETID AND E.LEDGER = D.LEDGER AND E.LEDGER_TEMPLATE = F.LEDGER_TEMPLATE AND F.DEFAULT_LEDGER = 'B'
|