480:
481: BEGIN
482:
483: -- Standard call to check for call compatibility.
484: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
485: l_api_name, 'inv_rcv_integration_apis') THEN
486: print_debug('FND_API not compatible inv_rcv_integration_apis.insert_mtli', 4);
487: RAISE fnd_api.g_exc_unexpected_error;
488: END IF;
482:
483: -- Standard call to check for call compatibility.
484: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
485: l_api_name, 'inv_rcv_integration_apis') THEN
486: print_debug('FND_API not compatible inv_rcv_integration_apis.insert_mtli', 4);
487: RAISE fnd_api.g_exc_unexpected_error;
488: END IF;
489:
490: -- Initialize message list if p_init_msg_list is set to TRUE.
483: -- Standard call to check for call compatibility.
484: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
485: l_api_name, 'inv_rcv_integration_apis') THEN
486: print_debug('FND_API not compatible inv_rcv_integration_apis.insert_mtli', 4);
487: RAISE fnd_api.g_exc_unexpected_error;
488: END IF;
489:
490: -- Initialize message list if p_init_msg_list is set to TRUE.
491: IF fnd_api.to_boolean(p_init_msg_lst) THEN
487: RAISE fnd_api.g_exc_unexpected_error;
488: END IF;
489:
490: -- Initialize message list if p_init_msg_list is set to TRUE.
491: IF fnd_api.to_boolean(p_init_msg_lst) THEN
492: fnd_msg_pub.initialize;
493: END IF;
494:
495: --Initialize the return status
492: fnd_msg_pub.initialize;
493: END IF;
494:
495: --Initialize the return status
496: x_return_status := FND_API.G_RET_STS_SUCCESS;
497:
498: --If the lot number and transaction_interface_id combination already exists
499: --then add the specified transaction_quantity and primary_quantity to the
500: --current lot interface record.
1031: print_debug('p_product_transaction_id returned: ' || p_product_transaction_id, 4);
1032: END IF;
1033:
1034: EXCEPTION
1035: WHEN FND_API.G_EXC_ERROR THEN
1036: IF c_mln_attributes%ISOPEN THEN
1037: CLOSE c_mln_attributes;
1038: END IF;
1039: x_return_status := FND_API.G_RET_STS_ERROR;
1035: WHEN FND_API.G_EXC_ERROR THEN
1036: IF c_mln_attributes%ISOPEN THEN
1037: CLOSE c_mln_attributes;
1038: END IF;
1039: x_return_status := FND_API.G_RET_STS_ERROR;
1040: fnd_msg_pub.count_and_get (
1041: p_encoded => FND_API.G_FALSE
1042: , p_count => x_msg_count
1043: , p_data => x_msg_data );
1037: CLOSE c_mln_attributes;
1038: END IF;
1039: x_return_status := FND_API.G_RET_STS_ERROR;
1040: fnd_msg_pub.count_and_get (
1041: p_encoded => FND_API.G_FALSE
1042: , p_count => x_msg_count
1043: , p_data => x_msg_data );
1044: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1045: IF c_mln_attributes%ISOPEN THEN
1040: fnd_msg_pub.count_and_get (
1041: p_encoded => FND_API.G_FALSE
1042: , p_count => x_msg_count
1043: , p_data => x_msg_data );
1044: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1045: IF c_mln_attributes%ISOPEN THEN
1046: CLOSE c_mln_attributes;
1047: END IF;
1048: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1044: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1045: IF c_mln_attributes%ISOPEN THEN
1046: CLOSE c_mln_attributes;
1047: END IF;
1048: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1049: fnd_msg_pub.count_and_get (
1050: p_encoded => FND_API.G_FALSE
1051: , p_count => x_msg_count
1052: , p_data => x_msg_data );
1046: CLOSE c_mln_attributes;
1047: END IF;
1048: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1049: fnd_msg_pub.count_and_get (
1050: p_encoded => FND_API.G_FALSE
1051: , p_count => x_msg_count
1052: , p_data => x_msg_data );
1053: WHEN OTHERS THEN
1054: IF c_mln_attributes%ISOPEN THEN
1053: WHEN OTHERS THEN
1054: IF c_mln_attributes%ISOPEN THEN
1055: CLOSE c_mln_attributes;
1056: END IF;
1057: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1058: fnd_msg_pub.count_and_get (
1059: p_encoded => FND_API.G_FALSE
1060: , p_count => x_msg_count
1061: , p_data => x_msg_data );
1055: CLOSE c_mln_attributes;
1056: END IF;
1057: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1058: fnd_msg_pub.count_and_get (
1059: p_encoded => FND_API.G_FALSE
1060: , p_count => x_msg_count
1061: , p_data => x_msg_data );
1062: IF SQLCODE IS NOT NULL THEN
1063: inv_mobile_helper_functions.sql_error (
1398: l_debug NUMBER := NVL(fnd_profile.VALUE('INV_DEBUG_TRACE'), 0);
1399: BEGIN
1400:
1401: -- Standard call to check for call compatibility.
1402: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
1403: l_api_name, 'inv_rcv_integration_apis') THEN
1404: print_debug('FND_API not compatible','inv_rcv_integration_apis.insert_msni');
1405: RAISE fnd_api.g_exc_unexpected_error;
1406: END IF;
1400:
1401: -- Standard call to check for call compatibility.
1402: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
1403: l_api_name, 'inv_rcv_integration_apis') THEN
1404: print_debug('FND_API not compatible','inv_rcv_integration_apis.insert_msni');
1405: RAISE fnd_api.g_exc_unexpected_error;
1406: END IF;
1407:
1408: -- Initialize message list if p_init_msg_list is set to TRUE.
1401: -- Standard call to check for call compatibility.
1402: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
1403: l_api_name, 'inv_rcv_integration_apis') THEN
1404: print_debug('FND_API not compatible','inv_rcv_integration_apis.insert_msni');
1405: RAISE fnd_api.g_exc_unexpected_error;
1406: END IF;
1407:
1408: -- Initialize message list if p_init_msg_list is set to TRUE.
1409: IF fnd_api.to_boolean(p_init_msg_lst) THEN
1405: RAISE fnd_api.g_exc_unexpected_error;
1406: END IF;
1407:
1408: -- Initialize message list if p_init_msg_list is set to TRUE.
1409: IF fnd_api.to_boolean(p_init_msg_lst) THEN
1410: fnd_msg_pub.initialize;
1411: END IF;
1412:
1413: --Initialize the return status
1410: fnd_msg_pub.initialize;
1411: END IF;
1412:
1413: --Initialize the return status
1414: x_return_status := fnd_api.g_ret_sts_success;
1415:
1416: --Generate transaction_interface_id if necessary
1417: IF (p_transaction_interface_id IS NULL) THEN
1418: SELECT mtl_material_transactions_s.NEXTVAL
1573: IF l_msni_tbl_count <= 0 THEN
1574: IF (l_debug = 1) THEN
1575: print_debug('Unexpected error. The table of serials is empty!', 4);
1576: END IF;
1577: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1578: END IF;
1579:
1580: FOR i IN 1 .. l_msni_tbl_count LOOP
1581:
1860: print_debug('p_product_transaction_id returned: ' || p_product_transaction_id, 4);
1861: END IF;
1862:
1863: EXCEPTION
1864: WHEN FND_API.G_EXC_ERROR THEN
1865: IF c_msn_attributes%ISOPEN THEN
1866: CLOSE c_msn_attributes;
1867: END IF;
1868: x_return_status := fnd_api.g_ret_sts_error;
1864: WHEN FND_API.G_EXC_ERROR THEN
1865: IF c_msn_attributes%ISOPEN THEN
1866: CLOSE c_msn_attributes;
1867: END IF;
1868: x_return_status := fnd_api.g_ret_sts_error;
1869: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
1870: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1871: IF c_msn_attributes%ISOPEN THEN
1872: CLOSE c_msn_attributes;
1865: IF c_msn_attributes%ISOPEN THEN
1866: CLOSE c_msn_attributes;
1867: END IF;
1868: x_return_status := fnd_api.g_ret_sts_error;
1869: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
1870: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1871: IF c_msn_attributes%ISOPEN THEN
1872: CLOSE c_msn_attributes;
1873: END IF;
1866: CLOSE c_msn_attributes;
1867: END IF;
1868: x_return_status := fnd_api.g_ret_sts_error;
1869: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
1870: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1871: IF c_msn_attributes%ISOPEN THEN
1872: CLOSE c_msn_attributes;
1873: END IF;
1874: x_return_status := fnd_api.g_ret_sts_unexp_error;
1870: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1871: IF c_msn_attributes%ISOPEN THEN
1872: CLOSE c_msn_attributes;
1873: END IF;
1874: x_return_status := fnd_api.g_ret_sts_unexp_error;
1875: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
1876: WHEN OTHERS THEN
1877: IF c_msn_attributes%ISOPEN THEN
1878: CLOSE c_msn_attributes;
1871: IF c_msn_attributes%ISOPEN THEN
1872: CLOSE c_msn_attributes;
1873: END IF;
1874: x_return_status := fnd_api.g_ret_sts_unexp_error;
1875: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
1876: WHEN OTHERS THEN
1877: IF c_msn_attributes%ISOPEN THEN
1878: CLOSE c_msn_attributes;
1879: END IF;
1876: WHEN OTHERS THEN
1877: IF c_msn_attributes%ISOPEN THEN
1878: CLOSE c_msn_attributes;
1879: END IF;
1880: x_return_status := fnd_api.g_ret_sts_unexp_error;
1881: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
1882:
1883: IF SQLCODE IS NOT NULL THEN
1884: inv_mobile_helper_functions.sql_error('INV_RCV_INTEGRATION_APIS.INSERT_MSNI', l_progress, SQLCODE);
1877: IF c_msn_attributes%ISOPEN THEN
1878: CLOSE c_msn_attributes;
1879: END IF;
1880: x_return_status := fnd_api.g_ret_sts_unexp_error;
1881: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
1882:
1883: IF SQLCODE IS NOT NULL THEN
1884: inv_mobile_helper_functions.sql_error('INV_RCV_INTEGRATION_APIS.INSERT_MSNI', l_progress, SQLCODE);
1885: END IF;
2017: IF (p_validation_mode = INV_RCV_INTEGRATION_APIS.G_EXISTS_ONLY AND
2018: l_lot_exists = 'N') THEN
2019: fnd_message.set_name('INV', 'INV_INVALID_LOT');
2020: fnd_msg_pub.ADD;
2021: x_return_status := FND_API.g_ret_sts_error;
2022: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2023: print_debug('err: ' || x_msg_data, 9);
2024: RETURN FALSE;
2025: END IF;
2018: l_lot_exists = 'N') THEN
2019: fnd_message.set_name('INV', 'INV_INVALID_LOT');
2020: fnd_msg_pub.ADD;
2021: x_return_status := FND_API.g_ret_sts_error;
2022: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2023: print_debug('err: ' || x_msg_data, 9);
2024: RETURN FALSE;
2025: END IF;
2026:
2038: --If the lot is not unique then raise an error
2039: IF NOT l_unique_lot THEN
2040: fnd_message.set_name('INV', 'INV_LOT_UNIQUE_FAIL');
2041: fnd_msg_pub.add;
2042: x_return_status := FND_API.g_ret_sts_error;
2043: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2044: RETURN FALSE;
2045: END IF;
2046:
2039: IF NOT l_unique_lot THEN
2040: fnd_message.set_name('INV', 'INV_LOT_UNIQUE_FAIL');
2041: fnd_msg_pub.add;
2042: x_return_status := FND_API.g_ret_sts_error;
2043: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2044: RETURN FALSE;
2045: END IF;
2046:
2047: --Validate the expiration date based on shelf life code
2060: fnd_msg_pub.ADD;
2061: IF l_debug = 1 THEN
2062: print_debug('validate_lot_number: Unable to fetch shelf life code for the inventory item passed', 9);
2063: END IF;
2064: x_return_status := FND_API.g_ret_sts_error;
2065: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2066: RETURN FALSE;
2067: END;
2068:
2061: IF l_debug = 1 THEN
2062: print_debug('validate_lot_number: Unable to fetch shelf life code for the inventory item passed', 9);
2063: END IF;
2064: x_return_status := FND_API.g_ret_sts_error;
2065: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2066: RETURN FALSE;
2067: END;
2068:
2069: IF l_debug = 1 THEN
2084: fnd_msg_pub.ADD;
2085: IF l_debug = 1 THEN
2086: print_debug('validate_lot_number: Expiration will not be considered for shelf_life code of type ITEM_SHELF_LIFE_DAYS', 9);
2087: END IF;
2088: x_return_status := FND_API.g_ret_sts_error;
2089: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2090: RETURN FALSE;
2091: END IF;
2092: ELSIF l_shelf_life_code = user_defined_exp_date THEN
2085: IF l_debug = 1 THEN
2086: print_debug('validate_lot_number: Expiration will not be considered for shelf_life code of type ITEM_SHELF_LIFE_DAYS', 9);
2087: END IF;
2088: x_return_status := FND_API.g_ret_sts_error;
2089: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2090: RETURN FALSE;
2091: END IF;
2092: ELSIF l_shelf_life_code = user_defined_exp_date THEN
2093: IF l_debug = 1 THEN
2098: fnd_msg_pub.ADD;
2099: IF l_debug = 1 THEN
2100: print_debug('validate_lot_number: Lot expiration date is required ', 9);
2101: END IF;
2102: x_return_status := FND_API.g_ret_sts_error;
2103: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2104: RETURN FALSE;
2105: ELSE
2106: l_expiration_date := p_expiration_date;
2099: IF l_debug = 1 THEN
2100: print_debug('validate_lot_number: Lot expiration date is required ', 9);
2101: END IF;
2102: x_return_status := FND_API.g_ret_sts_error;
2103: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2104: RETURN FALSE;
2105: ELSE
2106: l_expiration_date := p_expiration_date;
2107: END IF;
2159: , p_territory_code => p_territory_code
2160: , p_supplier_lot_number => p_supplier_lot_number
2161: , p_vendor_name => p_vendor_name
2162: , p_source => inv_lot_api_pub.inv);
2163: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2164: IF (l_debug = 1) THEN
2165: print_debug('validate_lot_number: Error in creating the lot number', 9);
2166: END IF;
2167: x_return_status := FND_API.g_ret_sts_error;
2163: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2164: IF (l_debug = 1) THEN
2165: print_debug('validate_lot_number: Error in creating the lot number', 9);
2166: END IF;
2167: x_return_status := FND_API.g_ret_sts_error;
2168: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2169: RETURN FALSE;
2170: END IF;
2171: END IF; --END IF create the lot number
2164: IF (l_debug = 1) THEN
2165: print_debug('validate_lot_number: Error in creating the lot number', 9);
2166: END IF;
2167: x_return_status := FND_API.g_ret_sts_error;
2168: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2169: RETURN FALSE;
2170: END IF;
2171: END IF; --END IF create the lot number
2172: --This API should be getting called only for a ship transaction from iSP.
2172: --This API should be getting called only for a ship transaction from iSP.
2173: ELSE
2174: fnd_message.set_name('INV','INV_NOT_IMPLEMENTED');
2175: fnd_msg_pub.add;
2176: x_return_status := FND_API.g_ret_sts_error;
2177: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2178: RETURN FALSE;
2179: END IF; --END IF Check the transaction type
2180:
2173: ELSE
2174: fnd_message.set_name('INV','INV_NOT_IMPLEMENTED');
2175: fnd_msg_pub.add;
2176: x_return_status := FND_API.g_ret_sts_error;
2177: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2178: RETURN FALSE;
2179: END IF; --END IF Check the transaction type
2180:
2181: --All the validations have passed successfully, then
2185: WHEN OTHERS THEN
2186: IF (l_debug = 1) THEN
2187: print_debug('validate_lot_number: Exception occurred in validate_lot_number', 3);
2188: END IF;
2189: x_return_status := FND_API.g_ret_sts_error;
2190: fnd_msg_pub.count_and_get(
2191: p_encoded => fnd_api.g_false
2192: , p_count => x_msg_count
2193: , p_data => x_msg_data);
2187: print_debug('validate_lot_number: Exception occurred in validate_lot_number', 3);
2188: END IF;
2189: x_return_status := FND_API.g_ret_sts_error;
2190: fnd_msg_pub.count_and_get(
2191: p_encoded => fnd_api.g_false
2192: , p_count => x_msg_count
2193: , p_data => x_msg_data);
2194: IF SQLCODE IS NOT NULL THEN
2195: inv_mobile_helper_functions.sql_error(
2256: print_debug('validate_serial_range: From Serial Number cannot be NULL', 9);
2257: END IF;
2258: fnd_message.set_name('INV', 'INV_INLTIS_FROMSER');
2259: fnd_msg_pub.add;
2260: x_return_status := FND_API.g_ret_sts_error;
2261: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2262: RETURN FALSE;
2263: END IF;
2264:
2257: END IF;
2258: fnd_message.set_name('INV', 'INV_INLTIS_FROMSER');
2259: fnd_msg_pub.add;
2260: x_return_status := FND_API.g_ret_sts_error;
2261: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2262: RETURN FALSE;
2263: END IF;
2264:
2265: --If to serial number and quantity both are NULL then raise an error
2268: print_debug('validate_serial_range: To Serial and quantity both cannot be NULL', 9);
2269: END IF;
2270: fnd_message.set_name('INV', 'INV_INLTIS_RANGE');
2271: fnd_msg_pub.add;
2272: x_return_status := FND_API.g_ret_sts_error;
2273: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2274: RETURN FALSE;
2275: END IF;
2276:
2269: END IF;
2270: fnd_message.set_name('INV', 'INV_INLTIS_RANGE');
2271: fnd_msg_pub.add;
2272: x_return_status := FND_API.g_ret_sts_error;
2273: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2274: RETURN FALSE;
2275: END IF;
2276:
2277: --If to serial number is passed, get the difference between from and to serials
2286: END IF;
2287: -- Bug Fix 4375959
2288: -- fnd_message.set_name('INV', 'INV_INLTIS_RANGE');
2289: fnd_msg_pub.add;
2290: x_return_status := FND_API.g_ret_sts_error;
2291: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2292: RETURN FALSE;
2293: END IF; --End If serial difference is < 0
2294:
2287: -- Bug Fix 4375959
2288: -- fnd_message.set_name('INV', 'INV_INLTIS_RANGE');
2289: fnd_msg_pub.add;
2290: x_return_status := FND_API.g_ret_sts_error;
2291: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2292: RETURN FALSE;
2293: END IF; --End If serial difference is < 0
2294:
2295: --If quantity is > 1 and the serial difference does not match the quantity
2302: print_debug('validate_serial_range: Serial quantity does not match transaction quantity', 9);
2303: END IF;
2304: fnd_message.set_name('INV', 'INV_SERQTY_NOTMATCH');
2305: fnd_msg_pub.add;
2306: x_return_status := FND_API.g_ret_sts_error;
2307: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2308: RETURN FALSE;
2309: END IF;
2310: END IF; --END IF p_to_serial_number is NOT NULL
2303: END IF;
2304: fnd_message.set_name('INV', 'INV_SERQTY_NOTMATCH');
2305: fnd_msg_pub.add;
2306: x_return_status := FND_API.g_ret_sts_error;
2307: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2308: RETURN FALSE;
2309: END IF;
2310: END IF; --END IF p_to_serial_number is NOT NULL
2311:
2318: print_debug('validate_serial_range: To serial number must be specified', 9);
2319: END IF;
2320: fnd_message.set_name('INV', 'INV_SERIAL_NOT_ENTERED');
2321: fnd_msg_pub.add;
2322: x_return_status := FND_API.g_ret_sts_error;
2323: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2324: RETURN FALSE;
2325: END IF; --END IF p_to_serial_number IS NULL
2326:
2319: END IF;
2320: fnd_message.set_name('INV', 'INV_SERIAL_NOT_ENTERED');
2321: fnd_msg_pub.add;
2322: x_return_status := FND_API.g_ret_sts_error;
2323: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2324: RETURN FALSE;
2325: END IF; --END IF p_to_serial_number IS NULL
2326:
2327: --Now check for the existence of all the serials in the range
2357: END IF;
2358: fnd_message.set_name('INV', 'INV_SER_NOTEXIST');
2359: fnd_message.set_token('TOKEN', l_cur_serial_number);
2360: fnd_msg_pub.add;
2361: x_return_status := FND_API.g_ret_sts_error;
2362: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2363: RETURN FALSE;
2364: END;
2365: END LOOP; --END For each serial in the range
2358: fnd_message.set_name('INV', 'INV_SER_NOTEXIST');
2359: fnd_message.set_token('TOKEN', l_cur_serial_number);
2360: fnd_msg_pub.add;
2361: x_return_status := FND_API.g_ret_sts_error;
2362: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2363: RETURN FALSE;
2364: END;
2365: END LOOP; --END For each serial in the range
2366: END IF; --END IF g_exists_only
2389: print_debug('validate_serial_range: Error returned by validate_serials', 9);
2390: END IF;
2391: fnd_message.set_name('INV', 'INVALID_SERIAL_NUMBER');
2392: fnd_msg_pub.ADD;
2393: x_return_status := FND_API.g_ret_sts_error;
2394: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2395: RETURN FALSE;
2396: END IF;
2397: END IF; --END IF g_exists_or_create
2390: END IF;
2391: fnd_message.set_name('INV', 'INVALID_SERIAL_NUMBER');
2392: fnd_msg_pub.ADD;
2393: x_return_status := FND_API.g_ret_sts_error;
2394: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2395: RETURN FALSE;
2396: END IF;
2397: END IF; --END IF g_exists_or_create
2398:
2402: --This API should be getting called only for a ship transaction from iSP.
2403: ELSE
2404: fnd_message.set_name('INV','INV_NOT_IMPLEMENTED');
2405: fnd_msg_pub.add;
2406: x_return_status := FND_API.g_ret_sts_error;
2407: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2408: RETURN FALSE;
2409: END IF; --END IF Check the transaction type
2410:
2403: ELSE
2404: fnd_message.set_name('INV','INV_NOT_IMPLEMENTED');
2405: fnd_msg_pub.add;
2406: x_return_status := FND_API.g_ret_sts_error;
2407: fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
2408: RETURN FALSE;
2409: END IF; --END IF Check the transaction type
2410:
2411: EXCEPTION
2412: WHEN OTHERS THEN
2413: IF (l_debug = 1) THEN
2414: print_debug('validate_serial_range: Exception occurred in validate_serial_range', 3);
2415: END IF;
2416: x_return_status := FND_API.g_ret_sts_error;
2417: fnd_msg_pub.count_and_get(
2418: p_encoded => fnd_api.g_false
2419: , p_count => x_msg_count
2420: , p_data => x_msg_data);
2414: print_debug('validate_serial_range: Exception occurred in validate_serial_range', 3);
2415: END IF;
2416: x_return_status := FND_API.g_ret_sts_error;
2417: fnd_msg_pub.count_and_get(
2418: p_encoded => fnd_api.g_false
2419: , p_count => x_msg_count
2420: , p_data => x_msg_data);
2421: IF SQLCODE IS NOT NULL THEN
2422: inv_mobile_helper_functions.sql_error(
2590: wms_container_pvt.create_lpn(
2591: p_api_version => 1.0,
2592: p_init_msg_list => g_false,
2593: p_commit => g_false,
2594: p_validation_level => fnd_api.g_valid_level_full,
2595: x_return_status => x_return_status,
2596: x_msg_count => x_msg_count,
2597: x_msg_data => x_msg_data,
2598: p_lpn => p_lpn,
2718: END IF;
2719: /*end , INVCONV */
2720:
2721: -- Standard call to check for call compatibility.
2722: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
2723: l_api_name, 'inv_rcv_integration_apis') THEN
2724: print_debug('FND_API not compatible inv_rcv_integration_apis.validate_lpn_info', 4);
2725: RAISE fnd_api.g_exc_unexpected_error;
2726: END IF;
2720:
2721: -- Standard call to check for call compatibility.
2722: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
2723: l_api_name, 'inv_rcv_integration_apis') THEN
2724: print_debug('FND_API not compatible inv_rcv_integration_apis.validate_lpn_info', 4);
2725: RAISE fnd_api.g_exc_unexpected_error;
2726: END IF;
2727:
2728: l_progress := '50';
2721: -- Standard call to check for call compatibility.
2722: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
2723: l_api_name, 'inv_rcv_integration_apis') THEN
2724: print_debug('FND_API not compatible inv_rcv_integration_apis.validate_lpn_info', 4);
2725: RAISE fnd_api.g_exc_unexpected_error;
2726: END IF;
2727:
2728: l_progress := '50';
2729:
2727:
2728: l_progress := '50';
2729:
2730: -- Initialize message list if p_init_msg_list is set to TRUE.
2731: IF fnd_api.to_boolean(p_init_msg_lst) THEN
2732: fnd_msg_pub.initialize;
2733: END IF;
2734:
2735: l_progress := '60';
2758:
2759: RETURN TRUE;
2760: EXCEPTION
2761: WHEN OTHERS THEN
2762: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2763:
2764: IF SQLCODE IS NOT NULL THEN
2765: inv_mobile_helper_functions.sql_error (
2766: 'INV_RCV_INTEGRATION_APIS.VALIDATE_LPN_INFO',
3161: BEGIN
3162: x_return_status := g_ret_sts_success;
3163:
3164: -- Standard call to check for call compatibility.
3165: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
3166: l_api_name, 'inv_rcv_integration_apis') THEN
3167: IF (l_debug = 1) THEN
3168: print_debug('FND_API not compatible inv_rcv_integration_apis.split_lot_serial', 4);
3169: END IF;
3164: -- Standard call to check for call compatibility.
3165: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version,
3166: l_api_name, 'inv_rcv_integration_apis') THEN
3167: IF (l_debug = 1) THEN
3168: print_debug('FND_API not compatible inv_rcv_integration_apis.split_lot_serial', 4);
3169: END IF;
3170: RAISE fnd_api.g_exc_unexpected_error;
3171: END IF;
3172:
3166: l_api_name, 'inv_rcv_integration_apis') THEN
3167: IF (l_debug = 1) THEN
3168: print_debug('FND_API not compatible inv_rcv_integration_apis.split_lot_serial', 4);
3169: END IF;
3170: RAISE fnd_api.g_exc_unexpected_error;
3171: END IF;
3172:
3173: -- Initialize message list if p_init_msg_list is set to TRUE.
3174: IF fnd_api.to_boolean(p_init_msg_lst) THEN
3170: RAISE fnd_api.g_exc_unexpected_error;
3171: END IF;
3172:
3173: -- Initialize message list if p_init_msg_list is set to TRUE.
3174: IF fnd_api.to_boolean(p_init_msg_lst) THEN
3175: fnd_msg_pub.initialize;
3176: END IF;
3177:
3178: inv_rcv_integration_pvt.split_lot_serial(p_rti_tb => p_new_rti_info,
3776: || p_txn_header_id || ' found MOL',4);
3777: END IF;
3778: fnd_message.set_name('WMS','WMS_TASK_NO_ELIGIBLE_TASKS');
3779: fnd_msg_pub.add;
3780: RAISE fnd_api.g_exc_error;
3781: END IF;
3782: ELSE
3783: IF (mmtt_cur%notfound) THEN
3784: IF (l_debug = 1) THEN
3826: ,p_inventory_item_id => NULL
3827: ,p_lpn_id => NULL
3828: ,p_activity_type_id => 1 -- INBOUND
3829: ,p_organization_id => l_orig_mmtt_rec.organization_id);
3830: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
3831: IF (l_debug = 1) THEN
3832: print_debug('SPLIT_MMTT: validate_operation failed',4);
3833: END IF;
3834: RAISE fnd_api.g_exc_error;
3830: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
3831: IF (l_debug = 1) THEN
3832: print_debug('SPLIT_MMTT: validate_operation failed',4);
3833: END IF;
3834: RAISE fnd_api.g_exc_error;
3835: END IF;
3836:
3837: IF (l_debug = 1) THEN
3838: print_debug('SPLIT_MMTT: Values returned from call to validate_operation',4);
4373: WHEN OTHERS THEN
4374: IF (l_debug = 1) THEN
4375: print_debug('SPLIT_MMTT: Error inserting mmtt', 4);
4376: END IF;
4377: RAISE fnd_api.g_exc_error;
4378: END;
4379:
4380: l_progress := '100';
4381:
4401: WHEN OTHERS THEN
4402: IF (l_debug = 1) THEN
4403: print_debug('SPLIT_MMTT: Error updating original MMTT', 4);
4404: END IF;
4405: RAISE fnd_api.g_exc_error;
4406: END;
4407:
4408: l_progress := '110';
4409: -- Update putaway_temp_table if necessary
4406: END;
4407:
4408: l_progress := '110';
4409: -- Update putaway_temp_table if necessary
4410: IF (p_updt_putaway_temp_tbl = fnd_api.g_true) THEN
4411: BEGIN
4412: UPDATE
4413: wms_putaway_group_tasks_gtmp
4414: SET
4433: IF (l_debug = 1) THEN
4434: print_debug('SPLIT_MMTT: Error updating putaway temp table',
4435: 4);
4436: END IF;
4437: RAISE fnd_api.g_exc_error;
4438: END;
4439: END IF;
4440:
4441: l_progress := '120';
4454: print_debug('SPLIT_MMTT: Error in split_operation_instance',4);
4455: END IF;
4456: fnd_message.set_name('WMS','WMS_TASK_SPLIT_FAIL');
4457: fnd_msg_pub.add;
4458: RAISE fnd_api.g_exc_error;
4459: END IF;
4460: l_progress := '130';
4461:
4462: /* Retrieve lot/serial control code call break to split */
4472: || x_orig_mol_rec.inventory_item_id ||
4473: ' organization:' ||
4474: x_orig_mol_rec.organization_id, 4);
4475: END IF;
4476: RAISE fnd_api.g_exc_error;
4477: END;
4478: l_progress := '140';
4479:
4480: l_new_txn_tb(1).transaction_id := l_new_mmtt_id;
4498: WHEN OTHERS THEN
4499: IF (l_debug = 1) THEN
4500: print_debug('SPLIT_MMTT: Error breaking lot serial', 4);
4501: END IF;
4502: RAISE fnd_api.g_exc_error;
4503: END;
4504:
4505: l_progress := '150';
4506:
4553: IF (l_debug = 1) THEN
4554: print_debug('SPLIT_MMTT: Error updating mmtt with id '
4555: || l_orig_mmtt_rec.transaction_temp_id, 4);
4556: END IF;
4557: RAISE fnd_api.g_exc_error;
4558: END;
4559: l_progress := '180';
4560:
4561: -- Update MOL of putaway_temp_table if necessary
4558: END;
4559: l_progress := '180';
4560:
4561: -- Update MOL of putaway_temp_table if necessary
4562: IF (p_updt_putaway_temp_tbl = fnd_api.g_true) THEN
4563: BEGIN
4564: UPDATE
4565: wms_putaway_group_tasks_gtmp
4566: SET move_order_line_id = x_new_mol_rec.line_id
4572: IF (l_debug = 1) THEN
4573: print_debug('Error updating[[[ putaway temp table',
4574: 4);
4575: END IF;
4576: RAISE fnd_api.g_exc_error;
4577: END;
4578: END IF;
4579: l_progress := '190';
4580:
4652: IF (l_debug = 1) THEN
4653: print_debug('SPLIT_MMTT: Error updating MMTT with id:'
4654: || l_orig_mmtt_rec.transaction_temp_id, 4);
4655: END IF;
4656: RAISE fnd_api.g_exc_error;
4657: END;
4658:
4659: l_progress := '230';
4660:
4658:
4659: l_progress := '230';
4660:
4661: -- Delete from putawau_temp_table if necessary
4662: IF (p_updt_putaway_temp_tbl = fnd_api.g_true) THEN
4663: BEGIN
4664: UPDATE
4665: wms_putaway_group_tasks_gtmp
4666: SET
4673: IF (l_debug = 1) THEN
4674: print_debug('Error updating putaway temp table',
4675: 4);
4676: END IF;
4677: RAISE fnd_api.g_exc_error;
4678: END;
4679: END IF;
4680: l_progress := '240';
4681:
4770:
4771: PROCEDURE split_mo
4772: (p_orig_mol_id IN NUMBER,
4773: p_mo_splt_tb IN OUT nocopy mo_in_tb_tp,
4774: p_updt_putaway_temp_tbl IN VARCHAR2 DEFAULT fnd_api.g_false,
4775: p_txn_header_id IN NUMBER DEFAULT NULL,
4776: p_operation_type IN VARCHAR2 DEFAULT NULL,
4777: x_return_status OUT NOCOPY VARCHAR2,
4778: x_msg_count OUT NOCOPY NUMBER,
4878: print_debug('SPLIT_MO ERROR: Original quantity is <= 0', 4);
4879: END IF;
4880: fnd_message.set_name('INV', 'INV_INVALID_QTY');
4881: fnd_msg_pub.ADD;
4882: RAISE fnd_api.g_exc_error;
4883: END IF;
4884:
4885: l_progress := '20';
4886:
4903: print_debug('SPLIT_MO - ERROR: Quantity to split is <= 0', 4);
4904: END IF;
4905: fnd_message.set_name('INV', 'INV_INVALID_QTY');
4906: fnd_msg_pub.ADD;
4907: RAISE fnd_api.g_exc_error;
4908: END IF;
4909:
4910: -- convert prim quantities to transaction uom in mol first
4911: IF (l_orig_mol_rec.uom_code = l_prim_uom_code) THEN
4948: || ', not enough to split ' || l_total_to_split, 4);
4949: END IF;
4950: fnd_message.set_name('INV', 'INV_INSUFFICIENT_QTY');
4951: fnd_msg_pub.ADD;
4952: RAISE fnd_api.g_exc_error;
4953: END IF;
4954:
4955: l_progress := '40';
4956:
5224: print_debug('SPLIT_MO: SQLCODE = ' || SQLCODE, 4);
5225: END IF;
5226: fnd_message.set_name('WMS','WMS_MO_CREATE_FAIL');
5227: fnd_msg_pub.add;
5228: RAISE fnd_api.g_exc_error;
5229: END;
5230:
5231: l_progress := '60';
5232: IF (l_debug = 1) THEN
5256: IF (x_return_status <> g_ret_sts_success) THEN
5257: IF (l_debug = 1) THEN
5258: print_debug('SPLIT_MO: Error in split_mmtt',4);
5259: END IF;
5260: RAISE fnd_api.g_exc_error;
5261: END IF;
5262:
5263: l_progress := '64';
5264:
5266: IF (p_txn_header_id IS NULL) THEN
5267: IF (l_debug = 1) THEN
5268: print_debug('SPLIT_MO: Not possible',4);
5269: END IF;
5270: RAISE fnd_api.g_exc_error;
5271: ELSE -- p_txn_header_id is not null
5272: l_remaining_qty := l_orig_mol_rec.quantity_detailed - l_orig_mol_rec.quantity;
5273: IF (l_prim_uom_code <> l_orig_mol_rec.uom_code) THEN
5274: l_remaining_prim_qty := inv_rcv_cache.convert_qty
5301: IF (x_return_status <> g_ret_sts_success) THEN
5302: IF (l_debug = 1) THEN
5303: print_debug('SPLIT_MO: Error in split_mmtt',4);
5304: END IF;
5305: RAISE fnd_api.g_exc_error;
5306: END IF;
5307: END IF;
5308: END IF; -- IF (l_orig_mol_rec.quantity_detailed > l_orig_mol_rec.quantity)
5309:
5329: print_debug('Returned from inv_rcv_reservation_util.split_wdd',4);
5330: print_debug('x_return_status =>'||x_return_status,4);
5331: END IF;
5332:
5333: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
5334: IF (l_debug = 1) THEN
5335: print_debug('x_msg_data: '||x_msg_data,4);
5336: print_debug('x_msg_count: '||x_msg_count,4);
5337: print_debug('SQLCODE:'||SQLCODE||' SQLERRM:'||SQLERRM,4);
5337: print_debug('SQLCODE:'||SQLCODE||' SQLERRM:'||SQLERRM,4);
5338: print_debug('Raising Exception!!!',4);
5339: END IF;
5340: l_progress := '@@@';
5341: RAISE fnd_api.g_exc_unexpected_error;
5342: END IF;
5343:
5344: l_new_mol_rec.backorder_delivery_detail_id := l_new_wdd_id;
5345:
5352: WHEN OTHERS THEN
5353: IF (l_debug = 1) THEN
5354: print_debug('Error retrieving doc type for SO',4);
5355: END IF;
5356: RAISE fnd_api.g_exc_unexpected_error;
5357: END;
5358:
5359: IF l_doc_type = 10 THEN
5360: l_rsv_query_rec.demand_source_type_id := inv_reservation_global.g_source_type_internal_ord;
5373: , x_return_status => x_return_status
5374: , x_msg_count => x_msg_count
5375: , x_msg_data => x_msg_data
5376: , p_query_input => l_rsv_query_rec
5377: , p_lock_records => fnd_api.g_true --???
5378: , p_sort_by_req_date => inv_reservation_global.g_query_demand_ship_date_desc--There's shoudl be just 1 row
5379: , x_mtl_reservation_tbl => l_rsv_results_tbl
5380: , x_mtl_reservation_tbl_count => l_rsv_results_count
5381: , x_error_code => l_error_code
5385: print_debug('Returned from inv_reservation_pub.query_reservation',4);
5386: print_debug('x_return_status: '||x_return_status,4);
5387: END IF;
5388:
5389: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
5390: IF (l_debug = 1) THEN
5391: print_debug('x_error_code: '||l_error_code,4);
5392: print_debug('x_msg_data: '||x_msg_data,4);
5393: print_debug('x_msg_count: '||x_msg_count,4);
5394: print_debug('SQLCODE:'||SQLCODE||' SQLERRM:'||SQLERRM,4);
5395: print_debug('Raising Exception!!!',4);
5396: END IF;
5397: l_progress := '@@@';
5398: RAISE fnd_api.g_exc_unexpected_error;
5399: END IF;
5400:
5401: l_rsv_update_rec := l_rsv_results_tbl(1);
5402: l_rsv_update_rec.demand_source_line_detail := l_new_wdd_id;
5421: ,p_original_rsv_rec => l_rsv_results_tbl(1)
5422: ,p_to_rsv_rec => l_rsv_update_rec
5423: ,p_original_serial_number => l_dummy_serial
5424: ,p_to_serial_number => l_dummy_serial
5425: ,p_validation_flag => fnd_api.g_false --??
5426: ,x_to_reservation_id => l_new_reservation_id);
5427:
5428: IF (l_debug = 1) THEN
5429: print_debug('Returned from inv_reservation_pub.transfer_reservation',4);
5430: print_debug('x_return_status =>'||x_return_status,4);
5431: print_debug('x_to_reservation_id =>'||l_new_reservation_id,4);
5432: END IF;
5433:
5434: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
5435: IF (l_debug = 1) THEN
5436: print_debug('x_msg_data: '||x_msg_data,4);
5437: print_debug('x_msg_count: '||x_msg_count,4);
5438: print_debug('SQLCODE:'||SQLCODE||' SQLERRM:'||SQLERRM,4);
5438: print_debug('SQLCODE:'||SQLCODE||' SQLERRM:'||SQLERRM,4);
5439: print_debug('Raising Exception!!!',4);
5440: END IF;
5441: l_progress := '@@@';
5442: RAISE fnd_api.g_exc_unexpected_error;
5443: END IF;
5444:
5445: END IF;--IF l_orig_mol_rec.backorder_delivery_detail_id IS NOT NULL
5446: --R12: XDOCK EXE END
5496: IF (l_debug = 1) THEN
5497: print_debug('SPLIT_MO: Error update new mol record',
5498: 4);
5499: END IF;
5500: RAISE fnd_api.g_exc_error;
5501: END;
5502:
5503: l_progress := '190';
5504:
5595: WHEN OTHERS THEN
5596: IF (l_debug = 1) THEN
5597: print_debug('SPLIT_MO ERROR: error update original MOL',4);
5598: END IF;
5599: RAISE fnd_api.g_exc_error;
5600: END;
5601:
5602: l_progress := '210';
5603: IF (l_debug = 1) THEN
5913: CLOSE mmtt_cur;
5914:
5915: IF (Nvl(l_mmtt_rec.primary_quantity,0) < p_prim_qty_to_splt) THEN
5916: print_debug(' ORIG MMTT QYT > P_PRIM_QTY_SPLT!!',1);
5917: RAISE fnd_api.g_exc_unexpected_error;
5918: END IF;
5919:
5920: l_mmtt_rec.primary_quantity := p_prim_qty_to_splt;
5921:
6399: IF (l_debug = 1) THEN
6400: print_debug('SPLIT_MMTT: Error while inserting new MMTT!', 4);
6401: print_debug('SQLCODE:'||SQLCODE||' SQLERRM:'||SQLERRM,11);
6402: END IF;
6403: RAISE fnd_api.g_exc_unexpected_error;
6404: END;
6405:
6406: x_new_mmtt_id := l_new_mmtt_id;
6407:
6415: IF (l_debug = 1) THEN
6416: print_debug('SPLIT_MMTT: Error while updating original MMTT!', 4);
6417: print_debug('SQLCODE:'||SQLCODE||' SQLERRM:'||SQLERRM,11);
6418: END IF;
6419: RAISE fnd_api.g_exc_unexpected_error;
6420: END ;
6421:
6422: -- Split parent MMTT, operation instance, operation plan
6423: l_mmtts_to_split(1) := l_new_mmtt_id;
6434: print_debug('SPLIT_MMTT: Error in split_operation_instance',4);
6435: END IF;
6436: fnd_message.set_name('WMS','WMS_TASK_SPLIT_FAIL');
6437: fnd_msg_pub.add;
6438: RAISE fnd_api.g_exc_error;
6439: END IF;
6440:
6441: IF l_debug = 1 THEN
6442: print_debug(' x_new_mmtt_id => '||x_new_mmtt_id,4);