OPM Expense Allocation SQL Query

select
m.alloc_code,
p.calendar_code prod_year,
p.period_code prod_month,
s.description product,
b.fixed_percent,
sum(p.amount) alloc_amount

from
gl_aloc_mst m,
gl_aloc_bas b,
gl_aloc_inp p,
mtl_system_items s,
gl_code_combinations_kfv c

where
m.alloc_id=b.alloc_id
and b.alloc_id=p.alloc_id
and s.inventory_item_id=b.inventory_item_id
and c.code_combination_id=p.account_id
and s.organization_id=:p_master_org_id
and p.account_key_type=1
and p.amount<>0
and p.calendar_code=:p_calendar_code
and p.period_code=:p_period_code

group by
m.alloc_code,
p.calendar_code,
p.period_code,
s.description,
b.fixed_percent

order by
m.alloc_code,
p.calendar_code,
p.period_code,
s.description,
b.fixed_percent

No comments:

Post a Comment