SELECT DISTINCT
Msr.sourcing_rule_name name,
Msi.description description,
Msi.item_type type,
Msi.inventory_item_status_code State,
Msr.planning_active plan comes into effect,
Msro.effective_date Effective Date,
Msro.disable_date Invalid date,
Msro.attribute1 Proportional Month
/*,decode (msso.source_type,3, ' sourcing ', 2, ' manufacturing location ', ' transfer to ') source type,
msso.vendor_id suppliers,
msso.vendor_site_id location,
Msso.allocation_percent ratio,
Msso.rank Priority */
From MRP. Mrp_sourcing_rules MSR,
Mrp.mrp_sr_receipt_org Msro,
Mrp.mrp_sr_source_org Msso,
Inv.mtl_system_items_b MSI
where msi.organization_id = X
and msi.organization_id = msr.organization_id
and msi.segment1 = Msr.sourcing_rule_name
and msr.organization_id = msro.receipt_organization_id
and msr.sourcing_rule_id = msro.sourcing_rule_id
and msro.sr_receipt_id = msso.sr_receipt_id
--and msr.planning_active=2--the proportion of the supply is not 100%
and msso.source_type=3--sourcing sources
--and Msi.item_type in (' SA ', ' OP ')
And msi.buyer_id is null--no buyer's
and msso.allocation_percent >0--option to exclude ratio 0
and msro.disable_date is null
ORDER BY Msr.sourcing_rule_name