243: END LOOP;
244:
245: END IF; -- Code release.
246:
247: oe_msg_pub.save_messages(p_request_id => p_request_id);
248:
249: oe_debug_pub.add('Exiting oe_schedule_grp.update_scheduling_results' ||
250: x_return_status,1);
251:
258:
259: WHEN OTHERS THEN
260: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
261:
262: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
263: THEN
264: OE_MSG_PUB.Add_Exc_Msg
265: ( G_PKG_NAME
266: , 'update_scheduling_results'
260: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
261:
262: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
263: THEN
264: OE_MSG_PUB.Add_Exc_Msg
265: ( G_PKG_NAME
266: , 'update_scheduling_results'
267: );
268: END IF;
324:
325: EXCEPTION
326: WHEN NO_DATA_FOUND THEN
327:
328: OE_MSG_PUB.set_msg_context
329: ( p_entity_code => 'LINE'
330: ,p_entity_id => g_sch_tbl(I).line_id
331: ,p_header_id => g_sch_tbl(I).header_id
332: ,p_line_id => g_sch_tbl(I).line_id);
332: ,p_line_id => g_sch_tbl(I).line_id);
333:
334: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_LOOP_LINE');
335: FND_MESSAGE.SET_TOKEN('LINE_ID',g_sch_tbl(I).line_id);
336: OE_MSG_PUB.ADD;
337: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
338: goto end_main_loop;
339: END;
340: -- Special Validation is needed before taking the data
338: goto end_main_loop;
339: END;
340: -- Special Validation is needed before taking the data
341:
342: OE_MSG_PUB.set_msg_context
343: ( p_entity_code => 'LINE'
344: ,p_entity_id => l_line_rec.line_id
345: ,p_header_id => l_line_rec.header_id
346: ,p_line_id => l_line_rec.line_id
367:
368: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ATTRIBUTE');
369: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
370: OE_Order_Util.Get_Attribute_Name('Schedule_Ship_Date'));
371: OE_MSG_PUB.ADD;
372: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
373:
374: END IF;
375:
380:
381: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ATTRIBUTE');
382: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
383: OE_Order_Util.Get_Attribute_Name('Schedule_Arrival_date'));
384: OE_MSG_PUB.ADD;
385: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
386:
387: END IF;
388:
393:
394: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ATTRIBUTE');
395: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
396: OE_Order_Util.Get_Attribute_Name('ship_from_org_id'));
397: OE_MSG_PUB.ADD;
398: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
399:
400: END IF;
401:
406:
407: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ATTRIBUTE');
408: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
409: OE_Order_Util.Get_Attribute_Name('Shipping_Method_Code'));
410: OE_MSG_PUB.ADD;
411: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
412:
413: END IF;
414:
419:
420: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ATTRIBUTE');
421: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
422: OE_Order_Util.Get_Attribute_Name('ordered_quantity'));
423: OE_MSG_PUB.ADD;
424: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
425:
426: END IF;
427:
434:
435: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ATTRIBUTE');
436: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
437: OE_Order_Util.Get_Attribute_Name('Earliest_Ship_date'));
438: OE_MSG_PUB.ADD;
439: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
440:
441: END IF;
442:
446:
447: oe_debug_pub.add('E4',2);
448: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
449: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LOOP_NOT_SUP');
450: OE_MSG_PUB.ADD;
451: END IF;
452:
453: /* Added for ER 6110708 to support Item Substitutions from Planning Loop Back */
454: IF g_sch_tbl(I).inventory_item_id IS NOT NULL
465: IF l_line_rec.inventory_item_id <> g_sch_tbl(I).orig_inventory_item_id THEN
466: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ATTRIBUTE');
467: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
468: OE_Order_Util.Get_Attribute_Name('inventory_item_id'));
469: OE_MSG_PUB.ADD;
470: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
471: END IF;
472:
473: l_opm_enabled := INV_GMI_RSV_BRANCH.Process_Branch(p_organization_id => l_line_rec.ship_from_org_id);
513: )
514: THEN
515: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
516: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LOOP_NOT_SUP');
517: OE_MSG_PUB.ADD;
518: END IF;
519:
520: -- Do not allow substitution of Shippable Item with non-Shippable and vise versa once the Line is Booked.
521: IF nvl(l_line_rec.booked_flag, 'N') = 'Y' THEN
528:
529: IF l_shippable_flag <> l_line_rec.shippable_flag THEN
530: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
531: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LOOP_SHP_NONSHP');
532: OE_MSG_PUB.ADD;
533: END IF;
534: END;
535: END IF;
536:
592: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
593: l_local_line_tbl(J).operation := OE_GLOBALS.G_OPR_NONE;
594: l_local_line_tbl(J).return_status := FND_API.G_RET_STS_ERROR;
595: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_INVALID_DATE');
596: OE_MSG_PUB.ADD;
597: goto end_loop;
598: END IF;
599: */
600: l_local_line_tbl(J).schedule_ship_date := g_sch_tbl(I).schedule_ship_date;
609: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
610: l_local_line_tbl(J).operation := OE_GLOBALS.G_OPR_NONE;
611: l_local_line_tbl(J).return_status := FND_API.G_RET_STS_ERROR;
612: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_INVALID_DATE');
613: oe_msg_pub.add;
614: goto end_loop;
615: END IF;
616: */
617: l_local_line_tbl(J).schedule_arrival_date := g_sch_tbl(I).schedule_arrival_date;
714: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
715: l_line_rec.operation := OE_GLOBALS.G_OPR_NONE;
716: l_line_rec.return_status := FND_API.G_RET_STS_ERROR;
717: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_INVALID_DATE');
718: OE_MSG_PUB.ADD;
719: goto end_loop1;
720: END IF;
721: */ l_line_rec.schedule_ship_date := g_sch_tbl(I).schedule_ship_date;
722: END IF;
727: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
728: l_line_rec.operation := OE_GLOBALS.G_OPR_NONE;
729: l_line_rec.return_status := FND_API.G_RET_STS_ERROR;
730: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_INVALID_DATE');
731: oe_msg_pub.add;
732: goto end_loop1;
733: END IF;
734: */ l_line_rec.schedule_arrival_date := g_sch_tbl(I).schedule_arrival_date;
735: END IF;
1033: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1034: g_line_tbl.delete;
1035: g_old_line_tbl.delete;
1036:
1037: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1038: THEN
1039: OE_MSG_PUB.Add_Exc_Msg
1040: ( G_PKG_NAME
1041: , 'process_order'
1035: g_old_line_tbl.delete;
1036:
1037: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1038: THEN
1039: OE_MSG_PUB.Add_Exc_Msg
1040: ( G_PKG_NAME
1041: , 'process_order'
1042: );
1043: END IF;
1056: IF g_sch_tbl(I).schedule_ship_date is null
1057: OR g_sch_tbl(I).schedule_arrival_date is NULL
1058: THEN
1059:
1060: OE_MSG_PUB.set_msg_context
1061: ( p_entity_code => 'LINE'
1062: ,p_entity_id => g_sch_tbl(I).line_id
1063: ,p_header_id => g_sch_tbl(I).header_id
1064: ,p_line_id => g_sch_tbl(I).line_id);
1065:
1066: oe_debug_pub.add('ONT_SCH_LOOP_DATE_NULL',1);
1067: g_sch_tbl(I).x_return_status := FND_API.G_RET_STS_ERROR;
1068: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_LOOP_DATE_NULL');
1069: OE_MSG_PUB.ADD;
1070:
1071: END IF;
1072:
1073: I := g_sch_tbl.NEXT(I);
1081:
1082: WHEN OTHERS THEN
1083: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1084:
1085: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1086: THEN
1087: OE_MSG_PUB.Add_Exc_Msg
1088: ( G_PKG_NAME
1089: , 'Validate_sch_data'
1083: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1084:
1085: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1086: THEN
1087: OE_MSG_PUB.Add_Exc_Msg
1088: ( G_PKG_NAME
1089: , 'Validate_sch_data'
1090: );
1091: END IF;
1108:
1109: oe_debug_pub.add('Validate_Lines' || g_line_tbl(I).line_id,1);
1110:
1111: x_return_status := FND_API.G_RET_STS_SUCCESS;
1112: OE_MSG_PUB.set_msg_context
1113: ( p_entity_code => 'LINE'
1114: ,p_entity_id => g_line_tbl(I).line_id
1115: ,p_header_id => g_line_tbl(I).header_id
1116: ,p_line_id => g_line_tbl(I).line_id
1135:
1136: oe_debug_pub.add('E1',2);
1137: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1138: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_LOOP_CANT_UPDATE');
1139: OE_MSG_PUB.ADD;
1140: x_return_status := FND_API.G_RET_STS_ERROR;
1141: END IF;
1142: */
1143: IF g_line_tbl(I).cancelled_flag = 'Y' THEN
1144:
1145: oe_debug_pub.add('E1-1',2);
1146: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1147: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LINE_FULLY_CANCELLED');
1148: OE_MSG_PUB.ADD;
1149: x_return_status := FND_API.G_RET_STS_ERROR;
1150: END IF;
1151:
1152: IF g_line_tbl(I).shipped_quantity is not null THEN
1153:
1154: oe_debug_pub.add('E1-2',2);
1155: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1156: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LINE_SHIPPED');
1157: OE_MSG_PUB.ADD;
1158: x_return_status := FND_API.G_RET_STS_ERROR;
1159: END IF;
1160:
1161: oe_debug_pub.add('Firm_demand_flag :' || g_line_tbl(I).firm_demand_flag,1);
1167:
1168: oe_debug_pub.add('E2',2);
1169: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1170: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_LOOP_FRMD');
1171: OE_MSG_PUB.ADD;
1172: x_return_status := FND_API.G_RET_STS_ERROR;
1173: END IF; */
1174:
1175: IF g_line_tbl(I).item_type_code = OE_GLOBALS.G_ITEM_SERVICE THEN
1176:
1177: oe_debug_pub.add('E3',2);
1178: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1179: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_LOOP_SRV');
1180: OE_MSG_PUB.ADD;
1181: x_return_status := FND_API.G_RET_STS_ERROR;
1182: END IF;
1183:
1184: IF g_line_tbl(I).ato_line_id IS NOT NULL THEN
1187:
1188: oe_debug_pub.add('E4',2);
1189: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1190: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LOOP_NOT_SUP');
1191: OE_MSG_PUB.ADD;
1192: x_return_status := FND_API.G_RET_STS_ERROR;
1193: END IF;
1194: */
1195: IF nvl(g_line_tbl(I).model_remnant_flag,'N') = 'Y' THEN
1195: IF nvl(g_line_tbl(I).model_remnant_flag,'N') = 'Y' THEN
1196: oe_debug_pub.add('E5',2);
1197: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1198: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LOOP_NOT_SUP');
1199: OE_MSG_PUB.ADD;
1200: x_return_status := FND_API.G_RET_STS_ERROR;
1201:
1202: END IF;
1203: END IF;
1206:
1207: oe_debug_pub.add('E6',2);
1208: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1209: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_LOOP_RET');
1210: OE_MSG_PUB.ADD;
1211: x_return_status := FND_API.G_RET_STS_ERROR;
1212: END IF;
1213:
1214: IF OE_OTA_UTIL.Is_OTA_Line(g_line_tbl(I).order_quantity_uom) THEN
1215:
1216: oe_debug_pub.add('E7',2);
1217: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1218: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LOOP_NOT_SUP');
1219: OE_MSG_PUB.ADD;
1220: x_return_status := FND_API.G_RET_STS_ERROR;
1221: END IF;
1222:
1223: IF g_line_tbl(I).source_type_code = OE_GLOBALS.G_SOURCE_EXTERNAL THEN
1224:
1225: oe_debug_pub.add('E8',2);
1226: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1227: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_LOOP_EXT');
1228: OE_MSG_PUB.ADD;
1229: x_return_status := FND_API.G_RET_STS_ERROR;
1230: END IF;
1231:
1232: l_scheduling_level_code := OE_SCHEDULE_UTIL.Get_Scheduling_Level
1239:
1240: oe_debug_pub.add('E9',2);
1241: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1242: FND_MESSAGE.SET_NAME('ONT', 'ONT_SCH_LOOP_LVL');
1243: OE_MSG_PUB.ADD;
1244: x_return_status := FND_API.G_RET_STS_ERROR;
1245:
1246:
1247: END IF;
1266: THEN
1267: oe_debug_pub.add('E10',2);
1268: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1269: FND_MESSAGE.SET_NAMe('ONT', 'OE_SCH_LOOP_WSH_UPD');
1270: OE_MSG_PUB.ADD;
1271: x_return_status := FND_API.G_RET_STS_ERROR;
1272:
1273: END IF;
1274: */
1300: IF (l_result = FND_API.G_TRUE) THEN
1301: oe_debug_pub.add('E11',2);
1302: g_line_tbl(I).operation := OE_GLOBALS.G_OPR_NONE;
1303: FND_MESSAGE.SET_NAME('ONT','OE_SCH_LINE_ON_HOLD');
1304: OE_MSG_PUB.Add;
1305: x_return_status := FND_API.G_RET_STS_ERROR;
1306: END IF;
1307:
1308:
1326:
1327: WHEN OTHERS THEN
1328: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1329:
1330: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1331: THEN
1332: OE_MSG_PUB.Add_Exc_Msg
1333: ( G_PKG_NAME
1334: , 'Validate_Lines'
1328: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1329:
1330: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1331: THEN
1332: OE_MSG_PUB.Add_Exc_Msg
1333: ( G_PKG_NAME
1334: , 'Validate_Lines'
1335: );
1336: END IF;
1406: IF NOT l_result THEN
1407:
1408: oe_debug_pub.add('E10',2);
1409: FND_MESSAGE.SET_NAME('ONT', 'OE_SCH_LOOP_NOT_SUP');
1410: OE_MSG_PUB.ADD;
1411: IF p_ship_set_id IS NOT NULL THEN
1412:
1413: FOR J IN 1..g_line_tbl.count LOOP
1414:
1457: EXCEPTION
1458:
1459: WHEN OTHERS THEN
1460:
1461: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1462: THEN
1463: OE_MSG_PUB.Add_Exc_Msg
1464: ( G_PKG_NAME
1465: , 'Validate_set'
1459: WHEN OTHERS THEN
1460:
1461: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1462: THEN
1463: OE_MSG_PUB.Add_Exc_Msg
1464: ( G_PKG_NAME
1465: , 'Validate_set'
1466: );
1467: END IF;
1501: RETURN FALSE;
1502:
1503: WHEN OTHERS THEN
1504:
1505: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1506: THEN
1507: OE_MSG_PUB.Add_Exc_Msg
1508: ( G_PKG_NAME
1509: , 'Find_line'
1503: WHEN OTHERS THEN
1504:
1505: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1506: THEN
1507: OE_MSG_PUB.Add_Exc_Msg
1508: ( G_PKG_NAME
1509: , 'Find_line'
1510: );
1511: END IF;
1551: RETURN Null;
1552:
1553: WHEN OTHERS THEN
1554:
1555: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1556: THEN
1557: OE_MSG_PUB.Add_Exc_Msg
1558: ( G_PKG_NAME
1559: , 'Find_index'
1553: WHEN OTHERS THEN
1554:
1555: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1556: THEN
1557: OE_MSG_PUB.Add_Exc_Msg
1558: ( G_PKG_NAME
1559: , 'Find_index'
1560: );
1561: END IF;
1603:
1604: WHEN OTHERS THEN
1605: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1606:
1607: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1608: THEN
1609: OE_MSG_PUB.Add_Exc_Msg
1610: ( G_PKG_NAME
1611: , 'Validate_set'
1605: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1606:
1607: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1608: THEN
1609: OE_MSG_PUB.Add_Exc_Msg
1610: ( G_PKG_NAME
1611: , 'Validate_set'
1612: );
1613: END IF;