Oracle EBS-SQL (CST-4):检查组织间项目成本.sql
select
i1.segment1 项目
,i1.description 项目描述
,i1.PRIMARY_UNIT_OF_MEASURE 单位
,decode(i1.item_type,'P','采购件','SA','子配件','FG','成品') 组织1项目类型
,decode(i2.item_type,'P','采购件','SA','子配件','FG','成品') 组织2项目类型
,c1.item_cost 组织1成本
,c2.item_cost 组织2成本
from
bom.cst_item_costs c2
,bom.cst_item_costs c1
,inv.mtl_system_items_b i2
,inv.mtl_system_items_b i1
where
--nvl(c1.item_cost,0) <> nvl(c2.item_cost,0) and
c1.inventory_item_id(+) = i1.inventory_item_id and
c1.cost_type_id(+) = 3 and --冻结成本
c1.organization_id(+) = i1.organization_id and
c2.inventory_item_id(+) = i2.inventory_item_id and
c2.cost_type_id(+) = 1 and --冻结成本
c2.organization_id(+) = i2.organization_id and
i2.organization_id = X2 and
i2.inventory_item_id = i1.inventory_item_id and
i1.organization_id = X1 and
(i1.inventory_item_status_code <> 'Inactive' and i2.inventory_item_status_code <> 'Inactive')