[Home] [Help]
6011: -- initialize API return status to success
6012: x_return_status := FND_API.G_RET_STS_SUCCESS;
6013:
6014: IF p_type = Demand_Priority THEN
6015: INSERT INTO MRP_ATP_DETAILS_TEMP
6016: (session_id, atp_level, inventory_item_id, organization_id, identifier1, identifier3,
6017: supply_demand_type, supply_demand_date, supply_demand_quantity, supply_demand_source_type,
6018: allocated_quantity, record_type, scenario_id, disposition_name, demand_class, char1,
6019: uom_code, plan_id, inventory_item_name, organization_code,
6157: AND SA.CUSTOMER_ID = MTP.PARTNER_ID(+) --bug3684383
6158: );
6159:
6160: ELSIF p_type = User_Defined_DC THEN
6161: INSERT INTO MRP_ATP_DETAILS_TEMP
6162: (session_id, atp_level, inventory_item_id, organization_id, identifier1, identifier3,
6163: supply_demand_type, supply_demand_date, supply_demand_quantity, supply_demand_source_type,
6164: allocated_quantity, record_type, scenario_id, disposition_name, demand_class, uom_code,
6165: inventory_item_name, organization_code, identifier2, identifier4, request_item_id,
6756: TRUNC(SA.SUPPLY_DATE))
6757: AND TRUNC(SA.SUPPLY_DATE) < NVL(p_itf, TRUNC(SA.SUPPLY_DATE) + 1)
6758: );
6759: ELSIF p_type = User_Defined_CC THEN
6760: INSERT INTO MRP_ATP_DETAILS_TEMP
6761: (session_id, atp_level, inventory_item_id, organization_id, identifier1, identifier3,
6762: supply_demand_type, supply_demand_date, supply_demand_quantity, supply_demand_source_type,
6763: allocated_quantity, record_type, scenario_id, disposition_name, demand_class, class, customer_id,
6764: customer_site_id, uom_code, inventory_item_name, organization_code, identifier2, identifier4,
7318: FROM msc_alloc_demands
7319: WHERE (demand_class, parent_demand_id) in
7320: (SELECT demand_class,
7321: identifier3
7322: FROM mrp_atp_details_temp
7323: WHERE session_id = p_session_id
7324: AND supply_demand_type = 1
7325: AND record_type = 2)
7326: AND plan_id = p_plan_id
7328: demand_class,
7329: parent_demand_id
7330: );
7331:
7332: /* Now update original demand qtys in mrp_atp_details_temp table*/
7333: UPDATE mrp_atp_details_temp madt
7334: SET madt.original_demand_quantity =
7335: (select -1*mat.supply_demand_quantity
7336: from msc_alloc_temp mat
7329: parent_demand_id
7330: );
7331:
7332: /* Now update original demand qtys in mrp_atp_details_temp table*/
7333: UPDATE mrp_atp_details_temp madt
7334: SET madt.original_demand_quantity =
7335: (select -1*mat.supply_demand_quantity
7336: from msc_alloc_temp mat
7337: where mat.demand_class = madt.demand_class
8088: END Get_Unalloc_Data_From_Sd_Temp;
8089:
8090: /*--Get_Period_From_Details_Temp--------------------------------------------
8091: | o Called from Compute_Allocation_Details in time phased pf scenarios.
8092: | o This function returns the period data from mrp_atp_details_temp.
8093: +-------------------------------------------------------------------------*/
8094: PROCEDURE Get_Period_From_Details_Temp(
8095: p_type IN INTEGER,
8096: p_inv_item_id IN NUMBER,
8172: 0) col6, -- Total Demand
8173: DECODE(SUPPLY_DEMAND_TYPE, 1, ALLOCATED_QUANTITY, 0) col7, -- Total Bucketed Demand
8174: ALLOCATED_QUANTITY col8 -- Period Quantity
8175: FROM
8176: MRP_ATP_DETAILS_TEMP
8177: WHERE
8178: SESSION_ID = p_session_id
8179: AND RECORD_TYPE = p_record_type
8180:
8188: ORIGINAL_DEMAND_QUANTITY col6, -- Total Demand
8189: 0 col7, -- Total Bucketed Demand
8190: 0 col8 -- Period Quantity
8191: FROM
8192: MRP_ATP_DETAILS_TEMP
8193: WHERE
8194: SESSION_ID = p_session_id
8195: AND RECORD_TYPE = p_record_type
8196: AND SUPPLY_DEMAND_TYPE = 1
8277: 0) col9, -- Unallocated Demand
8278: DECODE(SUPPLY_DEMAND_TYPE, 1, UNALLOCATED_QUANTITY, 0) col10, -- Unallocated Bucketed Demand
8279: UNALLOCATED_QUANTITY col11, -- Unallocated Net
8280: IDENTIFIER4 col12
8281: FROM MRP_ATP_DETAILS_TEMP
8282: WHERE SESSION_ID = p_session_id
8283: AND RECORD_TYPE = p_record_type
8284:
8285: UNION ALL
8296: 0 col10,
8297: 0 col11,
8298: IDENTIFIER4 col12
8299: FROM
8300: MRP_ATP_DETAILS_TEMP
8301: WHERE
8302: SESSION_ID = p_session_id
8303: AND RECORD_TYPE = p_record_type
8304: AND SUPPLY_DEMAND_TYPE = 1
8398: 0) col12, -- Unallocated Demand
8399: DECODE(SUPPLY_DEMAND_TYPE, 1, UNALLOCATED_QUANTITY, 0) col13, -- Unallocated Bucketed Demand
8400: UNALLOCATED_QUANTITY col14, -- Unallocated Net
8401: CUSTOMER_SITE_ID col15
8402: FROM MRP_ATP_DETAILS_TEMP
8403: WHERE SESSION_ID = p_session_id
8404: AND RECORD_TYPE = p_record_type
8405:
8406: UNION ALL
8420: 0 col13,
8421: 0 col14,
8422: CUSTOMER_SITE_ID col15
8423: FROM
8424: MRP_ATP_DETAILS_TEMP
8425: WHERE
8426: SESSION_ID = p_session_id
8427: AND RECORD_TYPE = p_record_type
8428: AND SUPPLY_DEMAND_TYPE = 1