DBA Data[Home] [Help]

VIEW: APPS.MSD_DEM_DEPENDENT_DEMAND_V

Source

View Text - Preformatted

SELECT plans.plan_id plan_id, plans.compile_designator supply_plan, msi.item_name item_code, mtp.organization_code, using_requirement_quantity quantity, using_assembly_demand_date sdate FROM msc_demands dem, msc_plans plans, msc_trading_partners mtp, msc_system_items msi WHERE dem.plan_id = plans.plan_id and plans.plan_id <> -1 and msi.sr_instance_id = dem.sr_instance_id and msi.plan_id = -1 and msi.organization_id = dem.organization_id and msi.inventory_item_id = dem.inventory_item_id and msi.mrp_planning_code <> 6 and mtp.partner_type = 3 and mtp.sr_tp_id = msi.organization_id and nvl(mtp.company_id,-1) = -1 and mtp.sr_instance_id = msi.sr_instance_id and dem.origination_type in (2,3,4,24,25,39) UNION ALL SELECT plans.plan_id plan_id, plans.compile_designator supply_plan, msi.item_name item_code, mtp.organization_code org_code, using_requirement_quantity quantity, using_assembly_demand_date sdate FROM msc_demands dem, msc_plans plans, msc_trading_partners mtp, msc_system_items msi WHERE dem.plan_id = plans.plan_id and plans.plan_id <> -1 and msi.sr_instance_id = dem.sr_instance_id and msi.plan_id = -1 and msi.organization_id = dem.organization_id and msi.inventory_item_id = dem.inventory_item_id and msi.mrp_planning_code <> 6 and mtp.partner_type = 3 and mtp.sr_tp_id = msi.organization_id and nvl(mtp.company_id,-1) = -1 and mtp.sr_instance_id = msi.sr_instance_id and dem.origination_type = 1 and dem.organization_id = nvl(dem.source_organization_id, -23453) UNION ALL SELECT plans.plan_id plan_id, plans.compile_designator supply_plan, msi.item_name item_code, mtp.organization_code org_code, dem.quantity_by_due_date quantity, TRUNC(dem.using_assembly_demand_date) sdate FROM msc_demands dem, msc_plans plans, msc_trading_partners mtp, msc_system_items msi, msc_system_items msia WHERE dem.plan_id = plans.plan_id and plans.plan_id <> -1 and dem.plan_id = msia.plan_id and dem.sr_instance_id = msia.sr_instance_id and dem.organization_id = msia.organization_id and dem.using_assembly_item_id = msia.inventory_item_id and((dem.inventory_item_id != dem.using_assembly_item_id and msia.bom_item_type = 5) OR(dem.inventory_item_id = dem.using_assembly_item_id)) and msi.sr_instance_id = dem.sr_instance_id and msi.plan_id = -1 and msi.organization_id = dem.organization_id and msi.inventory_item_id = dem.inventory_item_id and msi.mrp_planning_code <> 6 and mtp.partner_type = 3 and mtp.sr_tp_id = msi.organization_id and nvl(mtp.company_id,-1) = -1 and mtp.sr_instance_id = msi.sr_instance_id and dem.origination_type in (6, 30) and nvl(dem.source_organization_id, -23453) <> -23453 and nvl(dem.quantity_by_due_date, 0) != 0 UNION ALL SELECT plans.plan_id plan_id, plans.compile_designator supply_plan, msi.item_name item_code, mtp.organization_code org_code, (dem.using_requirement_quantity -nvl(dem.quantity_by_due_date, 0)) quantity, TRUNC(dem.dmd_satisfied_date) sdate FROM msc_demands dem, msc_plans plans, msc_trading_partners mtp, msc_system_items msi, msc_system_items msia WHERE dem.plan_id = plans.plan_id and plans.plan_id <> -1 and dem.plan_id = msia.plan_id and dem.sr_instance_id = msia.sr_instance_id and dem.organization_id = msia.organization_id and dem.using_assembly_item_id = msia.inventory_item_id and((dem.inventory_item_id != dem.using_assembly_item_id and msia.bom_item_type = 5) OR(dem.inventory_item_id = dem.using_assembly_item_id)) and msi.sr_instance_id = dem.sr_instance_id and msi.plan_id = -1 and msi.organization_id = dem.organization_id and msi.inventory_item_id = dem.inventory_item_id and msi.mrp_planning_code <> 6 and mtp.partner_type = 3 and mtp.sr_tp_id = msi.organization_id and nvl(mtp.company_id,-1) = -1 and mtp.sr_instance_id = msi.sr_instance_id and dem.origination_type in (6, 30) and nvl(dem.source_organization_id, -23453) <> -23453 and (dem.using_requirement_quantity -nvl(dem.quantity_by_due_date, 0) != 0)
View Text - HTML Formatted

