AP Liability Trial Balance SQL Query

select
cc.code_combination_id,
cc.segment1||'-'||cc.segment2||'-'||cc.segment3||'-'||cc.segment4||'-'||cc.segment5||'-'||cc.segment6 gl_account,
sum(nvl(al.accounted_dr,0)) dr,
sum(nvl(al.accounted_cr,0)) cr,
sum(nvl(al.accounted_dr,0))-sum(nvl(al.accounted_cr,0)) net_dr_cr

from
xla_ae_headers ah,
xla_ae_lines al,
gl_code_combinations cc

where
ah.ae_header_id=al.ae_header_id
and cc.code_combination_id=al.code_combination_id
and ah.application_id=200
and al.code_combination_id=1063  -- Combination ID of Liability Account
and al.accounting_date between :p_from_date and :p_to_date

group by
cc.code_combination_id,
cc.segment1,
cc.segment2,
cc.segment3,
cc.segment4,
cc.segment5,
cc.segment6

No comments:

Post a Comment