AP GL Reconcilation SQL Query

select
c.concatenated_segments account_code,
ap.account_balance,
gl.account_balance

from

(select
l.code_combination_id,
sum(nvl(accounted_dr,0)-nvl(accounted_cr,0)) account_balance

from
xla_ae_headers h,
xla_ae_lines l

where
h.ae_header_id=l.ae_header_id and
l.application_id=200 and
h.balance_type_code='A' and
h.gl_transfer_status_code='Y'

group by
l.code_combination_id) ap,

(select
l.code_combination_id,
sum(nvl(accounted_dr,0)-nvl(accounted_cr,0)) account_balance

from
gl_je_headers h,
gl_je_lines l

where
h.je_header_id=l.je_header_id
and h.je_source='Payables'
and h.actual_flag='A'
and h.status='P'

group by
l.code_combination_id) gl,

gl_code_combinations_kfv c

where
ap.code_combination_id=gl.code_combination_id
and ap.code_combination_id=c.code_combination_id

No comments:

Post a Comment