First, there is a hierarchical relationship between the legal entity, ledger, and OU in EBS, for example:
Among them, the relationship between the Ledger and the legal entity is not simply one-to-many. In theory, because the Ledger has a secondary Ledger, a legal entity corresponds to one Primary Ledger (Primary Ledger) however, a legal entity must correspond to only one primary ledger.Whether there is a "master-slave relationship" between the ledger"It is not clear yet and further research is required.
In R12, to find out the relationship between them, you need to look at the SQL:
SELECT lg. ledger_id,
Lg. NAME ledger_name,
Lg. short_name ledger_short_name,
Includet. object_id legal_entity_id,
Le. NAME legal_entity_name,
Reg. location_id,
Hrloctl. 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 includet,
Xle_entity_profiles le,
Xle_registrations reg,
Hr_locations_all_tl hrloctl
WHERE rs. application_id = 101
AND (rs.tar get_ledger_category_code = 'secondary' AND
Rs. relationship_type_code <> 'None') OR
(Rs.tar get_ledger_category_code = 'Primary' AND
Rs. relationship_type_code = 'None') OR
(Rs.tar get_ledger_category_code = 'alc' AND
Rs. relationship_type_code IN ('journal ', 'subledger ')))
AND lg. ledger_id = rs.tar get_ledger_id
AND lg. ledger_category_code = rs.tar get_ledger_category_code
AND nvl (lg. complete_flag, 'y') = 'y'
AND primdet. object_id = rs. primary_ledger_id
AND primdet. object_type_code = 'primary'
AND primdet. setup_step_code = 'none'
AND cfg. configuration_id = primdet. configuration_id
AND configure det. configuration_id (+) = cfg. configuration_id
AND define det. object_type_code (+) = 'gal _ ENTITY'
AND le. legal_entity_id (+) = includet. object_id
AND reg. source_id (+) = includet. 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 ');
From the data results, we can see that the system has seven LEDGER accounts and five LEGAL_ENTITY entities. For the legal entity TCL_YSP, there are two LEDGER accounts, its LEDGER_CATEGORY_CODE is PRIMARY and SECONDARY, respectively, indicating that a legal entity has a PRIMARY ledger and can have SECONDARY ledger, while the 2041 ledger does not have the corresponding legal entity, however, its LEDGER_CATEGORY_CODE is still PRIMARY, which indicates that the category_code of a ledger may be defined beforehand, rather than determined when it is associated with the legal entity, so it cannot be determined whether there is a hierarchical relationship between the ledger ......
To streamline the preceding SQL statements, you can also draw a corresponding relationship:
Select lg. ledger_id, -- ledger
Includet. 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 includet
Where rs. application_id = 101 -- 101 is the general ledger GL Application
And (rs.tar get_ledger_category_code = 'secondary' and
Rs. relationship_type_code <> 'None') or
(Rs.tar get_ledger_category_code = 'Primary' and
Rs. relationship_type_code = 'None') or
(Rs.tar get_ledger_category_code = 'alc' and
Rs. relationship_type_code in ('journal ', 'subledger ')))
And lg. ledger_id = rs.tar get_ledger_id
And lg. ledger_category_code = rs.tar get_ledger_category_code
And nvl (lg. complete_flag, 'y') = 'y'
And primdet. object_id = rs. primary_ledger_id
And primdet. object_type_code = 'primary'
And primdet. setup_step_code = 'none'
And cfg. configuration_id = primdet. configuration_id
And configure det. configuration_id (+) = cfg. configuration_id
And define det. object_type_code (+) = 'gal _ ENTITY ';