34: BEGIN
35: --
36: IF p_organization_id IS NULL THEN
37: fnd_message.set_name('INV', 'INV_NO ORG INFORMATION');
38: fnd_msg_pub.add;
39: RAISE fnd_api.g_exc_error;
40: END IF;
41: --
42: inv_reservation_util_pvt.search_organization_cache
67:
68: EXCEPTION
69: WHEN no_data_found THEN
70: fnd_message.set_name('INV', 'INVALID ORGANIZATION');
71: fnd_msg_pub.add;
72: RAISE fnd_api.g_exc_error;
73: END;
74: */
75: -- Modified to call common API
77: IF INV_Validate.Organization(
78: p_org => l_rec
79: )=INV_Validate.F THEN
80: fnd_message.set_name('INV', 'INVALID ORGANIZATION');
81: fnd_msg_pub.add;
82: RAISE fnd_api.g_exc_error;
83: END IF;
84:
85: --
112: --
113: WHEN OTHERS THEN
114: x_return_status := fnd_api.g_ret_sts_unexp_error ;
115: --
116: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
117: THEN
118: fnd_msg_pub.add_exc_msg
119: ( g_pkg_name
120: , 'Validate_Organization'
114: x_return_status := fnd_api.g_ret_sts_unexp_error ;
115: --
116: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
117: THEN
118: fnd_msg_pub.add_exc_msg
119: ( g_pkg_name
120: , 'Validate_Organization'
121: );
122: END IF;
146: l_rec_org.organization_id:=p_organization_id;
147: --
148: IF p_inventory_item_id IS NULL THEN
149: fnd_message.set_name('INV', 'INV_ENTER_ITEM');
150: fnd_msg_pub.add;
151: RAISE fnd_api.g_exc_error;
152: END IF;
153: --
154: inv_reservation_util_pvt.search_item_cache
188: AND organization_id = p_organization_id ;
189: EXCEPTION
190: WHEN no_data_found THEN
191: fnd_message.set_name('INV', 'INVALID ORGANIZATION');
192: fnd_msg_pub.add;
193: RAISE fnd_api.g_exc_error;
194: END;*/
195: -- Modified to call new common API
196: l_rec.inventory_item_id:=p_inventory_item_id;
198: p_item => l_rec,
199: p_org => l_rec_org
200: )=INV_Validate.F THEN
201: fnd_message.set_name('INV', 'INVALID ITEM');
202: fnd_msg_pub.add;
203: RAISE fnd_api.g_exc_error;
204: END IF;
205:
206: --
205:
206: --
207: IF l_rec.reservable_type = 2 THEN /* non reservable item */
208: fnd_message.set_name('INV','INV-ITEM NOT RESERVABLE');
209: fnd_msg_pub.add;
210: RAISE fnd_api.g_exc_error;
211: END IF;
212: --
213: inv_reservation_util_pvt.add_item_cache
238: --
239: WHEN OTHERS THEN
240: x_return_status := fnd_api.g_ret_sts_unexp_error ;
241: --
242: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
243: THEN
244: fnd_msg_pub.add_exc_msg
245: ( g_pkg_name
246: , 'Validate_Item'
240: x_return_status := fnd_api.g_ret_sts_unexp_error ;
241: --
242: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
243: THEN
244: fnd_msg_pub.add_exc_msg
245: ( g_pkg_name
246: , 'Validate_Item'
247: );
248: END IF;
302: l_valid_supply <> 'Y' THEN
303:
304: --error message
305: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_PO');
306: fnd_msg_pub.add;
307: RAISE fnd_api.g_exc_error;
308: END IF;
309: *** End R12 }} ***/
310:
351: END IF;
352:
353: IF (l_valid_status = 'N') THEN
354: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_PO');
355: fnd_msg_pub.ADD;
356: RAISE fnd_api.g_exc_error;
357: END IF;
358:
359: select count(1)
368:
369: IF (l_dropship_count >= 1) THEN
370: fnd_message.set_name('INV', 'INV_RSV_DS_SO_SUP');
371: fnd_message.set_name('SOURCE', 'PO');
372: fnd_msg_pub.add;
373: RAISE fnd_api.g_exc_error;
374: END IF;
375: ELSE
376: IF (l_debug = 1) THEN
392: --
393: WHEN OTHERS THEN
394: x_return_status := fnd_api.g_ret_sts_unexp_error ;
395: --
396: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
397: THEN
398: fnd_msg_pub.add_exc_msg
399: ( g_pkg_name
400: , 'Validate_Supply_Source_PO'
394: x_return_status := fnd_api.g_ret_sts_unexp_error ;
395: --
396: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
397: THEN
398: fnd_msg_pub.add_exc_msg
399: ( g_pkg_name
400: , 'Validate_Supply_Source_PO'
401: );
402: END IF;
464: l_valid_supply <> 'Y' THEN
465:
466: --error message
467: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_REQ');
468: fnd_msg_pub.add;
469: RAISE fnd_api.g_exc_error;
470: END IF;
471:
472: select count(1)
481:
482: IF (l_dropship_count >= 1) THEN
483: fnd_message.set_name('INV', 'INV_RSV_DS_SO_SUP');
484: fnd_message.set_token('SOURCE', 'requisition');
485: fnd_msg_pub.add;
486: RAISE fnd_api.g_exc_error;
487: END IF;
488: ELSE
489: IF (l_debug = 1) THEN
505: --
506: WHEN OTHERS THEN
507: x_return_status := fnd_api.g_ret_sts_unexp_error ;
508: --
509: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
510: THEN
511: fnd_msg_pub.add_exc_msg
512: ( g_pkg_name
513: , 'Validate_Supply_Source_REQ'
507: x_return_status := fnd_api.g_ret_sts_unexp_error ;
508: --
509: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
510: THEN
511: fnd_msg_pub.add_exc_msg
512: ( g_pkg_name
513: , 'Validate_Supply_Source_REQ'
514: );
515: END IF;
584: END IF;
585:
586: IF (l_valid_status = 'N') THEN
587: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_INTREQ');
588: fnd_msg_pub.ADD;
589: RAISE fnd_api.g_exc_error;
590: END IF;
591: ELSE
592: IF (l_debug = 1) THEN
608: --
609: WHEN OTHERS THEN
610: x_return_status := fnd_api.g_ret_sts_unexp_error ;
611: --
612: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
613: THEN
614: fnd_msg_pub.add_exc_msg
615: ( g_pkg_name
616: , 'Validate_Supply_Source_INTREQ'
610: x_return_status := fnd_api.g_ret_sts_unexp_error ;
611: --
612: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
613: THEN
614: fnd_msg_pub.add_exc_msg
615: ( g_pkg_name
616: , 'Validate_Supply_Source_INTREQ'
617: );
618: END IF;
689: END IF;
690:
691: IF (l_valid_status = 'N') THEN
692: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_ASN');
693: fnd_msg_pub.ADD;
694: RAISE fnd_api.g_exc_error;
695: END IF;
696:
697: SELECT wms_enabled_flag
705:
706: IF (l_wms_enabled = 'N') THEN
707: fnd_message.set_name('INV', 'INV_RSV_NON_WMS');
708: fnd_message.set_name('SOURCE', 'ASN');
709: fnd_msg_pub.add;
710: RAISE fnd_api.g_exc_error;
711: END IF;
712: ELSE
713: IF (l_debug = 1) THEN
727: --
728: WHEN OTHERS THEN
729: x_return_status := fnd_api.g_ret_sts_unexp_error ;
730: --
731: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
732: THEN
733: fnd_msg_pub.add_exc_msg
734: ( g_pkg_name
735: , 'Validate_Supply_Source_ASN'
729: x_return_status := fnd_api.g_ret_sts_unexp_error ;
730: --
731: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
732: THEN
733: fnd_msg_pub.add_exc_msg
734: ( g_pkg_name
735: , 'Validate_Supply_Source_ASN'
736: );
737: END IF;
808: END IF;
809:
810: IF (l_valid_status = 'N') THEN
811: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_INTRAN');
812: fnd_msg_pub.ADD;
813: RAISE fnd_api.g_exc_error;
814: END IF;
815:
816: SELECT wms_enabled_flag
824:
825: IF (l_wms_enabled = 'N') THEN
826: fnd_message.set_name('INV', 'INV_RSV_NON_WMS');
827: fnd_message.set_name('SOURCE', 'intransit shipment');
828: fnd_msg_pub.add;
829: RAISE fnd_api.g_exc_error;
830: END IF;
831:
832: SELECT replenish_to_order_flag
841:
842: IF (l_replenish_to_order = 'Y') THEN
843: fnd_message.set_name('INV', 'INV_RSV_INT_REPLEN');
844: fnd_message.set_token('SOURCE', 'intransit shipment');
845: fnd_msg_pub.add;
846: RAISE fnd_api.g_exc_error;
847: END IF;
848: ELSE
849: IF (l_debug = 1) THEN
863: --
864: WHEN OTHERS THEN
865: x_return_status := fnd_api.g_ret_sts_unexp_error ;
866: --
867: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
868: THEN
869: fnd_msg_pub.add_exc_msg
870: ( g_pkg_name
871: , 'Validate_Supply_Source_Intran'
865: x_return_status := fnd_api.g_ret_sts_unexp_error ;
866: --
867: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
868: THEN
869: fnd_msg_pub.add_exc_msg
870: ( g_pkg_name
871: , 'Validate_Supply_Source_Intran'
872: );
873: END IF;
945: END IF;
946:
947: IF (l_valid_status = 'N') THEN
948: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_RCV');
949: fnd_msg_pub.ADD;
950: RAISE fnd_api.g_exc_error;
951: END IF;
952:
953: SELECT wms_enabled_flag
961:
962: IF (l_wms_enabled = 'N') THEN
963: fnd_message.set_name('INV', 'INV_RSV_NON_WMS');
964: fnd_message.set_name('SOURCE', 'receiving');
965: fnd_msg_pub.add;
966: RAISE fnd_api.g_exc_error;
967: END IF;
968: ELSE
969: IF (l_debug = 1) THEN
982: --
983: WHEN OTHERS THEN
984: x_return_status := fnd_api.g_ret_sts_unexp_error ;
985: --
986: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
987: THEN
988: fnd_msg_pub.add_exc_msg
989: ( g_pkg_name
990: , 'Validate_Supply_Source_RCV'
984: x_return_status := fnd_api.g_ret_sts_unexp_error ;
985: --
986: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
987: THEN
988: fnd_msg_pub.add_exc_msg
989: ( g_pkg_name
990: , 'Validate_Supply_Source_RCV'
991: );
992: END IF;
1057: END IF;
1058:
1059: IF (l_valid_status = 'N') OR (l_return_status = fnd_api.g_ret_sts_error) THEN
1060: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_DISC');
1061: fnd_msg_pub.ADD;
1062: RAISE fnd_api.g_exc_error;
1063: ELSIF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
1064: RAISE fnd_api.g_exc_unexpected_error;
1065: END IF;
1087: --
1088: WHEN OTHERS THEN
1089: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1090: --
1091: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1092: THEN
1093: fnd_msg_pub.add_exc_msg
1094: ( g_pkg_name
1095: , 'Validate_Supply_Source_WIPDISC'
1089: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1090: --
1091: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1092: THEN
1093: fnd_msg_pub.add_exc_msg
1094: ( g_pkg_name
1095: , 'Validate_Supply_Source_WIPDISC'
1096: );
1097: END IF;
1169: END IF;
1170:
1171: IF (l_valid_status = 'N') THEN
1172: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_OSFM');
1173: fnd_msg_pub.ADD;
1174: RAISE fnd_api.g_exc_error;
1175: END IF;
1176:
1177: SELECT replenish_to_order_flag
1186:
1187: IF (l_replenish_to_order = 'Y') THEN
1188: fnd_message.set_name('INV', 'INV_RSV_REPLEN');
1189: fnd_message.set_token('SOURCE', 'OSFM');
1190: fnd_msg_pub.add;
1191: RAISE fnd_api.g_exc_error;
1192: END IF;
1193: ELSE
1194: IF (l_debug = 1) THEN
1214: --
1215: WHEN OTHERS THEN
1216: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1217: --
1218: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1219: THEN
1220: fnd_msg_pub.add_exc_msg
1221: ( g_pkg_name
1222: , 'Validate_Supply_Source_OSFM'
1216: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1217: --
1218: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1219: THEN
1220: fnd_msg_pub.add_exc_msg
1221: ( g_pkg_name
1222: , 'Validate_Supply_Source_OSFM'
1223: );
1224: END IF;
1298: END IF;
1299:
1300: IF (l_valid_status = 'N') THEN
1301: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_FPO');
1302: fnd_msg_pub.ADD;
1303: RAISE fnd_api.g_exc_error;
1304: END IF;
1305:
1306: SELECT replenish_to_order_flag
1315:
1316: IF (l_replenish_to_order = 'Y') THEN
1317: fnd_message.set_name('INV', 'INV_RSV_REPLEN');
1318: fnd_message.set_token('SOURCE', 'FPO');
1319: fnd_msg_pub.add;
1320: RAISE fnd_api.g_exc_error;
1321: END IF;
1322: ELSE
1323: IF (l_debug = 1) THEN
1343: --
1344: WHEN OTHERS THEN
1345: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1346: --
1347: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1348: THEN
1349: fnd_msg_pub.add_exc_msg
1350: ( g_pkg_name
1351: , 'Validate_Supply_Source_FPO'
1345: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1346: --
1347: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1348: THEN
1349: fnd_msg_pub.add_exc_msg
1350: ( g_pkg_name
1351: , 'Validate_Supply_Source_FPO'
1352: );
1353: END IF;
1427: END IF;
1428:
1429: IF (l_valid_status = 'N') THEN
1430: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY_BATCH');
1431: fnd_msg_pub.ADD;
1432: RAISE fnd_api.g_exc_error;
1433: END IF;
1434:
1435: SELECT replenish_to_order_flag
1443: END IF;
1444: IF (l_replenish_to_order = 'Y') THEN
1445: fnd_message.set_name('INV', 'INV_RSV_REPLEN');
1446: fnd_message.set_token('SOURCE', 'Batch');
1447: fnd_msg_pub.add;
1448: RAISE fnd_api.g_exc_error;
1449: END IF;
1450: ELSE
1451: IF (l_debug = 1) THEN
1471: --
1472: WHEN OTHERS THEN
1473: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1474: --
1475: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1476: THEN
1477: fnd_msg_pub.add_exc_msg
1478: ( g_pkg_name
1479: , 'Validate_Supply_Source_Batch'
1473: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1474: --
1475: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1476: THEN
1477: fnd_msg_pub.add_exc_msg
1478: ( g_pkg_name
1479: , 'Validate_Supply_Source_Batch'
1480: );
1481: END IF;
1524: END IF;
1525:
1526: IF (l_dropship_count >= 1) THEN
1527: fnd_message.set_name('INV', 'INV_RSV_DS_SO');
1528: fnd_msg_pub.add;
1529: RAISE fnd_api.g_exc_error;
1530: END IF;
1531:
1532: ELSE
1550: --
1551: WHEN OTHERS THEN
1552: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1553: --
1554: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1555: THEN
1556: fnd_msg_pub.add_exc_msg
1557: ( g_pkg_name
1558: , 'Validate_Demand_Source_SO'
1552: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1553: --
1554: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1555: THEN
1556: fnd_msg_pub.add_exc_msg
1557: ( g_pkg_name
1558: , 'Validate_Demand_Source_SO'
1559: );
1560: END IF;
1635: END IF;
1636:
1637: IF (l_valid_status = 'N') THEN
1638: fnd_message.set_name('INV', 'INV_RSV_INVALID_DEMAND_CMRO');
1639: fnd_msg_pub.ADD;
1640: RAISE fnd_api.g_exc_error;
1641: END IF;
1642: ELSE
1643: -- return error since this is not wip demand source or not CMRO entity type
1641: END IF;
1642: ELSE
1643: -- return error since this is not wip demand source or not CMRO entity type
1644: fnd_message.set_name('INV', 'INV_INVALID_DEMAND_SOURCE');
1645: fnd_msg_pub.ADD;
1646: RAISE fnd_api.g_exc_error;
1647: END IF;
1648:
1649: x_return_status := l_return_status;
1657: --
1658: WHEN OTHERS THEN
1659: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1660: --
1661: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1662: THEN
1663: fnd_msg_pub.add_exc_msg
1664: ( g_pkg_name
1665: , 'Validate_Demand_Source_CMRO'
1659: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1660: --
1661: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1662: THEN
1663: fnd_msg_pub.add_exc_msg
1664: ( g_pkg_name
1665: , 'Validate_Demand_Source_CMRO'
1666: );
1667: END IF;
1743: END IF;
1744:
1745: IF (l_valid_status = 'N') THEN
1746: fnd_message.set_name('INV', 'INV_RSV_INVALID_DEMAND_FPO');
1747: fnd_msg_pub.ADD;
1748: RAISE fnd_api.g_exc_error;
1749: END IF;
1750: ELSE
1751: -- return error since this is not wip demand source or not FPO entity type
1749: END IF;
1750: ELSE
1751: -- return error since this is not wip demand source or not FPO entity type
1752: fnd_message.set_name('INV', 'INV_INVALID_DEMAND_SOURCE');
1753: fnd_msg_pub.ADD;
1754: RAISE fnd_api.g_exc_error;
1755: END IF;
1756:
1757: x_return_status := l_return_status;
1765: --
1766: WHEN OTHERS THEN
1767: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1768: --
1769: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1770: THEN
1771: fnd_msg_pub.add_exc_msg
1772: ( g_pkg_name
1773: , 'Validate_Demand_Source_FPO'
1767: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1768: --
1769: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1770: THEN
1771: fnd_msg_pub.add_exc_msg
1772: ( g_pkg_name
1773: , 'Validate_Demand_Source_FPO'
1774: );
1775: END IF;
1851: END IF;
1852:
1853: IF (l_valid_status = 'N') THEN
1854: fnd_message.set_name('INV', 'INV_RSV_INVALID_DEMAND_BATCH');
1855: fnd_msg_pub.ADD;
1856: RAISE fnd_api.g_exc_error;
1857: END IF;
1858: ELSE
1859: -- return error since this is not wip demand source or not OPM Batch entity type
1857: END IF;
1858: ELSE
1859: -- return error since this is not wip demand source or not OPM Batch entity type
1860: fnd_message.set_name('INV', 'INV_INVALID_DEMAND_SOURCE');
1861: fnd_msg_pub.ADD;
1862: RAISE fnd_api.g_exc_error;
1863: END IF;
1864:
1865: x_return_status := l_return_status;
1873: --
1874: WHEN OTHERS THEN
1875: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1876: --
1877: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1878: THEN
1879: fnd_msg_pub.add_exc_msg
1880: ( g_pkg_name
1881: , 'Validate_Demand_Source_Batch'
1875: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1876: --
1877: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1878: THEN
1879: fnd_msg_pub.add_exc_msg
1880: ( g_pkg_name
1881: , 'Validate_Demand_Source_Batch'
1882: );
1883: END IF;
1976: NOT IN (inv_reservation_global.g_serial_control_predefined,
1977: inv_reservation_global.g_serial_control_dynamic_inv)
1978: AND p_serial_array.COUNT >0 THEN
1979: fnd_message.set_name('INV', 'INV_EXTRA_SERIAL');
1980: fnd_msg_pub.add;
1981: RAISE fnd_api.g_exc_error;
1982: END IF;
1983: --
1984: IF (l_debug = 1) THEN
1991: (p_item_cache_index).lot_control_code =
1992: inv_reservation_global.g_lot_control_no
1993: AND p_lot_number IS NOT NULL THEN
1994: fnd_message.set_name('INV', 'INV_NO_LOT_CONTROL');
1995: fnd_msg_pub.add;
1996: RAISE fnd_api.g_exc_error;
1997: END IF;
1998: IF (l_debug = 1) THEN
1999: debug_print('After lot cache: ' || l_return_status);
2006: (p_item_cache_index).revision_qty_control_code =
2007: inv_reservation_global.g_revision_control_no
2008: AND p_revision IS NOT NULL THEN
2009: fnd_message.set_name('INV', 'INV_NO_REVISION_CONTROL');
2010: fnd_msg_pub.add;
2011: RAISE fnd_api.g_exc_error;
2012: END IF;
2013: --
2014: IF (l_debug = 1) THEN
2025: OR
2026: p_locator_id IS NOT NULL
2027: ) THEN
2028: fnd_message.set_name('INV', 'INV_MISSING_REV');
2029: fnd_msg_pub.add;
2030: RAISE fnd_api.g_exc_error;
2031: END IF;
2032:
2033: IF (l_debug = 1) THEN
2045: OR
2046: p_locator_id IS NOT NULL
2047: ) THEN
2048: fnd_message.set_name('INV', 'INV_MISSING_LOT');
2049: fnd_msg_pub.add;
2050: RAISE fnd_api.g_exc_error;
2051: END IF;
2052:
2053: IF (l_debug = 1) THEN
2065: = inv_reservation_global.g_lot_control_yes
2066: AND p_revision IS NULL
2067: AND p_lot_number IS NOT NULL THEN
2068: fnd_message.set_name('INV', 'INV_MISSING_REV');
2069: fnd_msg_pub.add;
2070: RAISE fnd_api.g_exc_error;
2071: END IF;
2072:
2073: IF (l_debug = 1) THEN
2114: --
2115: EXCEPTION
2116: WHEN NO_DATA_FOUND then
2117: fnd_message.set_name('INV','INVALID_SUB');
2118: fnd_msg_pub.add;
2119: RAISE fnd_api.g_exc_error;
2120: END; */
2121: -- Modified to call common API
2122: l_rec.secondary_inventory_name :=p_subinventory_code;
2125: p_sub => l_rec,
2126: p_org => inv_reservation_global.g_organization_record_cache(p_org_cache_index)
2127: )=INV_Validate.F THEN
2128: fnd_message.set_name('INV','INVALID_SUB');
2129: fnd_msg_pub.add;
2130: RAISE fnd_api.g_exc_error;
2131: END IF;
2132:
2133:
2141: IF l_rec.reservable_type = inv_globals.g_subinventory_non_reservable
2142: THEN /* non reservable Subinventory */
2143: fnd_message.set_name('INV','INV-SUBINV NOT RESERVABLE');
2144: fnd_message.set_token('SUBINV', l_rec.secondary_inventory_name);
2145: fnd_msg_pub.add;
2146: RAISE fnd_api.g_exc_error;
2147: END IF;
2148: END IF;
2149: -- End of changes for Bug 6870416
2185: --
2186: IF (l_resultant_locator_control = 1
2187: AND p_locator_id IS NOT NULL AND p_locator_id > 0) THEN
2188: fnd_message.set_name('INV', 'INV_NO_LOCATOR_CONTROL');
2189: fnd_msg_pub.add;
2190: RAISE fnd_api.g_exc_error;
2191: END IF;
2192: --
2193: ELSIF p_locator_id IS NOT NULL THEN
2193: ELSIF p_locator_id IS NOT NULL THEN
2194: -- if the sub is null, but the locator id is not null
2195: -- raise the error
2196: fnd_message.set_name('INV', 'INV_NO_LOCATOR_CONTROL');
2197: fnd_msg_pub.add;
2198: RAISE fnd_api.g_exc_error;
2199: END IF;
2200: --
2201: -- Now we have validated that values are there.
2210: --
2211: EXCEPTION
2212: WHEN NO_DATA_FOUND THEN
2213: fnd_message.set_name('INV','INVALID_REVISION');
2214: fnd_msg_pub.add;
2215: RAISE fnd_api.g_exc_error;
2216: END;*/
2217: IF INV_Validate.revision
2218: (
2221: (p_org_cache_index),
2222: p_item => inv_reservation_global.g_item_record_cache(p_item_cache_index) )=INV_Validate.F THEN
2223:
2224: fnd_message.set_name('INV','INVALID_REVISION');
2225: fnd_msg_pub.add;
2226: RAISE fnd_api.g_exc_error;
2227: END IF;
2228:
2229: END IF;
2238: --
2239: IF l_lot_expiration_date IS NOT NULL
2240: AND l_lot_expiration_date < Sysdate THEN
2241: fnd_message.set_name('INV', 'INV_LOT_EXPIRED');
2242: fnd_msg_pub.add;
2243: RAISE fnd_api.g_exc_error;
2244: END IF;
2245: --
2246: EXCEPTION
2245: --
2246: EXCEPTION
2247: WHEN NO_DATA_FOUND then
2248: fnd_message.set_name('INV','INV_INVALID_LOT');
2249: fnd_msg_pub.add;
2250: RAISE fnd_api.g_exc_error;
2251: END;
2252: END IF;
2253: --
2264: AND organization_id = p_organization_id;
2265: EXCEPTION
2266: WHEN no_data_found THEN
2267: fnd_message.set_name('INV', 'INVALID_SUB');
2268: fnd_msg_pub.add;
2269: RAISE fnd_api.g_exc_error;
2270:
2271: END;*/
2272:
2285: --
2286: EXCEPTION
2287: WHEN NO_DATA_FOUND THEN
2288: fnd_message.set_name('INV','INVALID_SUB');
2289: fnd_msg_pub.add;
2290: RAISE fnd_api.g_exc_error;
2291: END ;
2292: ELSIF inv_reservation_global.g_item_record_cache
2293: (p_item_cache_index)
2301: --
2302: EXCEPTION
2303: WHEN NO_DATA_FOUND THEN
2304: fnd_message.SET_NAME('INV','INVALID_SUB');
2305: fnd_msg_pub.add;
2306: RAISE fnd_api.g_exc_error;
2307: END ;
2308: END IF;
2309: --
2332: --
2333: EXCEPTION
2334: WHEN NO_DATA_FOUND THEN
2335: fnd_message.set_name('INV','INV_LOCATOR_NOT_AVAILABLE');
2336: fnd_msg_pub.add;
2337: RAISE fnd_api.g_exc_error; */
2338:
2339:
2340: IF INV_Validate.validateLocator(
2344: p_sub => l_rec,
2345: p_item => inv_reservation_global.g_item_record_cache(p_item_cache_index)
2346: )=INV_Validate.F THEN
2347: fnd_message.set_name('INV','INV_LOCATOR_NOT_AVAILABLE');
2348: fnd_msg_pub.add;
2349: RAISE fnd_api.g_exc_error;
2350: END IF;
2351: END;
2352: ELSIF inv_reservation_global.g_item_record_cache
2364: --
2365: EXCEPTION
2366: WHEN NO_DATA_FOUND THEN
2367: fnd_message.set_name('INV','INV_LOCATOR_NOT_AVAILABLE');
2368: fnd_msg_pub.add;
2369: RAISE fnd_api.g_exc_error;
2370: END;*/
2371:
2372: -- Modified for common API
2376: p_org => inv_reservation_global.g_organization_record_cache
2377: (p_org_cache_index),
2378: p_sub => l_rec)=INV_Validate.F THEN
2379: fnd_message.set_name('INV','INV_LOCATOR_NOT_AVAILABLE');
2380: fnd_msg_pub.add;
2381: RAISE fnd_api.g_exc_error;
2382: END IF;
2383: END IF;
2384: END IF; -- if p_locator_id is not null
2423: --
2424: -- fnd_message.set_name('INV','INVALID_SERIAL_NUMBER');
2425: -- fnd_message.set_token('NUMBER',p_serial_array(l_loop_index).serial_number,FALSE);
2426: /*** {{ R12 Enhanced ----reservations code changes ***/
2427: -- fnd_msg_pub.add;
2428: -- RAISE fnd_api.g_exc_error;
2429: -- END IF;
2430: -- EXIT WHEN l_loop_index = p_serial_array.last ;
2431: -- l_loop_index := p_serial_array.next(l_loop_index);
2433: -- /*EXCEPTION
2434: -- WHEN NO_DATA_FOUND THEN
2435: -- fnd_message.set_name('INV','INVALID_SERIAL_NUMBER');
2436: -- fnd_message.set_token('NUMBER',p_serial_array(l_loop_index),FALSE);
2437: -- fnd_msg_pub.add;
2438: -- RAISE fnd_api.g_exc_error;
2439: -- */
2440: -- END;
2441: -- END IF;
2453: (p_item_cache_index).lot_divisible_flag <> 'Y' AND
2454: inv_reservation_global.g_item_record_cache(p_item_cache_index).lot_control_code = inv_reservation_global.g_lot_control_yes AND
2455: p_lot_number IS NULL THEN
2456: fnd_message.set_name('INV', 'INV_INDIVISIBLE_LOT_REQUIRED'); -- INVCONV New Message
2457: fnd_msg_pub.add;
2458: RAISE fnd_api.g_exc_error;
2459: END IF;
2460: -- INVCONV END
2461: --
2471: --
2472: WHEN OTHERS THEN
2473: x_return_status := fnd_api.g_ret_sts_unexp_error ;
2474: --
2475: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
2476: THEN
2477: fnd_msg_pub.add_exc_msg
2478: ( g_pkg_name
2479: , 'Validate_Item_SKU'
2473: x_return_status := fnd_api.g_ret_sts_unexp_error ;
2474: --
2475: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
2476: THEN
2477: fnd_msg_pub.add_exc_msg
2478: ( g_pkg_name
2479: , 'Validate_Item_SKU'
2480: );
2481: END IF;
2547: /*** End R12 }} ***/
2548:
2549: IF p_supply_source_type_id IS NULL THEN
2550: fnd_message.set_name('INV', 'MISSING SUPPLY');
2551: fnd_msg_pub.add;
2552: RAISE fnd_api.g_exc_error;
2553: END IF;
2554: --
2555:
2562: inv_reservation_global.g_source_type_intransit, inv_reservation_global.g_source_type_wip,
2563: inv_reservation_global.g_source_type_rcv)) THEN
2564:
2565: fnd_message.set_name('INV', 'INV_RSV_INVALID_SUPPLY');
2566: fnd_msg_pub.ADD;
2567: RAISE fnd_api.g_exc_error;
2568: END IF;
2569: /*** End R12 }} ***/
2570:
2755: (inv_reservation_global.g_wip_source_type_discrete,
2756: inv_reservation_global.g_wip_source_type_osfm, inv_reservation_global.g_wip_source_type_fpo,
2757: inv_reservation_global.g_wip_source_type_batch)) THEN
2758: fnd_message.set_name('INV', 'INV_RSV_WIP_ENT_ERR');
2759: fnd_msg_pub.ADD;
2760: RAISE fnd_api.g_exc_error;
2761: END IF;
2762:
2763: -- add validation to check if the supply is wip discrete and osfm, then the
2766: l_wip_entity_type = inv_reservation_global.g_wip_source_type_osfm) THEN
2767: IF (p_demand_source_type_id NOT IN (inv_reservation_global.g_source_type_oe,
2768: inv_reservation_global.g_source_type_internal_ord)) THEN
2769: fnd_message.set_name('INV', 'INV_INVALID_DEMAND_SOURCE');
2770: fnd_msg_pub.ADD;
2771: RAISE fnd_api.g_exc_error;
2772: END IF;
2773: END IF;
2774:
2922: OR p_locator_id IS NOT NULL
2923: THEN
2924: -- if the supply source is not inv, sub, locator should be null and serial number should be empty
2925: fnd_message.set_name('INV', 'EXTRA_SUPPLY_INFO');
2926: fnd_msg_pub.ADD;
2927: RAISE fnd_api.g_exc_error;
2928: END IF;
2929: --
2930: x_sub_cache_index := l_sub_cache_index;
2943: --
2944: WHEN OTHERS THEN
2945: x_return_status := fnd_api.g_ret_sts_unexp_error ;
2946: --
2947: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
2948: THEN
2949: fnd_msg_pub.add_exc_msg
2950: ( g_pkg_name
2951: , 'Validate_Supply_Source'
2945: x_return_status := fnd_api.g_ret_sts_unexp_error ;
2946: --
2947: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
2948: THEN
2949: fnd_msg_pub.add_exc_msg
2950: ( g_pkg_name
2951: , 'Validate_Supply_Source'
2952: );
2953: END IF;
2985: --
2986: IF p_primary_uom IS NULL
2987: AND p_reservation_uom IS NULL THEN
2988: fnd_message.set_name('INV', 'MISSING UOM');
2989: fnd_msg_pub.add;
2990: RAISE fnd_api.g_exc_error;
2991: END IF;
2992: --
2993: IF p_primary_quantity IS NULL
2992: --
2993: IF p_primary_quantity IS NULL
2994: AND p_reservation_quantity IS NULL THEN
2995: fnd_message.set_name('INV', 'MISSING RSV QUANTITY');
2996: fnd_msg_pub.add;
2997: RAISE fnd_api.g_exc_error;
2998: END IF;
2999: --
3000: IF p_primary_quantity IS NOT NULL THEN
3007: -- if serial number is provided
3008: IF l_quantity <> Trunc(l_quantity)
3009: AND p_has_serial_number = fnd_api.g_true THEN
3010: fnd_message.set_name('INV', 'INV_QTY_EQ_INTEGER');
3011: fnd_msg_pub.add;
3012: RAISE fnd_api.g_exc_error;
3013: END IF;
3014: --
3015:
3021: -- SINGLE UOM TRACKING
3022: -- ===================
3023: IF p_secondary_uom IS NOT NULL THEN
3024: fnd_message.set_name('INV', 'INV_SECONDARY_UOM_NOT_REQUIRED'); -- INVCONV New Message
3025: fnd_msg_pub.add;
3026: RAISE fnd_api.g_exc_error;
3027: ELSIF p_secondary_quantity IS NOT NULL THEN
3028: fnd_message.set_name('INV', 'INV_SECONDARY_QTY_NOT_REQUIRED');-- INVCONV New Message
3029: fnd_msg_pub.add;
3025: fnd_msg_pub.add;
3026: RAISE fnd_api.g_exc_error;
3027: ELSIF p_secondary_quantity IS NOT NULL THEN
3028: fnd_message.set_name('INV', 'INV_SECONDARY_QTY_NOT_REQUIRED');-- INVCONV New Message
3029: fnd_msg_pub.add;
3030: RAISE fnd_api.g_exc_error;
3031: END IF;
3032: ELSIF inv_reservation_global.g_item_record_cache
3033: (p_item_cache_index).tracking_quantity_ind = 'PS' THEN
3034: -- DUAL UOM TRACKING
3035: -- =================
3036: IF p_secondary_uom IS NULL THEN
3037: fnd_message.set_name('INV', 'INV_SECONDARY_UOM_REQUIRED'); -- INVCONV New Message
3038: fnd_msg_pub.add;
3039: RAISE fnd_api.g_exc_error;
3040: ELSIF p_secondary_uom <> inv_reservation_global.g_item_record_cache(p_item_cache_index).secondary_uom_code THEN
3041: fnd_message.set_name('INV', 'INV_INCORRECT_SECONDARY_UOM'); -- INVCONV New Message
3042: fnd_msg_pub.add;
3038: fnd_msg_pub.add;
3039: RAISE fnd_api.g_exc_error;
3040: ELSIF p_secondary_uom <> inv_reservation_global.g_item_record_cache(p_item_cache_index).secondary_uom_code THEN
3041: fnd_message.set_name('INV', 'INV_INCORRECT_SECONDARY_UOM'); -- INVCONV New Message
3042: fnd_msg_pub.add;
3043: RAISE fnd_api.g_exc_error;
3044: ELSIF p_secondary_quantity IS NULL THEN
3045: fnd_message.set_name('INV', 'INV_SECONDARY_QTY_REQUIRED'); -- INVCONV New Message
3046: fnd_msg_pub.add;
3042: fnd_msg_pub.add;
3043: RAISE fnd_api.g_exc_error;
3044: ELSIF p_secondary_quantity IS NULL THEN
3045: fnd_message.set_name('INV', 'INV_SECONDARY_QTY_REQUIRED'); -- INVCONV New Message
3046: fnd_msg_pub.add;
3047: RAISE fnd_api.g_exc_error;
3048: END IF;
3049: -- Ensure that primary/secondary quantities honor the UOM conversion and deviations in place
3050:
3069: ) ;
3070:
3071: IF (l_qtys_within_dev <> 1) THEN
3072: --fnd_message.set_name('INV', l_error_message);
3073: --fnd_msg_pub.add;
3074: RAISE fnd_api.g_exc_error;
3075: END IF;
3076: END IF; /* IF for Fixed item */
3077: END IF;
3086: --
3087: WHEN OTHERS THEN
3088: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3089: --
3090: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3091: THEN
3092: fnd_msg_pub.add_exc_msg
3093: ( g_pkg_name
3094: , 'Validate_Quantity'
3088: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3089: --
3090: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3091: THEN
3092: fnd_msg_pub.add_exc_msg
3093: ( g_pkg_name
3094: , 'Validate_Quantity'
3095: );
3096: END IF;
3195: Nvl(p_demand_header_id,-99)) OR
3196: (Nvl(p_orig_demand_line_id,-99) <> Nvl(p_demand_line_id,-99))) THEN
3197: IF nvl(l_line_rec_open_flag, 'N') <> 'Y' AND Nvl(l_source_type_code, 'INTERNAL') <> 'EXTERNAL' THEN
3198: FND_MESSAGE.SET_NAME('INV', 'INV_RESERVATION_CLOSED_SO');
3199: FND_MSG_PUB.add;
3200: RAISE fnd_api.g_exc_error;
3201: END IF;
3202: END IF;
3203:
3204: /* Bug 3118495 -- Should not allow user to create a reservation against a shipped sales order line */
3205: -- Validate 2 -- the sales order line should not be in 'SHIPPED' status
3206: IF l_flow_status_code = 'SHIPPED' THEN
3207: FND_MESSAGE.SET_NAME('INV', 'INV_RESERVATION_SHIPPED_SO');
3208: FND_MSG_PUB.add;
3209: RAISE fnd_api.g_exc_error;
3210: END IF;
3211: -- Validate 3 -- Item : The item on the reservation has to
3212: -- be the same as the item on the sales order line
3215: IF p_reservation_org_id <> l_line_rec_org_id
3216: OR p_reservation_item_id <> l_line_rec_inventory_item_id THEN
3217:
3218: FND_MESSAGE.SET_NAME('INV', 'INV_RESERVATION_INVALID_ITEM');
3219: FND_MSG_PUB.add;
3220: RAISE fnd_api.g_exc_error;
3221: END IF;
3222: END IF;
3223: /* End of Bug 6044651 */
3226: -- Validate 4 -- booked_flag: If the supply is not Inventory, sales
3227: -- order has to be booked.
3228: IF (nvl(l_booked_flag, 'N') <> 'Y' AND p_supply_type_id <> inv_reservation_global.g_source_type_inv) THEN
3229: FND_MESSAGE.SET_NAME('INV', 'INV_RSV_SO_NOT_BOOKED');
3230: FND_MSG_PUB.ADD;
3231: RAISE fnd_api.g_exc_error;
3232: END IF;
3233:
3234:
3310: **
3311: *IF (l_ordered_quantity_rsv_uom - l_reserved_quantity) <
3312: * p_reservation_quantity THEN
3313: * FND_MESSAGE.SET_NAME('INV','INV_RSV_ORDER_QTY_VALID');
3314: * FND_MSG_PUB.ADD;
3315: * RAISE fnd_api.g_exc_error;
3316: *END IF;
3317: */
3318:
3328: --
3329: WHEN OTHERS THEN
3330: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3331: --
3332: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3333: THEN
3334: fnd_msg_pub.add_exc_msg
3335: ( g_pkg_name
3336: , 'Validate_Sales_Order'
3330: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3331: --
3332: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3333: THEN
3334: fnd_msg_pub.add_exc_msg
3335: ( g_pkg_name
3336: , 'Validate_Sales_Order'
3337: );
3338: END IF;
3425: IF p_demand_source_type_id IS NULL
3426: OR p_demand_source_header_id IS NULL
3427: AND p_demand_source_name IS NULL THEN
3428: fnd_message.set_name('INV', 'MISSING DEMAND SOURCE');
3429: fnd_msg_pub.add;
3430: END IF;
3431: --
3432: -- Bug 6124188 Added Demand Source of PO for which reservation gets created
3433: -- in case Return is attemped with profile 'WMS:Express Return' as 'No'
3441: inv_reservation_global.g_source_type_internal_ord,
3442: inv_reservation_global.g_source_type_rma, inv_reservation_global.g_source_type_wip)
3443: AND NOT(p_demand_source_type_id >100)) THEN
3444: fnd_message.set_name('INV','INV_INVALID_DEMAND_SOURCE');
3445: fnd_msg_pub.add;
3446: RAISE fnd_api.g_exc_error;
3447: END IF;
3448: /*** End R12 }} ***/
3449:
3452: IF p_demand_source_type_id = inv_reservation_global.g_source_type_inv
3453: OR p_demand_source_type_id > 100 THEN
3454: if p_demand_source_name IS NULL THEN
3455: fnd_message.set_name('INV','INV_INVALID_DEMAND_SOURCE');
3456: fnd_msg_pub.add;
3457: RAISE fnd_api.g_exc_error;
3458: END IF;
3459: END IF;
3460: --
3513: , l_structure_num
3514: , p_demand_source_header_id
3515: ) THEN
3516: fnd_message.set_name('INV', 'INVALID_ACCOUNT_NUMBER');
3517: fnd_msg_pub.add;
3518: RAISE fnd_api.g_exc_error;
3519: END IF;
3520: EXCEPTION
3521: WHEN no_data_found THEN
3519: END IF;
3520: EXCEPTION
3521: WHEN no_data_found THEN
3522: fnd_message.set_name('INV', 'INVALID_ACCOUNT_NUMBER');
3523: fnd_msg_pub.add;
3524: RAISE fnd_api.g_exc_error;
3525: END;
3526: --
3527: ELSE
3525: END;
3526: --
3527: ELSE
3528: fnd_message.set_name('INV', 'INVALID_ACCOUNT_NUMBER');
3529: fnd_msg_pub.add;
3530: RAISE fnd_api.g_exc_error;
3531: END IF;
3532: END IF;
3533: --
3543: , combination_id => p_demand_source_header_id
3544: , data_set => p_organization_id
3545: ) THEN
3546: fnd_message.set_name('INV', 'INVALID_ACCOUNT_ALIAS');
3547: fnd_msg_pub.add;
3548: RAISE fnd_api.g_exc_error;
3549: END IF;
3550: END IF;
3551: END IF;
3721: --
3722: WHEN OTHERS THEN
3723: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3724: --
3725: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3726: THEN
3727: fnd_msg_pub.add_exc_msg
3728: ( g_pkg_name
3729: , 'Validate_Demand_Source'
3723: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3724: --
3725: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3726: THEN
3727: fnd_msg_pub.add_exc_msg
3728: ( g_pkg_name
3729: , 'Validate_Demand_Source'
3730: );
3731: END IF;
3797: --
3798: WHEN OTHERS THEN
3799: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3800: --
3801: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3802: THEN
3803: fnd_msg_pub.add_exc_msg
3804: ( g_pkg_name
3805: , 'create_crossdock_reservation'
3799: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3800: --
3801: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3802: THEN
3803: fnd_msg_pub.add_exc_msg
3804: ( g_pkg_name
3805: , 'create_crossdock_reservation'
3806: );
3807: END IF;
3877: --
3878: WHEN OTHERS THEN
3879: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3880: --
3881: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3882: THEN
3883: fnd_msg_pub.add_exc_msg
3884: ( g_pkg_name
3885: , 'update_crossdock_reservation'
3879: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3880: --
3881: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3882: THEN
3883: fnd_msg_pub.add_exc_msg
3884: ( g_pkg_name
3885: , 'update_crossdock_reservation'
3886: );
3887: END IF;
3955: --
3956: WHEN OTHERS THEN
3957: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3958: --
3959: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3960: THEN
3961: fnd_msg_pub.add_exc_msg
3962: ( g_pkg_name
3963: , 'transfer_crossdock_reservation'
3957: x_return_status := fnd_api.g_ret_sts_unexp_error ;
3958: --
3959: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
3960: THEN
3961: fnd_msg_pub.add_exc_msg
3962: ( g_pkg_name
3963: , 'transfer_crossdock_reservation'
3964: );
3965: END IF;
4032: --
4033: WHEN OTHERS THEN
4034: x_return_status := fnd_api.g_ret_sts_unexp_error ;
4035: --
4036: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
4037: THEN
4038: fnd_msg_pub.add_exc_msg
4039: ( g_pkg_name
4040: , 'relieve_crossdock_reservation'
4034: x_return_status := fnd_api.g_ret_sts_unexp_error ;
4035: --
4036: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
4037: THEN
4038: fnd_msg_pub.add_exc_msg
4039: ( g_pkg_name
4040: , 'relieve_crossdock_reservation'
4041: );
4042: END IF;
4108: --
4109: WHEN OTHERS THEN
4110: x_return_status := fnd_api.g_ret_sts_unexp_error ;
4111: --
4112: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
4113: THEN
4114: fnd_msg_pub.add_exc_msg
4115: ( g_pkg_name
4116: , 'delete_crossdock_reservation'
4110: x_return_status := fnd_api.g_ret_sts_unexp_error ;
4111: --
4112: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
4113: THEN
4114: fnd_msg_pub.add_exc_msg
4115: ( g_pkg_name
4116: , 'delete_crossdock_reservation'
4117: );
4118: END IF;
4177: debug_print('Reservation of intransit shipment supply cannot be created in PJM and WMS organization');
4178: END IF;
4179:
4180: fnd_message.set_name('INV', 'INV_RSV_PJM_WMS_INTRAN');
4181: fnd_msg_pub.ADD;
4182:
4183: RAISE fnd_api.g_exc_error;
4184: ELSIF (p_supply_source_type_id = inv_reservation_global.g_source_type_po OR
4185: p_supply_source_type_id = inv_reservation_global.g_source_type_asn) THEN
4316: debug_print('Multiple project and task combinations exists for the supply line');
4317: END IF;
4318:
4319: fnd_message.set_name('INV', 'INV_RSV_SUP_MUL_PROJ');
4320: fnd_msg_pub.ADD;
4321: RAISE fnd_api.g_exc_error;
4322: END IF;
4323:
4324: IF((p_project_id is not null) AND (l_project_count = 1)) THEN
4334: debug_print('The project and task of reservation record does not match with the supply line');
4335: END IF;
4336:
4337: fnd_message.set_name('INV', 'INV_RSV_SUP_DIFF_PROJ');
4338: fnd_msg_pub.ADD;
4339: RAISE fnd_api.g_exc_error;
4340: END IF;
4341: END IF;
4342: ELSIF (p_supply_source_type_id = inv_reservation_global.g_source_type_wip) THEN
4376: debug_print('Multiple project and task combinations exists for the supply line');
4377: END IF;
4378:
4379: fnd_message.set_name('INV', 'INV_RSV_SUP_MUL_PROJ');
4380: fnd_msg_pub.ADD;
4381: RAISE fnd_api.g_exc_error;
4382: END IF;
4383:
4384: IF (p_project_id is not null) THEN
4392: debug_print('The project and task of reservation record does not match with the supply line');
4393: END IF;
4394:
4395: fnd_message.set_name('INV', 'INV_RSV_SUP_DIFF_PROJ');
4396: fnd_msg_pub.ADD;
4397: RAISE fnd_api.g_exc_error;
4398: END IF;
4399: END IF;
4400: END IF;
4414: --
4415: WHEN OTHERS THEN
4416: x_return_status := fnd_api.g_ret_sts_unexp_error ;
4417: --
4418: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
4419: THEN
4420: fnd_msg_pub.add_exc_msg
4421: ( g_pkg_name
4422: , 'validate_pjm_reservations'
4416: x_return_status := fnd_api.g_ret_sts_unexp_error ;
4417: --
4418: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
4419: THEN
4420: fnd_msg_pub.add_exc_msg
4421: ( g_pkg_name
4422: , 'validate_pjm_reservations'
4423: );
4424: END IF;
4506: debug_print('The reservation record is null');
4507: END IF;
4508:
4509: fnd_message.set_name('INV', 'INV_RSV_NULL_REC');
4510: fnd_msg_pub.ADD;
4511: RAISE fnd_api.g_exc_error;
4512: END IF;
4513:
4514: inv_reservation_util_pvt.search_organization_cache
4531: IF INV_Validate.Organization(
4532: p_org => l_org_rec
4533: )=INV_Validate.F THEN
4534: fnd_message.set_name('INV', 'INVALID ORGANIZATION');
4535: fnd_msg_pub.add;
4536: RAISE fnd_api.g_exc_error;
4537: END IF;
4538:
4539: --
4560: debug_print('Serial reservation can be created with Inventory supply only');
4561: END IF;
4562:
4563: fnd_message.set_name('INV', 'INV_RSV_SR_SUP_ERR');
4564: fnd_msg_pub.ADD;
4565: RAISE fnd_api.g_exc_error;
4566: END IF;
4567:
4568: IF (l_debug = 1) THEN
4601: debug_print('Serial reservation can be created with Inventory, sales order or CMRO demand only');
4602: END IF;
4603:
4604: fnd_message.set_name('INV', 'INV_RSV_SR_DEM_ERR');
4605: fnd_msg_pub.ADD;
4606: RAISE fnd_api.g_exc_error;
4607: END IF;
4608:
4609: IF (l_debug = 1) THEN
4666: debug_print('Serial reservation needs to be detailed, revision is null');
4667: END IF;
4668:
4669: fnd_message.set_name('INV', 'INV_RSV_SR_DETAIL');
4670: fnd_msg_pub.ADD;
4671: END IF;
4672:
4673: IF (l_debug = 1) THEN
4674: debug_print('After revision check');
4681: debug_print('Serial reservation needs to be detailed, lot number is null');
4682: END IF;
4683:
4684: fnd_message.set_name('INV', 'INV_RSV_SR_DETAIL');
4685: fnd_msg_pub.ADD;
4686: END IF;
4687:
4688: IF (l_debug = 1) THEN
4689: debug_print('After lot check');
4695: debug_print('Serial reservation needs to be detailed, subinventory is null');
4696: END IF;
4697:
4698: fnd_message.set_name('INV', 'INV_RSV_SR_DETAIL');
4699: fnd_msg_pub.ADD;
4700: ELSE
4701: -- if subinventory is locator controlled and locator is null,
4702: --returns error
4703:
4726: p_sub => l_sub_rec,
4727: p_org => l_org_rec
4728: )=INV_Validate.F THEN
4729: fnd_message.set_name('INV','INVALID_SUB');
4730: fnd_msg_pub.add;
4731: RAISE fnd_api.g_exc_error;
4732: END IF;
4733:
4734: --
4784: debug_print('Serial reservation needs to be detailed, locator is null');
4785: END IF;
4786:
4787: fnd_message.set_name('INV', 'INV_RSV_SR_DETAIL');
4788: fnd_msg_pub.ADD;
4789: END IF;
4790: IF (l_debug = 1) THEN
4791: debug_print('After loc check');
4792: END IF;
4836: debug_print('did not find any records for the passed
4837: information' || SQLERRM);
4838: END IF;
4839: fnd_message.set_name('INV', 'INV_INVALID_SERIAL');
4840: fnd_msg_pub.ADD;
4841: RAISE fnd_api.g_exc_error;
4842: END;
4843: IF (l_debug = 1) THEN
4844: debug_print('current_status = ' || l_current_status);
4877: debug_print('The serial number is not in inventory for serial reservation');
4878: END IF;
4879:
4880: fnd_message.set_name('INV', 'INV_RSV_SR_STS_ERR');
4881: fnd_msg_pub.ADD;
4882:
4883: RAISE fnd_api.g_exc_error;
4884: END IF;
4885:
4913: debug_print('lot_number = ' || l_orig_rsv_rec.lot_number);
4914: END IF;
4915:
4916: fnd_message.set_name('INV', 'INV_RSV_SR_NOT_MATCH');
4917: fnd_msg_pub.ADD;
4918:
4919: RAISE fnd_api.g_exc_error;
4920: END IF;
4921: ELSE
4925: debug_print('reservation_id = ' || l_orig_rsv_rec.reservation_id);
4926: END IF;
4927:
4928: fnd_message.set_name('INV', 'INV_RSV_SR_NOT_MATCH');
4929: fnd_msg_pub.ADD;
4930:
4931: RAISE fnd_api.g_exc_error;
4932: END IF;
4933: END IF;
4945: debug_print('The reservation record is null');
4946: END IF;
4947:
4948: fnd_message.set_name('INV', 'INV_RSV_NULL_REC');
4949: fnd_msg_pub.ADD;
4950: RAISE fnd_api.g_exc_error;
4951: END IF;
4952:
4953: inv_reservation_util_pvt.search_organization_cache
4970: IF INV_Validate.Organization(
4971: p_org => l_org_rec
4972: )=INV_Validate.F THEN
4973: fnd_message.set_name('INV', 'INVALID ORGANIZATION');
4974: fnd_msg_pub.add;
4975: RAISE fnd_api.g_exc_error;
4976: END IF;
4977:
4978: --
5003: debug_print('Serial reservation can be created with Inventory supply only');
5004: END IF;
5005:
5006: fnd_message.set_name('INV', 'INV_RSV_SR_SUP_ERR');
5007: fnd_msg_pub.ADD;
5008: RAISE fnd_api.g_exc_error;
5009: END IF;
5010:
5011: -- validate the demand source for serial reservation of to reservation record
5040: debug_print('Serial reservation can be created with Inventory, sales order or CMRO demand only');
5041: END IF;
5042:
5043: fnd_message.set_name('INV', 'INV_RSV_SR_DEM_ERR');
5044: fnd_msg_pub.ADD;
5045: RAISE fnd_api.g_exc_error;
5046: END IF;
5047:
5048: IF (l_debug = 1) THEN
5106: debug_print('Serial reservation needs to be detailed, revision is null');
5107: END IF;
5108:
5109: fnd_message.set_name('INV', 'INV_RSV_SR_DETAIL');
5110: fnd_msg_pub.ADD;
5111: END IF;
5112:
5113: -- if lot controlled and lot number is null, return errors
5114: IF (inv_reservation_global.g_item_record_cache(l_to_rsv_rec.inventory_item_id).lot_control_code =
5117: debug_print('Serial reservation needs to be detailed, lot number is null');
5118: END IF;
5119:
5120: fnd_message.set_name('INV', 'INV_RSV_SR_DETAIL');
5121: fnd_msg_pub.ADD;
5122: END IF;
5123:
5124: -- if subinventory is null, return errors
5125: IF (l_to_rsv_rec.subinventory_code is null) THEN
5127: debug_print('Serial reservation needs to be detailed, subinventory is null');
5128: END IF;
5129:
5130: fnd_message.set_name('INV', 'INV_RSV_SR_DETAIL');
5131: fnd_msg_pub.ADD;
5132: ELSE
5133: -- if subinventory is locator controlled and locator is null, returns error
5134: inv_reservation_util_pvt.search_sub_cache
5135: (
5160: p_sub => l_sub_rec,
5161: p_org => l_org_rec
5162: )=INV_Validate.F THEN
5163: fnd_message.set_name('INV','INVALID_SUB');
5164: fnd_msg_pub.add;
5165: RAISE fnd_api.g_exc_error;
5166: END IF;
5167:
5168: --
5219: debug_print('Serial reservation needs to be detailed, locator is null');
5220: END IF;
5221:
5222: fnd_message.set_name('INV', 'INV_RSV_SR_DETAIL');
5223: fnd_msg_pub.ADD;
5224: END IF;
5225: END IF;
5226:
5227: IF (l_debug = 1) THEN
5274: debug_print('The serial number is not in inventory for serial reservation');
5275: END IF;
5276:
5277: fnd_message.set_name('INV', 'INV_RSV_SR_STS_ERR');
5278: fnd_msg_pub.ADD;
5279:
5280: RAISE fnd_api.g_exc_error;
5281: END IF;
5282:
5306: debug_print('lot_number = ' || l_to_rsv_rec.lot_number);
5307: END IF;
5308:
5309: fnd_message.set_name('INV', 'INV_RSV_SR_NOT_MATCH');
5310: fnd_msg_pub.ADD;
5311:
5312: RAISE fnd_api.g_exc_error;
5313: END IF;
5314: END LOOP;
5326: --
5327: WHEN OTHERS THEN
5328: x_return_status := fnd_api.g_ret_sts_unexp_error ;
5329: --
5330: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
5331: THEN
5332: fnd_msg_pub.add_exc_msg
5333: ( g_pkg_name
5334: , 'Validate_Serials'
5328: x_return_status := fnd_api.g_ret_sts_unexp_error ;
5329: --
5330: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
5331: THEN
5332: fnd_msg_pub.add_exc_msg
5333: ( g_pkg_name
5334: , 'Validate_Serials'
5335: );
5336: END IF;
5687: p_orig_rsv_rec.demand_source_line_id) THEN
5688: IF (l_debug = 1) THEN
5689: debug_print('Job already has a crossdocked reservation for a different demand');
5690: fnd_message.set_name('INV', 'INV_INVALID_DEMAND_SOURCE');
5691: fnd_msg_pub.add;
5692: RAISE fnd_api.g_exc_error;
5693: END IF;
5694: END IF;
5695: END IF;
5883:
5884: IF p_orig_rsv_rec.inventory_item_id
5885: <> p_to_rsv_rec.inventory_item_id THEN
5886: fnd_message.set_name('INV', 'INVENTORY_ITEM_ID_NOT_THE_SAME');
5887: fnd_msg_pub.add;
5888: RAISE fnd_api.g_exc_error;
5889: END IF;
5890:
5891: /*** {{ R12 Enhanced reservations code changes ***/
6071: || l_demand_source_header_id);
6072: debug_print(' Reservations exist for sales order line'
6073: || l_demand_source_line_id);
6074: fnd_message.set_name('INV', 'INV_INVALID_DEMAND_SOURCE');
6075: fnd_msg_pub.add;
6076: RAISE fnd_api.g_exc_error;
6077: END IF;
6078: END IF;
6079: END IF;
6224: --
6225: WHEN OTHERS THEN
6226: x_return_status := fnd_api.g_ret_sts_unexp_error ;
6227: --
6228: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
6229: THEN
6230: fnd_msg_pub.add_exc_msg
6231: ( g_pkg_name
6232: , 'Validate_Input_Parameters'
6226: x_return_status := fnd_api.g_ret_sts_unexp_error ;
6227: --
6228: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
6229: THEN
6230: fnd_msg_pub.add_exc_msg
6231: ( g_pkg_name
6232: , 'Validate_Input_Parameters'
6233: );
6234: END IF;