FROM fnd_flex_key_seg_vset_v
WHERE application_name = 'General Ledger'
AND id_flex_name = 'Accounting Flexfield'
select * from fnd_application_vl where application_id = 101
select * from fnd_id_flex_segments WHERE application_id = 101
SELECT LEDGER_ID,
LEDGER_NAME,
LEDGER_SHORT_NAME,
LEGAL_ENTITY_NAME,
gllv.LOCATION_CODE "LOCATION",
LOCATION_DESCRIPTION,
LEDGER_CATEGORY_CODE,
CURRENCY_CODE,
CHART_OF_ACCOUNTS_ID,
PERIOD_SET_NAME,
ACCOUNTED_PERIOD_TYPE,
hr_loc.country "Country Code",
-- hr_loc.location_code "Location Code",
glev.flex_segment_value "Company Code"
FROM gl_ledger_le_v gllv,
hr_locations_all hr_loc,
gl_legal_entities_bsvs glev
WHERE hr_loc.location_id = gllv.location_id
AND LEDGER_NAME LIKE 'PL%'
AND glev.LEGAL_ENTITY_ID = gllv.LEGAL_ENTITY_ID