1: PACKAGE BODY INV_ROI_INTEGRATION_GRP AS
2: /* $Header: INVPROIB.pls 120.9 2011/05/18 09:26:38 nimisra ship $*/
3:
4: -- Read the profile option that enables/disables the debug log
5: g_fnd_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N') ;
3:
4: -- Read the profile option that enables/disables the debug log
5: g_fnd_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N') ;
6:
7: g_pkg_name CONSTANT VARCHAR2(30) :='INV_ROI_INTEGRATION_GRP' ;
8: g_module_prefix CONSTANT VARCHAR2(40) := 'inv.plsql.' || g_pkg_name || '.' ;
9: l_progress VARCHAR2(3) := '000' ;
10:
11:
33: BEGIN
34: IF (g_debug = 1) THEN
35: inv_mobile_helper_functions.tracelog(
36: p_err_msg => p_err_msg ,
37: p_module => 'INV_ROI_INTEGRATION_GRP' ,
38: p_level => p_level
39: );
40: DBMS_OUTPUT.PUT_LINE(p_err_msg);
41: END IF;
213: IF NOT fnd_api.compatible_api_call(
214: l_api_version,
215: p_api_version,
216: l_api_name,
217: 'INV_ROI_INTEGRATION_GRP'
218: ) THEN
219: IF (g_debug = 1) THEN
220: print_debug('FND_API not compatible INV_ROI_INTEGRATION_GRP.INV_VALIDATE_LOT: '||l_progress, 1);
221: END IF;
216: l_api_name,
217: 'INV_ROI_INTEGRATION_GRP'
218: ) THEN
219: IF (g_debug = 1) THEN
220: print_debug('FND_API not compatible INV_ROI_INTEGRATION_GRP.INV_VALIDATE_LOT: '||l_progress, 1);
221: END IF;
222: RAISE fnd_api.g_exc_unexpected_error;
223: END IF;
224:
332:
333: /*check whether lot is specified in the RMA for that Receipt Line.. */
334:
335: IF g_debug = 1 THEN
336: print_debug('Before calling INV_ROI_INTEGRATION_GRP.Inv_Rma_lot_info_exists:' || l_progress, 1);
337: print_debug('p_oe_order_header_id:' || p_oe_order_header_id, 1);
338: print_debug('p_oe_order_line_id:' || p_oe_order_line_id, 1);
339: END IF;
340:
338: print_debug('p_oe_order_line_id:' || p_oe_order_line_id, 1);
339: END IF;
340:
341:
342: IF (INV_ROI_INTEGRATION_GRP.Inv_Rma_lot_info_exists(
343: x_msg_data =>l_msg_data
344: ,x_msg_count =>l_msg_count
345: ,x_count_rma_lots =>l_count_rma_lots
346: ,p_oe_order_header_id =>p_oe_order_header_id
350: /* Function returns TRUE => lot is entered on RMA so it has to be validated against user entered lot */
351: v_lot_no :=p_lot_number;
352:
353: IF g_debug = 1 THEN
354: print_debug(' INV_ROI_INTEGRATION_GRP.Inv_Rma_lot_info_exists returns TRUE : ' || l_progress, 1);
355: print_debug('l_msg_data:' || l_msg_data, 1);
356: print_debug('l_msg_count:' || l_msg_count, 1);
357: print_debug('l_count_rma_lots:' || l_count_rma_lots, 1);
358: print_debug('p_lot_number:' || p_lot_number, 1);
376: END IF;
377:
378: /*bug11734602,if l_rma_quantity returned from oe_lot_serial_numbers,
379: since its quantity always be populated with primary qty,considering the code logic
380: in INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity,
381: we should convert the l_rma_quantity into RMA UNIT_OF_MEASURE.*/
382: SELECT unit_of_measure
383: INTO l_rma_unit_of_measure
384: FROM oe_order_lines_all ,mtl_units_of_measure
411: IF g_debug = 1 THEN
412: print_debug('RMA lot does not match with user lot so error out' || l_progress, 4);
413: END IF;
414: FND_MESSAGE.SET_NAME('PO','PO_RMA_LOT_MISMATCH');
415: FND_MESSAGE.SET_TOKEN('PGM_NAME','INV_ROI_INTEGRATION_GRP.Inv_Validate_lot');
416: fnd_msg_pub.ADD;
417: RAISE g_exc_error;
418: END IF;--------IF l_rma_quantity = 0 THEN
419: ELSE ------ IF p_oe_order_line_id IS NOT NULL THEN
427:
428: l_progress := '006' ;
429:
430: IF g_debug = 1 THEN
431: print_debug('Before calling INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity : ' || l_progress, 1);
432: print_debug('p_item_id: ' || p_item_id, 1);
433: print_debug('p_lot_number: ' || p_lot_number, 1);
434: print_debug('p_oe_order_header_id: ' || p_oe_order_header_id, 1);
435: print_debug('p_oe_order_line_id: ' || p_oe_order_line_id, 1);
439: print_debug('p_to_organization_id: ' || p_to_organization_id, 1);
440: END IF;
441:
442:
443: INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity(
444: x_allowed =>l_allowed ,
445: x_allowed_quantity =>l_allowed_quantity ,
446: x_return_status =>l_return_status ,
447: x_msg_data =>l_msg_data ,
459: p_trx_quantity =>NULL
460: );
461:
462: IF g_debug = 1 THEN
463: print_debug('Program INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity return ' || l_return_status ||'and ' || l_progress, 1);
464: print_debug('l_allowed: ' || l_allowed, 1);
465: print_debug('l_allowed_quantity: ' || l_allowed_quantity, 1);
466: print_debug('l_return_status: ' || l_return_status, 1);
467: print_debug('l_msg_data: ' || l_msg_data, 1);
469: END IF;
470:
471: IF l_allowed = 'N' THEN
472: IF g_debug = 1 THEN
473: print_debug('Program INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity has failed
474: as user quantity is greater than the available RMA quantity ' || l_progress, 1);
475: END IF;
476: FND_MESSAGE.SET_NAME('INV','INV_RMA_QUANTITY_VAL_FAILED');
477: FND_MESSAGE.SET_TOKEN('x_allowed_quantity',l_allowed_quantity );
483: l_progress := '007' ;
484:
485: IF l_return_status = fnd_api.g_ret_sts_error THEN
486: IF g_debug = 1 THEN
487: print_debug('Program INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity has failed with a user defined exception '|| l_progress, 1);
488: END IF;
489: FND_MESSAGE.SET_NAME('INV','INV_PROGRAM_ERROR');
490: FND_MESSAGE.SET_TOKEN('PGM_NAME','INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity');
491: fnd_msg_pub.ADD;
486: IF g_debug = 1 THEN
487: print_debug('Program INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity has failed with a user defined exception '|| l_progress, 1);
488: END IF;
489: FND_MESSAGE.SET_NAME('INV','INV_PROGRAM_ERROR');
490: FND_MESSAGE.SET_TOKEN('PGM_NAME','INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity');
491: fnd_msg_pub.ADD;
492: RAISE g_exc_error;
493:
494: l_progress := '008' ;
494: l_progress := '008' ;
495:
496: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
497: IF g_debug = 1 THEN
498: print_debug('Program INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity has failed with a Unexpected exception ' || l_progress , 1);
499: END IF;
500: FND_MESSAGE.SET_NAME('INV','INV_PROGRAM_ERROR');
501: FND_MESSAGE.SET_TOKEN('PGM_NAME','INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity');
502: fnd_msg_pub.ADD;
497: IF g_debug = 1 THEN
498: print_debug('Program INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity has failed with a Unexpected exception ' || l_progress , 1);
499: END IF;
500: FND_MESSAGE.SET_NAME('INV','INV_PROGRAM_ERROR');
501: FND_MESSAGE.SET_TOKEN('PGM_NAME','INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity');
502: fnd_msg_pub.ADD;
503: RAISE g_exc_unexpected_error;
504: END IF;
505:
504: END IF;
505:
506: l_progress :='009';
507:
508: ELSE --------IF (INV_ROI_INTEGRATION_GRP.Inv_Rma_lot_info_exists(
509: /* lot is not present on RMA so user can receive into any valid
510: lot or create new lot and no quantity validation required.
511: Take RMA validation as Success*/
512: IF g_debug = 1 THEN
509: /* lot is not present on RMA so user can receive into any valid
510: lot or create new lot and no quantity validation required.
511: Take RMA validation as Success*/
512: IF g_debug = 1 THEN
513: print_debug(' INV_ROI_INTEGRATION_GRP.Inv_Rma_lot_info_exists returns FALSE : ' || l_progress, 1);
514: print_debug('l_msg_data: ' || l_msg_data, 1);
515: print_debug('l_msg_count: ' || l_msg_count, 1);
516: print_debug('l_count_rma_lots: ' || l_count_rma_lots, 1);
517: print_debug('lot is not present on RMA so user can receive into any valid
519: Take RMA validation as Success: ' || l_progress, 1);
520: END IF;
521:
522: x_return_status := FND_API.G_RET_STS_SUCCESS;
523: END IF;--------IF (INV_ROI_INTEGRATION_GRP.Inv_Rma_lot_info_exists(
524:
525: END IF;--------IF l_enforce_rma_lot_value = 'R' THEN
526:
527: IF g_debug = 1 THEN
543: l_lot_cont := FALSE ;
544: l_child_lot_cont := FALSE ;
545:
546:
547: INV_ROI_INTEGRATION_GRP.Check_Item_Attributes(
548: x_return_status => l_return_status
549: , x_msg_count => l_msg_count
550: , x_msg_data => l_msg_data
551: , x_lot_cont => l_lot_cont
1328: END;
1329:
1330: END IF; ------ IF p_line_secondary_quantity IS NOT NULL THEN
1331:
1332: print_debug('End of the program inv_roi_integration_grp.inv_validate_lot. Program has completed successfully '|| l_progress, 1);
1333:
1334: END IF; ------ IF p_new_lot= 'N' THEN
1335: -------end of validation for a new lot. Start Exception section --------------------------------------
1336:
1531: IF NOT fnd_api.compatible_api_call(
1532: l_api_version ,
1533: p_api_version ,
1534: l_api_name ,
1535: 'INV_ROI_INTEGRATION_GRP'
1536: ) THEN
1537: IF (g_debug = 1) THEN
1538: print_debug('FND_API not compatible INV_ROI_INTEGRATION_GRP.INV_New_lot'|| l_progress, 1);
1539: END IF;
1534: l_api_name ,
1535: 'INV_ROI_INTEGRATION_GRP'
1536: ) THEN
1537: IF (g_debug = 1) THEN
1538: print_debug('FND_API not compatible INV_ROI_INTEGRATION_GRP.INV_New_lot'|| l_progress, 1);
1539: END IF;
1540: RAISE fnd_api.g_exc_unexpected_error;
1541: END IF;
1542:
1713: EXCEPTION
1714: WHEN OTHERS THEN
1715: IF g_debug = 1 THEN
1716: print_debug('Populating p_lot_rec with mtl_lot_number (shipping org values) has
1717: failed with a Unexpected exception in INV_ROI_INTEGRATION_GRP.INV_NEW_LOT'|| l_progress, 1);
1718: END IF;
1719: RAISE g_exc_unexpected_error;
1720: END;
1721:
1968:
1969: EXCEPTION
1970: WHEN OTHERS THEN
1971: IF g_debug = 1 THEN
1972: print_debug('Updating MTLT with x_lot_rec(inv_lot_api_pub.Create_Inv_lot) has failed with a Unexpected exception in INV_ROI_INTEGRATION_GRP.INV_NEW_LOT :'|| l_progress, 1);
1973: END IF;
1974: RAISE g_exc_unexpected_error;
1975: END;
1976:
2218: END IF;------------IF l_permision_value = 'Y' THEN
2219: END IF;-----IF P_PRIMARY_UNIT_OF_MEASURE IS NOT NULL AND
2220: END IF;-------------- If p_line_secondary_quantity IS NOT NULL THEN
2221:
2222: print_debug('End of the program inv_roi_integration_grp.inv_new_lot. Program has completed successfully: '|| l_progress, 9);
2223:
2224: EXCEPTION
2225:
2226: WHEN NO_DATA_FOUND THEN
2399: IF NOT fnd_api.compatible_api_call(
2400: l_api_version,
2401: p_api_version,
2402: l_api_name,
2403: 'INV_ROI_INTEGRATION_GRP'
2404: ) THEN
2405: IF (g_debug = 1) THEN
2406: print_debug('FND_API not compatible INV_ROI_INTEGRATION_GRP.INV_Synch_Quantities:' || l_progress, 1);
2407: END IF;
2402: l_api_name,
2403: 'INV_ROI_INTEGRATION_GRP'
2404: ) THEN
2405: IF (g_debug = 1) THEN
2406: print_debug('FND_API not compatible INV_ROI_INTEGRATION_GRP.INV_Synch_Quantities:' || l_progress, 1);
2407: END IF;
2408: RAISE fnd_api.g_exc_unexpected_error;
2409: END IF;
2410:
2630:
2631: EXCEPTION
2632: WHEN OTHERS THEN
2633: IF g_debug = 1 THEN
2634: print_debug('Fetching RMA lot inside inv_roi_integration_grp.inv_rma_lot_info_exists failed:' || l_progress, 1);
2635: END IF;
2636: RAISE fnd_api.g_exc_error;
2637: END;
2638: l_progress :='062';
2810: IF NOT fnd_api.compatible_api_call(
2811: l_api_version,
2812: p_api_version,
2813: l_api_name,
2814: 'INV_ROI_INTEGRATION_GRP'
2815: ) THEN
2816: IF (g_debug = 1) THEN
2817: print_debug('FND_API not compatible INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity:'|| l_progress, 1);
2818: END IF;
2813: l_api_name,
2814: 'INV_ROI_INTEGRATION_GRP'
2815: ) THEN
2816: IF (g_debug = 1) THEN
2817: print_debug('FND_API not compatible INV_ROI_INTEGRATION_GRP.Inv_Validate_rma_quantity:'|| l_progress, 1);
2818: END IF;
2819: RAISE fnd_api.g_exc_unexpected_error;
2820: END IF;
2821:
3115: IF g_debug = 1 THEN
3116: print_debug('Inv_Validate_rma_quantity::INV_CONVERT.inv_um_convert has failed:'|| l_progress, 1);
3117: END IF;
3118: FND_MESSAGE.SET_NAME('INV','INV_NO_CONVERSION_ERR');
3119: FND_MESSAGE.SET_TOKEN('PGM_NAME','INV_ROI_INTEGRATION_GRP.INV_VALIDATE_RMA_QUANTITY');
3120: fnd_msg_pub.ADD;
3121: RAISE g_exc_unexpected_error;
3122: END IF;
3123:
3137: IF g_debug = 1 THEN
3138: print_debug(' RMA Quantity validation has failed ' || l_progress, 1);
3139: END IF;
3140: FND_MESSAGE.SET_NAME('PO','PO_RMA_QUANTITY_VAL_FAILED');
3141: FND_MESSAGE.SET_TOKEN('PGM_NAME','INV_ROI_INTEGRATION_GRP.INV_VALIDATE_RMA_QUANTITY');
3142: FND_MESSAGE.SET_TOKEN('TRX_QUANTITY',l_trx_quantity);
3143: FND_MESSAGE.SET_TOKEN('allowed_quantity',x_allowed_quantity );
3144: FND_MESSAGE.SET_TOKEN('lot_number',p_lot_number );
3145: fnd_msg_pub.ADD;
3154: print_debug('quantity validation has passed:' || l_progress, 1);
3155: END IF;
3156: END IF;
3157:
3158: print_debug('End of the program inv_roi_integration_grp.inv_new_lot. Program has completed successfully :'|| l_progress, 1);
3159:
3160: EXCEPTION
3161:
3162: WHEN NO_DATA_FOUND THEN
3375:
3376: END Check_Item_Attributes;
3377:
3378:
3379: END INV_ROI_INTEGRATION_GRP ;
3380: