OPM Accounting Details SQL Query

select
org.name,
mmt.transaction_date,
mtt.transaction_type_name,
msi.segment1,
msi.description,
mmt.transaction_quantity,
cc.concatenated_segments account,
xal.accounted_dr,
xal.accounted_cr

from
mtl_material_transactions mmt,
mtl_transaction_types mtt,
mtl_system_items msi,
hr_all_organization_units org,
gmf_xla_extract_headers xeh,
xla_events xe,
xla_ae_headers xah,
(select ae_header_id,code_combination_id,sum(nvl(accounted_dr,0)) accounted_dr,sum(nvl(accounted_cr,0)) accounted_cr
from xla_ae_lines group by ae_header_id,code_combination_id) xal,
gl_code_combinations_kfv cc

where
mmt.transaction_id=xeh.transaction_id and
mmt.transaction_type_id=mtt.transaction_type_id and
org.organization_id=mmt.organization_id and
mmt.inventory_item_id=msi.inventory_item_id and
xe.event_id=xeh.event_id and
xah.event_id=xe.event_id and
xal.ae_header_id=xah.ae_header_id and
cc.code_combination_id=xal.code_combination_id and
mmt.transaction_date between :p_from_date and :p_to_date
msi.organization_id=mmt.organization_id

order by
mmt.transaction_id

No comments:

Post a Comment