Search This Blog

Showing posts with label LE. Show all posts
Showing posts with label LE. Show all posts

Wednesday, July 13, 2011

To get the legal entity

SELECT xep.legal_entity_id, NAME, hl.address_line_1, hl.town_or_city,
       hl.postal_code, hl.country
  FROM apps.xle_entity_profiles xep,
       apps.xle_registrations xr,
       hr_locations hl,
       hz_geographies b,
       hz_parties hp,
       ra_customer_trx_all rct
 WHERE xep.geography_id = b.geography_id
   AND xr.location_id = hl.location_id
   AND xr.source_id = xep.legal_entity_id
   AND xr.identifying_flag = 'Y'
   AND xr.source_table = 'XLE_ENTITY_PROFILES'
   AND SYSDATE BETWEEN xr.effective_from AND NVL (xr.effective_to, SYSDATE)
   AND xep.transacting_entity_flag = 'Y'
   AND hp.party_id = xep.party_id
   AND xep.legal_entity_id = rct.legal_entity_id
   AND customer_trx_id = :customer_trx_id



SELECT ou.organization_id org_id, mp.organization_id inv_org_id,
          le.ledger_id, legal_entity_id, le.legal_entity_name,
          ou.NAME ORGANIZATION, mp.organization_code inv_org
     FROM financials_system_params_all fspa,
          mtl_parameters mp,
          hr_operating_units ou,
          xle_le_ou_ledger_v le
    WHERE fspa.inventory_organization_id = mp.organization_id
      AND fspa.org_id = ou.organization_id
      AND ou.organization_id = le.operating_unit_id
      AND ou.NAME LIKE 'GEC%'

------------
Base table: XLE_ENTITY_PROFILES