25: END print_debug;
26:
27: PROCEDURE Get_Catch_Weight_Attributes (
28: p_api_version IN NUMBER
29: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
30: , x_return_status OUT NOCOPY VARCHAR2
31: , x_msg_count OUT NOCOPY NUMBER
32: , x_msg_data OUT NOCOPY VARCHAR2
33: , p_organization_id IN NUMBER
51: l_secondary_uom_code VARCHAR2(3);
52: l_result VARCHAR2(30);
53: BEGIN
54: -- Standard call to check for call compatibility.
55: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
56: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
57: fnd_msg_pub.ADD;
58: RAISE fnd_api.g_exc_unexpected_error;
59: END IF;
54: -- Standard call to check for call compatibility.
55: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
56: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
57: fnd_msg_pub.ADD;
58: RAISE fnd_api.g_exc_unexpected_error;
59: END IF;
60:
61: -- Initialize message list if p_init_msg_list is set to TRUE.
62: IF fnd_api.to_boolean(p_init_msg_list) THEN
58: RAISE fnd_api.g_exc_unexpected_error;
59: END IF;
60:
61: -- Initialize message list if p_init_msg_list is set to TRUE.
62: IF fnd_api.to_boolean(p_init_msg_list) THEN
63: fnd_msg_pub.initialize;
64: END IF;
65:
66: -- Initialize API return status to success
63: fnd_msg_pub.initialize;
64: END IF;
65:
66: -- Initialize API return status to success
67: x_return_status := fnd_api.g_ret_sts_success;
68:
69: IF ( l_debug = 1 ) THEN
70: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
71: print_debug('orgid='||p_organization_id||' itemid='||p_inventory_item_id||' qty='||p_quantity||' uom='||p_uom_code, 4);
76: x_return_status => x_return_status
77: , x_msg_count => x_msg_count
78: , x_msg_data => x_msg_data
79: , p_organization_id => p_organization_id );
80: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
81: IF ( l_debug = 1 ) THEN
82: print_debug('Call to wms_install.check_install failed:' ||x_msg_data, 1);
83: END IF;
84: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
80: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
81: IF ( l_debug = 1 ) THEN
82: print_debug('Call to wms_install.check_install failed:' ||x_msg_data, 1);
83: END IF;
84: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
85: END IF;
86:
87: l_progress := '100';
88: IF ( l_wms_org_flag ) THEN
118: , x_ont_pricing_qty_source => x_ont_pricing_qty_source
119: , x_secondary_uom_code => x_secondary_uom_code
120: , x_secondary_quantity => x_secondary_quantity);
121:
122: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
123: IF ( l_debug = 1 ) THEN
124: print_debug('Call to Get_Default_Secondary_Quantity failed', 1);
125: END IF;
126: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
122: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
123: IF ( l_debug = 1 ) THEN
124: print_debug('Call to Get_Default_Secondary_Quantity failed', 1);
125: END IF;
126: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
127: END IF;
128: END IF;
129: ELSE -- not a wms org
130: IF ( l_debug = 1 ) THEN
153: IF ( SQLCODE IS NOT NULL ) THEN
154: print_debug('SQL error: ' || SQLERRM(SQLCODE), 1);
155: END IF;
156: END IF;
157: x_return_status := fnd_api.g_ret_sts_error;
158: fnd_message.set_name('WMS', 'WMS_GET_CWT_ATTR_FAIL');
159: fnd_msg_pub.ADD;
160: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
161: END Get_Catch_Weight_Attributes;
162:
163:
164: FUNCTION Get_Ont_Pricing_Qty_Source (
165: p_api_version IN NUMBER
166: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
167: , x_return_status OUT NOCOPY VARCHAR2
168: , x_msg_count OUT NOCOPY NUMBER
169: , x_msg_data OUT NOCOPY VARCHAR2
170: , p_organization_id IN NUMBER
178: l_wms_org_flag BOOLEAN;
179: l_ont_pricing_qty_source VARCHAR(30);
180: BEGIN
181: -- Standard call to check for call compatibility.
182: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
183: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
184: fnd_msg_pub.ADD;
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
181: -- Standard call to check for call compatibility.
182: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
183: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
184: fnd_msg_pub.ADD;
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
187:
188: -- Initialize message list if p_init_msg_list is set to TRUE.
189: IF fnd_api.to_boolean(p_init_msg_list) THEN
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
187:
188: -- Initialize message list if p_init_msg_list is set to TRUE.
189: IF fnd_api.to_boolean(p_init_msg_list) THEN
190: fnd_msg_pub.initialize;
191: END IF;
192:
193: -- Initialize API return status to success
190: fnd_msg_pub.initialize;
191: END IF;
192:
193: -- Initialize API return status to success
194: x_return_status := fnd_api.g_ret_sts_success;
195:
196: IF ( l_debug = 1 ) THEN
197: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
198: print_debug('orgid='||p_organization_id||' itemid='||p_inventory_item_id, 4);
203: x_return_status => x_return_status
204: , x_msg_count => x_msg_count
205: , x_msg_data => x_msg_data
206: , p_organization_id => p_organization_id );
207: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
208: IF ( l_debug = 1 ) THEN
209: print_debug('Call to wms_install.check_install failed:' ||x_msg_data, 1);
210: END IF;
211: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
207: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
208: IF ( l_debug = 1 ) THEN
209: print_debug('Call to wms_install.check_install failed:' ||x_msg_data, 1);
210: END IF;
211: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
212: END IF;
213:
214: IF ( l_wms_org_flag ) THEN
215: if (p_inventory_item_id is not null) then --BUG12851446
246: print_debug('SQL error: ' || SQLERRM(SQLCODE), 1);
247: END IF;
248: END IF;
249:
250: x_return_status := fnd_api.g_ret_sts_error;
251: fnd_message.set_name('WMS', 'WMS_API_FAIL');
252: fnd_msg_pub.ADD;
253: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
254: END Get_Ont_Pricing_Qty_Source;
255:
256:
257: PROCEDURE Get_Default_Secondary_Quantity (
258: p_api_version IN NUMBER
259: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
260: , x_return_status OUT NOCOPY VARCHAR2
261: , x_msg_count OUT NOCOPY NUMBER
262: , x_msg_data OUT NOCOPY VARCHAR2
263: , p_organization_id IN NUMBER
279: l_uom_code VARCHAR(3);
280: l_secondary_uom VARCHAR(3);
281: BEGIN
282: -- Standard call to check for call compatibility.
283: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
284: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
285: fnd_msg_pub.ADD;
286: RAISE fnd_api.g_exc_unexpected_error;
287: END IF;
282: -- Standard call to check for call compatibility.
283: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
284: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
285: fnd_msg_pub.ADD;
286: RAISE fnd_api.g_exc_unexpected_error;
287: END IF;
288:
289: -- Initialize message list if p_init_msg_list is set to TRUE.
290: IF fnd_api.to_boolean(p_init_msg_list) THEN
286: RAISE fnd_api.g_exc_unexpected_error;
287: END IF;
288:
289: -- Initialize message list if p_init_msg_list is set to TRUE.
290: IF fnd_api.to_boolean(p_init_msg_list) THEN
291: fnd_msg_pub.initialize;
292: END IF;
293:
294: -- Initialize API return status to success
291: fnd_msg_pub.initialize;
292: END IF;
293:
294: -- Initialize API return status to success
295: x_return_status := fnd_api.g_ret_sts_success;
296:
297: IF ( l_debug = 1 ) THEN
298: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
299: print_debug('orgid='||p_organization_id||' itemid='||p_inventory_item_id||' qty='||p_quantity||' uom='||p_uom_code, 4);
308: x_return_status => x_return_status
309: , x_msg_count => x_msg_count
310: , x_msg_data => x_msg_data
311: , p_organization_id => p_organization_id );
312: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
313: IF ( l_debug = 1 ) THEN
314: print_debug('Call to wms_install.check_install failed:' ||x_msg_data, 1);
315: END IF;
316: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
312: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
313: IF ( l_debug = 1 ) THEN
314: print_debug('Call to wms_install.check_install failed:' ||x_msg_data, 1);
315: END IF;
316: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
317: END IF;
318:
319: IF ( l_wms_org_flag ) THEN
320: SELECT ont_pricing_qty_source,
352: print_debug('Secondary UOM is not defined for this secondary priced item', 1);
353: END IF;
354: fnd_message.set_name('WMS', 'WMS_SEC_UOM_UNDEF_ERROR');
355: fnd_msg_pub.ADD;
356: RAISE FND_API.G_EXC_ERROR;
357: END IF;
358:
359: -- Use user specified uom if passed
360: IF ( p_uom_code IS NOT NULL ) THEN
378: fnd_message.set_token('uom1', p_uom_code);
379: fnd_message.set_token('uom2', x_secondary_uom_code);
380: fnd_message.set_token('module', l_api_name);
381: fnd_msg_pub.ADD;
382: RAISE FND_API.G_EXC_ERROR;
383: END IF;
384: l_progress := '400';
385: ELSE
386: x_secondary_quantity := NULL;
400: print_debug('SQL error: ' || SQLERRM(SQLCODE), 1);
401: END IF;
402: END IF;
403:
404: x_return_status := fnd_api.g_ret_sts_error;
405: fnd_message.set_name('WMS', 'WMS_CALC_SEC_QTY_FAIL');
406: fnd_msg_pub.ADD;
407: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
408: END Get_Default_Secondary_Quantity;
409:
410:
411: FUNCTION Check_Secondary_Qty_Tolerance (
412: p_api_version IN NUMBER
413: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
414: , x_return_status OUT NOCOPY VARCHAR2
415: , x_msg_count OUT NOCOPY NUMBER
416: , x_msg_data OUT NOCOPY VARCHAR2
417: , p_organization_id IN NUMBER
442: l_uom_code VARCHAR2(3) := p_uom_code;
443: l_converted_qty NUMBER;
444: BEGIN
445: -- Standard call to check for call compatibility.
446: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
447: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
448: fnd_msg_pub.ADD;
449: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
450: END IF;
445: -- Standard call to check for call compatibility.
446: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
447: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
448: fnd_msg_pub.ADD;
449: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
450: END IF;
451:
452: -- Initialize message list if p_init_msg_list is set to TRUE.
453: IF fnd_api.to_boolean(p_init_msg_list) THEN
449: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
450: END IF;
451:
452: -- Initialize message list if p_init_msg_list is set to TRUE.
453: IF fnd_api.to_boolean(p_init_msg_list) THEN
454: fnd_msg_pub.initialize;
455: END IF;
456:
457: -- Initialize API return status to success
454: fnd_msg_pub.initialize;
455: END IF;
456:
457: -- Initialize API return status to success
458: x_return_status := fnd_api.g_ret_sts_success;
459:
460: IF ( l_debug = 1 ) THEN
461: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
462: print_debug('orgid='||p_organization_id||' itemid='||p_inventory_item_id||' qty='||p_quantity||' uom='||p_uom_code||' secqty='||p_secondary_quantity, 4);
485: l_uom_deviation_high := p_uom_deviation_high;
486: l_uom_deviation_low := p_uom_deviation_low;
487: END IF;
488:
489: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
490: IF ( l_debug = 1 ) THEN
491: print_debug('Call to Get_Catch_Weight_Attributes failed', 1);
492: END IF;
493: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
489: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
490: IF ( l_debug = 1 ) THEN
491: print_debug('Call to Get_Catch_Weight_Attributes failed', 1);
492: END IF;
493: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
494: END IF;
495:
496: l_progress := '100';
497: IF (l_uom_deviation_high IS NOT NULL OR l_uom_deviation_low IS NOT NULL) THEN
512: fnd_message.set_token('uom1', l_uom_code);
513: fnd_message.set_token('uom2', l_secondary_uom_code);
514: fnd_message.set_token('module', l_api_name);
515: fnd_msg_pub.ADD;
516: RAISE FND_API.G_EXC_ERROR;
517: END IF;
518:
519: IF ( l_uom_deviation_high IS NOT NULL ) THEN
520: l_progress := '300';
554: print_debug('SQL error: ' || SQLERRM(SQLCODE), 1);
555: END IF;
556: END IF;
557:
558: x_return_status := fnd_api.g_ret_sts_error;
559: fnd_message.set_name('WMS', 'WMS_API_FAIL');
560: fnd_msg_pub.ADD;
561: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
562: END Check_Secondary_Qty_Tolerance;
596: BEGIN
597: SAVEPOINT UPDATE_SHIPPING_SECONDARY_QTY;
598:
599: -- Standard call to check for call compatibility.
600: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
601: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
602: fnd_msg_pub.ADD;
603: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
604: END IF;
599: -- Standard call to check for call compatibility.
600: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
601: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
602: fnd_msg_pub.ADD;
603: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
604: END IF;
605:
606: -- Initialize message list if p_init_msg_list is set to TRUE.
607: IF fnd_api.to_boolean(p_init_msg_list) THEN
603: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
604: END IF;
605:
606: -- Initialize message list if p_init_msg_list is set to TRUE.
607: IF fnd_api.to_boolean(p_init_msg_list) THEN
608: fnd_msg_pub.initialize;
609: END IF;
610:
611: -- Initialize API return status to success
608: fnd_msg_pub.initialize;
609: END IF;
610:
611: -- Initialize API return status to success
612: x_return_status := fnd_api.g_ret_sts_success;
613:
614: IF ( l_debug = 1 ) THEN
615: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
616: print_debug('deldetid='||p_delivery_detail_id||' secqty='||p_secondary_quantity||' secuom='||p_secondary_uom_code, 4);
626: print_debug('got from WDD orgid='||l_organization_id||' itemid='||l_inventory_item_id||' pkdqty='||l_picked_quantity||' requom='||l_requested_quantity_uom, 4);
627: END IF;
628: EXCEPTION
629: WHEN OTHERS THEN
630: x_return_status := fnd_api.g_ret_sts_error;
631: fnd_message.set_name('WMS', 'WMS_MISSING_WDD_ERR');
632: fnd_msg_pub.ADD;
633: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
634: END;
629: WHEN OTHERS THEN
630: x_return_status := fnd_api.g_ret_sts_error;
631: fnd_message.set_name('WMS', 'WMS_MISSING_WDD_ERR');
632: fnd_msg_pub.ADD;
633: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
634: END;
635:
636: Get_Default_Secondary_Quantity (
637: p_api_version => 1.0
645: , x_ont_pricing_qty_source => l_pricing_ind
646: , x_secondary_uom_code => l_secondary_uom_code
647: , x_secondary_quantity => l_secondary_quantity); -- 8655538
648:
649: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
650: IF ( l_debug = 1 ) THEN
651: print_debug('Call to Get_Default_Secondary_Quantity failed', 1);
652: END IF;
653: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
649: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
650: IF ( l_debug = 1 ) THEN
651: print_debug('Call to Get_Default_Secondary_Quantity failed', 1);
652: END IF;
653: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
654: END IF;
655:
656: IF ( l_pricing_ind = G_PRICE_SECONDARY ) THEN
657: l_progress := '100';
660: fnd_message.set_name('WMS', 'WMS_SEC_UOM_MISMATCH');
661: fnd_message.set_token('uom1', p_secondary_uom_code);
662: fnd_message.set_token('uom2', l_secondary_uom_code);
663: fnd_msg_pub.ADD;
664: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
665: END IF;
666:
667: IF ( p_secondary_quantity = FND_API.G_MISS_NUM ) THEN
668: l_progress := '200';
663: fnd_msg_pub.ADD;
664: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
665: END IF;
666:
667: IF ( p_secondary_quantity = FND_API.G_MISS_NUM ) THEN
668: l_progress := '200';
669:
670: -- User wishes to set secondary values to null
671: l_secondary_quantity := FND_API.G_MISS_NUM;
667: IF ( p_secondary_quantity = FND_API.G_MISS_NUM ) THEN
668: l_progress := '200';
669:
670: -- User wishes to set secondary values to null
671: l_secondary_quantity := FND_API.G_MISS_NUM;
672: l_secondary_uom_code := FND_API.G_MISS_CHAR;
673: ELSIF ( p_secondary_quantity IS NOT NULL ) THEN
674: l_progress := '300';
675:
668: l_progress := '200';
669:
670: -- User wishes to set secondary values to null
671: l_secondary_quantity := FND_API.G_MISS_NUM;
672: l_secondary_uom_code := FND_API.G_MISS_CHAR;
673: ELSIF ( p_secondary_quantity IS NOT NULL ) THEN
674: l_progress := '300';
675:
676: -- Check to make sure that the secondary qty is within tolerance
684: , p_quantity => l_picked_quantity
685: , p_uom_code => l_requested_quantity_uom
686: , p_secondary_quantity => p_secondary_quantity );
687:
688: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
689: IF ( l_debug = 1 ) THEN
690: print_debug('Check_Secondary_Qty_Tolerance failed ', 4);
691: END IF;
692: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
688: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
689: IF ( l_debug = 1 ) THEN
690: print_debug('Check_Secondary_Qty_Tolerance failed ', 4);
691: END IF;
692: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
693: END IF;
694:
695: l_progress := '400';
696: IF ( l_tolerance <> 0 ) THEN
698: print_debug('Secondary quantity out of tolerance', 4);
699: END IF;
700: fnd_message.set_name('WMS', 'WMS_CTWT_TOLERANCE_ERROR');
701: fnd_msg_pub.ADD;
702: RAISE FND_API.G_EXC_ERROR;
703: END IF;
704:
705: -- User specified sec qty, do not need to use the default value.
706: l_secondary_quantity := p_secondary_quantity;
710: print_debug('Cannot default secondary quantity', 4);
711: END IF;
712: fnd_message.set_name('WMS','WMS_CTWT_DEFAULT_ERROR');
713: fnd_msg_pub.ADD;
714: RAISE FND_API.G_EXC_ERROR;
715: END IF;
716:
717: -- If everything checks out, update wdd.picked_quantity2 with catch weight.
718: l_shipping_attr(1).delivery_detail_id := p_delivery_detail_id;
723: l_shipping_in_rec.action_code := 'UPDATE';
724:
725: WSH_INTERFACE_EXT_GRP.Create_Update_Delivery_Detail (
726: p_api_version_number => 1.0
727: , p_init_msg_list => fnd_api.g_false
728: , p_commit => fnd_api.g_false
729: , x_return_status => x_return_status
730: , x_msg_count => x_msg_count
731: , x_msg_data => x_msg_data
724:
725: WSH_INTERFACE_EXT_GRP.Create_Update_Delivery_Detail (
726: p_api_version_number => 1.0
727: , p_init_msg_list => fnd_api.g_false
728: , p_commit => fnd_api.g_false
729: , x_return_status => x_return_status
730: , x_msg_count => x_msg_count
731: , x_msg_data => x_msg_data
732: , p_detail_info_tab => l_shipping_attr
732: , p_detail_info_tab => l_shipping_attr
733: , p_IN_rec => l_shipping_in_rec
734: , x_OUT_rec => l_shipping_out_rec );
735:
736: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
737: --Get error messages from shipping
738: WSH_UTIL_CORE.get_messages('Y', x_msg_data, l_msg_details, x_msg_count);
739: IF x_msg_count > 1 then
740: x_msg_data := x_msg_data || l_msg_details;
747: END IF;
748: FND_MESSAGE.SET_NAME('WMS','WMS_UPD_DELIVERY_ERROR' );
749: fnd_message.set_token('MSG1', x_msg_data);
750: FND_MSG_PUB.ADD;
751: RAISE FND_API.g_exc_unexpected_error;
752: END IF;
753:
754: l_progress := '400';
755: END IF;
754: l_progress := '400';
755: END IF;
756:
757: -- End of API body
758: IF fnd_api.to_boolean(p_commit) THEN
759: COMMIT WORK;
760: END IF;
761:
762: IF ( l_debug = 1 ) THEN
773: END IF;
774: END IF;
775:
776: ROLLBACK TO UPDATE_SHIPPING_SECONDARY_QTY;
777: x_return_status := fnd_api.g_ret_sts_error;
778: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
779: fnd_msg_pub.ADD;
780: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
781: END Update_Shipping_Secondary_Qty;
782:
783:
784: PROCEDURE Update_Parent_Delivery_Sec_Qty (
785: p_api_version IN NUMBER
786: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
787: , p_commit IN VARCHAR2 := fnd_api.g_false
788: , x_return_status OUT NOCOPY VARCHAR2
789: , x_msg_count OUT NOCOPY NUMBER
790: , x_msg_data OUT NOCOPY VARCHAR2
783:
784: PROCEDURE Update_Parent_Delivery_Sec_Qty (
785: p_api_version IN NUMBER
786: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
787: , p_commit IN VARCHAR2 := fnd_api.g_false
788: , x_return_status OUT NOCOPY VARCHAR2
789: , x_msg_count OUT NOCOPY NUMBER
790: , x_msg_data OUT NOCOPY VARCHAR2
791: , p_organization_id IN NUMBER
826: BEGIN
827: SAVEPOINT UPDATE_PARENT_DELIVERY_SEC_QTY;
828:
829: -- Standard call to check for call compatibility.
830: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
831: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
832: fnd_msg_pub.ADD;
833: RAISE fnd_api.g_exc_unexpected_error;
834: END IF;
829: -- Standard call to check for call compatibility.
830: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
831: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
832: fnd_msg_pub.ADD;
833: RAISE fnd_api.g_exc_unexpected_error;
834: END IF;
835:
836: -- Initialize message list if p_init_msg_list is set to TRUE.
837: IF fnd_api.to_boolean(p_init_msg_list) THEN
833: RAISE fnd_api.g_exc_unexpected_error;
834: END IF;
835:
836: -- Initialize message list if p_init_msg_list is set to TRUE.
837: IF fnd_api.to_boolean(p_init_msg_list) THEN
838: fnd_msg_pub.initialize;
839: END IF;
840:
841: -- Initialize API return status to success
838: fnd_msg_pub.initialize;
839: END IF;
840:
841: -- Initialize API return status to success
842: x_return_status := fnd_api.g_ret_sts_success;
843:
844: IF ( l_debug = 1 ) THEN
845: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
846: print_debug('orgid='||p_organization_id||' parddid='||p_parent_del_det_id||' itemid='||p_inventory_item_id||' rev='||p_revision||' lot='||p_lot_number, 4);
858: -- but only if they are not already null
859: IF ( wdd_rec.picked_quantity2 IS NOT NULL OR
860: wdd_rec.requested_quantity_uom2 IS NOT NULL ) THEN
861: l_shipping_attr(l_attr_counter).delivery_detail_id := wdd_rec.delivery_detail_id;
862: l_shipping_attr(l_attr_counter).picked_quantity2 := FND_API.G_MISS_NUM;
863: l_shipping_attr(l_attr_counter).requested_quantity_uom2 := FND_API.G_MISS_CHAR;
864: l_attr_counter := l_attr_counter + 1;
865: END IF;
866: ELSE
859: IF ( wdd_rec.picked_quantity2 IS NOT NULL OR
860: wdd_rec.requested_quantity_uom2 IS NOT NULL ) THEN
861: l_shipping_attr(l_attr_counter).delivery_detail_id := wdd_rec.delivery_detail_id;
862: l_shipping_attr(l_attr_counter).picked_quantity2 := FND_API.G_MISS_NUM;
863: l_shipping_attr(l_attr_counter).requested_quantity_uom2 := FND_API.G_MISS_CHAR;
864: l_attr_counter := l_attr_counter + 1;
865: END IF;
866: ELSE
867: IF ( wdd_rec.requested_quantity_uom <> p_uom_code ) THEN
881: fnd_message.set_token('uom1', wdd_rec.requested_quantity_uom);
882: fnd_message.set_token('uom2', p_uom_code);
883: fnd_message.set_token('module', l_api_name);
884: fnd_msg_pub.ADD;
885: RAISE FND_API.G_EXC_ERROR;
886: END IF;
887: ELSE
888: l_line_quantity := wdd_rec.picked_quantity;
889: END IF;
906: FND_MESSAGE.SET_NAME('WMS','WMS_QTY_UPD_MISMATCH_ERR');
907: FND_MESSAGE.SET_TOKEN('QTY1', p_quantity);
908: FND_MESSAGE.SET_TOKEN('QTY2', l_total_quantity);
909: FND_MSG_PUB.ADD;
910: RAISE FND_API.G_EXC_ERROR;
911: END IF;
912:
913: l_progress := '200';
914:
921: END IF;
922:
923: WSH_INTERFACE_EXT_GRP.Create_Update_Delivery_Detail (
924: p_api_version_number => 1.0
925: , p_init_msg_list => fnd_api.g_false
926: , p_commit => fnd_api.g_false
927: , x_return_status => x_return_status
928: , x_msg_count => x_msg_count
929: , x_msg_data => x_msg_data
922:
923: WSH_INTERFACE_EXT_GRP.Create_Update_Delivery_Detail (
924: p_api_version_number => 1.0
925: , p_init_msg_list => fnd_api.g_false
926: , p_commit => fnd_api.g_false
927: , x_return_status => x_return_status
928: , x_msg_count => x_msg_count
929: , x_msg_data => x_msg_data
930: , p_detail_info_tab => l_shipping_attr
930: , p_detail_info_tab => l_shipping_attr
931: , p_IN_rec => l_shipping_in_rec
932: , x_OUT_rec => l_shipping_out_rec );
933:
934: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
935: --Get error messages from shipping
936: WSH_UTIL_CORE.get_messages('Y', x_msg_data, l_msg_details, x_msg_count);
937: IF x_msg_count > 1 then
938: x_msg_data := x_msg_data || l_msg_details;
945: END IF;
946: FND_MESSAGE.SET_NAME('WMS','WMS_UPD_DELIVERY_ERROR' );
947: fnd_message.set_token('MSG1', x_msg_data);
948: FND_MSG_PUB.ADD;
949: RAISE FND_API.g_exc_unexpected_error;
950: END IF;
951: END IF;
952:
953: l_progress := '300';
951: END IF;
952:
953: l_progress := '300';
954: -- End of API body
955: IF fnd_api.to_boolean(p_commit) THEN
956: COMMIT WORK;
957: END IF;
958:
959: IF ( l_debug = 1 ) THEN
970: END IF;
971: END IF;
972:
973: ROLLBACK TO UPDATE_PARENT_DELIVERY_SEC_QTY;
974: x_return_status := fnd_api.g_ret_sts_error;
975: fnd_message.set_name('WMS', 'WMS_API_FAIL');
976: fnd_msg_pub.ADD;
977: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
978: END Update_Parent_Delivery_Sec_Qty;
1041: l_return_val NUMBER;
1042: l_message VARCHAR2(2000);
1043:
1044: BEGIN
1045: x_return_status := fnd_api.g_ret_sts_success;
1046:
1047: IF (l_debug = 1) THEN
1048: print_debug('Entered ' || l_api_name ||
1049: ': p_ctwt_adj_type: ' || p_ctwt_adj_type ||
1090: ELSE
1091: IF (l_debug = 1) THEN
1092: print_debug('Unknown adjustment type: ' || p_ctwt_adj_type, 4);
1093: END IF;
1094: RAISE fnd_api.g_exc_unexpected_error;
1095: END IF;
1096: l_txn_src_typ_id := inv_globals.g_sourcetype_inventory;
1097:
1098: SELECT cat_wt_account
1247: ELSE
1248: IF (l_debug = 1) THEN
1249: print_debug('Error from TM: '|| l_message, 4);
1250: END IF;
1251: x_return_status := fnd_api.g_ret_sts_error;
1252: x_msg_data := l_message;
1253: RAISE fnd_api.g_exc_error;
1254: END IF;
1255:
1249: print_debug('Error from TM: '|| l_message, 4);
1250: END IF;
1251: x_return_status := fnd_api.g_ret_sts_error;
1252: x_msg_data := l_message;
1253: RAISE fnd_api.g_exc_error;
1254: END IF;
1255:
1256: IF p_lpn_id IS NOT NULL THEN
1257: SELECT lpn_context
1274: END IF;
1275: END IF;
1276:
1277: EXCEPTION
1278: WHEN fnd_api.g_exc_error THEN
1279: IF (l_debug = 1) THEN
1280: print_debug('fnd_api.g_exc_error', 1);
1281: END IF;
1282: ROLLBACK TO process_ctwt_sp;
1276:
1277: EXCEPTION
1278: WHEN fnd_api.g_exc_error THEN
1279: IF (l_debug = 1) THEN
1280: print_debug('fnd_api.g_exc_error', 1);
1281: END IF;
1282: ROLLBACK TO process_ctwt_sp;
1283:
1284: WHEN OTHERS THEN
1286: print_debug('SQL error: ' || SQLERRM, 1);
1287: END IF;
1288:
1289: ROLLBACK TO process_ctwt_sp;
1290: x_return_status := fnd_api.g_ret_sts_error;
1291: x_msg_data := SQLERRM;
1292:
1293: END process_ctwt_adj;
1294:
1295:
1296:
1297: PROCEDURE update_lpn_primary_quantity (
1298: p_api_version IN NUMBER
1299: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1300: , p_commit IN VARCHAR2 := fnd_api.g_false
1301: , x_return_status OUT NOCOPY VARCHAR2
1302: , x_msg_count OUT NOCOPY NUMBER
1303: , x_msg_data OUT NOCOPY VARCHAR2
1296:
1297: PROCEDURE update_lpn_primary_quantity (
1298: p_api_version IN NUMBER
1299: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
1300: , p_commit IN VARCHAR2 := fnd_api.g_false
1301: , x_return_status OUT NOCOPY VARCHAR2
1302: , x_msg_count OUT NOCOPY NUMBER
1303: , x_msg_data OUT NOCOPY VARCHAR2
1304: , p_record_source IN VARCHAR2
1617: BEGIN
1618: SAVEPOINT update_lpn_primary_qty_sp;
1619:
1620: -- Standard call to check for call compatibility.
1621: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1622: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
1623: fnd_msg_pub.ADD;
1624: RAISE fnd_api.g_exc_unexpected_error;
1625: END IF;
1620: -- Standard call to check for call compatibility.
1621: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1622: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
1623: fnd_msg_pub.ADD;
1624: RAISE fnd_api.g_exc_unexpected_error;
1625: END IF;
1626:
1627: -- Initialize message list if p_init_msg_list is set to TRUE.
1628: IF fnd_api.to_boolean(p_init_msg_list) THEN
1624: RAISE fnd_api.g_exc_unexpected_error;
1625: END IF;
1626:
1627: -- Initialize message list if p_init_msg_list is set to TRUE.
1628: IF fnd_api.to_boolean(p_init_msg_list) THEN
1629: fnd_msg_pub.initialize;
1630: END IF;
1631:
1632: -- Initialize API return status to success
1629: fnd_msg_pub.initialize;
1630: END IF;
1631:
1632: -- Initialize API return status to success
1633: x_return_status := fnd_api.g_ret_sts_success;
1634:
1635: t_wdd_id.DELETE;
1636: g_src_line_id.DELETE;
1637: t_temp_id.DELETE;
1726: print_debug('UOM conversion error', 4);
1727: END IF;
1728: FND_MESSAGE.SET_NAME('INV','INV_NO_CONVERSION_ERR');
1729: fnd_msg_pub.ADD;
1730: RAISE fnd_api.g_exc_error;
1731: END IF;
1732: END IF;
1733: END IF;
1734:
1752: IF l_lpn_pri_qty <= 0 THEN
1753: IF (l_debug = 1) THEN
1754: print_debug('l_lpn_pri_qty is 0 or -ve, erroring out', 4);
1755: END IF;
1756: RAISE fnd_api.g_exc_unexpected_error;
1757: END IF;
1758:
1759: IF l_lpn_sec_qty <> p_secondary_quantity THEN
1760: IF (l_debug = 1) THEN
1759: IF l_lpn_sec_qty <> p_secondary_quantity THEN
1760: IF (l_debug = 1) THEN
1761: print_debug('l_lpn_sec_qty does not match passed-in secondary', 4);
1762: END IF;
1763: RAISE fnd_api.g_exc_unexpected_error;
1764: END IF;
1765:
1766: IF l_lpn_pri_qty > l_primary_qty THEN
1767: -- Reduce WDD qty to match entered primary qty
1794: WHEN OTHERS THEN
1795: IF (l_debug = 1) THEN
1796: print_debug('Error querying LPN sub/loc, sub reservable type: ' || SQLERRM, 4);
1797: END IF;
1798: RAISE FND_API.g_exc_unexpected_error;
1799: END;
1800:
1801: IF (l_debug = 1) THEN
1802: print_debug('l_subinv_code: ' || l_subinv_code, 4);
1805: END IF;
1806:
1807: -- Ct wt +ve adjustment
1808: IF l_pri_qty_to_incr > 0 THEN
1809: l_api_return_status := fnd_api.g_ret_sts_success;
1810: process_ctwt_adj(
1811: x_return_status => l_api_return_status
1812: , x_msg_count => x_msg_count
1813: , x_msg_data => x_msg_data
1822: , p_pri_qty => l_pri_qty_to_incr
1823: , p_pri_uom_code => l_pr_uom_code
1824: , p_sec_uom_code => p_secondary_uom_code
1825: );
1826: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
1827: IF (l_debug = 1) THEN
1828: print_debug('Error status from process_ctwt_adj: '
1829: || l_api_return_status, 4);
1830: END IF;
1827: IF (l_debug = 1) THEN
1828: print_debug('Error status from process_ctwt_adj: '
1829: || l_api_return_status, 4);
1830: END IF;
1831: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1832: RAISE fnd_api.g_exc_error;
1833: ELSE
1834: RAISE fnd_api.g_exc_unexpected_error;
1835: END IF;
1828: print_debug('Error status from process_ctwt_adj: '
1829: || l_api_return_status, 4);
1830: END IF;
1831: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1832: RAISE fnd_api.g_exc_error;
1833: ELSE
1834: RAISE fnd_api.g_exc_unexpected_error;
1835: END IF;
1836: END IF;
1830: END IF;
1831: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1832: RAISE fnd_api.g_exc_error;
1833: ELSE
1834: RAISE fnd_api.g_exc_unexpected_error;
1835: END IF;
1836: END IF;
1837: END IF;
1838:
1854: WHEN OTHERS THEN
1855: IF (l_debug = 1) THEN
1856: print_debug('Error querying LPN rsv qty: ' || SQLERRM, 4);
1857: END IF;
1858: RAISE FND_API.g_exc_unexpected_error;
1859: END;
1860:
1861: IF (l_debug = 1) THEN
1862: print_debug('l_lpn_rsv_pri_qty: ' || l_lpn_rsv_pri_qty, 4);
1879: IF (l_debug = 1) THEN
1880: print_debug('Calling delete_reservation for rsv ID: ' || t_rsv_id(i), 4);
1881: END IF;
1882:
1883: l_api_return_status := fnd_api.g_ret_sts_success;
1884: inv_reservation_pvt.delete_reservation (
1885: p_api_version_number => 1.0
1886: , p_init_msg_lst => fnd_api.g_false
1887: , x_return_status => l_api_return_status
1882:
1883: l_api_return_status := fnd_api.g_ret_sts_success;
1884: inv_reservation_pvt.delete_reservation (
1885: p_api_version_number => 1.0
1886: , p_init_msg_lst => fnd_api.g_false
1887: , x_return_status => l_api_return_status
1888: , x_msg_count => x_msg_count
1889: , x_msg_data => x_msg_data
1890: , p_rsv_rec => l_rsv_rec
1890: , p_rsv_rec => l_rsv_rec
1891: , p_original_serial_number => l_original_serial_number
1892: , p_validation_flag => NULL
1893: );
1894: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
1895: IF (l_debug = 1) THEN
1896: print_debug('Error status from inv_reservation_pvt.delete_reservation: '
1897: || l_api_return_status, 4);
1898: END IF;
1895: IF (l_debug = 1) THEN
1896: print_debug('Error status from inv_reservation_pvt.delete_reservation: '
1897: || l_api_return_status, 4);
1898: END IF;
1899: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1900: RAISE fnd_api.g_exc_error;
1901: ELSE
1902: RAISE fnd_api.g_exc_unexpected_error;
1903: END IF;
1896: print_debug('Error status from inv_reservation_pvt.delete_reservation: '
1897: || l_api_return_status, 4);
1898: END IF;
1899: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1900: RAISE fnd_api.g_exc_error;
1901: ELSE
1902: RAISE fnd_api.g_exc_unexpected_error;
1903: END IF;
1904: END IF;
1898: END IF;
1899: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1900: RAISE fnd_api.g_exc_error;
1901: ELSE
1902: RAISE fnd_api.g_exc_unexpected_error;
1903: END IF;
1904: END IF;
1905: END LOOP;
1906: --}
2006: END IF; --} if sub is reservable
2007:
2008: -- Ct wt -ve adjustment
2009: IF l_pri_qty_to_reduce > 0 THEN --{
2010: l_api_return_status := fnd_api.g_ret_sts_success;
2011: process_ctwt_adj(
2012: x_return_status => l_api_return_status
2013: , x_msg_count => x_msg_count
2014: , x_msg_data => x_msg_data
2023: , p_pri_qty => l_pri_qty_to_reduce
2024: , p_pri_uom_code => l_pr_uom_code
2025: , p_sec_uom_code => p_secondary_uom_code
2026: );
2027: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
2028: IF (l_debug = 1) THEN
2029: print_debug('Error status from process_ctwt_adj: '
2030: || l_api_return_status, 4);
2031: END IF;
2028: IF (l_debug = 1) THEN
2029: print_debug('Error status from process_ctwt_adj: '
2030: || l_api_return_status, 4);
2031: END IF;
2032: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2033: RAISE fnd_api.g_exc_error;
2034: ELSE
2035: RAISE fnd_api.g_exc_unexpected_error;
2036: END IF;
2029: print_debug('Error status from process_ctwt_adj: '
2030: || l_api_return_status, 4);
2031: END IF;
2032: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2033: RAISE fnd_api.g_exc_error;
2034: ELSE
2035: RAISE fnd_api.g_exc_unexpected_error;
2036: END IF;
2037: END IF;
2031: END IF;
2032: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2033: RAISE fnd_api.g_exc_error;
2034: ELSE
2035: RAISE fnd_api.g_exc_unexpected_error;
2036: END IF;
2037: END IF;
2038: END IF; --} end if l_pri_qty_to_reduce > 0
2039: END IF; --} end if qty adjustment required
2051: IF l_lpn_pri_qty <= 0 THEN
2052: IF (l_debug = 1) THEN
2053: print_debug('l_lpn_pri_qty is 0 or -ve, erroring out', 4);
2054: END IF;
2055: RAISE fnd_api.g_exc_unexpected_error;
2056: END IF;
2057:
2058: IF l_lpn_sec_qty <> p_secondary_quantity THEN
2059: IF (l_debug = 1) THEN
2058: IF l_lpn_sec_qty <> p_secondary_quantity THEN
2059: IF (l_debug = 1) THEN
2060: print_debug('l_lpn_sec_qty does not match passed-in secondary', 4);
2061: END IF;
2062: RAISE fnd_api.g_exc_unexpected_error;
2063: END IF;
2064:
2065: IF l_lpn_pri_qty > l_primary_qty THEN
2066: -- Reduce WDD qty to match entered primary qty
2098: WHEN OTHERS THEN
2099: IF (l_debug = 1) THEN
2100: print_debug('Error querying LPN sub/loc, sub reservable type: ' || SQLERRM, 4);
2101: END IF;
2102: RAISE FND_API.g_exc_unexpected_error;
2103: END;
2104:
2105: -- Ct wt +ve adjustment
2106: IF l_pri_qty_to_incr > 0 THEN
2103: END;
2104:
2105: -- Ct wt +ve adjustment
2106: IF l_pri_qty_to_incr > 0 THEN
2107: l_api_return_status := fnd_api.g_ret_sts_success;
2108: process_ctwt_adj(
2109: x_return_status => l_api_return_status
2110: , x_msg_count => x_msg_count
2111: , x_msg_data => x_msg_data
2120: , p_pri_qty => l_pri_qty_to_incr
2121: , p_pri_uom_code => l_pr_uom_code
2122: , p_sec_uom_code => p_secondary_uom_code
2123: );
2124: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
2125: IF (l_debug = 1) THEN
2126: print_debug('Error status from process_ctwt_adj: '
2127: || l_api_return_status, 4);
2128: END IF;
2125: IF (l_debug = 1) THEN
2126: print_debug('Error status from process_ctwt_adj: '
2127: || l_api_return_status, 4);
2128: END IF;
2129: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2130: RAISE fnd_api.g_exc_error;
2131: ELSE
2132: RAISE fnd_api.g_exc_unexpected_error;
2133: END IF;
2126: print_debug('Error status from process_ctwt_adj: '
2127: || l_api_return_status, 4);
2128: END IF;
2129: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2130: RAISE fnd_api.g_exc_error;
2131: ELSE
2132: RAISE fnd_api.g_exc_unexpected_error;
2133: END IF;
2134: END IF;
2128: END IF;
2129: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2130: RAISE fnd_api.g_exc_error;
2131: ELSE
2132: RAISE fnd_api.g_exc_unexpected_error;
2133: END IF;
2134: END IF;
2135: END IF;
2136:
2161: print_debug('UOM conversion error', 4);
2162: END IF;
2163: FND_MESSAGE.SET_NAME('INV','INV_NO_CONVERSION_ERR');
2164: fnd_msg_pub.ADD;
2165: RAISE FND_API.G_EXC_ERROR;
2166: END IF;
2167: ELSE
2168: l_wdd_qty_incr := l_pri_increase;
2169: END IF;
2189: print_debug('UOM conversion error', 4);
2190: END IF;
2191: FND_MESSAGE.SET_NAME('INV','INV_NO_CONVERSION_ERR');
2192: fnd_msg_pub.ADD;
2193: RAISE FND_API.G_EXC_ERROR;
2194: END IF;
2195: ELSE
2196: l_wdd_qty_decr := l_pri_decrease;
2197: END IF;
2225: END IF;
2226:
2227: WSH_INTERFACE_EXT_GRP.create_update_delivery_detail(
2228: p_api_version_number => 1.0
2229: , p_init_msg_list => fnd_api.g_false
2230: , p_commit => fnd_api.g_false
2231: , x_return_status => x_return_status
2232: , x_msg_count => x_msg_count
2233: , x_msg_data => x_msg_data
2226:
2227: WSH_INTERFACE_EXT_GRP.create_update_delivery_detail(
2228: p_api_version_number => 1.0
2229: , p_init_msg_list => fnd_api.g_false
2230: , p_commit => fnd_api.g_false
2231: , x_return_status => x_return_status
2232: , x_msg_count => x_msg_count
2233: , x_msg_data => x_msg_data
2234: , p_detail_info_tab => l_shipping_attr
2235: , p_in_rec => l_shipping_in_rec
2236: , x_out_rec => l_shipping_out_rec
2237: );
2238:
2239: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
2240: --Get error messages from shipping
2241: WSH_UTIL_CORE.get_messages('Y', x_msg_data, l_msg_details, x_msg_count);
2242: IF x_msg_count > 1 then
2243: x_msg_data := x_msg_data || l_msg_details;
2248: END IF;
2249: FND_MESSAGE.set_name('WMS','WMS_UPD_DELIVERY_ERROR' );
2250: FND_MESSAGE.set_token('MSG1', x_msg_data);
2251: FND_MSG_PUB.add;
2252: RAISE FND_API.g_exc_unexpected_error;
2253: END IF;
2254: END IF; --}
2255:
2256: IF (l_debug = 1) THEN
2280: WHEN OTHERS THEN
2281: IF (l_debug = 1) THEN
2282: print_debug('Error querying LPN rsv qty: ' || SQLERRM, 4);
2283: END IF;
2284: RAISE FND_API.g_exc_unexpected_error;
2285: END;
2286:
2287: l_rem_pri_qty_decr := l_pri_qty_to_reduce;
2288: l_rem_pri_qty_incr := l_pri_qty_to_incr;
2311: IF (l_debug = 1) THEN
2312: print_debug('Calling delete_reservation for rsv ID: ' || t_rsv_id(i), 4);
2313: END IF;
2314:
2315: l_api_return_status := fnd_api.g_ret_sts_success;
2316: inv_reservation_pvt.delete_reservation (
2317: p_api_version_number => 1.0
2318: , p_init_msg_lst => fnd_api.g_false
2319: , x_return_status => l_api_return_status
2314:
2315: l_api_return_status := fnd_api.g_ret_sts_success;
2316: inv_reservation_pvt.delete_reservation (
2317: p_api_version_number => 1.0
2318: , p_init_msg_lst => fnd_api.g_false
2319: , x_return_status => l_api_return_status
2320: , x_msg_count => x_msg_count
2321: , x_msg_data => x_msg_data
2322: , p_rsv_rec => l_rsv_rec
2322: , p_rsv_rec => l_rsv_rec
2323: , p_original_serial_number => l_original_serial_number
2324: , p_validation_flag => NULL
2325: );
2326: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
2327: IF (l_debug = 1) THEN
2328: print_debug('Error status from inv_reservation_pvt.delete_reservation: '
2329: || l_api_return_status, 4);
2330: END IF;
2327: IF (l_debug = 1) THEN
2328: print_debug('Error status from inv_reservation_pvt.delete_reservation: '
2329: || l_api_return_status, 4);
2330: END IF;
2331: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2332: RAISE fnd_api.g_exc_error;
2333: ELSE
2334: RAISE fnd_api.g_exc_unexpected_error;
2335: END IF;
2328: print_debug('Error status from inv_reservation_pvt.delete_reservation: '
2329: || l_api_return_status, 4);
2330: END IF;
2331: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2332: RAISE fnd_api.g_exc_error;
2333: ELSE
2334: RAISE fnd_api.g_exc_unexpected_error;
2335: END IF;
2336: END IF;
2330: END IF;
2331: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2332: RAISE fnd_api.g_exc_error;
2333: ELSE
2334: RAISE fnd_api.g_exc_unexpected_error;
2335: END IF;
2336: END IF;
2337: END LOOP;
2338: l_rem_pri_qty_decr := l_rem_pri_qty_decr - l_lpn_rsv_pri_qty;
2476: WHEN OTHERS THEN
2477: IF (l_debug = 1) THEN
2478: print_debug('Error querying non-LPN rsv qty: ' || SQLERRM, 4);
2479: END IF;
2480: RAISE FND_API.g_exc_unexpected_error;
2481: END;
2482:
2483: IF (l_debug = 1) THEN
2484: print_debug('l_nonlpn_rsv_pri_qty: ' || l_nonlpn_rsv_pri_qty, 4);
2598: END IF; --} if sub is reservable
2599:
2600: -- Ct wt -ve adjustment
2601: IF l_pri_qty_to_reduce > 0 THEN --{
2602: l_api_return_status := fnd_api.g_ret_sts_success;
2603: process_ctwt_adj(
2604: x_return_status => l_api_return_status
2605: , x_msg_count => x_msg_count
2606: , x_msg_data => x_msg_data
2615: , p_pri_qty => l_pri_qty_to_reduce
2616: , p_pri_uom_code => l_pr_uom_code
2617: , p_sec_uom_code => p_secondary_uom_code
2618: );
2619: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
2620: IF (l_debug = 1) THEN
2621: print_debug('Error status from process_ctwt_adj: '
2622: || l_api_return_status, 4);
2623: END IF;
2620: IF (l_debug = 1) THEN
2621: print_debug('Error status from process_ctwt_adj: '
2622: || l_api_return_status, 4);
2623: END IF;
2624: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2625: RAISE fnd_api.g_exc_error;
2626: ELSE
2627: RAISE fnd_api.g_exc_unexpected_error;
2628: END IF;
2621: print_debug('Error status from process_ctwt_adj: '
2622: || l_api_return_status, 4);
2623: END IF;
2624: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2625: RAISE fnd_api.g_exc_error;
2626: ELSE
2627: RAISE fnd_api.g_exc_unexpected_error;
2628: END IF;
2629: END IF;
2623: END IF;
2624: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2625: RAISE fnd_api.g_exc_error;
2626: ELSE
2627: RAISE fnd_api.g_exc_unexpected_error;
2628: END IF;
2629: END IF;
2630: END IF; --} end if l_pri_qty_to_reduce > 0
2631:
2652: IF l_lpn_pri_qty <= 0 THEN
2653: IF (l_debug = 1) THEN
2654: print_debug('l_lpn_pri_qty is 0 or -ve, erroring out', 4);
2655: END IF;
2656: RAISE fnd_api.g_exc_unexpected_error;
2657: END IF;
2658:
2659: IF l_lpn_sec_qty <> p_secondary_quantity THEN
2660: IF (l_debug = 1) THEN
2659: IF l_lpn_sec_qty <> p_secondary_quantity THEN
2660: IF (l_debug = 1) THEN
2661: print_debug('l_lpn_sec_qty does not match passed-in secondary', 4);
2662: END IF;
2663: RAISE fnd_api.g_exc_unexpected_error;
2664: END IF;
2665:
2666: IF l_lpn_pri_qty > l_primary_qty THEN
2667: -- Reduce MMTT/MTLT qtys to match entered primary qty
2709: ELSE
2710: IF (l_debug = 1) THEN
2711: print_debug('No temp IDs to process!', 4);
2712: END IF;
2713: RAISE fnd_api.g_exc_error;
2714: END IF;
2715:
2716: IF l_pri_qty_to_reduce > 0 THEN --{
2717: IF (l_debug = 1) THEN
2765:
2766: IF (t_clpn_id(i) IS NOT NULL)
2767: OR (l_lot_control_code <> 1 AND l_lot_divisible_flag = 'N')
2768: THEN --{
2769: l_api_return_status := fnd_api.g_ret_sts_success;
2770: process_ctwt_adj(
2771: x_return_status => l_api_return_status
2772: , x_msg_count => x_msg_count
2773: , x_msg_data => x_msg_data
2782: , p_pri_qty => l_sku_pri_decr
2783: , p_pri_uom_code => l_pr_uom_code
2784: , p_sec_uom_code => p_secondary_uom_code
2785: );
2786: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
2787: IF (l_debug = 1) THEN
2788: print_debug('Error status from process_ctwt_adj: '
2789: || l_api_return_status, 4);
2790: END IF;
2787: IF (l_debug = 1) THEN
2788: print_debug('Error status from process_ctwt_adj: '
2789: || l_api_return_status, 4);
2790: END IF;
2791: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2792: RAISE fnd_api.g_exc_error;
2793: ELSE
2794: RAISE fnd_api.g_exc_unexpected_error;
2795: END IF;
2788: print_debug('Error status from process_ctwt_adj: '
2789: || l_api_return_status, 4);
2790: END IF;
2791: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2792: RAISE fnd_api.g_exc_error;
2793: ELSE
2794: RAISE fnd_api.g_exc_unexpected_error;
2795: END IF;
2796: END IF;
2790: END IF;
2791: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2792: RAISE fnd_api.g_exc_error;
2793: ELSE
2794: RAISE fnd_api.g_exc_unexpected_error;
2795: END IF;
2796: END IF;
2797: END IF; --} end if content LPN or indiv lot
2798: END LOOP; --} end loop through MMTTs
2939: ', sec_qty=' || t_sec_qty(j)
2940: , 4);
2941: END IF;
2942:
2943: l_api_return_status := fnd_api.g_ret_sts_success;
2944: inv_quantity_tree_pub.query_quantities(
2945: p_api_version_number => 1.0
2946: , p_init_msg_lst => fnd_api.g_false
2947: , x_return_status => l_api_return_status
2942:
2943: l_api_return_status := fnd_api.g_ret_sts_success;
2944: inv_quantity_tree_pub.query_quantities(
2945: p_api_version_number => 1.0
2946: , p_init_msg_lst => fnd_api.g_false
2947: , x_return_status => l_api_return_status
2948: , x_msg_count => x_msg_count
2949: , x_msg_data => x_msg_data
2950: , p_organization_id => p_organization_id
2973: , p_lpn_id => NVL(t_clpn_id(j),t_lpn_id(j))
2974: , p_grade_code => NULL
2975: );
2976:
2977: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
2978: IF (l_debug = 1) THEN
2979: print_debug('Error status from inv_quantity_tree_pub.query_quantities: '
2980: || l_api_return_status, 4);
2981: END IF;
2978: IF (l_debug = 1) THEN
2979: print_debug('Error status from inv_quantity_tree_pub.query_quantities: '
2980: || l_api_return_status, 4);
2981: END IF;
2982: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2983: RAISE fnd_api.g_exc_error;
2984: ELSE
2985: RAISE fnd_api.g_exc_unexpected_error;
2986: END IF;
2979: print_debug('Error status from inv_quantity_tree_pub.query_quantities: '
2980: || l_api_return_status, 4);
2981: END IF;
2982: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2983: RAISE fnd_api.g_exc_error;
2984: ELSE
2985: RAISE fnd_api.g_exc_unexpected_error;
2986: END IF;
2987: END IF;
2981: END IF;
2982: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
2983: RAISE fnd_api.g_exc_error;
2984: ELSE
2985: RAISE fnd_api.g_exc_unexpected_error;
2986: END IF;
2987: END IF;
2988:
2989: IF (l_debug = 1) THEN
3018: IF (l_debug = 1) THEN
3019: print_debug('Catch weight +ve adjustment: ' || l_pri_increase, 4);
3020: END IF;
3021:
3022: l_api_return_status := fnd_api.g_ret_sts_success;
3023: process_ctwt_adj(
3024: x_return_status => l_api_return_status
3025: , x_msg_count => x_msg_count
3026: , x_msg_data => x_msg_data
3035: , p_pri_qty => l_pri_increase
3036: , p_pri_uom_code => l_pr_uom_code
3037: , p_sec_uom_code => p_secondary_uom_code
3038: );
3039: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
3040: IF (l_debug = 1) THEN
3041: print_debug('Error status from process_ctwt_adj: '
3042: || l_api_return_status, 4);
3043: END IF;
3040: IF (l_debug = 1) THEN
3041: print_debug('Error status from process_ctwt_adj: '
3042: || l_api_return_status, 4);
3043: END IF;
3044: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3045: RAISE fnd_api.g_exc_error;
3046: ELSE
3047: RAISE fnd_api.g_exc_unexpected_error;
3048: END IF;
3041: print_debug('Error status from process_ctwt_adj: '
3042: || l_api_return_status, 4);
3043: END IF;
3044: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3045: RAISE fnd_api.g_exc_error;
3046: ELSE
3047: RAISE fnd_api.g_exc_unexpected_error;
3048: END IF;
3049: END IF;
3043: END IF;
3044: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3045: RAISE fnd_api.g_exc_error;
3046: ELSE
3047: RAISE fnd_api.g_exc_unexpected_error;
3048: END IF;
3049: END IF;
3050: END IF; --} end if l_att < l_sku_pri_incr
3051:
3105: IF (l_sqoh = 0) AND (l_pri_increase = 0)
3106: AND ((l_att - l_sku_pri_incr) > 0)
3107: AND ((l_att - l_sku_pri_incr) <= l_max_pri_residual)
3108: THEN
3109: l_api_return_status := fnd_api.g_ret_sts_success;
3110: process_ctwt_adj(
3111: x_return_status => l_api_return_status
3112: , x_msg_count => x_msg_count
3113: , x_msg_data => x_msg_data
3122: , p_pri_qty => (l_att - l_sku_pri_incr)
3123: , p_pri_uom_code => l_pr_uom_code
3124: , p_sec_uom_code => p_secondary_uom_code
3125: );
3126: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
3127: IF (l_debug = 1) THEN
3128: print_debug('Error status from process_ctwt_adj: '
3129: || l_api_return_status, 4);
3130: END IF;
3127: IF (l_debug = 1) THEN
3128: print_debug('Error status from process_ctwt_adj: '
3129: || l_api_return_status, 4);
3130: END IF;
3131: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3132: RAISE fnd_api.g_exc_error;
3133: ELSE
3134: RAISE fnd_api.g_exc_unexpected_error;
3135: END IF;
3128: print_debug('Error status from process_ctwt_adj: '
3129: || l_api_return_status, 4);
3130: END IF;
3131: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3132: RAISE fnd_api.g_exc_error;
3133: ELSE
3134: RAISE fnd_api.g_exc_unexpected_error;
3135: END IF;
3136: END IF;
3130: END IF;
3131: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3132: RAISE fnd_api.g_exc_error;
3133: ELSE
3134: RAISE fnd_api.g_exc_unexpected_error;
3135: END IF;
3136: END IF;
3137: END IF;
3138:
3149: --
3150: IF (l_sqoh > 0)
3151: AND ((l_att - l_sku_pri_incr) <= 0)
3152: THEN
3153: l_api_return_status := fnd_api.g_ret_sts_success;
3154: wms_cycle_pvt.create_unscheduled_counts
3155: ( p_api_version => 1.0
3156: , p_init_msg_list => fnd_api.g_false
3157: , p_commit => fnd_api.g_false
3152: THEN
3153: l_api_return_status := fnd_api.g_ret_sts_success;
3154: wms_cycle_pvt.create_unscheduled_counts
3155: ( p_api_version => 1.0
3156: , p_init_msg_list => fnd_api.g_false
3157: , p_commit => fnd_api.g_false
3158: , x_return_status => l_api_return_status
3159: , x_msg_count => x_msg_count
3160: , x_msg_data => x_msg_data
3153: l_api_return_status := fnd_api.g_ret_sts_success;
3154: wms_cycle_pvt.create_unscheduled_counts
3155: ( p_api_version => 1.0
3156: , p_init_msg_list => fnd_api.g_false
3157: , p_commit => fnd_api.g_false
3158: , x_return_status => l_api_return_status
3159: , x_msg_count => x_msg_count
3160: , x_msg_data => x_msg_data
3161: , p_organization_id => p_organization_id
3165: , p_lpn_id => t_lpn_id(j)
3166: , p_revision => p_revision
3167: );
3168:
3169: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
3170: IF (l_debug = 1) THEN
3171: print_debug('Error status from wms_cycle_pvt.create_unscheduled_counts: '
3172: || l_api_return_status, 4);
3173: print_debug('Error msg: ' || x_msg_data, 4);
3171: print_debug('Error status from wms_cycle_pvt.create_unscheduled_counts: '
3172: || l_api_return_status, 4);
3173: print_debug('Error msg: ' || x_msg_data, 4);
3174: END IF;
3175: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3176: RAISE fnd_api.g_exc_error;
3177: ELSE
3178: RAISE fnd_api.g_exc_unexpected_error;
3179: END IF;
3172: || l_api_return_status, 4);
3173: print_debug('Error msg: ' || x_msg_data, 4);
3174: END IF;
3175: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3176: RAISE fnd_api.g_exc_error;
3177: ELSE
3178: RAISE fnd_api.g_exc_unexpected_error;
3179: END IF;
3180: END IF;
3174: END IF;
3175: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3176: RAISE fnd_api.g_exc_error;
3177: ELSE
3178: RAISE fnd_api.g_exc_unexpected_error;
3179: END IF;
3180: END IF;
3181: END IF;
3182: END IF; --} end if p_ccnt_sec_residual is Y
3260: END IF; --} end if qty adjustment or cycle count check required
3261: END IF; --} end if record source is MMTT
3262:
3263: -- End of API body
3264: IF fnd_api.to_boolean(p_commit) THEN
3265: COMMIT WORK;
3266: END IF;
3267:
3268: IF ( l_debug = 1 ) THEN
3269: print_debug(l_api_name || ' Exited ', 1);
3270: END IF;
3271:
3272: EXCEPTION
3273: WHEN fnd_api.g_exc_error THEN
3274: ROLLBACK TO update_lpn_primary_qty_sp;
3275: x_return_status := fnd_api.g_ret_sts_error;
3276: fnd_msg_pub.count_and_get
3277: ( p_count => x_msg_count
3271:
3272: EXCEPTION
3273: WHEN fnd_api.g_exc_error THEN
3274: ROLLBACK TO update_lpn_primary_qty_sp;
3275: x_return_status := fnd_api.g_ret_sts_error;
3276: fnd_msg_pub.count_and_get
3277: ( p_count => x_msg_count
3278: , p_data => x_msg_data
3279: , p_encoded => fnd_api.g_false
3275: x_return_status := fnd_api.g_ret_sts_error;
3276: fnd_msg_pub.count_and_get
3277: ( p_count => x_msg_count
3278: , p_data => x_msg_data
3279: , p_encoded => fnd_api.g_false
3280: );
3281: IF (l_debug = 1) THEN
3282: print_debug (x_msg_data, 4);
3283: END IF;
3287: print_debug('Error: ' || SQLERRM, 1);
3288: END IF;
3289:
3290: ROLLBACK TO update_lpn_primary_qty_sp;
3291: x_return_status := fnd_api.g_ret_sts_unexp_error;
3292: x_msg_data := SQLERRM;
3293:
3294: END update_lpn_primary_quantity;
3295:
3300: -- Description:
3301: --
3302: PROCEDURE Update_LPN_Secondary_Quantity (
3303: p_api_version IN NUMBER
3304: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3305: , p_commit IN VARCHAR2 := fnd_api.g_false
3306: , x_return_status OUT NOCOPY VARCHAR2
3307: , x_msg_count OUT NOCOPY NUMBER
3308: , x_msg_data OUT NOCOPY VARCHAR2
3301: --
3302: PROCEDURE Update_LPN_Secondary_Quantity (
3303: p_api_version IN NUMBER
3304: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3305: , p_commit IN VARCHAR2 := fnd_api.g_false
3306: , x_return_status OUT NOCOPY VARCHAR2
3307: , x_msg_count OUT NOCOPY NUMBER
3308: , x_msg_data OUT NOCOPY VARCHAR2
3309: , p_record_source IN VARCHAR2
3344: BEGIN
3345: SAVEPOINT UPDATE_LPN_SECONDARY_QUANTITY;
3346:
3347: -- Standard call to check for call compatibility.
3348: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
3349: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
3350: fnd_msg_pub.ADD;
3351: RAISE fnd_api.g_exc_unexpected_error;
3352: END IF;
3347: -- Standard call to check for call compatibility.
3348: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
3349: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
3350: fnd_msg_pub.ADD;
3351: RAISE fnd_api.g_exc_unexpected_error;
3352: END IF;
3353:
3354: -- Initialize message list if p_init_msg_list is set to TRUE.
3355: IF fnd_api.to_boolean(p_init_msg_list) THEN
3351: RAISE fnd_api.g_exc_unexpected_error;
3352: END IF;
3353:
3354: -- Initialize message list if p_init_msg_list is set to TRUE.
3355: IF fnd_api.to_boolean(p_init_msg_list) THEN
3356: fnd_msg_pub.initialize;
3357: END IF;
3358:
3359: -- Initialize API return status to success
3356: fnd_msg_pub.initialize;
3357: END IF;
3358:
3359: -- Initialize API return status to success
3360: x_return_status := fnd_api.g_ret_sts_success;
3361:
3362: IF ( l_debug = 1 ) THEN
3363: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
3364: print_debug('recsrc='||p_record_source ||' orgid='||p_organization_id||' lpnid='||p_lpn_id||' itemid='||p_inventory_item_id||' rev='||p_revision||' lot='||p_lot_number, 4);
3398: , p_uom_code => p_uom_code
3399: , p_secondary_quantity => p_secondary_quantity
3400: , p_secondary_uom_code => p_secondary_uom_code );
3401:
3402: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
3403: RAISE fnd_api.g_exc_unexpected_error;
3404: END IF;
3405: END IF;
3406: ELSIF ( p_record_source = 'MMTT' OR p_record_source = 'mmtt' ) THEN
3399: , p_secondary_quantity => p_secondary_quantity
3400: , p_secondary_uom_code => p_secondary_uom_code );
3401:
3402: IF ( x_return_status <> fnd_api.g_ret_sts_success ) THEN
3403: RAISE fnd_api.g_exc_unexpected_error;
3404: END IF;
3405: END IF;
3406: ELSIF ( p_record_source = 'MMTT' OR p_record_source = 'mmtt' ) THEN
3407: l_progress := '300';
3442: fnd_message.set_token('uom1', mmtt_rec.transaction_uom);
3443: fnd_message.set_token('uom2', p_uom_code);
3444: fnd_message.set_token('module', l_api_name);
3445: fnd_msg_pub.ADD;
3446: RAISE FND_API.G_EXC_ERROR;
3447: END IF;
3448: ELSE
3449: l_line_quantity := mmtt_rec.transaction_quantity;
3450: END IF;
3504: fnd_message.set_token('uom1', mmtt_rec.transaction_uom);
3505: fnd_message.set_token('uom2', p_uom_code);
3506: fnd_message.set_token('module', l_api_name);
3507: fnd_msg_pub.ADD;
3508: RAISE FND_API.G_EXC_ERROR;
3509: END IF;
3510: ELSE
3511: l_line_quantity := mtlt_rec.transaction_quantity;
3512: END IF;
3531: FND_MESSAGE.SET_NAME('WMS','WMS_QTY_UPD_MISMATCH_ERROR');
3532: FND_MESSAGE.SET_TOKEN('QTY1', p_quantity);
3533: FND_MESSAGE.SET_TOKEN('QTY2', l_total_quantity);
3534: FND_MSG_PUB.ADD;
3535: RAISE FND_API.G_EXC_ERROR;
3536: END IF;
3537: END IF;
3538:
3539: l_progress := '800';
3537: END IF;
3538:
3539: l_progress := '800';
3540: -- End of API body
3541: IF fnd_api.to_boolean(p_commit) THEN
3542: COMMIT WORK;
3543: END IF;
3544:
3545: IF ( l_debug = 1 ) THEN
3556: END IF;
3557: END IF;
3558:
3559: ROLLBACK TO UPDATE_LPN_SECONDARY_QUANTITY;
3560: x_return_status := fnd_api.g_ret_sts_error;
3561: fnd_message.set_name('WMS', 'WMS_OTHERS_ERROR_CALL'||l_progress);
3562: fnd_msg_pub.ADD;
3563: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
3564: END Update_LPN_Secondary_Quantity;
3565:
3566:
3567: FUNCTION Check_LPN_Secondary_Quantity (
3568: p_api_version IN NUMBER
3569: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
3570: , x_return_status OUT NOCOPY VARCHAR2
3571: , x_msg_count OUT NOCOPY NUMBER
3572: , x_msg_data OUT NOCOPY VARCHAR2
3573: , p_organization_id IN NUMBER
3627: l_lot_control_code NUMBER;
3628: l_uom_conv_rate NUMBER;
3629: BEGIN
3630: -- Standard call to check for call compatibility.
3631: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
3632: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
3633: fnd_msg_pub.ADD;
3634: RAISE fnd_api.g_exc_unexpected_error;
3635: END IF;
3630: -- Standard call to check for call compatibility.
3631: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
3632: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
3633: fnd_msg_pub.ADD;
3634: RAISE fnd_api.g_exc_unexpected_error;
3635: END IF;
3636:
3637: -- Initialize message list if p_init_msg_list is set to TRUE.
3638: IF fnd_api.to_boolean(p_init_msg_list) THEN
3634: RAISE fnd_api.g_exc_unexpected_error;
3635: END IF;
3636:
3637: -- Initialize message list if p_init_msg_list is set to TRUE.
3638: IF fnd_api.to_boolean(p_init_msg_list) THEN
3639: fnd_msg_pub.initialize;
3640: END IF;
3641:
3642: -- Initialize API return status to success
3639: fnd_msg_pub.initialize;
3640: END IF;
3641:
3642: -- Initialize API return status to success
3643: x_return_status := fnd_api.g_ret_sts_success;
3644:
3645: IF ( l_debug = 1 ) THEN
3646: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
3647: print_debug('orgid='||p_organization_id||' outerlpnid='||p_outermost_lpn_id, 4);
3657: WHEN NO_DATA_FOUND THEN
3658: IF ( l_debug = 1 ) THEN
3659: print_debug('Error Could not find outermost lpn', 1);
3660: END IF;
3661: RAISE FND_API.G_EXC_ERROR;
3662: WHEN OTHERS THEN
3663: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3664: END;
3665:
3659: print_debug('Error Could not find outermost lpn', 1);
3660: END IF;
3661: RAISE FND_API.G_EXC_ERROR;
3662: WHEN OTHERS THEN
3663: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3664: END;
3665:
3666: l_progress := '000';
3667: IF ( l_lpn_context = WMS_CONTAINER_PVT.LPN_CONTEXT_PICKED OR
3704: WHEN NO_DATA_FOUND THEN
3705: -- All the items in this lpn check out, continue
3706: NULL;
3707: WHEN OTHERS THEN
3708: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3709: END;
3710:
3711: -- Check LPN that all catch weight enabled items that are defaultable and do not
3712: -- have sec qty defined have a valid uom conversion.
3759: WHEN NO_DATA_FOUND THEN
3760: IF ( l_debug = 1 ) THEN
3761: print_debug('Error: could not find item in MSI: orgid='||mmtt_item_rec.organization_id||' itemid='||mmtt_item_rec.inventory_item_id, 1);
3762: END IF;
3763: RAISE FND_API.G_EXC_ERROR;
3764: WHEN OTHERS THEN
3765: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3766: END;
3767:
3761: print_debug('Error: could not find item in MSI: orgid='||mmtt_item_rec.organization_id||' itemid='||mmtt_item_rec.inventory_item_id, 1);
3762: END IF;
3763: RAISE FND_API.G_EXC_ERROR;
3764: WHEN OTHERS THEN
3765: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3766: END;
3767:
3768: IF ( l_pricing_ind = G_PRICE_SECONDARY ) THEN
3769: -- If the item is not lot controlled, return to user that lpn still needs catch weight
3819: END IF;
3820:
3821: l_temp := 0;
3822: WHEN OTHERS THEN
3823: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3824: END;
3825:
3826: -- If this lot item was found to not have catch weigth but can be defaulted
3827: -- Check UOM conversion to make sure it's valid
3884: print_debug('SQL error: ' || SQLERRM(SQLCODE), 1);
3885: END IF;
3886: END IF;
3887:
3888: x_return_status := fnd_api.g_ret_sts_error;
3889: fnd_message.set_name('WMS', 'WMS_API_FAIL');
3890: fnd_msg_pub.ADD;
3891: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
3892: END Check_LPN_Secondary_Quantity;
4697: l_progress := '10';
4698: print_debug(' out 2 Loop l_from_item_pri_qty => '||l_from_item_pri_qty,4);
4699: if (l_from_item_pri_qty IS NULL OR l_from_item_pri_qty = 0 ) THEN
4700: x_show_ct_wt := 0;
4701: x_return_status := fnd_api.g_ret_sts_success;
4702: RETURN;
4703: END IF;
4704:
4705: l_progress := '20';
4704:
4705: l_progress := '20';
4706: if (p_to_lpn_id IS NULL) THEN
4707: x_show_ct_wt := 1 ;
4708: x_return_status := fnd_api.g_ret_sts_success;
4709: RETURN;
4710: END IF;
4711: IF (p_to_lpn_id IS NOT NULL) THEN
4712: OPEN itemCur(p_to_lpn_id);
4722: print_debug('After Loop l_to_sec_qty => '||l_to_sec_qty,4);
4723:
4724: if (l_to_sec_qty IS NULL) THEN
4725: x_show_ct_wt := 0 ;
4726: x_return_status := fnd_api.g_ret_sts_success;
4727: RETURN;
4728: END IF;
4729:
4730: l_progress := '40';
4729:
4730: l_progress := '40';
4731: if (l_to_sec_qty = 0) THEN
4732: x_show_ct_wt := 1;
4733: x_return_status := fnd_api.g_ret_sts_success;
4734: RETURN;
4735: END IF;
4736: END IF;
4737: l_progress := '50';
4757: ELSE
4758: x_show_ct_wt := 0;
4759: END IF;
4760: l_progress := '70';
4761: x_return_status := fnd_api.g_ret_sts_success;
4762:
4763: EXCEPTION
4764: WHEN OTHERS THEN
4765: IF (l_debug = 1) THEN
4898:
4899: l_progress := '60';
4900: returnTolerance := Check_Secondary_Qty_Tolerance (
4901: p_api_version => 1
4902: , p_init_msg_list => fnd_api.g_false
4903: , x_return_status => x_return_status
4904: , x_msg_count => x_msg_count
4905: , x_msg_data => x_msg_data
4906: , p_organization_id => p_org_id
4931: END IS_CT_WT_SPLIT_VALID;
4932:
4933: FUNCTION VALIDATE_CT_WT_FOR_DELIVERYNUM(
4934: p_api_version IN NUMBER
4935: , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
4936: , x_return_status OUT NOCOPY VARCHAR2
4937: , x_msg_count OUT NOCOPY NUMBER
4938: , x_msg_data OUT NOCOPY VARCHAR2
4939: , p_org_id IN NUMBER
4974: BEGIN
4975:
4976:
4977: -- Standard call to check for call compatibility.
4978: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
4979: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
4980: fnd_msg_pub.ADD;
4981: RAISE fnd_api.g_exc_unexpected_error;
4982: END IF;
4977: -- Standard call to check for call compatibility.
4978: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
4979: fnd_message.set_name('WMS', 'WMS_CONT_INCOMPATIBLE_API_CALL');
4980: fnd_msg_pub.ADD;
4981: RAISE fnd_api.g_exc_unexpected_error;
4982: END IF;
4983:
4984: -- Initialize message list if p_init_msg_list is set to TRUE.
4985: IF fnd_api.to_boolean(p_init_msg_list) THEN
4981: RAISE fnd_api.g_exc_unexpected_error;
4982: END IF;
4983:
4984: -- Initialize message list if p_init_msg_list is set to TRUE.
4985: IF fnd_api.to_boolean(p_init_msg_list) THEN
4986: fnd_msg_pub.initialize;
4987: END IF;
4988:
4989: -- Initialize API return status to success
4986: fnd_msg_pub.initialize;
4987: END IF;
4988:
4989: -- Initialize API return status to success
4990: x_return_status := fnd_api.g_ret_sts_success;
4991:
4992:
4993: IF ( l_debug = 1 ) THEN
4994: print_debug(l_api_name || ' Entered ' || g_pkg_version, 1);
5058: IF ( SQLCODE IS NOT NULL ) THEN
5059: print_debug('SQL error: ' || SQLERRM(SQLCODE), 1);
5060: END IF;
5061: END IF;
5062: x_return_status := fnd_api.g_ret_sts_error;
5063: fnd_message.set_name('WMS', 'WMS_CALC_SEC_QTY_FAIL');
5064: fnd_msg_pub.ADD;
5065: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
5066: END VALIDATE_CT_WT_FOR_DELIVERYNUM;
5157: l_tare_weight NUMBER;
5158: l_inner_lpn_tare NUMBER := 0;
5159:
5160: BEGIN
5161: x_return_status := fnd_api.g_ret_sts_success;
5162:
5163: SAVEPOINT update_tare_sp;
5164:
5165: IF (l_debug = 1) THEN
5274: l_lpn_rec.tare_weight := l_new_tare_wt;
5275: l_lpn_rec.tare_weight_uom_code := l_new_tare_wt_uom_code;
5276: l_lpn_tbl(1) := l_lpn_rec;
5277:
5278: l_api_return_status := fnd_api.g_ret_sts_success;
5279: wms_container_pvt.modify_lpns(
5280: p_api_version => 1.0
5281: , p_init_msg_list => fnd_api.g_true
5282: , p_commit => fnd_api.g_false
5277:
5278: l_api_return_status := fnd_api.g_ret_sts_success;
5279: wms_container_pvt.modify_lpns(
5280: p_api_version => 1.0
5281: , p_init_msg_list => fnd_api.g_true
5282: , p_commit => fnd_api.g_false
5283: , x_return_status => l_api_return_status
5284: , x_msg_count => x_msg_count
5285: , x_msg_data => x_msg_data
5278: l_api_return_status := fnd_api.g_ret_sts_success;
5279: wms_container_pvt.modify_lpns(
5280: p_api_version => 1.0
5281: , p_init_msg_list => fnd_api.g_true
5282: , p_commit => fnd_api.g_false
5283: , x_return_status => l_api_return_status
5284: , x_msg_count => x_msg_count
5285: , x_msg_data => x_msg_data
5286: , p_caller => NULL
5285: , x_msg_data => x_msg_data
5286: , p_caller => NULL
5287: , p_lpn_table => l_lpn_tbl
5288: );
5289: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
5290: IF (l_debug = 1) THEN
5291: print_debug('Error status from wms_container_pvt.modify_lpns: '
5292: || l_api_return_status, 4);
5293: END IF;
5290: IF (l_debug = 1) THEN
5291: print_debug('Error status from wms_container_pvt.modify_lpns: '
5292: || l_api_return_status, 4);
5293: END IF;
5294: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
5295: RAISE fnd_api.g_exc_error;
5296: ELSE
5297: RAISE fnd_api.g_exc_unexpected_error;
5298: END IF;
5291: print_debug('Error status from wms_container_pvt.modify_lpns: '
5292: || l_api_return_status, 4);
5293: END IF;
5294: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
5295: RAISE fnd_api.g_exc_error;
5296: ELSE
5297: RAISE fnd_api.g_exc_unexpected_error;
5298: END IF;
5299: END IF;
5293: END IF;
5294: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
5295: RAISE fnd_api.g_exc_error;
5296: ELSE
5297: RAISE fnd_api.g_exc_unexpected_error;
5298: END IF;
5299: END IF;
5300:
5301: EXCEPTION
5298: END IF;
5299: END IF;
5300:
5301: EXCEPTION
5302: WHEN fnd_api.g_exc_error THEN
5303: ROLLBACK TO update_tare_sp;
5304: x_return_status := fnd_api.g_ret_sts_error;
5305: fnd_msg_pub.count_and_get
5306: ( p_count => x_msg_count
5300:
5301: EXCEPTION
5302: WHEN fnd_api.g_exc_error THEN
5303: ROLLBACK TO update_tare_sp;
5304: x_return_status := fnd_api.g_ret_sts_error;
5305: fnd_msg_pub.count_and_get
5306: ( p_count => x_msg_count
5307: , p_data => x_msg_data
5308: , p_encoded => fnd_api.g_false
5304: x_return_status := fnd_api.g_ret_sts_error;
5305: fnd_msg_pub.count_and_get
5306: ( p_count => x_msg_count
5307: , p_data => x_msg_data
5308: , p_encoded => fnd_api.g_false
5309: );
5310: IF (l_debug = 1) THEN
5311: print_debug (x_msg_data, 4);
5312: END IF;
5316: print_debug('Error: ' || SQLERRM, 1);
5317: END IF;
5318:
5319: ROLLBACK TO update_tare_sp;
5320: x_return_status := fnd_api.g_ret_sts_unexp_error;
5321: x_msg_data := SQLERRM;
5322:
5323: END update_lpn_tare;
5324: