Friday, 29 April 2016

Query to find Legal Entity, Organization, Company Code

/* Formatted on 4/29/2016 5:04:05 PM (QP5 v5.114.809.3010) */
  SELECT   xep.legal_entity_id "Legal Entity ID",
           xep.name "Legal Entity",
           hr_outl.name "Organization Name",
           hr_outl.organization_id "Organization ID",
           hr_loc.location_id "Location ID",
           hr_loc.country "Country Code",
           hr_loc.location_code "Location Code",
           glev.flex_segment_value "Company Code"
    FROM   xle_entity_profiles xep,
           xle_registrations reg,
           --
           hr_operating_units hou,
           -- hr_all_organization_units      hr_ou,
           hr_all_organization_units_tl hr_outl,
           hr_locations_all hr_loc,
           --
           gl_legal_entities_bsvs glev
   WHERE       1 = 1
           AND xep.transacting_entity_flag = 'Y'
           AND xep.legal_entity_id = reg.source_id
           AND reg.source_table = 'XLE_ENTITY_PROFILES'
           AND reg.identifying_flag = 'Y'
           AND xep.legal_entity_id = hou.default_legal_context_id
           AND reg.location_id = hr_loc.location_id
           AND xep.legal_entity_id = glev.legal_entity_id
           --
           -- AND hr_ou.organization_id         =  hou.business_group_id
           AND hr_outl.organization_id = hou.organization_id
ORDER BY   hr_outl.name

1 comment:

  1. Regards
    Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
    LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
    Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, Oracle Manufacturing, BI Publisher, OAF, ADF, SQL, PL/SQL, D2K at sridevikoduru@oracleappstechnical.com | +91 - 9581017828.

    ReplyDelete