Find GL Code Combination Id & Description
1) ---Only in 11i ----
SELECT gcc.segment1
|| '.'
|| gcc.segment2
|| '.'
|| gcc.segment3
|| '.'
|| gcc.segment4
|| '.'
|| gcc.segment5
ACCOUNT_CODE,
a1.description
|| '-'
|| a2.description
|| '-'
|| a3.description
|| '-'
|| a4.description
|| '-'
|| a5.description
ACCOUNT_DECS
FROM fnd_flex_values_vl A1,
fnd_flex_values_vl A2,
fnd_flex_values_vl A3,
fnd_flex_values_vl A4,
fnd_flex_values_vl A5,
gl_code_combinations gcc
WHERE a1.flex_value = gcc.segment1
AND a1.flex_value_set_id IN
(SELECT FLEX_VALUE_SET_ID
FROM fnd_id_flex_segments
WHERE application_id = 101
AND id_flex_code = 'GL#'
AND enabled_flag = 'Y'
AND application_column_name = 'SEGMENT1')
AND a2.flex_value = gcc.segment2
AND a2.flex_value_set_id IN
(SELECT flex_value_set_id
FROM fnd_id_flex_segments
WHERE application_id = 101
AND id_flex_code = 'GL#'
AND enabled_flag = 'Y'
AND application_column_name = 'SEGMENT2')
AND a3.flex_value = gcc.segment3
AND a3.flex_value_set_id IN
(SELECT flex_value_set_id
FROM fnd_id_flex_segments
WHERE application_id = 101
AND id_flex_code = 'GL#'
AND enabled_flag = 'Y'
AND application_column_name = 'SEGMENT3')
AND a4.flex_value = gcc.segment4
AND a4.flex_value_set_id IN
(SELECT flex_value_set_id
FROM fnd_id_flex_segments
WHERE application_id = 101
AND id_flex_code = 'GL#'
AND enabled_flag = 'Y'
AND application_column_name = 'SEGMENT4')
AND a5.flex_value = gcc.segment5
AND a5.flex_value_set_id IN
(SELECT flex_value_set_id
FROM fnd_id_flex_segments
WHERE application_id = 101
AND id_flex_code = 'GL#'
AND enabled_flag = 'Y'
AND application_column_name = 'SEGMENT5');
2) ---Only in R12----
SELECT gcc.concatenated_segments ACCOUNT_CODE,
GL_FLEXFIELDS_PKG.get_concat_description (gcc.chart_of_accounts_id,
gcc.code_combination_id)
ACCOUNT_DECS
FROM gl_code_combinations_kfv gcc;