First, a hierarchical relationship between the legal entity and the ledger in EBS and the OU is shown below:
Among them, for the ledger and legal entity, is not simple is a one-to-many relationship, in theory: Because of the ledger ledger subsidiary ledger, so a legal entity in addition to a main ledger (Primary Ledger), there may be ancillary ledger, However, a legal entity must only correspond to a single main ledger, and whether there is a "master-slave relationship" between the ledger is still not clear, pending further textual research.
And in R12, to find out about their relationship, you need to look at the SQL:
SELECT lg.ledger_id, Lg.name ledger_name, Lg.short_name ledger_short_name, cfgdet.object_id legal_entity_id, Le.NAME Legal_entity_name, reg.location_id location_id, Hrloctl.location_code location_code, Hrloctl.description location_ Description, Lg.ledger_category_code, Lg.currency_code, lg.chart_of_accounts_id, Lg.period_set_name, Lg.accounted_ Period_type, Lg.sla_accounting_method_code, Lg.sla_accounting_method_type, Lg.bal_seg_value_option_code, Lg.bal_ Seg_column_name, lg.bal_seg_value_set_id, Cfg.acctg_environment_code, cfg.configuration_id, rs.primary_ledger_id, Rs.relationship_enabled_flag from Gl_ledger_config_details Primdet, gl_ledgers LG, Gl_ledger_relationships RS, Gl_ Ledger_configurations cfg, gl_ledger_config_details cfgdet, xle_entity_profiles le, xle_registrations Reg, Hr_ Locations_all_tl hrloctl WHERE rs.application_id = (Rs.target_ledger_category_code = ' secondary ' and rs.relation Ship_type_code <> ' NONE ') OR (rs.target_ledger_category_code = ' PRIMARY ' and RS.relationship_type_code = ' NONE ') OR (rs.target_ledger_category_code = ' ALC ' and Rs.relationship_type_code in (' JOURNAL ', ' Subledger ')) and lg.ledger_id = rs.target_ledger_id and Lg.ledger_category_code = Rs.target_ledger_category _code and NVL (Lg.complete_flag, ' y ') = ' y ' and primdet.object_id = rs.primary_ledger_id and Primdet.object_type_code = ' PR Imary ' and Primdet.setup_step_code = ' NONE ' and cfg.configuration_id = primdet.configuration_id and Cfgdet.configuration _id (+) = cfg.configuration_id and Cfgdet.object_type_code (+) = ' legal_entity ' and le.legal_entity_id (+) = Cfgdet.object_ ID and reg.source_id (+) = cfgdet.object_id and reg.source_table (+) = ' xle_entity_profiles ' and reg.identifying_flag (+) = ' Y ' and hrloctl.location_id (+) = reg.location_id and Hrloctl. LANGUAGE (+) = Userenv (' LANG ');
As can be seen from the data results, there are 7 ledger accounts (ledger) and 5 legal entity (legal_entity) in the system, and for TCL_YSP this legal entity, there are two ledger accounts, Ledger_category_ Code is primary and secondary respectively, indicating that a legal entity has a main ledger, and can have auxiliary ledger, and 2041 this ledger, there is no corresponding legal entity, but its ledger_category_code is still primary, This means that the category_code of a ledger may be defined beforehand, not in relation to the legal entity, so it is not possible to determine the hierarchical relationship between the ledger accounts.
By streamlining the above SQL, you can also derive a corresponding relationship:
Select lg.ledger_id,--Ledger cfgdet.object_id legal_entity_id,--legal entity Lg.currency_code, lg.chart_of_accounts_id, rs.primary_ledger_id from Gl_ledger_config_details Primdet, gl_ledgers LG, Gl_ledger_relationships RS, Gl_ledger_ Configurations cfg, gl_ledger_config_details cfgdet where rs.application_id = 101--101 for GL GL application and (Rs.target_ledger_ Category_code = ' secondary ' and Rs.relationship_type_code <> ' NONE ') or (Rs.target_ledger_category_code = ' PRIMARY ' and Rs.relationship_type_code = ' NONE ') or (Rs.target_ledger_category_code = ' ALC ' and rs.relationship_type_ Code in (' JOURNAL ', ' Subledger ')) and lg.ledger_id = rs.target_ledger_id and Lg.ledger_category_code = Rs.target_ledger_ Category_code and NVL (Lg.complete_flag, ' y ') = ' y ' and primdet.object_id = rs.primary_ledger_id and Primdet.object_type_c Ode = ' PRIMARY ' and primdet.setup_step_code = ' NONE ' and cfg.configuration_id = primdet.configuration_id and Cfgdet.config URATION_ID (+) = cfg.configuration_id and Cfgdet.object_type_code(+) = ' legal_entity ';