Tuesday, July 6, 2021

SQL to get Business Unit Details in Fusion

Below is the reference SQL used to get the business unit details in Oracle fusion


SELECT haotl.NAME                 BU_NAME,
       hao.location_id            LOCATION_ID,
       haotl.business_group_id    BUSINESS_GROUP_ID,
       haotl.effective_start_date DATE_FROM,
       haotl.effective_end_date   DATE_TO,
       hoi.org_information1       MANAGER_ID,
       hoi.org_information2       LEGAL_ENTITY_ID,
       hoi.org_information3       PRIMARY_LEDGER_ID,
       hoi.org_information4       DEFAULT_SET_ID,
       haotl.NAME                 SHORT_CODE,
       hoi.org_information6       ENABLED_FOR_HR_FLAG,
       hoi.org_information7       FIN_BUSINESS_UNIT_ID,
       hoi.org_information8       DEFAULT_CURRENCY_CODE,
       hoi.org_information9       PROFIT_CENTER_FLAG,
       hoi.created_by             CREATED_BY,
       hoi.creation_date          CREATION_DATE,
       hoi.last_updated_by        LAST_UPDATED_BY,
       hoi.last_update_date       LAST_UPDATE_DATE,
       hoi.last_update_login      LAST_UPDATE_LOGIN
FROM   fusion.hr_all_organization_units_f hao,
       fusion.hr_organization_units_f_tl haotl,
       fusion.hr_org_unit_classifications_f houc,
       fusion.hr_organization_information_f hoi
WHERE  hao.organization_id = haotl.organization_id
       AND houc.organization_id = haotl.organization_id
       AND houc.classification_code = 'FUN_BUSINESS_UNIT'
       AND hoi.organization_id = haotl.organization_id
       AND hoi.org_information_context = houc.classification_code
       AND Trunc(sysdate) BETWEEN haotl.effective_start_date AND
                                  haotl.effective_end_date
       AND haotl.language = Userenv('LANG')
       AND haotl.effective_start_date = hao.effective_start_date
       AND haotl.effective_end_date = hao.effective_end_date
ORDER  BY bu_name; 

No comments:

Post a Comment