233: msc_sch_wb.atp_debug('Add_PF_Bucketed_Demands: ' || 'demand_source_type = ' ||p_atp_rec.demand_source_type);--cmro
234: END IF;
235:
236: -- Initializing API return code
237: x_return_status := FND_API.G_RET_STS_SUCCESS;
238:
239: l_req_date := p_atp_rec.requested_ship_date;
240: l_atf_date := p_atp_rec.atf_date;
241: l_req_qty := nvl(p_atp_rec.quantity_ordered, 0);
261: l_bucketed_demands_rec,
262: l_return_status
263: );
264:
265: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
266: IF PG_DEBUG in ('Y', 'C') THEN
267: msc_sch_wb.atp_debug('Add_PF_Bucketed_Demands: ' || 'Error occured in procedure Calc_Bucketed_Demands_Info');
268: END IF;
269: x_return_status := FND_API.G_RET_STS_ERROR;
265: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
266: IF PG_DEBUG in ('Y', 'C') THEN
267: msc_sch_wb.atp_debug('Add_PF_Bucketed_Demands: ' || 'Error occured in procedure Calc_Bucketed_Demands_Info');
268: END IF;
269: x_return_status := FND_API.G_RET_STS_ERROR;
270: return;
271: END IF;
272:
273: IF l_bucketed_demands_rec.insert_mem_bd = 'Y' and l_bucketed_demands_rec.mem_bd_qty > 0 THEN
281: member, -- member item bd
282: p_refresh_number,
283: l_return_status
284: );
285: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
286: IF PG_DEBUG in ('Y', 'C') THEN
287: msc_sch_wb.atp_debug('Add_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
288: END IF;
289: x_return_status := FND_API.G_RET_STS_ERROR;
285: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
286: IF PG_DEBUG in ('Y', 'C') THEN
287: msc_sch_wb.atp_debug('Add_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
288: END IF;
289: x_return_status := FND_API.G_RET_STS_ERROR;
290: return;
291: END IF;
292: END IF;
293:
302: family, -- family item bd
303: p_refresh_number,
304: l_return_status
305: );
306: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
307: IF PG_DEBUG in ('Y', 'C') THEN
308: msc_sch_wb.atp_debug('Add_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
309: END IF;
310: x_return_status := FND_API.G_RET_STS_ERROR;
306: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
307: IF PG_DEBUG in ('Y', 'C') THEN
308: msc_sch_wb.atp_debug('Add_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
309: END IF;
310: x_return_status := FND_API.G_RET_STS_ERROR;
311: return;
312: END IF;
313: END IF;
314:
320: WHEN OTHERS THEN
321: IF PG_DEBUG in ('Y', 'C') THEN
322: msc_sch_wb.atp_debug('Add_PF_Bucketed_Demands: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
323: END IF;
324: x_return_status := FND_API.G_RET_STS_ERROR;
325:
326: END Add_PF_Bucketed_Demands;
327:
328: /*--Calc_Bucketed_Demands_Info----------------------------------------------
349: msc_sch_wb.atp_debug('Calc_Bucketed_Demands_Info: ' || 'ATF Date Qty = ' ||to_char(p_atf_date_qty));
350: END IF;
351:
352: -- Initializing API return code
353: x_return_status := FND_API.G_RET_STS_SUCCESS;
354:
355: IF p_req_date <= p_atf_date THEN
356: IF (p_req_date_qty >= p_req_qty) OR (p_atf_date_qty >= p_req_qty) THEN
357: /* Request is satisfied using member item's supply within ATF.
447: WHEN OTHERS THEN
448: IF PG_DEBUG in ('Y', 'C') THEN
449: msc_sch_wb.atp_debug('Calc_Bucketed_Demands_Info: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
450: END IF;
451: x_return_status := FND_API.G_RET_STS_ERROR;
452:
453: END Calc_Bucketed_Demands_Info;
454:
455: /*--Update_PF_Bucketed_Demands----------------------------------------------
482: msc_sch_wb.atp_debug('Update_PF_Bucketed_Demands: ' || 'p_new_demand_date_qty = ' ||to_char(p_new_demand_date_qty));
483: END IF;
484:
485: -- Initializing API return code
486: x_return_status := FND_API.G_RET_STS_SUCCESS;
487:
488: IF p_demand_date <= p_atf_date THEN
489: l_update_mem_bd := 'Y';
490: l_mem_bd_qty := p_new_demand_date_qty;
546: WHEN OTHERS THEN
547: IF PG_DEBUG in ('Y', 'C') THEN
548: msc_sch_wb.atp_debug('Update_PF_Bucketed_Demands: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
549: END IF;
550: x_return_status := FND_API.G_RET_STS_ERROR;
551:
552: END Update_PF_Bucketed_Demands;
553:
554: /*--Increment_Bucketed_Demands_Qty------------------------------------------
582: msc_sch_wb.atp_debug('Increment_Bucketed_Demands_Qty: ' || 'p_parent_demand_id = ' ||to_char(p_parent_demand_id));
583: END IF;
584:
585: -- Initializing API return code
586: x_return_status := FND_API.G_RET_STS_SUCCESS;
587:
588: l_req_date := p_atp_rec.requested_ship_date;
589: l_atf_date := p_atp_rec.atf_date;
590: l_req_qty := nvl(p_atp_rec.quantity_ordered, 0);
610: l_bucketed_demands_rec,
611: l_return_status
612: );
613:
614: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
615: IF PG_DEBUG in ('Y', 'C') THEN
616: msc_sch_wb.atp_debug('Increment_Bucketed_Demands_Qty: ' || 'Error occured in procedure Calc_Bucketed_Demands_Info');
617: END IF;
618: x_return_status := FND_API.G_RET_STS_ERROR;
614: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
615: IF PG_DEBUG in ('Y', 'C') THEN
616: msc_sch_wb.atp_debug('Increment_Bucketed_Demands_Qty: ' || 'Error occured in procedure Calc_Bucketed_Demands_Info');
617: END IF;
618: x_return_status := FND_API.G_RET_STS_ERROR;
619: return;
620: END IF;
621:
622: IF nvl(l_bucketed_demands_rec.mem_bd_qty, 0) = 0 THEN
653: member, -- member item bd
654: p_atp_rec.refresh_number,
655: l_return_status
656: );
657: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
658: IF PG_DEBUG in ('Y', 'C') THEN
659: msc_sch_wb.atp_debug('Increment_Bucketed_Demands_Qty: ' || 'Error occured in procedure Insert_Bucketed_Demand');
660: END IF;
661: x_return_status := FND_API.G_RET_STS_ERROR;
657: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
658: IF PG_DEBUG in ('Y', 'C') THEN
659: msc_sch_wb.atp_debug('Increment_Bucketed_Demands_Qty: ' || 'Error occured in procedure Insert_Bucketed_Demand');
660: END IF;
661: x_return_status := FND_API.G_RET_STS_ERROR;
662: return;
663: END IF;
664: END IF;
665: END IF;
698: family, -- family item bd
699: p_atp_rec.refresh_number,
700: l_return_status
701: );
702: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
703: IF PG_DEBUG in ('Y', 'C') THEN
704: msc_sch_wb.atp_debug('Increment_Bucketed_Demands_Qty: ' || 'Error occured in procedure Insert_Bucketed_Demand');
705: END IF;
706: x_return_status := FND_API.G_RET_STS_ERROR;
702: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
703: IF PG_DEBUG in ('Y', 'C') THEN
704: msc_sch_wb.atp_debug('Increment_Bucketed_Demands_Qty: ' || 'Error occured in procedure Insert_Bucketed_Demand');
705: END IF;
706: x_return_status := FND_API.G_RET_STS_ERROR;
707: return;
708: END IF;
709: END IF;
710: END IF;
717: WHEN OTHERS THEN
718: IF PG_DEBUG in ('Y', 'C') THEN
719: msc_sch_wb.atp_debug('Increment_Bucketed_Demands_Qty: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
720: END IF;
721: x_return_status := FND_API.G_RET_STS_ERROR;
722:
723: END Increment_Bucketed_Demands_Qty;
724:
725: /*--Move_PF_Bucketed_Demands------------------------------------------------
767: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'p_atf_date_qty = ' ||to_char(p_atf_date_qty));
768: END IF;
769:
770: -- Initializing API return code
771: x_return_status := FND_API.G_RET_STS_SUCCESS;
772:
773: --bug3555084 start
774: IF p_parent_demand_id is not null THEN
775: IF upper(p_atp_rec.override_flag) = 'Y' THEN
924: member, -- member item bd
925: l_atp_rec.refresh_number,
926: l_return_status
927: );
928: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
929: IF PG_DEBUG in ('Y', 'C') THEN
930: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
931: END IF;
932: x_return_status := FND_API.G_RET_STS_ERROR;
928: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
929: IF PG_DEBUG in ('Y', 'C') THEN
930: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
931: END IF;
932: x_return_status := FND_API.G_RET_STS_ERROR;
933: return;
934: END IF;
935: END IF;
936: END IF;
965: family, -- family item bd
966: l_atp_rec.refresh_number,
967: l_return_status
968: );
969: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
970: IF PG_DEBUG in ('Y', 'C') THEN
971: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
972: END IF;
973: x_return_status := FND_API.G_RET_STS_ERROR;
969: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
970: IF PG_DEBUG in ('Y', 'C') THEN
971: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
972: END IF;
973: x_return_status := FND_API.G_RET_STS_ERROR;
974: return;
975: END IF;
976: END IF;
977: END IF;
984: p_new_demand_date,
985: p_atf_date,
986: l_return_status
987: );
988: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
989: IF PG_DEBUG in ('Y', 'C') THEN
990: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Move_PF_Bd_Dates');
991: END IF;
992: x_return_status := FND_API.G_RET_STS_ERROR;
988: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
989: IF PG_DEBUG in ('Y', 'C') THEN
990: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Move_PF_Bd_Dates');
991: END IF;
992: x_return_status := FND_API.G_RET_STS_ERROR;
993: return;
994: END IF;
995: ELSE
996: l_demand_qty := p_demand_qty - nvl(p_bkwd_pass_atf_date_qty,0); --bug3397904
1087: member, -- member item bd
1088: l_atp_rec.refresh_number,
1089: l_return_status
1090: );
1091: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1092: IF PG_DEBUG in ('Y', 'C') THEN
1093: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
1094: END IF;
1095: x_return_status := FND_API.G_RET_STS_ERROR;
1091: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1092: IF PG_DEBUG in ('Y', 'C') THEN
1093: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
1094: END IF;
1095: x_return_status := FND_API.G_RET_STS_ERROR;
1096: return;
1097: END IF;
1098: END IF;
1099: ELSIF l_update_mem_bd = 'D' THEN
1134: family, -- family item bd
1135: l_atp_rec.refresh_number,
1136: l_return_status
1137: );
1138: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1139: IF PG_DEBUG in ('Y', 'C') THEN
1140: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
1141: END IF;
1142: x_return_status := FND_API.G_RET_STS_ERROR;
1138: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1139: IF PG_DEBUG in ('Y', 'C') THEN
1140: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occured in procedure Insert_Bucketed_Demand');
1141: END IF;
1142: x_return_status := FND_API.G_RET_STS_ERROR;
1143: return;
1144: END IF;
1145: END IF;
1146: END IF;
1154: WHEN OTHERS THEN
1155: IF PG_DEBUG in ('Y', 'C') THEN
1156: msc_sch_wb.atp_debug('Move_PF_Bucketed_Demands: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
1157: END IF;
1158: x_return_status := FND_API.G_RET_STS_ERROR;
1159:
1160: END Move_PF_Bucketed_Demands;
1161:
1162: /*--Move_PF_Bd_Dates--------------------------------------------------------
1177: msc_sch_wb.atp_debug('*********Begin procedure Move_PF_Bd_Dates ********');
1178: END IF;
1179:
1180: -- Initializing API return code
1181: x_return_status := FND_API.G_RET_STS_SUCCESS;
1182:
1183: IF (p_old_demand_date < p_atf_date) and (p_new_demand_date <= p_atf_date) THEN
1184: update msc_alloc_demands
1185: --bug3697365 added timestamp also
1228: WHEN OTHERS THEN
1229: IF PG_DEBUG in ('Y', 'C') THEN
1230: msc_sch_wb.atp_debug('Move_PF_Bd_Dates: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
1231: END IF;
1232: x_return_status := FND_API.G_RET_STS_ERROR;
1233:
1234: END Move_PF_Bd_Dates;
1235:
1236: /*--Insert_Bucketed_Demand--------------------------------------------------
1256: msc_sch_wb.atp_debug('*********Begin procedure Insert_Bucketed_Demand ********');
1257: END IF;
1258:
1259: -- Initializing API return code
1260: x_return_status := FND_API.G_RET_STS_SUCCESS;
1261:
1262: INSERT INTO MSC_ALLOC_DEMANDS(
1263: PLAN_ID,
1264: INVENTORY_ITEM_ID,
1325: WHEN OTHERS THEN
1326: IF PG_DEBUG in ('Y', 'C') THEN
1327: msc_sch_wb.atp_debug('Insert_Bucketed_Demand: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
1328: END IF;
1329: x_return_status := FND_API.G_RET_STS_ERROR;
1330:
1331: END Insert_Bucketed_Demand;
1332:
1333: /*--Find_PF_Bucketed_Demands--------------------------------------------------
1349: msc_sch_wb.atp_debug('Find_PF_Bucketed_Demands: ' || 'p_parent_demand_id = ' ||to_char(p_parent_demand_id));
1350: END IF;
1351:
1352: -- Initializing API return code
1353: x_return_status := FND_API.G_RET_STS_SUCCESS;
1354:
1355: BEGIN
1356: SELECT allocated_quantity,
1357: demand_date
1398: WHEN OTHERS THEN
1399: IF PG_DEBUG in ('Y', 'C') THEN
1400: msc_sch_wb.atp_debug('Find_PF_Bucketed_Demands: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
1401: END IF;
1402: x_return_status := FND_API.G_RET_STS_ERROR;
1403:
1404: END Find_PF_Bucketed_Demands;
1405:
1406: /*--Add_PF_Rollup_Supplies--------------------------------------------------
1431: msc_sch_wb.atp_debug('*********Begin procedure Add_PF_Rollup_Supplies ********');
1432: END IF;
1433:
1434: -- Initializing API return code
1435: x_return_status := FND_API.G_RET_STS_SUCCESS;
1436:
1437: IF p_schedule_date <= p_atf_date THEN
1438: INSERT INTO MSC_ALLOC_SUPPLIES(
1439: PLAN_ID,
1546: WHEN OTHERS THEN
1547: IF PG_DEBUG in ('Y', 'C') THEN
1548: msc_sch_wb.atp_debug('Add_PF_Rollup_Supplies: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
1549: END IF;
1550: x_return_status := FND_API.G_RET_STS_ERROR;
1551:
1552: END Add_PF_Rollup_Supplies;
1553:
1554: /*--Update_PF_Rollup_Supplies----------------------------------------------
1581: msc_sch_wb.atp_debug('Update_PF_Rollup_Supplies: ' || 'p_atf_date ='||to_char(p_atf_date));
1582: END IF;
1583:
1584: -- Initializing API return code
1585: x_return_status := FND_API.G_RET_STS_SUCCESS;
1586:
1587: IF p_date is NULL THEN
1588: UPDATE msc_alloc_supplies
1589: SET old_supply_date = supply_date, -- why do we populate old_supply_date and qty??
1628: WHEN OTHERS THEN
1629: IF PG_DEBUG in ('Y', 'C') THEN
1630: msc_sch_wb.atp_debug('Update_PF_Rollup_Supplies: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
1631: END IF;
1632: x_return_status := FND_API.G_RET_STS_ERROR;
1633:
1634: END Update_PF_Rollup_Supplies;
1635:
1636: /*--Add_PF_Stealing_Supply_Details------------------------------------------
1681: msc_sch_wb.atp_debug('Add_PF_Stealing_Supply_Details: ' || 'p_atf_date = ' ||to_char(p_atf_date));
1682: END IF;
1683:
1684: -- Initializing API return code
1685: x_return_status := FND_API.G_RET_STS_SUCCESS;
1686:
1687: IF (p_ship_date > p_atf_date) THEN
1688: l_mem_stealing_rec_date := p_atf_date;
1689: l_pf_stealing_rec_date := p_ship_date;
1829: WHEN OTHERS THEN
1830: IF PG_DEBUG in ('Y', 'C') THEN
1831: msc_sch_wb.atp_debug('Add_PF_Stealing_Supply_Details: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
1832: END IF;
1833: x_return_status := FND_API.G_RET_STS_ERROR;
1834:
1835: END Add_PF_Stealing_Supply_Details;
1836:
1837: /*--Get_Mat_Avail_Pf--------------------------------------------------------
1869: msc_sch_wb.atp_debug('Begin Get_Mat_Avail_Pf');
1870: END IF;
1871:
1872: -- Initializing API return code
1873: x_return_status := FND_API.G_RET_STS_SUCCESS;
1874:
1875: IF MSC_ATP_PVT.G_INV_CTP = 5 THEN
1876: -- ODS atp
1877: IF p_summary_flag = 'Y' THEN
1888: x_atp_dates,
1889: x_atp_qtys,
1890: l_return_status
1891: );
1892: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1893: IF PG_DEBUG in ('Y', 'C') THEN
1894: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Ods_Summ');
1895: END IF;
1896: x_return_status := FND_API.G_RET_STS_ERROR;
1892: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1893: IF PG_DEBUG in ('Y', 'C') THEN
1894: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Ods_Summ');
1895: END IF;
1896: x_return_status := FND_API.G_RET_STS_ERROR;
1897: return;
1898: END IF;
1899: ELSE
1900: -- ODS atp
1913: x_atp_dates,
1914: x_atp_qtys,
1915: l_return_status
1916: );
1917: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1918: IF PG_DEBUG in ('Y', 'C') THEN
1919: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Ods');
1920: END IF;
1921: x_return_status := FND_API.G_RET_STS_ERROR;
1917: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1918: IF PG_DEBUG in ('Y', 'C') THEN
1919: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Ods');
1920: END IF;
1921: x_return_status := FND_API.G_RET_STS_ERROR;
1922: return;
1923: END IF;
1924: END IF;
1925: ELSE
1936: x_atp_dates,
1937: x_atp_qtys,
1938: l_return_status
1939: );
1940: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1941: IF PG_DEBUG in ('Y', 'C') THEN
1942: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Pds_Summ');
1943: END IF;
1944: x_return_status := FND_API.G_RET_STS_ERROR;
1940: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1941: IF PG_DEBUG in ('Y', 'C') THEN
1942: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Pds_Summ');
1943: END IF;
1944: x_return_status := FND_API.G_RET_STS_ERROR;
1945: return;
1946: END IF;
1947: ELSE
1948: Get_Mat_Avail_Pf_Pds(
1955: x_atp_dates,
1956: x_atp_qtys,
1957: l_return_status
1958: );
1959: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1960: IF PG_DEBUG in ('Y', 'C') THEN
1961: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Pds');
1962: END IF;
1963: x_return_status := FND_API.G_RET_STS_ERROR;
1959: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1960: IF PG_DEBUG in ('Y', 'C') THEN
1961: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Pds');
1962: END IF;
1963: x_return_status := FND_API.G_RET_STS_ERROR;
1964: return;
1965: END IF;
1966: END IF; -- summary atp
1967: END IF; -- ODS/PDS
1969: WHEN OTHERS THEN
1970: IF PG_DEBUG in ('Y', 'C') THEN
1971: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
1972: END IF;
1973: x_return_status := FND_API.G_RET_STS_ERROR;
1974:
1975: END Get_Mat_Avail_Pf;
1976:
1977: /*--Get_Mat_Avail_Pf_Dtls---------------------------------------------------
2004: msc_sch_wb.atp_debug('Begin Get_Mat_Avail_Pf_Dtls');
2005: END IF;
2006:
2007: -- Initializing API return code
2008: x_return_status := FND_API.G_RET_STS_SUCCESS;
2009:
2010: IF MSC_ATP_PVT.G_INV_CTP = 5 THEN
2011: -- ODS atp
2012: Get_Mat_Avail_Pf_Ods_Dtls(
2026: p_scenario_id,
2027: p_identifier,
2028: l_return_status
2029: );
2030: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2031: IF PG_DEBUG in ('Y', 'C') THEN
2032: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Dtls: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Ods_Dtls');
2033: END IF;
2034: x_return_status := FND_API.G_RET_STS_ERROR;
2030: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2031: IF PG_DEBUG in ('Y', 'C') THEN
2032: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Dtls: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Ods_Dtls');
2033: END IF;
2034: x_return_status := FND_API.G_RET_STS_ERROR;
2035: return;
2036: END IF;
2037: ELSE
2038: Get_Mat_Avail_Pf_Pds_Dtls(
2046: p_scenario_id,
2047: p_identifier,
2048: l_return_status
2049: );
2050: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2051: IF PG_DEBUG in ('Y', 'C') THEN
2052: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Dtls: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Pds_Dtls');
2053: END IF;
2054: x_return_status := FND_API.G_RET_STS_ERROR;
2050: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2051: IF PG_DEBUG in ('Y', 'C') THEN
2052: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Dtls: ' || 'Error occured in procedure Get_Mat_Avail_Pf_Pds_Dtls');
2053: END IF;
2054: x_return_status := FND_API.G_RET_STS_ERROR;
2055: return;
2056: END IF;
2057: END IF; -- ODS/PDS
2058: EXCEPTION
2059: WHEN OTHERS THEN
2060: IF PG_DEBUG in ('Y', 'C') THEN
2061: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Dtls: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
2062: END IF;
2063: x_return_status := FND_API.G_RET_STS_ERROR;
2064:
2065: END Get_Mat_Avail_Pf_Dtls;
2066:
2067: /*--Get_Mat_Avail_Pf_Ods_Summ-----------------------------------------------
2086: msc_sch_wb.atp_debug('Begin Get_Mat_Avail_Pf_Ods_Summ');
2087: END IF;
2088:
2089: -- Initializing API return code
2090: x_return_status := FND_API.G_RET_STS_SUCCESS;
2091:
2092: -- in summary approach we store sales ordrers for requested item while
2093: -- demands and supplies are stored on PF level
2094: SELECT SD_DATE, sum(SD_QTY)
2153: WHEN OTHERS THEN
2154: IF PG_DEBUG in ('Y', 'C') THEN
2155: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Ods_Summ: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
2156: END IF;
2157: x_return_status := FND_API.G_RET_STS_ERROR;
2158:
2159: END Get_Mat_Avail_Pf_Ods_Summ;
2160:
2161: /*--Get_Mat_Avail_Pf_Ods----------------------------------------------------
2185: msc_sch_wb.atp_debug('Begin Get_Mat_Avail_Pf_Ods');
2186: END IF;
2187:
2188: -- Initializing API return code
2189: x_return_status := FND_API.G_RET_STS_SUCCESS;
2190:
2191: -- SQL Query changes Begin 2640489
2192: SELECT SD_DATE, SUM(SD_QTY)
2193: BULK COLLECT INTO x_atp_dates, x_atp_qtys
2417: WHEN OTHERS THEN
2418: IF PG_DEBUG in ('Y', 'C') THEN
2419: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Ods: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
2420: END IF;
2421: x_return_status := FND_API.G_RET_STS_ERROR;
2422:
2423: END Get_Mat_Avail_Pf_Ods;
2424:
2425: /*--Get_Mat_Avail_Pf_Pds_Summ----------------------------------------------------
2451: msc_sch_wb.atp_debug('Begin Get_Mat_Avail_Pf_Pds_Summ');
2452: END IF;
2453:
2454: -- Initializing API return code
2455: x_return_status := FND_API.G_RET_STS_SUCCESS;
2456:
2457: SELECT SD_DATE, SUM(SD_QTY)
2458: BULK COLLECT INTO x_atp_dates, x_atp_qtys
2459: FROM (
2523: WHEN OTHERS THEN
2524: IF PG_DEBUG in ('Y', 'C') THEN
2525: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Pds_Summ: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
2526: END IF;
2527: x_return_status := FND_API.G_RET_STS_ERROR;
2528:
2529: END Get_Mat_Avail_Pf_Pds_Summ;
2530:
2531: /*--Get_Mat_Avail_Pf_Pds---------------------------------------------------------
2555: msc_sch_wb.atp_debug('Begin Get_Mat_Avail_Pf_Pds');
2556: END IF;
2557:
2558: -- Initializing API return code
2559: x_return_status := FND_API.G_RET_STS_SUCCESS;
2560:
2561: SELECT SD_DATE, SUM(SD_QTY)
2562: BULK COLLECT INTO x_atp_dates, x_atp_qtys
2563: FROM (
2607: WHEN OTHERS THEN
2608: IF PG_DEBUG in ('Y', 'C') THEN
2609: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Pds: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
2610: END IF;
2611: x_return_status := FND_API.G_RET_STS_ERROR;
2612:
2613: END Get_Mat_Avail_Pf_Pds;
2614:
2615: /*--Get_Mat_Avail_Pf_Ods_Dtls-----------------------------------------------
2643: msc_sch_wb.atp_debug('Begin Get_Mat_Avail_Pf_Ods_Dtls');
2644: END IF;
2645:
2646: -- Initializing API return code
2647: x_return_status := FND_API.G_RET_STS_SUCCESS;
2648:
2649: INSERT INTO msc_atp_sd_details_temp (
2650: ATP_Level,
2651: Order_line_id,
3052: WHEN OTHERS THEN
3053: IF PG_DEBUG in ('Y', 'C') THEN
3054: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Ods_Dtls: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
3055: END IF;
3056: x_return_status := FND_API.G_RET_STS_ERROR;
3057:
3058: END Get_Mat_Avail_Pf_Ods_Dtls;
3059:
3060: /*--Get_Mat_Avail_Pf_Pds_Dtls-----------------------------------------------------------
3094: msc_sch_wb.atp_debug('Begin Get_Mat_Avail_Pf_Pds_Dtls');
3095: END IF;
3096:
3097: -- Initializing API return code
3098: x_return_status := FND_API.G_RET_STS_SUCCESS;
3099:
3100: INSERT INTO msc_atp_sd_details_temp (
3101: ATP_Level,
3102: Order_line_id,
3294: WHEN OTHERS THEN
3295: IF PG_DEBUG in ('Y', 'C') THEN
3296: msc_sch_wb.atp_debug('Get_Mat_Avail_Pf_Pds_Dtls: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
3297: END IF;
3298: x_return_status := FND_API.G_RET_STS_ERROR;
3299:
3300: END Get_Mat_Avail_Pf_Pds_Dtls;
3301:
3302: /*--Set_Alloc_Rule_Variables------------------------------------------------------
3328: msc_sch_wb.atp_debug('Set_Alloc_Rule_Variables: G_HIERARCHY_PROFILE: ' || MSC_AATP_PVT.G_HIERARCHY_PROFILE);
3329: END IF;
3330:
3331: -- Initializing API return code
3332: x_return_status := FND_API.G_RET_STS_SUCCESS;
3333:
3334: IF MSC_ATP_PVT.G_ALLOCATION_METHOD = 1 THEN
3335: /* Demand priority allocated ATP
3336: Here we always use allocation rule from family inside/outside ATF
3420: WHEN OTHERS THEN
3421: IF PG_DEBUG in ('Y', 'C') THEN
3422: msc_sch_wb.atp_debug('Set_Alloc_Rule_Variables: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
3423: END IF;
3424: x_return_status := FND_API.G_RET_STS_ERROR;
3425:
3426: END Set_Alloc_Rule_Variables;
3427:
3428: /*--Item_Alloc_Avail_Pf-----------------------------------------------------------
3465: msc_sch_wb.atp_debug('Item_Alloc_Avail_Pf: p_level_id: ' || p_level_id);
3466: END IF;
3467:
3468: -- Initializing API return code
3469: x_return_status := FND_API.G_RET_STS_SUCCESS;
3470:
3471: SELECT SD_DATE,
3472: SUM(SD_QTY)
3473: BULK COLLECT INTO
3893: WHEN OTHERS THEN
3894: IF PG_DEBUG in ('Y', 'C') THEN
3895: msc_sch_wb.atp_debug('Item_Alloc_Avail_Pf: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
3896: END IF;
3897: x_return_status := FND_API.G_RET_STS_ERROR;
3898:
3899: END Item_Alloc_Avail_Pf;
3900:
3901: /*--Item_Alloc_Avail_Pf_Unalloc------------------------------------------------
3932: msc_sch_wb.atp_debug('Item_Alloc_Avail_Pf_Unalloc: p_level_id: ' || p_level_id);
3933: END IF;
3934:
3935: -- Initializing API return code
3936: x_return_status := FND_API.G_RET_STS_SUCCESS;
3937:
3938: SELECT SD_DATE,
3939: SUM(UNALLOC_SD_QTY),
3940: SUM(SD_QTY)
4364: WHEN OTHERS THEN
4365: IF PG_DEBUG in ('Y', 'C') THEN
4366: msc_sch_wb.atp_debug('Item_Alloc_Avail_Pf_Unalloc: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
4367: END IF;
4368: x_return_status := FND_API.G_RET_STS_ERROR;
4369:
4370: END Item_Alloc_Avail_Pf_Unalloc;
4371:
4372: /*--Item_Alloc_Avail_Pf_Dtls-------------------------------------------------------------
4425: msc_sch_wb.atp_debug('Item_Alloc_Avail_Pf_Dtls: p_uom_code: ' || p_uom_code);
4426: END IF;
4427:
4428: -- Initializing API return code
4429: x_return_status := FND_API.G_RET_STS_SUCCESS;
4430:
4431: INSERT INTO msc_atp_sd_details_temp (
4432: ATP_Level,
4433: Order_line_id,
5338: WHEN OTHERS THEN
5339: IF PG_DEBUG in ('Y', 'C') THEN
5340: msc_sch_wb.atp_debug('Item_Alloc_Avail_Pf_Dtls: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
5341: END IF;
5342: x_return_status := FND_API.G_RET_STS_ERROR;
5343:
5344: END Item_Alloc_Avail_Pf_Dtls;
5345:
5346: /*--Item_Prealloc_Avail_Pf--------------------------------------------------------
5370: msc_sch_wb.atp_debug('Item_Prealloc_Avail_Pf p_demand_class: ' || p_demand_class);
5371: END IF;
5372:
5373: -- Initializing API return code
5374: x_return_status := FND_API.G_RET_STS_SUCCESS;
5375:
5376: SELECT SD_DATE,
5377: SUM(SD_QTY)
5378: BULK COLLECT INTO
5413: WHEN OTHERS THEN
5414: IF PG_DEBUG in ('Y', 'C') THEN
5415: msc_sch_wb.atp_debug('Item_Prealloc_Avail_Pf: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
5416: END IF;
5417: x_return_status := FND_API.G_RET_STS_ERROR;
5418:
5419: END Item_Prealloc_Avail_Pf;
5420:
5421: /*--Item_Prealloc_Avail_Pf_Summ---------------------------------------------------
5446: msc_sch_wb.atp_debug('Item_Prealloc_Avail_Pf_Summ p_demand_class: ' || p_demand_class);
5447: END IF;
5448:
5449: -- Initializing API return code
5450: x_return_status := FND_API.G_RET_STS_SUCCESS;
5451:
5452: -- SQL changed for summary enhancement
5453: SELECT SD_DATE,
5454: SUM(SD_QTY)
5516: WHEN OTHERS THEN
5517: IF PG_DEBUG in ('Y', 'C') THEN
5518: msc_sch_wb.atp_debug('Item_Prealloc_Avail_Pf_Summ: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
5519: END IF;
5520: x_return_status := FND_API.G_RET_STS_ERROR;
5521:
5522: END Item_Prealloc_Avail_Pf_Summ;
5523:
5524: /*--Item_Prealloc_Avail_Pf_Dtls---------------------------------------------------
5557: msc_sch_wb.atp_debug('Item_Prealloc_Avail_Pf_Dtls p_demand_class: ' || p_demand_class);
5558: END IF;
5559:
5560: -- Initializing API return code
5561: x_return_status := FND_API.G_RET_STS_SUCCESS;
5562:
5563: INSERT INTO msc_atp_sd_details_temp (
5564: ATP_Level,
5565: Order_line_id,
5763: p_demand_class,
5764: l_return_status
5765: );
5766:
5767: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
5768: IF PG_DEBUG in ('Y', 'C') THEN
5769: msc_sch_wb.atp_debug('Item_Prealloc_Avail_Pf_Dtls: ' || 'Error occured in procedure Populate_Original_Demand_Qty');
5770: END IF;
5771: x_return_status := FND_API.G_RET_STS_ERROR;
5767: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
5768: IF PG_DEBUG in ('Y', 'C') THEN
5769: msc_sch_wb.atp_debug('Item_Prealloc_Avail_Pf_Dtls: ' || 'Error occured in procedure Populate_Original_Demand_Qty');
5770: END IF;
5771: x_return_status := FND_API.G_RET_STS_ERROR;
5772: return;
5773: END IF;
5774:
5775: EXCEPTION
5776: WHEN OTHERS THEN
5777: IF PG_DEBUG in ('Y', 'C') THEN
5778: msc_sch_wb.atp_debug('Item_Prealloc_Avail_Pf_Dtls: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
5779: END IF;
5780: x_return_status := FND_API.G_RET_STS_ERROR;
5781:
5782: END Item_Prealloc_Avail_Pf_Dtls;
5783:
5784: /*--Get_Forward_Mat_Pf------------------------------------------------------------
5807: msc_sch_wb.atp_debug('Get_Forward_Mat_Pf: p_plan_id: ' || p_plan_id);
5808: END IF;
5809:
5810: -- Initializing API return code
5811: x_return_status := FND_API.G_RET_STS_SUCCESS;
5812:
5813: SELECT SD_DATE,
5814: SUM(SD_QTY),
5815: DEMAND_CLASS
5866: WHEN OTHERS THEN
5867: IF PG_DEBUG in ('Y', 'C') THEN
5868: msc_sch_wb.atp_debug('Get_Forward_Mat_Pf: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
5869: END IF;
5870: x_return_status := FND_API.G_RET_STS_ERROR;
5871:
5872: END Get_Forward_Mat_Pf;
5873:
5874: /*--Get_Forward_Mat_Pf_Summ---------------------------------------------------
5898: msc_sch_wb.atp_debug('Get_Forward_Mat_Pf_Summ: p_plan_id: ' || p_plan_id);
5899: END IF;
5900:
5901: -- Initializing API return code
5902: x_return_status := FND_API.G_RET_STS_SUCCESS;
5903:
5904: -- Summary SQL can be used
5905: SELECT SD_DATE,
5906: SUM(SD_QTY),
5977: WHEN OTHERS THEN
5978: IF PG_DEBUG in ('Y', 'C') THEN
5979: msc_sch_wb.atp_debug('Get_Forward_Mat_Pf_Summ: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
5980: END IF;
5981: x_return_status := FND_API.G_RET_STS_ERROR;
5982:
5983: END Get_Forward_Mat_Pf_Summ;
5984:
5985: /*--Insert_SD_Into_Details_Temp-----------------------------------------------
6034: msc_sch_wb.atp_debug('Insert_SD_Into_Details_Temp: p_uom_code: ' || p_uom_code);
6035: END IF;
6036:
6037: -- initialize API return status to success
6038: x_return_status := FND_API.G_RET_STS_SUCCESS;
6039:
6040: IF p_type = Demand_Priority THEN
6041: INSERT INTO MRP_ATP_DETAILS_TEMP
6042: (session_id, atp_level, inventory_item_id, organization_id, identifier1, identifier3,
7298: WHEN OTHERS THEN
7299: IF PG_DEBUG in ('Y', 'C') THEN
7300: msc_sch_wb.atp_debug('Insert_SD_Into_Details_Temp: ' || 'Error code:' || to_char(sqlcode));
7301: END IF;
7302: x_return_status := FND_API.G_RET_STS_ERROR;
7303:
7304: END Insert_SD_Into_Details_Temp;
7305:
7306: /*--Populate_Original_Demand_Qty--------------------------------------------
7324: msc_sch_wb.atp_debug('Populate_Original_Demand_Qty: ' || 'p_session_id: '|| to_char(p_session_id));
7325: END IF;
7326:
7327: -- Initializing API return code
7328: x_return_status := FND_API.G_RET_STS_SUCCESS;
7329:
7330: /* Clear msc_alloc_temp before use */
7331: DELETE msc_alloc_temp;
7332:
7403: WHEN OTHERS THEN
7404: IF PG_DEBUG in ('Y', 'C') THEN
7405: msc_sch_wb.atp_debug('Populate_Original_Demand_Qty: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
7406: END IF;
7407: x_return_status := FND_API.G_RET_STS_ERROR;
7408:
7409: END Populate_Original_Demand_Qty;
7410:
7411: /*--PF_Atp_Consume----------------------------------------------------------
7447: msc_sch_wb.atp_debug('PF_Atp_Consume: ' || 'p_atf_date: '|| to_char(p_atf_date));
7448: END IF;
7449:
7450: -- Initializing API return code
7451: x_return_status := FND_API.G_RET_STS_SUCCESS;
7452:
7453: /* p_consumption_type
7454: * 1 = b/w consumption
7455: * 2 = f/w consumption
7600: WHEN OTHERS THEN
7601: IF PG_DEBUG in ('Y', 'C') THEN
7602: msc_sch_wb.atp_debug('PF_Atp_Consume: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
7603: END IF;
7604: x_return_status := FND_API.G_RET_STS_ERROR;
7605:
7606: END PF_Atp_Consume;
7607:
7608: /*--PF_Atp_Alloc_Consume-------------------------------------------------------
7634: msc_sch_wb.atp_debug('**********Begin PF_Atp_Alloc_Consume Procedure************');
7635: END IF;
7636:
7637: -- Initializing API return code
7638: x_return_status := FND_API.G_RET_STS_SUCCESS;
7639:
7640: x_dc_list_tab := MRP_ATP_PUB.Char80_Arr();
7641: x_dc_start_index := MRP_ATP_PUB.Number_Arr();
7642: x_dc_end_index := MRP_ATP_PUB.Number_Arr();
7791: WHEN OTHERS THEN
7792: IF PG_DEBUG in ('Y', 'C') THEN
7793: msc_sch_wb.atp_debug('PF_Atp_Alloc_Consume: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
7794: END IF;
7795: x_return_status := FND_API.G_RET_STS_ERROR;
7796:
7797: END PF_Atp_Alloc_Consume;
7798:
7799: /*--Get_Period_Data_From_Sd_Temp--------------------------------------------
7819: msc_sch_wb.atp_debug('PROCEDURE Get_Period_Data_From_Sd_Temp');
7820: END IF;
7821:
7822: -- Initializing API return code
7823: x_return_status := FND_API.G_RET_STS_SUCCESS;
7824:
7825: SELECT SD_View.ATP_level
7826: ,SD_View.scenario_id
7827: ,SD_View.inventory_item_id
7948: WHEN OTHERS THEN
7949: IF PG_DEBUG in ('Y', 'C') THEN
7950: msc_sch_wb.atp_debug('Get_Period_Data_From_Sd_Temp: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
7951: END IF;
7952: x_return_status := FND_API.G_RET_STS_ERROR;
7953:
7954: END Get_Period_Data_From_Sd_Temp;
7955:
7956: /*--Get_Unalloc_Data_From_Sd_Temp-------------------------------------------
7973: msc_sch_wb.atp_debug('PROCEDURE Get_Unalloc_Data_From_Sd_Temp');
7974: END IF;
7975:
7976: -- initialize API return status to success
7977: x_return_status := FND_API.G_RET_STS_SUCCESS;
7978:
7979: -- do netting for unallocated qty also
7980: SELECT SD_View.ATP_level
7981: ,SD_View.scenario_id
8108: WHEN OTHERS THEN
8109: IF PG_DEBUG in ('Y', 'C') THEN
8110: msc_sch_wb.atp_debug('Get_Unalloc_Data_From_Sd_Temp: ' || 'Error code:' || to_char(sqlcode));
8111: END IF;
8112: x_return_status := FND_API.G_RET_STS_ERROR;
8113:
8114: END Get_Unalloc_Data_From_Sd_Temp;
8115:
8116: /*--Get_Period_From_Details_Temp--------------------------------------------
8136: msc_sch_wb.atp_debug('PROCEDURE Get_Period_From_Details_Temp');
8137: END IF;
8138:
8139: -- initialize API return status to success
8140: x_return_status := FND_API.G_RET_STS_SUCCESS;
8141:
8142: IF p_type = Demand_Priority THEN
8143: SELECT
8144: final.col1,
8483: WHEN OTHERS THEN
8484: IF PG_DEBUG in ('Y', 'C') THEN
8485: msc_sch_wb.atp_debug('Get_Period_From_Details_Temp: ' || 'Error code:' || to_char(sqlcode));
8486: END IF;
8487: x_return_status := FND_API.G_RET_STS_ERROR;
8488:
8489: END Get_Period_From_Details_Temp;
8490:
8491: /*--Get_Pf_Atp_Item_Id------------------------------------------------------
8680: msc_sch_wb.atp_debug('Get_Family_Item_Info: ' || 'p_organization_id = ' ||to_char(p_organization_id));
8681: END IF;
8682:
8683: -- Initializing API return code
8684: x_return_status := FND_API.G_RET_STS_SUCCESS;
8685:
8686: SELECT DECODE(i2.bom_item_type,
8687: 5, DECODE(i2.atp_flag,
8688: 'N', i1.inventory_item_id,
8746: WHEN OTHERS THEN
8747: IF PG_DEBUG in ('Y', 'C') THEN
8748: msc_sch_wb.atp_debug('Get_Family_Item_Info: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
8749: END IF;
8750: x_return_status := FND_API.G_RET_STS_ERROR;
8751:
8752: END Get_Family_Item_Info;
8753:
8754: /*--Get_PF_Plan_Info----------------------------------------------------------
8781:
8782: END IF;
8783:
8784: -- initialize API return status to success
8785: x_return_status := FND_API.G_RET_STS_SUCCESS;
8786:
8787: /* First get member item's plan*/
8788: MSC_ATP_PROC.get_global_plan_info(
8789: p_instance_id,
8797: IF PG_DEBUG in ('Y', 'C') THEN
8798: msc_sch_wb.atp_debug('Get_PF_Plan_Info: ' || 'ATP Downtime');
8799: END IF;
8800:
8801: x_return_status := FND_API.G_RET_STS_ERROR;
8802: MSC_ATP_PVT.G_DOWNTIME_HIT := 'Y';
8803: p_error_code := MSC_ATP_PVT.PLAN_DOWN_TIME;
8804: RAISE NO_DATA_FOUND;
8805: END IF;
8855: IF PG_DEBUG in ('Y', 'C') THEN
8856: msc_sch_wb.atp_debug('Get_PF_Plan_Info: ' || 'ATP Downtime');
8857: END IF;
8858:
8859: x_return_status := FND_API.G_RET_STS_ERROR;
8860: MSC_ATP_PVT.G_DOWNTIME_HIT := 'Y';
8861: p_error_code := MSC_ATP_PVT.PLAN_DOWN_TIME;
8862: RAISE NO_DATA_FOUND;
8863: END IF;
8877: IF PG_DEBUG in ('Y', 'C') THEN
8878: msc_sch_wb.atp_debug('Get_PF_Plan_Info: ' || 'Exception: ' || sqlerrm);
8879: msc_sch_wb.atp_debug('Get_PF_Plan_Info: ' || 'Error code:' || to_char(sqlcode));
8880: END IF;
8881: x_return_status := FND_API.G_RET_STS_ERROR;
8882:
8883: END Get_PF_Plan_Info;
8884:
8885: /*--Populate_ATF_Dates--------------------------------------------------------
8909: msc_util.msc_log('Populate_ATF_Dates: ' || 'p_plan_id = ' ||to_char(p_plan_id));
8910: END IF;
8911:
8912: -- initialize API return status to success
8913: x_return_status := FND_API.G_RET_STS_SUCCESS;
8914:
8915: --bug3663487 start SQL ID 9426916 and 9426907
8916: SELECT c2.calendar_date,i2.organization_id,i2.sr_instance_id,i2.inventory_item_id
8917: BULK COLLECT INTO l_atf_date,l_organization_id,l_sr_instance_id,l_inventory_item_id
9055: IF PG_DEBUG in ('Y', 'C') THEN
9056: msc_util.msc_log('Populate_ATF_Dates: ' || 'Exception: ' || sqlerrm);
9057: msc_util.msc_log('Populate_ATF_Dates: ' || 'Error code:' || to_char(sqlcode));
9058: END IF;
9059: x_return_status := FND_API.G_RET_STS_ERROR;
9060:
9061: END Populate_ATF_Dates;
9062:
9063: /*--Calculate_Alloc_Percentages-----------------------------------------------
9108: msc_util.msc_log('Calculate_Alloc_Percentages: ' || 'p_plan_id = ' ||to_char(p_plan_id));
9109: END IF;
9110:
9111: -- initialize API return status to success
9112: x_return_status := FND_API.G_RET_STS_SUCCESS;
9113:
9114: /* populate allocated quantity for planned order at product family that are blown down as production forecasts*/
9115: insert into msc_alloc_temp(
9116: transaction_id,
9176: IF PG_DEBUG in ('Y', 'C') THEN
9177: msc_util.msc_log('Calculate_Alloc_Percentages: ' || 'Exception: ' || sqlerrm);
9178: msc_util.msc_log('Calculate_Alloc_Percentages: ' || 'Error code:' || to_char(sqlcode));
9179: END IF;
9180: x_return_status := FND_API.G_RET_STS_ERROR;
9181:
9182: END Calculate_Alloc_Percentages;
9183:
9184: /*--Pf_Post_Plan_Proc-----------------------------------------------------------------
9451: END;
9452:
9453: Calculate_Alloc_Percentages(p_plan_id, l_return_status);
9454:
9455: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9456: IF PG_DEBUG in ('Y', 'C') THEN
9457: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Calculate_Alloc_Percentages');
9458: END IF;
9459: RAISE FND_API.G_EXC_ERROR;
9455: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9456: IF PG_DEBUG in ('Y', 'C') THEN
9457: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Calculate_Alloc_Percentages');
9458: END IF;
9459: RAISE FND_API.G_EXC_ERROR;
9460: END IF;
9461:
9462: msc_util.msc_log('Before generating the SQL');
9463:
9557:
9558: /* forecast at PF changes begin*/
9559: Prepare_Demands_Stmt(l_share_partition, p_demand_priority, l_excess_supply_by_dc,
9560: NULL, l_alloc_temp_table, l_parallel_degree, l_sql_stmt_1, l_return_status);
9561: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9562: IF PG_DEBUG in ('Y', 'C') THEN
9563: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Prepare_Demands_Stmt');
9564: END IF;
9565: RAISE FND_API.G_EXC_ERROR;
9561: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9562: IF PG_DEBUG in ('Y', 'C') THEN
9563: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Prepare_Demands_Stmt');
9564: END IF;
9565: RAISE FND_API.G_EXC_ERROR;
9566: END IF;
9567:
9568: msc_util.msc_log('After generating Demands SQL1');
9569: msc_util.msc_log(l_sql_stmt_1);
9599:
9600: Prepare_Supplies_Stmt(l_share_partition, p_demand_priority,
9601: l_excess_supply_by_dc, NULL, l_alloc_temp_table, l_parallel_degree, l_sql_stmt_1, l_return_status);
9602:
9603: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9604: IF PG_DEBUG in ('Y', 'C') THEN
9605: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Prepare_Supplies_Stmt');
9606: END IF;
9607: RAISE FND_API.G_EXC_ERROR;
9603: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9604: IF PG_DEBUG in ('Y', 'C') THEN
9605: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Prepare_Supplies_Stmt');
9606: END IF;
9607: RAISE FND_API.G_EXC_ERROR;
9608: END IF;
9609:
9610: msc_util.msc_log(l_sql_stmt_1);
9611: msc_util.msc_log('After Generating Supplies SQL1');
9752: /* forecast at PF changes begin*/
9753: Prepare_Demands_Stmt(l_share_partition, p_demand_priority, l_excess_supply_by_dc,
9754: l_temp_table, l_alloc_temp_table, l_parallel_degree, l_sql_stmt_1, l_return_status);
9755:
9756: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9757: IF PG_DEBUG in ('Y', 'C') THEN
9758: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Prepare_Demands_Stmt');
9759: END IF;
9760: RAISE FND_API.G_EXC_ERROR;
9756: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9757: IF PG_DEBUG in ('Y', 'C') THEN
9758: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Prepare_Demands_Stmt');
9759: END IF;
9760: RAISE FND_API.G_EXC_ERROR;
9761: END IF;
9762:
9763: msc_util.msc_log(l_sql_stmt_1);
9764: msc_util.msc_log('After generating Demands SQL1');
9937: /* forecast at PF changes begin*/
9938: Prepare_Supplies_Stmt(l_share_partition, p_demand_priority, l_excess_supply_by_dc,
9939: l_temp_table, l_alloc_temp_table, l_parallel_degree, l_sql_stmt_1, l_return_status);
9940:
9941: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9942: IF PG_DEBUG in ('Y', 'C') THEN
9943: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Prepare_Supplies_Stmt');
9944: END IF;
9945: RAISE FND_API.G_EXC_ERROR;
9941: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
9942: IF PG_DEBUG in ('Y', 'C') THEN
9943: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Prepare_Supplies_Stmt');
9944: END IF;
9945: RAISE FND_API.G_EXC_ERROR;
9946: END IF;
9947:
9948: msc_util.msc_log(l_sql_stmt_1);
9949: msc_util.msc_log('After Generating Supplies SQL1');
10079:
10080: /* Call Update_Pf_Display_Flags to update Pf_Display_Flag in msc_alloc_demands*/
10081: Update_Pf_Display_Flag(p_plan_id, l_return_status);
10082:
10083: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
10084: IF PG_DEBUG in ('Y', 'C') THEN
10085: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Update_Pf_Display_Flag');
10086: END IF;
10087: RAISE FND_API.G_EXC_ERROR;
10083: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
10084: IF PG_DEBUG in ('Y', 'C') THEN
10085: msc_util.msc_log('Pf_Post_Plan_Proc: ' || 'Error occured in procedure Update_Pf_Display_Flag');
10086: END IF;
10087: RAISE FND_API.G_EXC_ERROR;
10088: END IF;
10089:
10090: BEGIN
10091: update msc_plans
10159: msc_util.msc_log('Prepare_Demands_Stmt: ' || 'MSC_ATP_PVT.G_HP_DEMAND_BUCKETING_PREF : ' || MSC_ATP_PVT.G_HP_DEMAND_BUCKETING_PREF);
10160: END IF;
10161:
10162: -- Initializing API return code
10163: x_return_status := FND_API.G_RET_STS_SUCCESS;
10164:
10165: IF p_share_partition = 'Y' THEN
10166: x_sql_stmt := '
10167: INSERT INTO MSC_ALLOC_DEMANDS(';
10558: WHEN OTHERS THEN
10559: IF PG_DEBUG in ('Y', 'C') THEN
10560: msc_util.msc_log('Prepare_Demands_Stmt: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
10561: END IF;
10562: x_return_status := FND_API.G_RET_STS_ERROR;
10563:
10564: END Prepare_Demands_Stmt;
10565:
10566: -- New private procedure added for forecast at PF
10597: msc_util.msc_log('Prepare_Supplies_Stmt: ' || 'p_parallel_degree : ' || p_parallel_degree);
10598: END IF;
10599:
10600: -- Initializing API return code
10601: x_return_status := FND_API.G_RET_STS_SUCCESS;
10602:
10603: IF p_share_partition = 'Y' THEN
10604: x_sql_stmt := '
10605: INSERT INTO MSC_ALLOC_SUPPLIES(';
10790: WHEN OTHERS THEN
10791: IF PG_DEBUG in ('Y', 'C') THEN
10792: msc_util.msc_log('Prepare_Supplies_Stmt: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
10793: END IF;
10794: x_return_status := FND_API.G_RET_STS_ERROR;
10795:
10796: END Prepare_Supplies_Stmt;
10797:
10798: /*Private procedures removed for forecast at PF **Will be deleted after code review
10827: msc_util.msc_log('Prepare_Demands_Stmt1: ' || 'p_parallel_degree : ' || p_parallel_degree);
10828: END IF;
10829:
10830: -- Initializing API return code
10831: x_return_status := FND_API.G_RET_STS_SUCCESS;
10832:
10833: IF p_share_partition = 'Y' THEN
10834: x_sql_stmt := '
10835: INSERT INTO MSC_ALLOC_DEMANDS(';
11428: WHEN OTHERS THEN
11429: IF PG_DEBUG in ('Y', 'C') THEN
11430: msc_util.msc_log('Prepare_Demands_Stmt1: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
11431: END IF;
11432: x_return_status := FND_API.G_RET_STS_ERROR;
11433:
11434: END Prepare_Demands_Stmt1;
11435:
11436: /*--Prepare_Demands_Stmt2---------------------------------------------------
11449: IS
11450:
11451: BEGIN
11452: -- Initializing API return code
11453: x_return_status := FND_API.G_RET_STS_SUCCESS;
11454:
11455: IF p_share_partition = 'Y' THEN
11456: x_sql_stmt := '
11457: INSERT INTO MSC_ALLOC_DEMANDS(';
11656: WHEN OTHERS THEN
11657: IF PG_DEBUG in ('Y', 'C') THEN
11658: msc_util.msc_log('Prepare_Demands_Stmt2: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
11659: END IF;
11660: x_return_status := FND_API.G_RET_STS_ERROR;
11661:
11662: END Prepare_Demands_Stmt2;
11663:
11664: /*--Prepare_Supplies_Stmt1--------------------------------------------------
11683: IS
11684:
11685: BEGIN
11686: -- Initializing API return code
11687: x_return_status := FND_API.G_RET_STS_SUCCESS;
11688:
11689: IF p_share_partition = 'Y' THEN
11690: x_sql_stmt := '
11691: INSERT INTO MSC_ALLOC_SUPPLIES(';
11984: WHEN OTHERS THEN
11985: IF PG_DEBUG in ('Y', 'C') THEN
11986: msc_util.msc_log('Prepare_Supplies_Stmt1: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
11987: END IF;
11988: x_return_status := FND_API.G_RET_STS_ERROR;
11989:
11990: END Prepare_Supplies_Stmt1;
11991:
11992: /*--Prepare_Supplies_Stmt2-----------------------------------------------------
12005: IS
12006:
12007: BEGIN
12008: -- Initializing API return code
12009: x_return_status := FND_API.G_RET_STS_SUCCESS;
12010:
12011: IF p_share_partition = 'Y' THEN
12012: x_sql_stmt := '
12013: INSERT INTO MSC_ALLOC_SUPPLIES(';
12147: WHEN OTHERS THEN
12148: IF PG_DEBUG in ('Y', 'C') THEN
12149: msc_util.msc_log('Prepare_Supplies_Stmt2: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
12150: END IF;
12151: x_return_status := FND_API.G_RET_STS_ERROR;
12152:
12153: END Prepare_Supplies_Stmt2;
12154:
12155: /*--Update_Pf_Display_Flag-----------------------------------------------------
12169: msc_util.msc_log('Update_Pf_Display_Flag: ' || 'p_plan_id: ' || p_plan_id);
12170: END IF;
12171:
12172: -- Initializing API return code
12173: x_return_status := FND_API.G_RET_STS_SUCCESS;
12174:
12175: -- Performance tuning pending
12176: /*
12177: UPDATE MSC_ALLOC_DEMANDS AD
12216: WHEN OTHERS THEN
12217: IF PG_DEBUG in ('Y', 'C') THEN
12218: msc_util.msc_log('Update_Pf_Display_Flag: ' || 'Error occurred: ' || to_char(sqlcode) || ':' || SQLERRM);
12219: END IF;
12220: x_return_status := FND_API.G_RET_STS_ERROR;
12221:
12222: END Update_Pf_Display_Flag;
12223:
12224: -- CTO-PF start
12251: msc_sch_wb.atp_debug(' User Id Paramenter : ' || p_user_id );
12252: msc_sch_wb.atp_debug(' Date Parameter : ' || p_sysdate );
12253: END IF;
12254:
12255: x_return_status := FND_API.G_RET_STS_SUCCESS;
12256:
12257: IF PG_DEBUG in ('Y', 'C') THEN
12258: msc_sch_wb.atp_debug(' Inserting Demands');
12259: END IF;
12507: IF PG_DEBUG in ('Y', 'C') THEN
12508: msc_sch_wb.atp_debug('Inside main exception of Create_PF_DP_Alloc_Reliefs');
12509: msc_sch_wb.atp_debug ('Create_PF_DP_Alloc_Reliefs. Error : ' || sqlcode || ': '|| sqlerrm);
12510: END IF;
12511: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
12512:
12513: END Create_PF_DP_Alloc_Reliefs;
12514:
12515: /*--Create_PF_Allocation_Reliefs-----------------------------------------------------
12536: msc_sch_wb.atp_debug(' User Id Paramenter : ' || p_user_id );
12537: msc_sch_wb.atp_debug(' Date Parameter : ' || p_sysdate );
12538: END IF;
12539:
12540: x_return_status := FND_API.G_RET_STS_SUCCESS;
12541:
12542: IF PG_DEBUG in ('Y', 'C') THEN
12543: msc_sch_wb.atp_debug(' Inserting Demands');
12544: END IF;
12644: IF PG_DEBUG in ('Y', 'C') THEN
12645: msc_sch_wb.atp_debug('Inside main exception of Create_PF_Allocation_Reliefs');
12646: msc_sch_wb.atp_debug ('Create_PF_Allocation_Reliefs. Error : ' || sqlcode || ': '|| sqlerrm);
12647: END IF;
12648: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
12649:
12650: END Create_PF_Allocation_Reliefs;
12651: -- CTO-PF end
12652: END MSC_ATP_PF;