OPM Item Costs SQL Query

select
ccdv.calendar_code,
ccdv.period_code,
org.name org_name,
msi.segment1 item_code,
msi.description item_name,
sum(ccdv.cmpnt_cost) item_cost

from
cm_cmpt_dtl_vw1 ccdv,
mtl_system_items msi,
mtl_parameters mp,
hr_all_organization_units org

where
ccdv.INVENTORY_ITEM_ID=MSI.INVENTORY_ITEM_ID AND
ccdv.organization_id=mp.organization_id and
org.organization_id=mp.organization_id and
msi.organization_id=85 and
ccdv.period_code like nvl(:p_period_code,ccdv.period_code) and
ccdv.calendar_code like nvl(:p_calendar_code,ccdv.calendar_code) and
ccdv.organization_id=nvl(:p_org_id,ccdv.organization_id)

group by
ccdv.calendar_code,
ccdv.period_code,
org.name,
msi.segment1,
msi.description

order by
ccdv.calendar_code,
ccdv.period_code,
org.name,
msi.segment1,
msi.description

No comments:

Post a Comment