SELECT PLANS.PLAN_ID PLAN_ID
, PLANS.COMPILE_DESIGNATOR SUPPLY_PLAN
, MSI.ITEM_NAME ITEM_CODE
, MTP.ORGANIZATION_CODE
, USING_REQUIREMENT_QUANTITY QUANTITY
, USING_ASSEMBLY_DEMAND_DATE SDATE
FROM MSC_DEMANDS DEM
, MSC_PLANS PLANS
, MSC_TRADING_PARTNERS MTP
, MSC_SYSTEM_ITEMS MSI
WHERE DEM.PLAN_ID = PLANS.PLAN_ID
AND PLANS.PLAN_ID <> -1
AND MSI.SR_INSTANCE_ID = DEM.SR_INSTANCE_ID
AND MSI.PLAN_ID = -1
AND MSI.ORGANIZATION_ID = DEM.ORGANIZATION_ID
AND MSI.INVENTORY_ITEM_ID = DEM.INVENTORY_ITEM_ID
AND MSI.MRP_PLANNING_CODE <> 6
AND MTP.PARTNER_TYPE = 3
AND MTP.SR_TP_ID = MSI.ORGANIZATION_ID
AND NVL(MTP.COMPANY_ID
, -1) = -1
AND MTP.SR_INSTANCE_ID = MSI.SR_INSTANCE_ID
AND DEM.ORIGINATION_TYPE IN (2
, 3
, 4
, 24
, 25
, 39) UNION ALL SELECT PLANS.PLAN_ID PLAN_ID
, PLANS.COMPILE_DESIGNATOR SUPPLY_PLAN
, MSI.ITEM_NAME ITEM_CODE
, MTP.ORGANIZATION_CODE ORG_CODE
, USING_REQUIREMENT_QUANTITY QUANTITY
, USING_ASSEMBLY_DEMAND_DATE SDATE
FROM MSC_DEMANDS DEM
, MSC_PLANS PLANS
, MSC_TRADING_PARTNERS MTP
, MSC_SYSTEM_ITEMS MSI
WHERE DEM.PLAN_ID = PLANS.PLAN_ID
AND PLANS.PLAN_ID <> -1
AND MSI.SR_INSTANCE_ID = DEM.SR_INSTANCE_ID
AND MSI.PLAN_ID = -1
AND MSI.ORGANIZATION_ID = DEM.ORGANIZATION_ID
AND MSI.INVENTORY_ITEM_ID = DEM.INVENTORY_ITEM_ID
AND MSI.MRP_PLANNING_CODE <> 6
AND MTP.PARTNER_TYPE = 3
AND MTP.SR_TP_ID = MSI.ORGANIZATION_ID
AND NVL(MTP.COMPANY_ID
, -1) = -1
AND MTP.SR_INSTANCE_ID = MSI.SR_INSTANCE_ID
AND DEM.ORIGINATION_TYPE = 1
AND DEM.ORGANIZATION_ID = NVL(DEM.SOURCE_ORGANIZATION_ID
, -23453) UNION ALL SELECT PLANS.PLAN_ID PLAN_ID
, PLANS.COMPILE_DESIGNATOR SUPPLY_PLAN
, MSI.ITEM_NAME ITEM_CODE
, MTP.ORGANIZATION_CODE ORG_CODE
, DEM.QUANTITY_BY_DUE_DATE QUANTITY
, TRUNC(DEM.USING_ASSEMBLY_DEMAND_DATE) SDATE
FROM MSC_DEMANDS DEM
, MSC_PLANS PLANS
, MSC_TRADING_PARTNERS MTP
, MSC_SYSTEM_ITEMS MSI
, MSC_SYSTEM_ITEMS MSIA
WHERE DEM.PLAN_ID = PLANS.PLAN_ID
AND PLANS.PLAN_ID <> -1
AND DEM.PLAN_ID = MSIA.PLAN_ID
AND DEM.SR_INSTANCE_ID = MSIA.SR_INSTANCE_ID
AND DEM.ORGANIZATION_ID = MSIA.ORGANIZATION_ID
AND DEM.USING_ASSEMBLY_ITEM_ID = MSIA.INVENTORY_ITEM_ID AND((DEM.INVENTORY_ITEM_ID != DEM.USING_ASSEMBLY_ITEM_ID
AND MSIA.BOM_ITEM_TYPE = 5) OR(DEM.INVENTORY_ITEM_ID = DEM.USING_ASSEMBLY_ITEM_ID))
AND MSI.SR_INSTANCE_ID = DEM.SR_INSTANCE_ID
AND MSI.PLAN_ID = -1
AND MSI.ORGANIZATION_ID = DEM.ORGANIZATION_ID
AND MSI.INVENTORY_ITEM_ID = DEM.INVENTORY_ITEM_ID
AND MSI.MRP_PLANNING_CODE <> 6
AND MTP.PARTNER_TYPE = 3
AND MTP.SR_TP_ID = MSI.ORGANIZATION_ID
AND NVL(MTP.COMPANY_ID
, -1) = -1
AND MTP.SR_INSTANCE_ID = MSI.SR_INSTANCE_ID
AND DEM.ORIGINATION_TYPE IN (6
, 30)
AND NVL(DEM.SOURCE_ORGANIZATION_ID
, -23453) <> -23453
AND NVL(DEM.QUANTITY_BY_DUE_DATE
, 0) != 0 UNION ALL SELECT PLANS.PLAN_ID PLAN_ID
, PLANS.COMPILE_DESIGNATOR SUPPLY_PLAN
, MSI.ITEM_NAME ITEM_CODE
, MTP.ORGANIZATION_CODE ORG_CODE
, (DEM.USING_REQUIREMENT_QUANTITY -NVL(DEM.QUANTITY_BY_DUE_DATE
, 0)) QUANTITY
, TRUNC(DEM.DMD_SATISFIED_DATE) SDATE
FROM MSC_DEMANDS DEM
, MSC_PLANS PLANS
, MSC_TRADING_PARTNERS MTP
, MSC_SYSTEM_ITEMS MSI
, MSC_SYSTEM_ITEMS MSIA
WHERE DEM.PLAN_ID = PLANS.PLAN_ID
AND PLANS.PLAN_ID <> -1
AND DEM.PLAN_ID = MSIA.PLAN_ID
AND DEM.SR_INSTANCE_ID = MSIA.SR_INSTANCE_ID
AND DEM.ORGANIZATION_ID = MSIA.ORGANIZATION_ID
AND DEM.USING_ASSEMBLY_ITEM_ID = MSIA.INVENTORY_ITEM_ID AND((DEM.INVENTORY_ITEM_ID != DEM.USING_ASSEMBLY_ITEM_ID
AND MSIA.BOM_ITEM_TYPE = 5) OR(DEM.INVENTORY_ITEM_ID = DEM.USING_ASSEMBLY_ITEM_ID))
AND MSI.SR_INSTANCE_ID = DEM.SR_INSTANCE_ID
AND MSI.PLAN_ID = -1
AND MSI.ORGANIZATION_ID = DEM.ORGANIZATION_ID
AND MSI.INVENTORY_ITEM_ID = DEM.INVENTORY_ITEM_ID
AND MSI.MRP_PLANNING_CODE <> 6
AND MTP.PARTNER_TYPE = 3
AND MTP.SR_TP_ID = MSI.ORGANIZATION_ID
AND NVL(MTP.COMPANY_ID
, -1) = -1
AND MTP.SR_INSTANCE_ID = MSI.SR_INSTANCE_ID
AND DEM.ORIGINATION_TYPE IN (6
, 30)
AND NVL(DEM.SOURCE_ORGANIZATION_ID
, -23453) <> -23453
AND (DEM.USING_REQUIREMENT_QUANTITY -NVL(DEM.QUANTITY_BY_DUE_DATE
, 0) != 0)