See query:
select distinct f2.description Business_Unit,
f3.description Department,
f4.description Function,
a.segment5 Account,
f5.description Account_Description,
sum(nvl(d.entered_dr,0) - nvl(d.entered_cr,0)) Actual,
(Select sum(nvl(dd.entered_dr,0) - nvl(dd.entered_cr,0))
from apps.gl_je_headers_v cc,
APPS.GL_JE_LINES_V dd,
apps.gl_code_combinations aa,
apps.fnd_flex_values_vl ff2,
apps.fnd_flex_values_vl ff3,
apps.fnd_flex_values_vl ff4,
apps.fnd_flex_values_vl ff5,
apps.gl_budget_versions ee
where dd.code_combination_id = aa.CODE_COMBINATION_ID
and dd.code_combination_id = d.code_combination_id
and cc.JE_HEADER_ID = dd.JE_HEADER_ID
and cc.BUDGET_VERSION_ID = ee.BUDGET_VERSION_ID
AND aa.segment2 = ff2.flex_value
AND aa.segment3 = ff3.flex_value
AND aa.segment4 = ff4.flex_value
AND aa.segment5 = ff5.flex_value
and ee.BUDGET_NAME = '&Budget_Name'
and aa.segment5 in (
'34001',
'34002',
'34011',
'34012',
'34013',
'34014',
'34015',
'34016',
'34051',
'34052',
'34053',
'34054')
and cc.actual_flag = 'B'
AND ff2.flex_value_set_id = 1009628
AND ff3.flex_value_set_id = 1009629
AND ff4.flex_value_set_id = 1009630
AND ff5.flex_value_set_id = 1009631) Budget
from apps.gl_je_headers_v c,
APPS.GL_JE_LINES_V d,
apps.gl_code_combinations a,
apps.fnd_flex_values_vl f2,
apps.fnd_flex_values_vl f3,
apps.fnd_flex_values_vl f4,
apps.fnd_flex_values_vl f5
where c.JE_HEADER_ID = d.JE_HEADER_ID
and d.code_combination_id = a.CODE_COMBINATION_ID
AND a.segment2 = f2.flex_value
AND a.segment3 = f3.flex_value
AND a.segment4 = f4.flex_value
AND a.segment5 = f5.flex_value
and c.actual_flag = 'A'
and d.effective_Date between TO_CHAR(TO_DATE('01-APR-2007', 'DD-MON-YYYY')) and TO_CHAR(TO_DATE('31-MAR-2008', 'DD-MON-YYYY'))
AND f2.flex_value_set_id = 1009628
AND f3.flex_value_set_id = 1009629
AND f4.flex_value_set_id = 1009630
AND f5.flex_value_set_id = 1009631
and a.segment5 in (
'34001',
'34002',
'34011',
'34012',
'34013',
'34014',
'34015',
'34016',
'34051',
'34052',
'34053',
'34054')
group by d.code_combination_id,
f2.description,
f3.description,
f4.description,
a.segment5,
f5.description
order by f2.description, f3.description, f4.description, f5.DESCRIPTION;
My query is not showing the records where actual is null but budget has values.
Please can you assist?
Thanks
Software/Hardware used:
ASKED:
August 15, 2008 2:46 PM
UPDATED:
August 15, 2008 6:05 PM