26: --
27: -- Input Parameters
28: -- p_api_version_number
29: -- API version number (current version is 1.0)
30: -- p_init_msg_list (optional, default FND_API.G_FALSE)
31: -- Valid values: FND_API.G_FALSE or FND_API.G_TRUE.
32: -- if set to FND_API.G_TRUE
33: -- initialize error message list
34: -- if set to FND_API.G_FALSE - not initialize error
27: -- Input Parameters
28: -- p_api_version_number
29: -- API version number (current version is 1.0)
30: -- p_init_msg_list (optional, default FND_API.G_FALSE)
31: -- Valid values: FND_API.G_FALSE or FND_API.G_TRUE.
32: -- if set to FND_API.G_TRUE
33: -- initialize error message list
34: -- if set to FND_API.G_FALSE - not initialize error
35: -- message list
28: -- p_api_version_number
29: -- API version number (current version is 1.0)
30: -- p_init_msg_list (optional, default FND_API.G_FALSE)
31: -- Valid values: FND_API.G_FALSE or FND_API.G_TRUE.
32: -- if set to FND_API.G_TRUE
33: -- initialize error message list
34: -- if set to FND_API.G_FALSE - not initialize error
35: -- message list
36: -- p_commit (optional, default FND_API.G_FALSE)
30: -- p_init_msg_list (optional, default FND_API.G_FALSE)
31: -- Valid values: FND_API.G_FALSE or FND_API.G_TRUE.
32: -- if set to FND_API.G_TRUE
33: -- initialize error message list
34: -- if set to FND_API.G_FALSE - not initialize error
35: -- message list
36: -- p_commit (optional, default FND_API.G_FALSE)
37: -- whether or not to commit the changes to database
38: --
32: -- if set to FND_API.G_TRUE
33: -- initialize error message list
34: -- if set to FND_API.G_FALSE - not initialize error
35: -- message list
36: -- p_commit (optional, default FND_API.G_FALSE)
37: -- whether or not to commit the changes to database
38: --
39: -- p_mo_line_tbl
40: -- Table of Move Order Line records to pick release
54: --
55: -- Output Parameters
56: -- x_return_status
57: -- if the pick release process succeeds, the value is
58: -- fnd_api.g_ret_sts_success;
59: -- if there is an expected error, the value is
60: -- fnd_api.g_ret_sts_error;
61: -- if there is an unexpected error, the value is
62: -- fnd_api.g_ret_sts_unexp_error;
56: -- x_return_status
57: -- if the pick release process succeeds, the value is
58: -- fnd_api.g_ret_sts_success;
59: -- if there is an expected error, the value is
60: -- fnd_api.g_ret_sts_error;
61: -- if there is an unexpected error, the value is
62: -- fnd_api.g_ret_sts_unexp_error;
63: -- x_msg_count
64: -- if there is one or more errors, the number of error messages
58: -- fnd_api.g_ret_sts_success;
59: -- if there is an expected error, the value is
60: -- fnd_api.g_ret_sts_error;
61: -- if there is an unexpected error, the value is
62: -- fnd_api.g_ret_sts_unexp_error;
63: -- x_msg_count
64: -- if there is one or more errors, the number of error messages
65: -- in the buffer
66: -- x_msg_data
64: -- if there is one or more errors, the number of error messages
65: -- in the buffer
66: -- x_msg_data
67: -- if there is one and only one error, the error message
68: -- (See fnd_api package for more details about the above output parameters)
69: -- x_pick_release_status
70: -- This output parameter is a table of records (of type
71: -- INV_Release_Status_Tbl_Type) which specifies the pick release status
72: -- for each move order line that is passed in.
99: print_debug('Inside Store_smc_bo_details','INV_PICK_RELEASE_PUB');
100: print_debug('delivery detail'||back_order_det_tbl(1).delivery_detail_id,
101: 'INV_PICK_RELEASE_PUB');
102: End If;
103: x_return_status := fnd_api.g_ret_sts_success;
104:
105: if back_order_det_tbl.count >0 then
106: l_delivery_detail_id :=back_order_det_tbl(1).delivery_detail_id;
107: If is_debug Then
125: ||all_del_det_bo_tbl(l_delivery_detail_id).cycle_count_quantity
126: ,'INV_PICK_RELEASE_PUB');
127: End If;
128: EXCEPTION
129: WHEN FND_API.G_EXC_ERROR THEN
130: --
131: x_return_status := FND_API.G_RET_STS_ERROR;
132: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
133: if is_debug then
127: End If;
128: EXCEPTION
129: WHEN FND_API.G_EXC_ERROR THEN
130: --
131: x_return_status := FND_API.G_RET_STS_ERROR;
132: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
133: if is_debug then
134: print_debug(SQLERRM,'INV_PICK_RELEASE_PUB');
135: end if;
128: EXCEPTION
129: WHEN FND_API.G_EXC_ERROR THEN
130: --
131: x_return_status := FND_API.G_RET_STS_ERROR;
132: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
133: if is_debug then
134: print_debug(SQLERRM,'INV_PICK_RELEASE_PUB');
135: end if;
136: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
132: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
133: if is_debug then
134: print_debug(SQLERRM,'INV_PICK_RELEASE_PUB');
135: end if;
136: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
137: WHEN OTHERS THEN
138: if is_debug then
139: print_debug(SQLERRM,'INV_PICK_RELEASE_PUB');
140: end if;
138: if is_debug then
139: print_debug(SQLERRM,'INV_PICK_RELEASE_PUB');
140: end if;
141: ROLLBACK TO Pick_Release_PUB;
142: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
143: END;
144:
145: --2509322:Earlier when ever a component in a model is short we backorder all
146: -- components to the difference of new model quantity and original
157: l_shipping_attr WSH_INTERFACE.ChangedAttributeTabType;
158: l_del_index INTEGER;
159:
160: BEGIN
161: x_return_status := fnd_api.g_ret_sts_success;
162:
163: IF all_del_det_bo_tbl.COUNT >0 THEN
164: l_del_index :=all_del_det_bo_tbl.FIRST ;
165: LOOP
192: p_changed_attributes => l_shipping_attr,
193: x_return_status => x_return_status
194: );
195:
196: if( x_return_status = FND_API.G_RET_STS_ERROR ) then
197: if is_debug then
198: print_debug('return error from update shipping attributes',
199: 'Inv_Pick_Release_Pub.Pick_Release');
200: end if;
197: if is_debug then
198: print_debug('return error from update shipping attributes',
199: 'Inv_Pick_Release_Pub.Pick_Release');
200: end if;
201: raise FND_API.G_EXC_ERROR;
202: elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
203: if is_debug then
204: print_debug('return error from update shipping attributes',
205: 'Inv_Pick_Release_Pub.Pick_Release');
198: print_debug('return error from update shipping attributes',
199: 'Inv_Pick_Release_Pub.Pick_Release');
200: end if;
201: raise FND_API.G_EXC_ERROR;
202: elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
203: if is_debug then
204: print_debug('return error from update shipping attributes',
205: 'Inv_Pick_Release_Pub.Pick_Release');
206: end if;
203: if is_debug then
204: print_debug('return error from update shipping attributes',
205: 'Inv_Pick_Release_Pub.Pick_Release');
206: end if;
207: raise FND_API.G_EXC_UNEXPECTED_ERROR;
208: end if;
209:
210: l_shipping_attr.DELETE;
211: EXIT WHEN l_del_index =all_del_det_bo_tbl.LAST;
213:
214: END LOOP;
215: END IF;
216: all_del_det_bo_tbl.DELETE;
217: x_return_status :=fnd_api.g_ret_sts_success;
218: EXCEPTION
219: WHEN FND_API.G_EXC_ERROR THEN
220: --
221: x_return_status := FND_API.G_RET_STS_ERROR;
215: END IF;
216: all_del_det_bo_tbl.DELETE;
217: x_return_status :=fnd_api.g_ret_sts_success;
218: EXCEPTION
219: WHEN FND_API.G_EXC_ERROR THEN
220: --
221: x_return_status := FND_API.G_RET_STS_ERROR;
222: --
223: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
217: x_return_status :=fnd_api.g_ret_sts_success;
218: EXCEPTION
219: WHEN FND_API.G_EXC_ERROR THEN
220: --
221: x_return_status := FND_API.G_RET_STS_ERROR;
222: --
223: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
224: , p_data => x_msg_data);
225: --
222: --
223: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
224: , p_data => x_msg_data);
225: --
226: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
227: --
228: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
229: --
230: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
224: , p_data => x_msg_data);
225: --
226: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
227: --
228: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
229: --
230: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
231: , p_data => x_msg_data);
232: --
232: --
233: WHEN OTHERS THEN
234: ROLLBACK TO Pick_Release_PUB;
235: --
236: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
237: --
238: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
239: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
240: END IF;
393:
394: -- The Move Order Lines may need to have their grouping rule ID defaulted
395: -- from the header. This is only necessary if the Grouping Rule ID was not
396: -- passed in as a parameter.
397: IF p_grouping_rule_id <> FND_API.G_MISS_NUM THEN
398: l_grouping_rule_id := p_grouping_rule_id;
399: l_get_header_rule := 2;
400: ELSE
401: l_get_header_rule := 1;
416: ROLLBACK TO Assign_Pick_slip;
417: FND_MESSAGE.SET_NAME('INV','INV_NO_HEADER_FOUND');
418: FND_MESSAGE.SET_TOKEN('MO_LINE_ID','');
419: FND_MSG_PUB.Add;
420: RAISE fnd_api.g_exc_unexpected_error;
421: END;
422:
423: IF (l_debug = 1) THEN
424: print_debug('l_grouping_rule_id = '||l_grouping_rule_id||',l_organization_id = '||l_organization_id,
437: WHEN no_data_found THEN
438: ROLLBACK TO Assign_pick_slip;
439: FND_MESSAGE.SET_NAME('INV','INV-NO ORG INFORMATION');
440: FND_MSG_PUB.Add;
441: RAISE fnd_api.g_exc_unexpected_error;
442: END;
443: END IF; -- get header rule
444: END IF; -- return status
445:
458: , x_error_message => l_api_error_msg
459: , x_api_Status => l_api_return_status
460: ) ;
461:
462: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
463: IF (l_debug = 1) THEN
464: print_debug('return error from WSH_INV_INTEGRATION.find_printer',
465: 'Inv_Pick_Release_Pvt.Process_Line');
466: END IF;
463: IF (l_debug = 1) THEN
464: print_debug('return error from WSH_INV_INTEGRATION.find_printer',
465: 'Inv_Pick_Release_Pvt.Process_Line');
466: END IF;
467: RAISE fnd_api.g_exc_unexpected_error;
468: END IF;
469:
470: END IF ;
471: IF p_ps_mode = 'I' and
468: END IF;
469:
470: END IF ;
471: IF p_ps_mode = 'I' and
472: p_allow_partial_pick = fnd_api.g_true THEN
473: COMMIT WORK;
474:
475: BEGIN
476:
491: FROM wsh_picking_batches
492: WHERE NAME = l_request_number;
493: EXCEPTION
494: WHEN NO_DATA_FOUND THEN
495: x_return_status := fnd_api.g_ret_sts_error;
496: RAISE fnd_api.g_exc_error;
497: END;
498:
499: wsh_pr_pick_slip_number.print_pick_slip(
492: WHERE NAME = l_request_number;
493: EXCEPTION
494: WHEN NO_DATA_FOUND THEN
495: x_return_status := fnd_api.g_ret_sts_error;
496: RAISE fnd_api.g_exc_error;
497: END;
498:
499: wsh_pr_pick_slip_number.print_pick_slip(
500: p_pick_slip_number => l_pick_slip_number
504: , x_error_message => l_api_error_msg
505: ); -- don't need to call WMS new pick slip report, call shipping's api and add new wms report to the
506: -- proper document set
507:
508: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
509: ROLLBACK TO assign_pick_slip;
510: fnd_message.set_name('INV', 'INV_PRINT_PICK_SLIP_FAILED');
511: fnd_message.set_token('PICK_SLIP_NUM', TO_CHAR(l_pick_slip_number));
512: fnd_msg_pub.ADD;
509: ROLLBACK TO assign_pick_slip;
510: fnd_message.set_name('INV', 'INV_PRINT_PICK_SLIP_FAILED');
511: fnd_message.set_token('PICK_SLIP_NUM', TO_CHAR(l_pick_slip_number));
512: fnd_msg_pub.ADD;
513: RAISE fnd_api.g_exc_unexpected_error;
514: END IF;
515: END IF;
516:
517: ELSE
545: IF (l_debug = 1) THEN
546: print_debug('l_call_mode'|| l_call_mode, 'Inv_Pick_Release_PVT.Process_Line');
547: END IF;
548:
549: IF l_api_return_status <> fnd_api.g_ret_sts_success
550: OR l_pick_slip_number = -1 THEN
551: ROLLBACK TO assign_pick_slip;
552: fnd_message.set_name('INV', 'INV_NO_PICK_SLIP_NUMBER');
553: fnd_msg_pub.ADD;
550: OR l_pick_slip_number = -1 THEN
551: ROLLBACK TO assign_pick_slip;
552: fnd_message.set_name('INV', 'INV_NO_PICK_SLIP_NUMBER');
553: fnd_msg_pub.ADD;
554: RAISE fnd_api.g_exc_unexpected_error;
555: END IF;
556:
557: IF ( p_ps_mode <> 'I' ) THEN
558: WSH_INV_INTEGRATION_GRP.FIND_PRINTER
561: , x_error_message => l_api_error_msg
562: , x_api_Status => l_api_return_status
563: ) ;
564:
565: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
566: IF (l_debug = 1) THEN
567: print_debug('return error from WSH_INV_INTEGRATION.find_printer',
568: 'Inv_Pick_Release_Pvt.Process_Line');
569: END IF;
566: IF (l_debug = 1) THEN
567: print_debug('return error from WSH_INV_INTEGRATION.find_printer',
568: 'Inv_Pick_Release_Pvt.Process_Line');
569: END IF;
570: RAISE fnd_api.g_exc_unexpected_error;
571: END IF;
572:
573: END IF ;
574: l_mso_header_id := inv_salesorder.get_salesorder_for_oeheader(mmtt_line.oe_header_id);
585: -- picking is allowed) commit
586: -- and print at this point.
587: -- Bug 1663376 - Don't Commit if Ship_set_Id is not null,
588: -- since we need to be able to rollback
589: IF l_ready_to_print = fnd_api.g_true
590: AND p_allow_partial_pick = fnd_api.g_true
591: AND mmtt_line.ship_set_id IS NULL
592: AND mmtt_line.ship_model_id IS NULL
593: AND l_call_mode IS NULL THEN
586: -- and print at this point.
587: -- Bug 1663376 - Don't Commit if Ship_set_Id is not null,
588: -- since we need to be able to rollback
589: IF l_ready_to_print = fnd_api.g_true
590: AND p_allow_partial_pick = fnd_api.g_true
591: AND mmtt_line.ship_set_id IS NULL
592: AND mmtt_line.ship_model_id IS NULL
593: AND l_call_mode IS NULL THEN
594: COMMIT WORK;
605: FROM wsh_picking_batches
606: WHERE NAME = l_request_number;
607: EXCEPTION
608: WHEN NO_DATA_FOUND THEN
609: x_return_status := fnd_api.g_ret_sts_error;
610: RAISE fnd_api.g_exc_error;
611: END;
612:
613: wsh_pr_pick_slip_number.print_pick_slip(
606: WHERE NAME = l_request_number;
607: EXCEPTION
608: WHEN NO_DATA_FOUND THEN
609: x_return_status := fnd_api.g_ret_sts_error;
610: RAISE fnd_api.g_exc_error;
611: END;
612:
613: wsh_pr_pick_slip_number.print_pick_slip(
614: p_pick_slip_number => l_pick_slip_number
617: , x_api_status => l_api_return_status
618: , x_error_message => l_api_error_msg
619: );
620:
621: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
622: ROLLBACK TO process_line_pvt;
623: fnd_message.set_name('INV', 'INV_PRINT_PICK_SLIP_FAILED');
624: fnd_message.set_token('PICK_SLIP_NUM', TO_CHAR(l_pick_slip_number));
625: fnd_msg_pub.ADD;
622: ROLLBACK TO process_line_pvt;
623: fnd_message.set_name('INV', 'INV_PRINT_PICK_SLIP_FAILED');
624: fnd_message.set_token('PICK_SLIP_NUM', TO_CHAR(l_pick_slip_number));
625: fnd_msg_pub.ADD;
626: RAISE fnd_api.g_exc_unexpected_error;
627: END IF;
628: END IF;
629: END IF;
630: END LOOP;
629: END IF;
630: END LOOP;
631: END IF; -- p_move_ordeR_header <> -1
632: EXCEPTION
633: WHEN FND_API.G_EXC_ERROR THEN
634: ROLLBACK TO Assign_pick_slip;
635: --
636: x_return_status := FND_API.G_RET_STS_ERROR;
637: --
632: EXCEPTION
633: WHEN FND_API.G_EXC_ERROR THEN
634: ROLLBACK TO Assign_pick_slip;
635: --
636: x_return_status := FND_API.G_RET_STS_ERROR;
637: --
638: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
639: , p_data => x_msg_data);
640: --
637: --
638: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
639: , p_data => x_msg_data);
640: --
641: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
642: ROLLBACK TO Assign_pick_slip;
643: --
644: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
645: --
640: --
641: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
642: ROLLBACK TO Assign_pick_slip;
643: --
644: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
645: --
646: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
647: , p_data => x_msg_data);
648: --
648: --
649: WHEN OTHERS THEN
650: ROLLBACK TO Assign_pick_slip;
651: --
652: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
653: --
654: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
655: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
656: END IF;
957: l_counter NUMBER := 1 ;
958: honor_case_pick_count NUMBER := 0;
959: honor_case_pick VARCHAR2(1) := 'Y';
960: l_label_status VARCHAR2(500);
961: l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
962: v_transaction_id INV_LABEL.transaction_id_rec_type;
963: --Bug 6696594
964:
965: --MUOM Fulfillment Project
1024:
1025: SAVEPOINT Pick_Release_PUB;
1026:
1027: -- Standard Call to check for call compatibility
1028: IF NOT fnd_api.Compatible_API_Call(l_api_version , p_api_version , l_api_name , G_PKG_NAME) THEN
1029: If is_debug then
1030: print_debug('Fnd_APi not compatible','INV_Pick_Release_Pub.Pick_Release');
1031: End If;
1032: RAISE fnd_api.g_exc_unexpected_error;
1026:
1027: -- Standard Call to check for call compatibility
1028: IF NOT fnd_api.Compatible_API_Call(l_api_version , p_api_version , l_api_name , G_PKG_NAME) THEN
1029: If is_debug then
1030: print_debug('Fnd_APi not compatible','INV_Pick_Release_Pub.Pick_Release');
1031: End If;
1032: RAISE fnd_api.g_exc_unexpected_error;
1033: END IF;
1034:
1028: IF NOT fnd_api.Compatible_API_Call(l_api_version , p_api_version , l_api_name , G_PKG_NAME) THEN
1029: If is_debug then
1030: print_debug('Fnd_APi not compatible','INV_Pick_Release_Pub.Pick_Release');
1031: End If;
1032: RAISE fnd_api.g_exc_unexpected_error;
1033: END IF;
1034:
1035: -- Initialize message list if p_init_msg_list is set to true
1036: IF fnd_api.to_Boolean(p_init_msg_list) THEN
1032: RAISE fnd_api.g_exc_unexpected_error;
1033: END IF;
1034:
1035: -- Initialize message list if p_init_msg_list is set to true
1036: IF fnd_api.to_Boolean(p_init_msg_list) THEN
1037: fnd_msg_pub.initialize;
1038: END IF;
1039:
1040: -- Initialize API return status to success
1037: fnd_msg_pub.initialize;
1038: END IF;
1039:
1040: -- Initialize API return status to success
1041: x_return_status := fnd_api.g_ret_sts_success;
1042:
1043:
1044: -- Validate parameters
1045:
1053:
1054: ROLLBACK TO Pick_Release_PUB;
1055: FND_MESSAGE.SET_NAME('INV','INV_NO_LINES_TO_PICK');
1056: FND_MSG_PUB.Add;
1057: RAISE fnd_api.g_exc_unexpected_error;
1058: END IF;
1059:
1060: -- Set move order transaction date if passed in as not NULL
1061: IF p_mo_transact_date <> fnd_api.g_miss_date THEN
1057: RAISE fnd_api.g_exc_unexpected_error;
1058: END IF;
1059:
1060: -- Set move order transaction date if passed in as not NULL
1061: IF p_mo_transact_date <> fnd_api.g_miss_date THEN
1062: inv_cache.mo_transaction_date := p_mo_transact_date;
1063: END IF;
1064:
1065: -- Validate that all move order lines are from the same org, that all lines
1082: END IF;
1083: end if;
1084:
1085: -- only process the valid move order, fix bug 1540709.
1086: IF (l_mo_line.return_status <> FND_API.G_RET_STS_UNEXP_ERROR and
1087: l_mo_line.return_status <> FND_API.G_RET_STS_ERROR) THEN
1088:
1089: -- Verify that the lines are all for the same organization
1090: IF l_mo_line.organization_id <> l_organization_id THEN
1083: end if;
1084:
1085: -- only process the valid move order, fix bug 1540709.
1086: IF (l_mo_line.return_status <> FND_API.G_RET_STS_UNEXP_ERROR and
1087: l_mo_line.return_status <> FND_API.G_RET_STS_ERROR) THEN
1088:
1089: -- Verify that the lines are all for the same organization
1090: IF l_mo_line.organization_id <> l_organization_id THEN
1091: If is_debug then
1094:
1095: ROLLBACK TO Pick_Release_PUB;
1096: FND_MESSAGE.SET_NAME('INV','INV_PICK_DIFFERENT_ORG');
1097: FND_MSG_PUB.Add;
1098: RAISE fnd_api.g_exc_unexpected_error;
1099: END IF;
1100:
1101: -- Verify that the line status is approved or pre-approved
1102: IF (l_mo_line.line_status <> 3 AND l_mo_line.line_status <> 7) THEN
1106:
1107: ROLLBACK TO Pick_Release_PUB;
1108: FND_MESSAGE.SET_NAME('INV','INV_PICK_LINE_STATUS');
1109: FND_MSG_PUB.Add;
1110: RAISE fnd_api.g_exc_unexpected_error;
1111: END IF;
1112:
1113: IF l_mo_line.header_id <> l_current_header_id OR
1114: l_current_header_id IS NULL THEN
1116: If NOT l_return_value Then
1117: If is_debug then
1118: print_debug('Error setting cache for move order header ','INV_Pick_Release_Pub.Pick_Release');
1119: End If;
1120: RAISE fnd_api.g_exc_unexpected_error;
1121: End If;
1122: l_mo_type := INV_CACHE.mtrh_rec.move_order_type;
1123: l_mo_number := INV_CACHE.mtrh_rec.request_number;
1124: l_current_header_id := l_mo_line.header_id;
1132: ROLLBACK TO Pick_Release_PUB;
1133: FND_MESSAGE.SET_NAME('INV','INV_NON_PICK_WAVE_MO');
1134: FND_MESSAGE.SET_TOKEN('MO_NUMBER',l_mo_number);
1135: FND_MSG_PUB.Add;
1136: RAISE fnd_api.g_exc_unexpected_error;
1137: END IF;
1138: l_mol_id_tbl(l_mol_id_index) := l_mo_line.line_id;
1139: l_mol_id_index := l_mol_id_index + 1;
1140: END IF;
1237: ROLLBACK TO Pick_Release_PUB;
1238: If is_debug then
1239: print_debug('No Item Info found','Inv_Pick_Release_Pub.Pick_Release');
1240: End If;
1241: RAISE fnd_api.g_exc_unexpected_error;
1242: END;
1243:
1244: IF l_revision_control_code = 1 THEN
1245: l_revision_controlled := FALSE;
1262:
1263: inv_quantity_tree_pvt.create_tree
1264: (
1265: p_api_version_number => 1.0
1266: ,p_init_msg_lst => fnd_api.g_false
1267: ,x_return_status => l_api_return_status
1268: ,x_msg_count => x_msg_count
1269: ,x_msg_data => x_msg_data
1270: ,p_organization_id => l_organization_id
1291: End If;
1292:
1293: l_qtree_item_tbl(l_item_index).tree_id := l_tree_id;
1294:
1295: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1296: RAISE fnd_api.g_exc_error ;
1297: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1298: RAISE fnd_api.g_exc_unexpected_error;
1299: END IF;
1292:
1293: l_qtree_item_tbl(l_item_index).tree_id := l_tree_id;
1294:
1295: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1296: RAISE fnd_api.g_exc_error ;
1297: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1298: RAISE fnd_api.g_exc_unexpected_error;
1299: END IF;
1300:
1293: l_qtree_item_tbl(l_item_index).tree_id := l_tree_id;
1294:
1295: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1296: RAISE fnd_api.g_exc_error ;
1297: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1298: RAISE fnd_api.g_exc_unexpected_error;
1299: END IF;
1300:
1301: --Bug 2500570.If unable to get delivery detail we should not
1294:
1295: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1296: RAISE fnd_api.g_exc_error ;
1297: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1298: RAISE fnd_api.g_exc_unexpected_error;
1299: END IF;
1300:
1301: --Bug 2500570.If unable to get delivery detail we should not
1302: --error for batch.
1324: End If;
1325: --ROLLBACK TO Pick_Release_PUB;
1326: --FND_MESSAGE.SET_NAME('INV','INV_DELIV_INFO_MISSING');
1327: -- FND_MSG_PUB.Add;
1328: -- RAISE fnd_api.g_exc_unexpected_error;
1329: END;
1330:
1331: l_return_value := INV_CACHE.set_mso_rec(l_oe_header_id);
1332: IF NOT l_return_value THEN
1355:
1356: inv_quantity_tree_pvt.create_tree
1357: (
1358: p_api_version_number => 1.0
1359: ,p_init_msg_lst => fnd_api.g_false
1360: ,x_return_status => l_api_return_status
1361: ,x_msg_count => x_msg_count
1362: ,x_msg_data => x_msg_data
1363: ,p_organization_id => l_organization_id
1383: End If;
1384:
1385: l_qtree_line_tbl(l_qtree_line_index).tree_id := l_tree_id;
1386:
1387: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1388: If is_debug then
1389: print_debug('Error from Create tree','Inv_pick_release_pub.Pick_release');
1390: End If;
1391: RAISE fnd_api.g_exc_error ;
1387: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1388: If is_debug then
1389: print_debug('Error from Create tree','Inv_pick_release_pub.Pick_release');
1390: End If;
1391: RAISE fnd_api.g_exc_error ;
1392: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1393: If is_debug then
1394: print_debug('Unexpected error from Create tree','Inv_pick_release_pub.Pick_release');
1395: End If;
1388: If is_debug then
1389: print_debug('Error from Create tree','Inv_pick_release_pub.Pick_release');
1390: End If;
1391: RAISE fnd_api.g_exc_error ;
1392: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1393: If is_debug then
1394: print_debug('Unexpected error from Create tree','Inv_pick_release_pub.Pick_release');
1395: End If;
1396: RAISE fnd_api.g_exc_unexpected_error;
1392: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1393: If is_debug then
1394: print_debug('Unexpected error from Create tree','Inv_pick_release_pub.Pick_release');
1395: End If;
1396: RAISE fnd_api.g_exc_unexpected_error;
1397: END IF;
1398:
1399: l_qtree_line_index :=
1400: l_qtree_line_tbl(l_qtree_line_index).next_line_rec;
1414: If NOT l_return_value Then
1415: If is_debug then
1416: print_debug('Error setting cache for wms installed','INV_Pick_Release_Pub.Pick_Release');
1417: End If;
1418: RAISE fnd_api.g_exc_unexpected_error;
1419: End If;
1420: l_wms_installed := INV_CACHE.wms_installed;
1421: --sort only necessary if wms installed and multiple headers in the
1422: -- line_tbl
1432: End If;
1433: ROLLBACK TO Pick_Release_PUB;
1434: FND_MESSAGE.SET_NAME('INV','INV_AUTO_PICK_CONFIRM_PARAM');
1435: FND_MSG_PUB.Add;
1436: RAISE fnd_api.g_exc_unexpected_error;
1437: ELSE
1438: l_auto_pick_confirm := p_auto_pick_confirm;
1439: END IF;
1440: ELSE
1444: If is_debug then
1445: print_debug('Error setting cache for organization',
1446: 'INV_Pick_Release_Pub.Pick_Release');
1447: End If;
1448: RAISE fnd_api.g_exc_unexpected_error;
1449: End If;
1450: l_auto_pick_confirm:= INV_CACHE.org_rec.mo_pick_confirm_required;
1451: END IF;
1452:
1470: End If;
1471: ROLLBACK TO Pick_Release_PUB;
1472: FND_MESSAGE.SET_NAME('INV','INV_WSH_ORG_NOT_FOUND');
1473: FND_MSG_PUB.Add;
1474: RAISE fnd_api.g_exc_unexpected_error;
1475: END;
1476:
1477: g_organization_id := l_organization_id;
1478: g_print_mode := l_print_mode;
1478: g_print_mode := l_print_mode;
1479: END IF;
1480:
1481: -- Validate parameter for allowing partial pick release
1482: IF p_allow_partial_pick <> fnd_api.g_true AND
1483: p_allow_partial_pick <> fnd_api.g_false THEN
1484:
1485: If is_debug then
1486: print_debug('Error: invalid partial pick parameter','INV_Pick_Release_Pub.Pick_Release');
1479: END IF;
1480:
1481: -- Validate parameter for allowing partial pick release
1482: IF p_allow_partial_pick <> fnd_api.g_true AND
1483: p_allow_partial_pick <> fnd_api.g_false THEN
1484:
1485: If is_debug then
1486: print_debug('Error: invalid partial pick parameter','INV_Pick_Release_Pub.Pick_Release');
1487: End If;
1487: End If;
1488: ROLLBACK TO Pick_Release_PUB;
1489: FND_MESSAGE.SET_NAME('INV','INV_INVALID_PARTIAL_PICK_PARAM');
1490: FND_MSG_PUB.Add;
1491: RAISE fnd_api.g_exc_unexpected_error;
1492: END IF;
1493:
1494: If is_debug then
1495: print_debug('p_allow_partial_pick is ' || p_allow_partial_pick,'Inv_Pick_Release_Pub.Pick_Release');
1497:
1498: -- The Move Order Lines may need to have their grouping rule ID defaulted
1499: -- from the header. This is only necessary if the Grouping Rule ID was not
1500: -- passed in as a parameter.
1501: IF p_grouping_rule_id IS NOT NULL AND p_grouping_rule_id <> fnd_api.G_MISS_NUM THEN
1502: l_grouping_rule_id := p_grouping_rule_id;
1503: l_get_header_rule := 2;
1504: ELSE
1505: l_get_header_rule := 1;
1521: p_request_number => INV_CACHE.mtrh_rec.request_number)) THEN
1522: IF (is_debug) THEN
1523: print_debug('Error setting cache for WSH picking batch record','INV_Pick_Release_Pub.Pick_Release');
1524: END IF;
1525: RAISE fnd_api.g_exc_unexpected_error;
1526: END IF;
1527: -- Set the allocation method variable
1528: l_allocation_method := NVL(INV_CACHE.wpb_rec.allocation_method, g_inventory_only);
1529:
1535: IF (p_del_detail_id.COUNT <> p_trolin_delivery_ids.COUNT) THEN
1536: IF (is_debug) THEN
1537: print_debug('Mismatch in size of input tables from Shipping for delivery creation','INV_Pick_Release_Pub.Pick_Release');
1538: END IF;
1539: RAISE fnd_api.g_exc_unexpected_error;
1540: END IF;
1541:
1542: -- Bug# 4258360: Loop through p_wsh_release_table to build the index pointer table to it.
1543: -- Do this only if p_wsh_release_table has entries in it. Crossdocking will be called after
1582:
1583: wms_wave_planning_pvt.update_wave_lines_tbl( p_mo_line_table => l_mo_line_tbl
1584: ,x_return_status => l_return_status);
1585:
1586: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
1587: IF (l_debug = 1) THEN
1588: print_debug('After calling the update_wave_lines_tbl which has returned error - Still Continue with rest of Pick Release','Inv_Pick_Release_Pub.Pick_Release');
1589: END IF;
1590: END IF;
1600: l_organization_id := l_mo_line.organization_id;
1601: LOOP
1602: l_mo_line := l_mo_line_tbl(l_line_index);
1603: -- only process the valid move order, fix bug 1540709.
1604: IF (l_mo_line.return_status <> FND_API.G_RET_STS_UNEXP_ERROR and
1605: l_mo_line.return_status <> FND_API.G_RET_STS_ERROR) THEN
1606: -- First retrieve the new Grouping Rule ID if necessary.
1607: IF l_get_header_rule = 1 THEN
1608: l_return_value := INV_CACHE.set_mtrh_rec(l_mo_line.header_id);
1601: LOOP
1602: l_mo_line := l_mo_line_tbl(l_line_index);
1603: -- only process the valid move order, fix bug 1540709.
1604: IF (l_mo_line.return_status <> FND_API.G_RET_STS_UNEXP_ERROR and
1605: l_mo_line.return_status <> FND_API.G_RET_STS_ERROR) THEN
1606: -- First retrieve the new Grouping Rule ID if necessary.
1607: IF l_get_header_rule = 1 THEN
1608: l_return_value := INV_CACHE.set_mtrh_rec(l_mo_line.header_id);
1609: If NOT l_return_value Then
1610: If is_debug then
1611: print_debug('Error setting cache for move order header ',
1612: 'INV_Pick_Release_Pub.Pick_Release');
1613: End If;
1614: RAISE fnd_api.g_exc_unexpected_error;
1615: End If;
1616: l_grouping_rule_id := INV_CACHE.mtrh_rec.grouping_rule_id;
1617:
1618: -- If the header did not have a grouping rule ID, retrieve it from
1638: End If;
1639: ROLLBACK TO Pick_Release_PUB;
1640: FND_MESSAGE.SET_NAME('INV','INV-NO ORG INFORMATION');
1641: FND_MSG_PUB.Add;
1642: RAISE fnd_api.g_exc_unexpected_error;
1643: END;
1644:
1645: If g_organization_id IS NULL Or
1646: g_organization_id <> l_organization_id Then
1684: l_mo_line.ship_model_id <>l_cur_ship_model_id then
1685: Backorder_SMC_DETAILS(l_api_return_status ,
1686: x_msg_data ,
1687: x_msg_count ) ;
1688: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1689: RAISE fnd_api.g_exc_error ;
1690: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1691: RAISE fnd_api.g_exc_unexpected_error;
1692: END IF;
1685: Backorder_SMC_DETAILS(l_api_return_status ,
1686: x_msg_data ,
1687: x_msg_count ) ;
1688: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1689: RAISE fnd_api.g_exc_error ;
1690: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1691: RAISE fnd_api.g_exc_unexpected_error;
1692: END IF;
1693: END IF;
1686: x_msg_data ,
1687: x_msg_count ) ;
1688: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1689: RAISE fnd_api.g_exc_error ;
1690: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1691: RAISE fnd_api.g_exc_unexpected_error;
1692: END IF;
1693: END IF;
1694:
1687: x_msg_count ) ;
1688: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1689: RAISE fnd_api.g_exc_error ;
1690: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1691: RAISE fnd_api.g_exc_unexpected_error;
1692: END IF;
1693: END IF;
1694:
1695: IF l_mo_line.ship_model_id IS NOT NULL AND
1740: ,p_tree_id => l_tree_id
1741: ,x_backup_id => l_backup_id
1742: );
1743:
1744: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1745: RAISE fnd_api.g_exc_error ;
1746: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1747: RAISE fnd_api.g_exc_unexpected_error;
1748: END IF;
1741: ,x_backup_id => l_backup_id
1742: );
1743:
1744: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1745: RAISE fnd_api.g_exc_error ;
1746: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1747: RAISE fnd_api.g_exc_unexpected_error;
1748: END IF;
1749: End If;
1742: );
1743:
1744: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1745: RAISE fnd_api.g_exc_error ;
1746: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1747: RAISE fnd_api.g_exc_unexpected_error;
1748: END IF;
1749: End If;
1750:
1743:
1744: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
1745: RAISE fnd_api.g_exc_error ;
1746: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
1747: RAISE fnd_api.g_exc_unexpected_error;
1748: END IF;
1749: End If;
1750:
1751: --Bug 2814919
1789: End If;
1790:
1791: INV_Pick_Release_PVT.Process_Line(
1792: p_api_version => 1.0
1793: ,p_init_msg_list => fnd_api.g_false
1794: ,p_commit => fnd_api.g_false
1795: ,x_return_status => l_api_return_status
1796: ,x_msg_count => x_msg_count
1797: ,x_msg_data => x_msg_data
1790:
1791: INV_Pick_Release_PVT.Process_Line(
1792: p_api_version => 1.0
1793: ,p_init_msg_list => fnd_api.g_false
1794: ,p_commit => fnd_api.g_false
1795: ,x_return_status => l_api_return_status
1796: ,x_msg_count => x_msg_count
1797: ,x_msg_data => x_msg_data
1798: ,p_mo_line_rec => l_mo_line
1806: If is_debug then
1807: print_debug('l_return_status from process_line is '|| l_api_return_status, 'Inv_Pick_Release_Pub.Pick_Release');
1808: End If;
1809:
1810: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
1811: -- Return error if Process_Line returns error and
1812: -- allow_partial_pick is false, since we can't pick full quantity
1813: IF p_allow_partial_pick = fnd_api.g_false THEN
1814: x_pick_release_status.delete;
1809:
1810: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
1811: -- Return error if Process_Line returns error and
1812: -- allow_partial_pick is false, since we can't pick full quantity
1813: IF p_allow_partial_pick = fnd_api.g_false THEN
1814: x_pick_release_status.delete;
1815: ROLLBACK TO Pick_Release_PUB;
1816: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_PICK_FULL');
1817: FND_MSG_PUB.Add;
1814: x_pick_release_status.delete;
1815: ROLLBACK TO Pick_Release_PUB;
1816: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_PICK_FULL');
1817: FND_MSG_PUB.Add;
1818: RAISE fnd_api.g_exc_unexpected_error;
1819: END IF;
1820: END IF;
1821:
1822: l_quantity := l_mo_line.quantity;
1926:
1927: wsh_integration.ins_backorder_ss_smc_rec
1928: (p_api_version_number => 1.0,
1929: p_source_code => 'INV',
1930: p_init_msg_list => fnd_api.g_false,
1931: p_backorder_rec => l_shipset_smc_backorder_rec,
1932: x_return_status => l_api_return_status,
1933: x_msg_count => x_msg_count,
1934: x_msg_data => x_msg_data);
1932: x_return_status => l_api_return_status,
1933: x_msg_count => x_msg_count,
1934: x_msg_data => x_msg_data);
1935:
1936: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
1937: If is_debug then
1938: print_debug('Error occured while updating shipping for ' ||
1939: 'failed ship set','Inv_Pick_Release_Pub.Pick_Release');
1940: print_debug('l_return_status' || l_api_return_status,
1994: ,p_tree_id => l_tree_id
1995: ,p_backup_id => l_qtree_backup_tbl(l_tree_id)
1996: );
1997:
1998: if( l_api_return_status = FND_API.G_RET_STS_ERROR ) then
1999: If is_debug then
2000: print_debug('Error in Restore_Tree',
2001: 'Inv_Pick_Release_Pub.Pick_Release');
2002: End If;
1999: If is_debug then
2000: print_debug('Error in Restore_Tree',
2001: 'Inv_Pick_Release_Pub.Pick_Release');
2002: End If;
2003: raise FND_API.G_EXC_ERROR;
2004: elsif l_api_return_status=FND_API.G_RET_STS_UNEXP_ERROR then
2005: If is_debug then
2006: print_debug('Unexpected error in Restore_tree',
2007: 'Inv_Pick_Release_Pub.Pick_Release');
2000: print_debug('Error in Restore_Tree',
2001: 'Inv_Pick_Release_Pub.Pick_Release');
2002: End If;
2003: raise FND_API.G_EXC_ERROR;
2004: elsif l_api_return_status=FND_API.G_RET_STS_UNEXP_ERROR then
2005: If is_debug then
2006: print_debug('Unexpected error in Restore_tree',
2007: 'Inv_Pick_Release_Pub.Pick_Release');
2008: End If;
2005: If is_debug then
2006: print_debug('Unexpected error in Restore_tree',
2007: 'Inv_Pick_Release_Pub.Pick_Release');
2008: End If;
2009: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2010: end if;
2011:
2012: --delete entry, so we don't restore tree more than once
2013: l_qtree_backup_tbl.DELETE(l_tree_id);
2024: If is_debug then
2025: print_debug('Error setting cache for delivery line',
2026: 'INV_Pick_Release_Pub.Pick_Release');
2027: End If;
2028: RAISE fnd_api.g_exc_unexpected_error;
2029: End If;
2030: l_delivery_detail_id := INV_CACHE.wdd_rec.delivery_detail_id;
2031: l_source_header_id := INV_CACHE.wdd_rec.source_header_id;
2032: l_source_line_id := INV_CACHE.wdd_rec.source_line_id;
2051: (p_source_code => 'INV',
2052: p_changed_attributes => l_shipping_attr,
2053: x_return_status => l_api_return_status
2054: );
2055: if( l_api_return_status = FND_API.G_RET_STS_ERROR ) then
2056: If is_debug then
2057: print_debug('return error from update shipping attributes',
2058: 'Inv_Pick_Release_Pub.Pick_Release');
2059: End If;
2056: If is_debug then
2057: print_debug('return error from update shipping attributes',
2058: 'Inv_Pick_Release_Pub.Pick_Release');
2059: End If;
2060: raise FND_API.G_EXC_ERROR;
2061: elsif l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
2062: If is_debug then
2063: print_debug('return error from update shipping attributes',
2064: 'Inv_Pick_Release_Pub.Pick_Release');
2057: print_debug('return error from update shipping attributes',
2058: 'Inv_Pick_Release_Pub.Pick_Release');
2059: End If;
2060: raise FND_API.G_EXC_ERROR;
2061: elsif l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
2062: If is_debug then
2063: print_debug('return error from update shipping attributes',
2064: 'Inv_Pick_Release_Pub.Pick_Release');
2065: End If;
2062: If is_debug then
2063: print_debug('return error from update shipping attributes',
2064: 'Inv_Pick_Release_Pub.Pick_Release');
2065: End If;
2066: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2067: end if;
2068:
2069: --close the move order line
2070: -- HW INVCONV Update Qty2
2070: -- HW INVCONV Update Qty2
2071: update mtl_txn_request_lines
2072: set quantity = 0
2073: ,quantity_detailed = 0
2074: ,secondary_quantity = decode(secondary_quantity,fnd_api.g_miss_num, NULL, 0)
2075: ,secondary_quantity_detailed = decode(secondary_quantity_detailed,fnd_api.g_miss_num, NULL, 0)
2076: ,line_status = 5
2077: ,status_date =sysdate --BUG 7560455
2078: where line_id = l_mo_line.line_id;
2071: update mtl_txn_request_lines
2072: set quantity = 0
2073: ,quantity_detailed = 0
2074: ,secondary_quantity = decode(secondary_quantity,fnd_api.g_miss_num, NULL, 0)
2075: ,secondary_quantity_detailed = decode(secondary_quantity_detailed,fnd_api.g_miss_num, NULL, 0)
2076: ,line_status = 5
2077: ,status_date =sysdate --BUG 7560455
2078: where line_id = l_mo_line.line_id;
2079:
2148:
2149: wsh_integration.ins_backorder_ss_smc_rec
2150: (p_api_version_number => 1.0,
2151: p_source_code => 'INV',
2152: p_init_msg_list => fnd_api.g_false,
2153: p_backorder_rec => l_shipset_smc_backorder_rec,
2154: x_return_status => l_api_return_status,
2155: x_msg_count => x_msg_count,
2156: x_msg_data => x_msg_data);
2154: x_return_status => l_api_return_status,
2155: x_msg_count => x_msg_count,
2156: x_msg_data => x_msg_data);
2157:
2158: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
2159: If is_debug then
2160: print_debug('Error occured while updating shipping for ' ||
2161: 'failed ship set',
2162: 'Inv_Pick_Release_Pub.Pick_Release');
2205: End If;
2206: ROLLBACK TO Pick_Release_PUB;
2207: FND_MESSAGE.SET_NAME('INV','INV_DELIV_INFO_MISSING');
2208: FND_MSG_PUB.Add;
2209: RAISE fnd_api.g_exc_unexpected_error;
2210: END;
2211:
2212: -- convert to primary UOM
2213: IF l_txn_source_line_uom <>
2275: (x_return_status => l_api_return_status
2276: ,p_tree_id => l_tree_id
2277: ,p_backup_id => l_qtree_backup_tbl(l_tree_id)
2278: );
2279: if( l_api_return_status = FND_API.G_RET_STS_ERROR ) then
2280: If is_debug then
2281: print_debug('Error in Restore_Tree',
2282: 'Inv_Pick_Release_Pub.Pick_Release');
2283: End If;
2280: If is_debug then
2281: print_debug('Error in Restore_Tree',
2282: 'Inv_Pick_Release_Pub.Pick_Release');
2283: End If;
2284: raise FND_API.G_EXC_ERROR;
2285: elsif l_api_return_status=FND_API.G_RET_STS_UNEXP_ERROR then
2286: If is_debug then
2287: print_debug('Unexpected error in Restore_tree',
2288: 'Inv_Pick_Release_Pub.Pick_Release');
2281: print_debug('Error in Restore_Tree',
2282: 'Inv_Pick_Release_Pub.Pick_Release');
2283: End If;
2284: raise FND_API.G_EXC_ERROR;
2285: elsif l_api_return_status=FND_API.G_RET_STS_UNEXP_ERROR then
2286: If is_debug then
2287: print_debug('Unexpected error in Restore_tree',
2288: 'Inv_Pick_Release_Pub.Pick_Release');
2289: End If;
2286: If is_debug then
2287: print_debug('Unexpected error in Restore_tree',
2288: 'Inv_Pick_Release_Pub.Pick_Release');
2289: End If;
2290: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2291: end if;
2292:
2293: --delete entry, so we don't restore tree more than once
2294: l_qtree_backup_tbl.DELETE(l_tree_id);
2326: End If;
2327: ROLLBACK TO Pick_Release_PUB;
2328: FND_MESSAGE.SET_NAME('INV','INV_DELIV_INFO_MISSING');
2329: FND_MSG_PUB.Add;
2330: RAISE fnd_api.g_exc_unexpected_error;
2331: END;
2332:
2333: --convert to primary quantity
2334: if l_txn_source_line_uom <>
2380: If is_debug then
2381: print_debug('Error setting cache for delivery line',
2382: 'INV_Pick_Release_Pub.Pick_Release');
2383: End If;
2384: RAISE fnd_api.g_exc_unexpected_error;
2385: End If;
2386: l_delivery_detail_id := INV_CACHE.wdd_rec.delivery_detail_id;
2387: l_source_header_id := INV_CACHE.wdd_rec.source_header_id;
2388: l_source_line_id := INV_CACHE.wdd_rec.source_line_id;
2408: -- and do only once.
2409:
2410: Store_smc_bo_details(x_return_status => l_api_return_status,
2411: back_order_det_tbl =>l_smc_backorder_det_tbl);
2412: if( l_api_return_status = FND_API.G_RET_STS_ERROR ) then
2413: If is_debug then
2414: print_debug(' return error E from Store_smc_bo_details',
2415: 'Inv_Pick_Release_Pub.Pick_Release');
2416: End If;
2414: print_debug(' return error E from Store_smc_bo_details',
2415: 'Inv_Pick_Release_Pub.Pick_Release');
2416: End If;
2417: l_smc_backorder_det_tbl.DELETE;
2418: raise FND_API.G_EXC_ERROR;
2419: elsif l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
2420: If is_debug then
2421: print_debug(' return error U from Store_smc_bo_details',
2422: 'Inv_Pick_Release_Pub.Pick_Release');
2415: 'Inv_Pick_Release_Pub.Pick_Release');
2416: End If;
2417: l_smc_backorder_det_tbl.DELETE;
2418: raise FND_API.G_EXC_ERROR;
2419: elsif l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
2420: If is_debug then
2421: print_debug(' return error U from Store_smc_bo_details',
2422: 'Inv_Pick_Release_Pub.Pick_Release');
2423: End If;
2421: print_debug(' return error U from Store_smc_bo_details',
2422: 'Inv_Pick_Release_Pub.Pick_Release');
2423: End If;
2424: l_smc_backorder_det_tbl.DELETE;
2425: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2426: end if;
2427:
2428: l_smc_backorder_det_tbl.DELETE;
2429:
2536: Backorder_SMC_DETAILS(l_api_return_status ,
2537: x_msg_data ,
2538: x_msg_count
2539: );
2540: if( l_api_return_status = FND_API.G_RET_STS_ERROR ) then
2541: If is_debug then
2542: print_debug('return error E from Backorder_SMC_DETAILS',
2543: 'Inv_Pick_Release_Pub.Pick_Release');
2544: End If;
2541: If is_debug then
2542: print_debug('return error E from Backorder_SMC_DETAILS',
2543: 'Inv_Pick_Release_Pub.Pick_Release');
2544: End If;
2545: raise FND_API.G_EXC_ERROR;
2546: elsif l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
2547: If is_debug then
2548: print_debug('return error U from Backorder_SMC_DETAILS',
2549: 'Inv_Pick_Release_Pub.Pick_Release');
2542: print_debug('return error E from Backorder_SMC_DETAILS',
2543: 'Inv_Pick_Release_Pub.Pick_Release');
2544: End If;
2545: raise FND_API.G_EXC_ERROR;
2546: elsif l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
2547: If is_debug then
2548: print_debug('return error U from Backorder_SMC_DETAILS',
2549: 'Inv_Pick_Release_Pub.Pick_Release');
2550: End If;
2547: If is_debug then
2548: print_debug('return error U from Backorder_SMC_DETAILS',
2549: 'Inv_Pick_Release_Pub.Pick_Release');
2550: End If;
2551: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2552: end if;
2553:
2554: ELSE
2555:
2594: IF (is_debug) THEN
2595: print_debug('Error setting cache for delivery line',
2596: 'INV_Pick_Release_Pub.Pick_Release');
2597: END IF;
2598: RAISE fnd_api.g_exc_unexpected_error;
2599: END IF;
2600: l_delivery_detail_id := INV_CACHE.wdd_rec.delivery_detail_id;
2601: l_source_header_id := INV_CACHE.wdd_rec.source_header_id;
2602: l_source_line_id := INV_CACHE.wdd_rec.source_line_id;
2656: -- When calling the Shipping package WSH_INTERFACE_EXT_GRP instead of
2657: -- WSH_INTERFACE_GRP, we have to pass a G_MISS_NUM value instead of NULL
2658: -- in order to properly NULL out the move_order_line_id value.
2659:
2660: l_detail_info_tab(1).move_order_line_id := fnd_api.g_miss_num;
2661:
2662: -- Caller needs to be WMS_XDOCK% in order for shipping to allow this action
2663: l_in_rec.caller := 'WMS_XDOCK.INVPPICB';
2664: l_in_rec.action_code := 'UPDATE';
2666: END IF;
2667:
2668: WSH_INTERFACE_EXT_GRP.Create_Update_Delivery_Detail
2669: (p_api_version_number => 1.0,
2670: p_init_msg_list => fnd_api.g_false,
2671: p_commit => fnd_api.g_false,
2672: x_return_status => l_api_return_status,
2673: x_msg_count => x_msg_count,
2674: x_msg_data => x_msg_data,
2667:
2668: WSH_INTERFACE_EXT_GRP.Create_Update_Delivery_Detail
2669: (p_api_version_number => 1.0,
2670: p_init_msg_list => fnd_api.g_false,
2671: p_commit => fnd_api.g_false,
2672: x_return_status => l_api_return_status,
2673: x_msg_count => x_msg_count,
2674: x_msg_data => x_msg_data,
2675: p_detail_info_tab => l_detail_info_tab,
2676: p_in_rec => l_in_rec,
2677: x_out_rec => l_out_rec
2678: );
2679:
2680: IF (l_api_return_status = FND_API.G_RET_STS_ERROR) THEN
2681: IF (is_debug) THEN
2682: print_debug('Error returned from Create_Update_Delivery_Detail API',
2683: 'Inv_Pick_Release_Pub.Pick_Release');
2684: END IF;
2681: IF (is_debug) THEN
2682: print_debug('Error returned from Create_Update_Delivery_Detail API',
2683: 'Inv_Pick_Release_Pub.Pick_Release');
2684: END IF;
2685: RAISE FND_API.G_EXC_ERROR;
2686: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2687: IF (is_debug) THEN
2688: print_debug('Unexpected errror from Create_Update_Delivery_Detail API',
2689: 'Inv_Pick_Release_Pub.Pick_Release');
2682: print_debug('Error returned from Create_Update_Delivery_Detail API',
2683: 'Inv_Pick_Release_Pub.Pick_Release');
2684: END IF;
2685: RAISE FND_API.G_EXC_ERROR;
2686: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2687: IF (is_debug) THEN
2688: print_debug('Unexpected errror from Create_Update_Delivery_Detail API',
2689: 'Inv_Pick_Release_Pub.Pick_Release');
2690: END IF;
2687: IF (is_debug) THEN
2688: print_debug('Unexpected errror from Create_Update_Delivery_Detail API',
2689: 'Inv_Pick_Release_Pub.Pick_Release');
2690: END IF;
2691: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2692: END IF;
2693:
2694: ELSE -- means (l_transaction_quantity <> 0)
2695: -- Move order line is partially allocated
2706: (l_quantity2 - NVL(l_quantity2_delivered,0)) - l_transaction_quantity2;
2707:
2708: WSH_INTERFACE_GRP.Delivery_Detail_Action
2709: (p_api_version_number => 1.0,
2710: p_init_msg_list => fnd_api.g_false,
2711: p_commit => fnd_api.g_false,
2712: x_return_status => l_api_return_status,
2713: x_msg_count => x_msg_count,
2714: x_msg_data => x_msg_data,
2707:
2708: WSH_INTERFACE_GRP.Delivery_Detail_Action
2709: (p_api_version_number => 1.0,
2710: p_init_msg_list => fnd_api.g_false,
2711: p_commit => fnd_api.g_false,
2712: x_return_status => l_api_return_status,
2713: x_msg_count => x_msg_count,
2714: x_msg_data => x_msg_data,
2715: p_detail_id_tab => l_detail_id_tab,
2716: p_action_prms => l_action_prms,
2717: x_action_out_rec => l_action_out_rec
2718: );
2719:
2720: IF (l_api_return_status = FND_API.G_RET_STS_ERROR) THEN
2721: IF (is_debug) THEN
2722: print_debug('Error returned from Split Delivery_Detail_Action API',
2723: 'Inv_Pick_Release_Pub.Pick_Release');
2724: END IF;
2721: IF (is_debug) THEN
2722: print_debug('Error returned from Split Delivery_Detail_Action API',
2723: 'Inv_Pick_Release_Pub.Pick_Release');
2724: END IF;
2725: RAISE FND_API.G_EXC_ERROR;
2726: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2727: IF (is_debug) THEN
2728: print_debug('Unexpected errror from Split Delivery_Detail_Action API',
2729: 'Inv_Pick_Release_Pub.Pick_Release');
2722: print_debug('Error returned from Split Delivery_Detail_Action API',
2723: 'Inv_Pick_Release_Pub.Pick_Release');
2724: END IF;
2725: RAISE FND_API.G_EXC_ERROR;
2726: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2727: IF (is_debug) THEN
2728: print_debug('Unexpected errror from Split Delivery_Detail_Action API',
2729: 'Inv_Pick_Release_Pub.Pick_Release');
2730: END IF;
2727: IF (is_debug) THEN
2728: print_debug('Unexpected errror from Split Delivery_Detail_Action API',
2729: 'Inv_Pick_Release_Pub.Pick_Release');
2730: END IF;
2731: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2732: END IF;
2733:
2734: l_xdock_index := l_action_out_rec.result_id_tab.FIRST;
2735: l_split_delivery_detail_id := l_action_out_rec.result_id_tab(l_xdock_index);
2743: -- When calling the Shipping package WSH_INTERFACE_EXT_GRP instead of
2744: -- WSH_INTERFACE_GRP, we have to pass a G_MISS_NUM value instead of NULL
2745: -- in order to properly NULL out the move_order_line_id value.
2746: --l_detail_info_tab(1).move_order_line_id := NULL;
2747: l_detail_info_tab(1).move_order_line_id := fnd_api.g_miss_num;
2748:
2749:
2750: IF NVL(p_dynamic_replenishment,'N') = 'Y' THEN
2751: IF (is_debug) THEN
2763: l_in_rec.action_code := 'UPDATE';
2764:
2765: WSH_INTERFACE_EXT_GRP.Create_Update_Delivery_Detail
2766: (p_api_version_number => 1.0,
2767: p_init_msg_list => fnd_api.g_false,
2768: p_commit => fnd_api.g_false,
2769: x_return_status => l_api_return_status,
2770: x_msg_count => x_msg_count,
2771: x_msg_data => x_msg_data,
2764:
2765: WSH_INTERFACE_EXT_GRP.Create_Update_Delivery_Detail
2766: (p_api_version_number => 1.0,
2767: p_init_msg_list => fnd_api.g_false,
2768: p_commit => fnd_api.g_false,
2769: x_return_status => l_api_return_status,
2770: x_msg_count => x_msg_count,
2771: x_msg_data => x_msg_data,
2772: p_detail_info_tab => l_detail_info_tab,
2773: p_in_rec => l_in_rec,
2774: x_out_rec => l_out_rec
2775: );
2776:
2777: IF (l_api_return_status = FND_API.G_RET_STS_ERROR) THEN
2778: IF (is_debug) THEN
2779: print_debug('Error returned from Create_Update_Delivery_Detail API',
2780: 'Inv_Pick_Release_Pub.Pick_Release');
2781: END IF;
2778: IF (is_debug) THEN
2779: print_debug('Error returned from Create_Update_Delivery_Detail API',
2780: 'Inv_Pick_Release_Pub.Pick_Release');
2781: END IF;
2782: RAISE FND_API.G_EXC_ERROR;
2783: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2784: IF (is_debug) THEN
2785: print_debug('Unexpected errror from Create_Update_Delivery_Detail API',
2786: 'Inv_Pick_Release_Pub.Pick_Release');
2779: print_debug('Error returned from Create_Update_Delivery_Detail API',
2780: 'Inv_Pick_Release_Pub.Pick_Release');
2781: END IF;
2782: RAISE FND_API.G_EXC_ERROR;
2783: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2784: IF (is_debug) THEN
2785: print_debug('Unexpected errror from Create_Update_Delivery_Detail API',
2786: 'Inv_Pick_Release_Pub.Pick_Release');
2787: END IF;
2784: IF (is_debug) THEN
2785: print_debug('Unexpected errror from Create_Update_Delivery_Detail API',
2786: 'Inv_Pick_Release_Pub.Pick_Release');
2787: END IF;
2788: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2789: END IF;
2790:
2791: -- Insert the split WDD line into p_wsh_release_table.
2792: -- The split WDD release record should be the same as the original one with
2898: (p_source_code => 'INV',
2899: p_changed_attributes => l_shipping_attr,
2900: x_return_status => l_api_return_status
2901: );
2902: IF (l_api_return_status = FND_API.G_RET_STS_ERROR) THEN
2903: IF is_debug THEN
2904: print_debug('return error from update shipping attributes',
2905: 'Inv_Pick_Release_Pub.Pick_Release');
2906: END IF;
2903: IF is_debug THEN
2904: print_debug('return error from update shipping attributes',
2905: 'Inv_Pick_Release_Pub.Pick_Release');
2906: END IF;
2907: RAISE FND_API.G_EXC_ERROR;
2908: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2909: IF is_debug THEN
2910: print_debug('return error from update shipping attributes',
2911: 'Inv_Pick_Release_Pub.Pick_Release');
2904: print_debug('return error from update shipping attributes',
2905: 'Inv_Pick_Release_Pub.Pick_Release');
2906: END IF;
2907: RAISE FND_API.G_EXC_ERROR;
2908: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
2909: IF is_debug THEN
2910: print_debug('return error from update shipping attributes',
2911: 'Inv_Pick_Release_Pub.Pick_Release');
2912: END IF;
2909: IF is_debug THEN
2910: print_debug('return error from update shipping attributes',
2911: 'Inv_Pick_Release_Pub.Pick_Release');
2912: END IF;
2913: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2914: END IF;
2915: END IF; -- for IF (l_allocation_method = g_prioritize_inventory) AND (p_wsh...
2916:
2917: -- HW INVCONV Added secondary_quantity
2922: UPDATE mtl_txn_request_lines
2923: SET line_status = 5,
2924: status_date =sysdate, --BUG 7560455
2925: quantity = l_transaction_quantity,
2926: secondary_quantity = DECODE(secondary_quantity, fnd_api.g_miss_num, NULL,
2927: l_transaction_quantity2)
2928: WHERE line_id = l_mo_line.line_id;
2929:
2930: -- Bug# 4258360: For allocation modes of I (Inventory Only) or
2947: --The uom is always primary uom setting it to quantity value.
2948: -- Update the move order line to the partial quantity that was allocated
2949: UPDATE mtl_txn_request_lines
2950: SET quantity = l_transaction_quantity,
2951: secondary_quantity = DECODE(secondary_quantity, fnd_api.g_miss_num, NULL,
2952: l_transaction_quantity2)
2953: ,primary_quantity=l_transaction_quantity
2954: WHERE line_id = l_mo_line.line_id;
2955: END IF;
2972: IF (is_debug) THEN
2973: print_debug('Error setting cache for WDD delivery line',
2974: 'INV_Pick_Release_Pub.Pick_Release');
2975: END IF;
2976: RAISE fnd_api.g_exc_unexpected_error;
2977: END IF;
2978: l_delivery_detail_id := INV_CACHE.wdd_rec.delivery_detail_id;
2979:
2980: -- Update WDD record in release table with a released status of 'S'
3015: END IF;
3016: l_detail_rec_count := 0;
3017: --Update the Pick Release API's return status to an error if the line could
3018: -- not be processed. Note that processing of other lines will continue.
3019: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3020: l_api_return_status = fnd_api.g_ret_sts_error THEN
3021: x_return_status := fnd_api.g_ret_sts_error;
3022: END IF;
3023: END IF; -- mo line return status <> ERROR
3016: l_detail_rec_count := 0;
3017: --Update the Pick Release API's return status to an error if the line could
3018: -- not be processed. Note that processing of other lines will continue.
3019: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3020: l_api_return_status = fnd_api.g_ret_sts_error THEN
3021: x_return_status := fnd_api.g_ret_sts_error;
3022: END IF;
3023: END IF; -- mo line return status <> ERROR
3024:
3017: --Update the Pick Release API's return status to an error if the line could
3018: -- not be processed. Note that processing of other lines will continue.
3019: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3020: l_api_return_status = fnd_api.g_ret_sts_error THEN
3021: x_return_status := fnd_api.g_ret_sts_error;
3022: END IF;
3023: END IF; -- mo line return status <> ERROR
3024:
3025: -- Bug 2776309
3059: IF is_debug THEN
3060: print_debug('Error in updating MMTT records lock_flag: ' || sqlerrm
3061: ,'Inv_Pick_Release_Pub.Pick_Release');
3062: END IF;
3063: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3064: END;
3065: END IF;
3066:
3067: -- Bug 4349602: Deleting Move Order Lines which are not allocated
3085: IF is_debug THEN
3086: print_debug('Error in Deleting Move Order Lines: ' || sqlerrm
3087: ,'Inv_Pick_Release_Pub.Pick_Release');
3088: END IF;
3089: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3090: END;
3091:
3092: IF l_wms_installed THEN
3093: -- 09/14/2000 added call to cartonization api
3127:
3128: WMS_CARTNZN_PUB.cartonize
3129: (
3130: p_api_version => 1,
3131: p_init_msg_list => fnd_api.g_false,
3132: p_commit => fnd_api.g_false,
3133: p_validation_level => fnd_api.g_valid_level_full,
3134: x_return_status => l_api_return_status,
3135: x_msg_count => x_msg_count,
3128: WMS_CARTNZN_PUB.cartonize
3129: (
3130: p_api_version => 1,
3131: p_init_msg_list => fnd_api.g_false,
3132: p_commit => fnd_api.g_false,
3133: p_validation_level => fnd_api.g_valid_level_full,
3134: x_return_status => l_api_return_status,
3135: x_msg_count => x_msg_count,
3136: x_msg_data => x_msg_data,
3129: (
3130: p_api_version => 1,
3131: p_init_msg_list => fnd_api.g_false,
3132: p_commit => fnd_api.g_false,
3133: p_validation_level => fnd_api.g_valid_level_full,
3134: x_return_status => l_api_return_status,
3135: x_msg_count => x_msg_count,
3136: x_msg_data => x_msg_data,
3137: p_out_bound => 'Y',
3138: p_org_id => l_mo_line_tbl(l_line_index).organization_id,
3139: p_move_order_header_id => l_mo_line_tbl(l_line_index).header_id
3140: );
3141:
3142: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3143: l_api_return_status = fnd_api.g_ret_sts_error THEN
3144: If is_debug then
3145: print_debug('error from cartonize api',
3146: 'Inv_Pick_Release_Pub.Pick_Release');
3139: p_move_order_header_id => l_mo_line_tbl(l_line_index).header_id
3140: );
3141:
3142: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3143: l_api_return_status = fnd_api.g_ret_sts_error THEN
3144: If is_debug then
3145: print_debug('error from cartonize api',
3146: 'Inv_Pick_Release_Pub.Pick_Release');
3147: print_debug('error count ' || x_msg_count,
3147: print_debug('error count ' || x_msg_count,
3148: 'Inv_Pick_Release_Pub.Pick_Release');
3149: print_debug('error msg ' || x_msg_data,
3150: 'Inv_Pick_Release_Pub.Pick_Release');
3151: x_return_status := fnd_api.g_ret_sts_error;
3152: End If;
3153: ELSE -- patchset J bulk picking
3154: IF (WMS_CONTROL.G_CURRENT_RELEASE_LEVEL >= INV_RELEASE.G_J_RELEASE_LEVEL) THEN
3155: IF (is_debug) THEN
3164: p_ps_mode => l_print_mode,
3165: p_grouping_rule_id => p_grouping_rule_id,
3166: p_allow_partial_pick => p_allow_partial_pick);
3167:
3168: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3169: l_api_return_status = fnd_api.g_ret_sts_error THEN
3170: print_debug('error from assign_pick_slip_number api',
3171: 'Inv_Pick_Release_Pub.Pick_Release');
3172: print_debug('error count ' || x_msg_count,
3165: p_grouping_rule_id => p_grouping_rule_id,
3166: p_allow_partial_pick => p_allow_partial_pick);
3167:
3168: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3169: l_api_return_status = fnd_api.g_ret_sts_error THEN
3170: print_debug('error from assign_pick_slip_number api',
3171: 'Inv_Pick_Release_Pub.Pick_Release');
3172: print_debug('error count ' || x_msg_count,
3173: 'Inv_Pick_Release_Pub.Pick_Release');
3172: print_debug('error count ' || x_msg_count,
3173: 'Inv_Pick_Release_Pub.Pick_Release');
3174: print_debug('error msg ' || x_msg_data,
3175: 'Inv_Pick_Release_Pub.Pick_Release');
3176: x_return_status := fnd_api.g_ret_sts_error;
3177: END IF;
3178: IF (is_debug) THEN
3179: print_debug('PATCHSET J -- BULK PICKING --- END',
3180: 'Inv_Pick_Release_Pub.Pick_Release');
3195:
3196: WMS_CARTNZN_PUB.cartonize
3197: (
3198: p_api_version => 1,
3199: p_init_msg_list => fnd_api.g_false,
3200: p_commit => fnd_api.g_false,
3201: p_validation_level => fnd_api.g_valid_level_full,
3202: x_return_status => l_api_return_status,
3203: x_msg_count => x_msg_count,
3196: WMS_CARTNZN_PUB.cartonize
3197: (
3198: p_api_version => 1,
3199: p_init_msg_list => fnd_api.g_false,
3200: p_commit => fnd_api.g_false,
3201: p_validation_level => fnd_api.g_valid_level_full,
3202: x_return_status => l_api_return_status,
3203: x_msg_count => x_msg_count,
3204: x_msg_data => x_msg_data,
3197: (
3198: p_api_version => 1,
3199: p_init_msg_list => fnd_api.g_false,
3200: p_commit => fnd_api.g_false,
3201: p_validation_level => fnd_api.g_valid_level_full,
3202: x_return_status => l_api_return_status,
3203: x_msg_count => x_msg_count,
3204: x_msg_data => x_msg_data,
3205: p_out_bound => 'Y',
3206: p_org_id => l_mo_line_tbl(l_line_index).organization_id,
3207: p_move_order_header_id => l_mo_line_tbl(l_line_index).header_id
3208: );
3209:
3210: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3211: l_api_return_status = fnd_api.g_ret_sts_error THEN
3212: If is_debug then
3213: print_debug('error from cartonize api',
3214: 'Inv_Pick_Release_Pub.Pick_Release');
3207: p_move_order_header_id => l_mo_line_tbl(l_line_index).header_id
3208: );
3209:
3210: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3211: l_api_return_status = fnd_api.g_ret_sts_error THEN
3212: If is_debug then
3213: print_debug('error from cartonize api',
3214: 'Inv_Pick_Release_Pub.Pick_Release');
3215: print_debug('error count ' || x_msg_count,
3216: 'Inv_Pick_Release_Pub.Pick_Release');
3217: print_debug('error msg ' || x_msg_data,
3218: 'Inv_Pick_Release_Pub.Pick_Release');
3219: End If;
3220: x_return_status := fnd_api.g_ret_sts_error;
3221: ELSE -- patchset J bulk picking
3222: IF (WMS_CONTROL.G_CURRENT_RELEASE_LEVEL >= INV_RELEASE.G_J_RELEASE_LEVEL) THEN
3223: IF (is_debug) THEN
3224: print_debug('PATCHSET J -- BULK PICKING --- START',
3235: p_ps_mode => l_print_mode,
3236: p_grouping_rule_id => p_grouping_rule_id,
3237: p_allow_partial_pick => p_allow_partial_pick);
3238:
3239: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3240: l_api_return_status = fnd_api.g_ret_sts_error THEN
3241: print_debug('error from assign_pick_slip_number api',
3242: 'Inv_Pick_Release_Pub.Pick_Release');
3243: print_debug('error count ' || x_msg_count,
3236: p_grouping_rule_id => p_grouping_rule_id,
3237: p_allow_partial_pick => p_allow_partial_pick);
3238:
3239: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3240: l_api_return_status = fnd_api.g_ret_sts_error THEN
3241: print_debug('error from assign_pick_slip_number api',
3242: 'Inv_Pick_Release_Pub.Pick_Release');
3243: print_debug('error count ' || x_msg_count,
3244: 'Inv_Pick_Release_Pub.Pick_Release');
3243: print_debug('error count ' || x_msg_count,
3244: 'Inv_Pick_Release_Pub.Pick_Release');
3245: print_debug('error msg ' || x_msg_data,
3246: 'Inv_Pick_Release_Pub.Pick_Release');
3247: x_return_status := fnd_api.g_ret_sts_error;
3248: END IF;
3249: IF (is_debug) THEN
3250: print_debug('PATCHSET J -- BULK PICKING --- END',
3251: 'Inv_Pick_Release_Pub.Pick_Release');
3293: IF (l_debug = 1) THEN
3294: print_debug('Calling print_label with v_transaction_id.count : ' || v_transaction_id.COUNT, 'Inv_Pick_Release_Pub.Pick_Release');
3295: END IF;
3296:
3297: l_return_status := fnd_api.g_ret_sts_success;
3298:
3299: inv_label.print_label (
3300: x_return_status => l_return_status
3301: , x_msg_count => x_msg_count
3305: , p_print_mode => 1
3306: , p_business_flow_code => 42 --Business Flow Pick Release
3307: , p_transaction_id => v_transaction_id);
3308:
3309: IF ( l_return_status <> fnd_api.g_ret_sts_success ) THEN
3310: IF (l_debug = 1) THEN
3311: print_debug('failed to print labels', 'Inv_Pick_Release_Pub.Pick_Release');
3312: END IF;
3313: fnd_message.set_name('WMS','WMS_PRINT_LABEL_FAIL');
3374: --2509322
3375: backorder_smc_details(l_api_return_status,
3376: x_msg_data,
3377: x_msg_count);
3378: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3379: RAISE fnd_api.g_exc_error;
3380: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
3381: RAISE fnd_api.g_exc_unexpected_error;
3382: END IF;
3375: backorder_smc_details(l_api_return_status,
3376: x_msg_data,
3377: x_msg_count);
3378: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3379: RAISE fnd_api.g_exc_error;
3380: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
3381: RAISE fnd_api.g_exc_unexpected_error;
3382: END IF;
3383: -- END IF;
3376: x_msg_data,
3377: x_msg_count);
3378: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3379: RAISE fnd_api.g_exc_error;
3380: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
3381: RAISE fnd_api.g_exc_unexpected_error;
3382: END IF;
3383: -- END IF;
3384:
3377: x_msg_count);
3378: IF l_api_return_status = fnd_api.g_ret_sts_error THEN
3379: RAISE fnd_api.g_exc_error;
3380: ELSIF l_api_return_status = fnd_api.g_ret_sts_unexp_error THEN
3381: RAISE fnd_api.g_exc_unexpected_error;
3382: END IF;
3383: -- END IF;
3384:
3385: --bug 2408329: Since Quantity trees are cached and not built in a pick release
3438: 'Inv_Pick_Release_Pub.Pick_Release');
3439: END IF;
3440: WMS_XDOCK_PEGGING_PUB.Planned_Cross_Dock
3441: (p_api_version => 1.0,
3442: p_init_msg_list => fnd_api.g_false,
3443: p_commit => fnd_api.g_false,
3444: x_return_status => l_api_return_status,
3445: x_msg_count => x_msg_count,
3446: x_msg_data => x_msg_data,
3439: END IF;
3440: WMS_XDOCK_PEGGING_PUB.Planned_Cross_Dock
3441: (p_api_version => 1.0,
3442: p_init_msg_list => fnd_api.g_false,
3443: p_commit => fnd_api.g_false,
3444: x_return_status => l_api_return_status,
3445: x_msg_count => x_msg_count,
3446: x_msg_data => x_msg_data,
3447: p_batch_id => INV_CACHE.wpb_rec.batch_id,
3448: p_wsh_release_table => p_wsh_release_table,
3449: p_trolin_delivery_ids => p_trolin_delivery_ids,
3450: p_del_detail_id => p_del_detail_id);
3451:
3452: IF (l_api_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3453: IF (is_debug) THEN
3454: print_debug('Success returned from Planned_Cross_Dock API',
3455: 'Inv_Pick_Release_Pub.Pick_Release');
3456: END IF;
3453: IF (is_debug) THEN
3454: print_debug('Success returned from Planned_Cross_Dock API',
3455: 'Inv_Pick_Release_Pub.Pick_Release');
3456: END IF;
3457: ELSIF (l_api_return_status = FND_API.G_RET_STS_ERROR) THEN
3458: IF (is_debug) THEN
3459: print_debug('Error returned from Planned_Cross_Dock API',
3460: 'Inv_Pick_Release_Pub.Pick_Release');
3461: END IF;
3458: IF (is_debug) THEN
3459: print_debug('Error returned from Planned_Cross_Dock API',
3460: 'Inv_Pick_Release_Pub.Pick_Release');
3461: END IF;
3462: RAISE FND_API.G_EXC_ERROR;
3463: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3464: IF (is_debug) THEN
3465: print_debug('Unexpected error returned from Planned_Cross_Dock API',
3466: 'Inv_Pick_Release_Pub.Pick_Release');
3459: print_debug('Error returned from Planned_Cross_Dock API',
3460: 'Inv_Pick_Release_Pub.Pick_Release');
3461: END IF;
3462: RAISE FND_API.G_EXC_ERROR;
3463: ELSIF (l_api_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3464: IF (is_debug) THEN
3465: print_debug('Unexpected error returned from Planned_Cross_Dock API',
3466: 'Inv_Pick_Release_Pub.Pick_Release');
3467: END IF;
3464: IF (is_debug) THEN
3465: print_debug('Unexpected error returned from Planned_Cross_Dock API',
3466: 'Inv_Pick_Release_Pub.Pick_Release');
3467: END IF;
3468: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3469: END IF;
3470: END IF;
3471:
3472: -- Standard call to commit
3469: END IF;
3470: END IF;
3471:
3472: -- Standard call to commit
3473: IF p_commit = fnd_api.g_true THEN
3474: COMMIT;
3475: END IF;
3476:
3477: -- Standard call to get message count and if count is 1, get message info
3484: l_return_value := inv_cache.set_pick_release(FALSE); --Added bug3237702
3485: inv_log_util.g_maintain_log_profile := FALSE;
3486:
3487: EXCEPTION
3488: WHEN FND_API.G_EXC_ERROR THEN
3489: --
3490: x_return_status := FND_API.G_RET_STS_ERROR;
3491: l_return_value := inv_cache.set_pick_release(FALSE); --Added bug3237702
3492: inv_log_util.g_maintain_log_profile := TRUE;
3486:
3487: EXCEPTION
3488: WHEN FND_API.G_EXC_ERROR THEN
3489: --
3490: x_return_status := FND_API.G_RET_STS_ERROR;
3491: l_return_value := inv_cache.set_pick_release(FALSE); --Added bug3237702
3492: inv_log_util.g_maintain_log_profile := TRUE;
3493: --
3494: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3493: --
3494: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3495: , p_data => x_msg_data);
3496: --
3497: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3498: --
3499: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3500: l_return_value := inv_cache.set_pick_release(FALSE); --Added bug3237702
3501: inv_log_util.g_maintain_log_profile := TRUE;
3495: , p_data => x_msg_data);
3496: --
3497: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3498: --
3499: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3500: l_return_value := inv_cache.set_pick_release(FALSE); --Added bug3237702
3501: inv_log_util.g_maintain_log_profile := TRUE;
3502: --
3503: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3512: ROLLBACK TO Pick_Release_PUB;
3513: --
3514: l_return_value := inv_cache.set_pick_release(FALSE); --Added bug3237702
3515: inv_log_util.g_maintain_log_profile := TRUE;
3516: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3517: --
3518: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
3519: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
3520: END IF;
3560: --
3561: -- Output Parameters
3562: -- x_return_status
3563: -- if the pick release process succeeds, the value is
3564: -- fnd_api.g_ret_sts_success;
3565: -- if there is an expected error, the value is
3566: -- fnd_api.g_ret_sts_error;
3567: -- if there is an unexpected error, the value is
3568: -- fnd_api.g_ret_sts_unexp_error;
3562: -- x_return_status
3563: -- if the pick release process succeeds, the value is
3564: -- fnd_api.g_ret_sts_success;
3565: -- if there is an expected error, the value is
3566: -- fnd_api.g_ret_sts_error;
3567: -- if there is an unexpected error, the value is
3568: -- fnd_api.g_ret_sts_unexp_error;
3569: -- x_msg_count
3570: -- if there is one or more errors, the number of error messages
3564: -- fnd_api.g_ret_sts_success;
3565: -- if there is an expected error, the value is
3566: -- fnd_api.g_ret_sts_error;
3567: -- if there is an unexpected error, the value is
3568: -- fnd_api.g_ret_sts_unexp_error;
3569: -- x_msg_count
3570: -- if there is one or more errors, the number of error messages
3571: -- in the buffer
3572: -- x_msg_data
3570: -- if there is one or more errors, the number of error messages
3571: -- in the buffer
3572: -- x_msg_data
3573: -- if there is one and only one error, the error message
3574: -- (See fnd_api package for more details about the above output parameters)
3575: --
3576:
3577: -- HW INVCONV added p_missing_quantity2
3578:
3578:
3579: PROCEDURE Reserve_Unconfirmed_Quantity
3580: (
3581: p_api_version IN NUMBER
3582: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3583: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
3584: ,x_return_status OUT NOCOPY VARCHAR2
3585: ,x_msg_count OUT NOCOPY NUMBER
3586: ,x_msg_data OUT NOCOPY VARCHAR2
3579: PROCEDURE Reserve_Unconfirmed_Quantity
3580: (
3581: p_api_version IN NUMBER
3582: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
3583: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
3584: ,x_return_status OUT NOCOPY VARCHAR2
3585: ,x_msg_count OUT NOCOPY NUMBER
3586: ,x_msg_data OUT NOCOPY VARCHAR2
3587: ,p_missing_quantity IN NUMBER
3584: ,x_return_status OUT NOCOPY VARCHAR2
3585: ,x_msg_count OUT NOCOPY NUMBER
3586: ,x_msg_data OUT NOCOPY VARCHAR2
3587: ,p_missing_quantity IN NUMBER
3588: ,p_missing_quantity2 IN NUMBER DEFAULT fnd_api.g_miss_num
3589: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
3590: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
3591: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3585: ,x_msg_count OUT NOCOPY NUMBER
3586: ,x_msg_data OUT NOCOPY VARCHAR2
3587: ,p_missing_quantity IN NUMBER
3588: ,p_missing_quantity2 IN NUMBER DEFAULT fnd_api.g_miss_num
3589: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
3590: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
3591: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3586: ,x_msg_data OUT NOCOPY VARCHAR2
3587: ,p_missing_quantity IN NUMBER
3588: ,p_missing_quantity2 IN NUMBER DEFAULT fnd_api.g_miss_num
3589: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
3590: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
3591: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3594: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3587: ,p_missing_quantity IN NUMBER
3588: ,p_missing_quantity2 IN NUMBER DEFAULT fnd_api.g_miss_num
3589: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
3590: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
3591: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3594: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3595: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
3588: ,p_missing_quantity2 IN NUMBER DEFAULT fnd_api.g_miss_num
3589: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
3590: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
3591: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3594: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3595: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
3596: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3589: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
3590: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
3591: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3594: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3595: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
3596: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3597: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3590: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
3591: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3594: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3595: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
3596: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3597: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3598: ) IS
3591: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3594: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3595: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
3596: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3597: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3598: ) IS
3599: l_api_version CONSTANT NUMBER := 1.0;
3592: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3594: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3595: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
3596: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3597: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3598: ) IS
3599: l_api_version CONSTANT NUMBER := 1.0;
3600: l_api_name CONSTANT VARCHAR2(30) := 'Reserve_Unconfirmed_Quantity';
3593: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
3594: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3595: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
3596: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3597: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
3598: ) IS
3599: l_api_version CONSTANT NUMBER := 1.0;
3600: l_api_name CONSTANT VARCHAR2(30) := 'Reserve_Unconfirmed_Quantity';
3601:
3634: -- Set savepoint for this API
3635: SAVEPOINT Reserve_Unconfirmed_Qty_PUB;
3636:
3637: -- Standard Call to check for call compatibility
3638: IF NOT fnd_api.Compatible_API_Call(l_api_version
3639: , p_api_version
3640: , l_api_name
3641: , G_PKG_NAME) THEN
3642: RAISE fnd_api.g_exc_unexpected_error;
3638: IF NOT fnd_api.Compatible_API_Call(l_api_version
3639: , p_api_version
3640: , l_api_name
3641: , G_PKG_NAME) THEN
3642: RAISE fnd_api.g_exc_unexpected_error;
3643: END IF;
3644:
3645: -- Initialize message list if p_init_msg_list is set to true
3646: IF fnd_api.to_Boolean(p_init_msg_list) THEN
3642: RAISE fnd_api.g_exc_unexpected_error;
3643: END IF;
3644:
3645: -- Initialize message list if p_init_msg_list is set to true
3646: IF fnd_api.to_Boolean(p_init_msg_list) THEN
3647: fnd_msg_pub.initialize;
3648: END IF;
3649:
3650: -- Initialize API return status to success
3647: fnd_msg_pub.initialize;
3648: END IF;
3649:
3650: -- Initialize API return status to success
3651: x_return_status := fnd_api.g_ret_sts_success;
3652:
3653: -- Validate parameters
3654:
3655: -- First make sure that missing quantity is not <= 0
3655: -- First make sure that missing quantity is not <= 0
3656: IF p_missing_quantity <= 0 THEN
3657: FND_MESSAGE.SET_NAME('INV','INV_NO_QTY_TO_TRANSFER');
3658: FND_MSG_PUB.Add;
3659: RAISE fnd_api.g_exc_unexpected_error;
3660: END IF;
3661:
3662: -- Determine whether the reservation id was given, or if it must be derived
3663: -- based on the supply source parameters.
3660: END IF;
3661:
3662: -- Determine whether the reservation id was given, or if it must be derived
3663: -- based on the supply source parameters.
3664: IF p_reservation_id <> fnd_api.g_miss_num AND
3665: p_reservation_id IS NOT NULL THEN
3666: -- Initialize the reservation querying record with the reservation ID
3667: l_reservation_id := p_reservation_id;
3668: l_reservation_rec.reservation_id := l_reservation_id;
3669: ELSE
3670: -- Initialize the reservation record with the demand/supply source
3671: -- information. At minimum, must have a demand source type, line and header,
3672: -- and an item and organization ID
3673: IF p_inventory_item_id = fnd_api.g_miss_num OR
3674: p_inventory_item_id IS NULL OR
3675: p_organization_id = fnd_api.g_miss_num OR
3676: p_organization_id IS NULL OR
3677: p_demand_source_header_id = fnd_api.g_miss_num OR
3671: -- information. At minimum, must have a demand source type, line and header,
3672: -- and an item and organization ID
3673: IF p_inventory_item_id = fnd_api.g_miss_num OR
3674: p_inventory_item_id IS NULL OR
3675: p_organization_id = fnd_api.g_miss_num OR
3676: p_organization_id IS NULL OR
3677: p_demand_source_header_id = fnd_api.g_miss_num OR
3678: p_demand_source_header_id IS NULL OR
3679: p_demand_source_line_id = fnd_api.g_miss_num OR
3673: IF p_inventory_item_id = fnd_api.g_miss_num OR
3674: p_inventory_item_id IS NULL OR
3675: p_organization_id = fnd_api.g_miss_num OR
3676: p_organization_id IS NULL OR
3677: p_demand_source_header_id = fnd_api.g_miss_num OR
3678: p_demand_source_header_id IS NULL OR
3679: p_demand_source_line_id = fnd_api.g_miss_num OR
3680: p_demand_source_line_id IS NULL THEN
3681: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_ID_RSV');
3675: p_organization_id = fnd_api.g_miss_num OR
3676: p_organization_id IS NULL OR
3677: p_demand_source_header_id = fnd_api.g_miss_num OR
3678: p_demand_source_header_id IS NULL OR
3679: p_demand_source_line_id = fnd_api.g_miss_num OR
3680: p_demand_source_line_id IS NULL THEN
3681: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_ID_RSV');
3682: FND_MSG_PUB.Add;
3683: RAISE fnd_api.g_exc_unexpected_error;
3679: p_demand_source_line_id = fnd_api.g_miss_num OR
3680: p_demand_source_line_id IS NULL THEN
3681: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_ID_RSV');
3682: FND_MSG_PUB.Add;
3683: RAISE fnd_api.g_exc_unexpected_error;
3684: END IF;
3685:
3686: -- First attempt to convert the demand source header id given
3687: -- (the OE header id) to the MTL_SALES_ORDERS id to be used.
3689: inv_salesorder.get_salesorder_for_oeheader(p_demand_source_header_id);
3690: IF l_mso_header_id IS NULL THEN
3691: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_GET_MSO_HEADER');
3692: FND_MSG_PUB.Add;
3693: RAISE fnd_api.g_exc_unexpected_error;
3694: END IF;*/
3695:
3696: l_reservation_rec.inventory_item_id := p_inventory_item_id;
3697: l_reservation_rec.organization_id := p_organization_id;
3701: l_reservation_rec.demand_source_line_id := p_demand_source_line_id;
3702: -- R12 Crossdock changes
3703: l_reservation_rec.demand_source_line_detail := NULL;
3704:
3705: IF p_subinventory_code <> fnd_api.g_miss_char THEN
3706: l_reservation_rec.subinventory_code := p_subinventory_code;
3707: ELSE
3708: l_reservation_rec.subinventory_code := NULL;
3709: END IF;
3707: ELSE
3708: l_reservation_rec.subinventory_code := NULL;
3709: END IF;
3710:
3711: IF p_locator_id <> fnd_api.g_miss_num THEN
3712: l_reservation_rec.locator_id := p_locator_id;
3713: ELSE
3714: l_reservation_rec.locator_id := NULL;
3715: END IF;
3713: ELSE
3714: l_reservation_rec.locator_id := NULL;
3715: END IF;
3716:
3717: IF p_revision <> fnd_api.g_miss_char THEN
3718: l_reservation_rec.revision := p_revision;
3719: ELSE
3720: l_reservation_rec.revision := NULL;
3721: END IF;
3719: ELSE
3720: l_reservation_rec.revision := NULL;
3721: END IF;
3722:
3723: IF p_lot_number <> fnd_api.g_miss_char THEN
3724: l_reservation_rec.lot_number := p_lot_number;
3725: ELSE
3726: l_reservation_rec.lot_number := NULL;
3727: END IF;
3730: -- Retrieve the reservation information
3731: INV_Reservation_PUB.Query_Reservation
3732: (
3733: p_api_version_number => 1.0
3734: , p_init_msg_lst => fnd_api.g_false
3735: , x_return_status => l_api_return_status
3736: , x_msg_count => x_msg_count
3737: , x_msg_data => x_msg_data
3738: , p_query_input => l_reservation_rec
3740: , x_mtl_reservation_tbl_count => l_reservation_count
3741: , x_error_code => l_api_error_code
3742: );
3743: -- Return an error if the query reservations call failed
3744: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
3745: FND_MESSAGE.SET_NAME('INV','INV_QRY_RSV_FAILED');
3746: FND_MSG_PUB.Add;
3747: RAISE fnd_api.g_exc_unexpected_error;
3748: END IF;
3743: -- Return an error if the query reservations call failed
3744: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
3745: FND_MESSAGE.SET_NAME('INV','INV_QRY_RSV_FAILED');
3746: FND_MSG_PUB.Add;
3747: RAISE fnd_api.g_exc_unexpected_error;
3748: END IF;
3749:
3750: -- Only 1 reservation record should have been returned, since the parameters
3751: -- passed are supposed to uniquely identify a reservation record.
3751: -- passed are supposed to uniquely identify a reservation record.
3752: IF l_reservation_count = 0 THEN
3753: FND_MESSAGE.SET_NAME('INV','INV_NO_RSVS_FOUND');
3754: FND_MSG_PUB.Add;
3755: RAISE fnd_api.g_exc_unexpected_error;
3756: END IF;
3757:
3758: IF l_reservation_count > 1 THEN
3759: FND_MESSAGE.SET_NAME('INV','INV_NON_UNIQUE_RSV');
3757:
3758: IF l_reservation_count > 1 THEN
3759: FND_MESSAGE.SET_NAME('INV','INV_NON_UNIQUE_RSV');
3760: FND_MSG_PUB.Add;
3761: RAISE fnd_api.g_exc_unexpected_error;
3762: END IF;
3763:
3764: -- Determine whether the quantity to transfer is greater
3765: -- than the currently reserved quantity
3765: -- than the currently reserved quantity
3766: IF p_missing_quantity > l_reservations_tbl(1).primary_reservation_quantity THEN
3767: FND_MESSAGE.SET_NAME('INV','INV_INSUFF_QTY_RSV');
3768: FND_MSG_PUB.Add;
3769: RAISE fnd_api.g_exc_unexpected_error;
3770: END IF;
3771:
3772: -- Initialize the querying record with the reservation ID so that the update
3773: -- will be more efficient.
3796: -- Make the call to the Transfer Reservation API
3797: INV_Reservation_PUB.Transfer_Reservation
3798: (
3799: p_api_version_number => 1.0
3800: , p_init_msg_lst => fnd_api.g_true
3801: , x_return_status => l_api_return_status
3802: , x_msg_count => x_msg_count
3803: , x_msg_data => x_msg_data
3804: , p_original_rsv_rec => l_reservation_rec
3804: , p_original_rsv_rec => l_reservation_rec
3805: , p_to_rsv_rec => l_cc_reservation_rec
3806: , p_original_serial_number => l_dummy_sn
3807: , p_to_serial_number => l_dummy_sn
3808: , p_validation_flag => fnd_api.g_true
3809: , x_to_reservation_id => l_new_rsv_id
3810: );
3811: -- Return an error if the transfer reservations call failed
3812: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
3808: , p_validation_flag => fnd_api.g_true
3809: , x_to_reservation_id => l_new_rsv_id
3810: );
3811: -- Return an error if the transfer reservations call failed
3812: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
3813: FND_MESSAGE.SET_NAME('INV','INV_TRANSFER_RSV_FAILED');
3814: FND_MSG_PUB.Add;
3815: RAISE fnd_api.g_exc_unexpected_error;
3816: END IF;
3811: -- Return an error if the transfer reservations call failed
3812: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
3813: FND_MESSAGE.SET_NAME('INV','INV_TRANSFER_RSV_FAILED');
3814: FND_MSG_PUB.Add;
3815: RAISE fnd_api.g_exc_unexpected_error;
3816: END IF;
3817:
3818: -- Commit if necessary
3819: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3815: RAISE fnd_api.g_exc_unexpected_error;
3816: END IF;
3817:
3818: -- Commit if necessary
3819: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3820: ROLLBACK TO Reserve_Unconfirmed_Qty_PUB;
3821: ELSE
3822: -- Standard call to commit
3823: IF p_commit = fnd_api.g_true THEN
3819: IF x_return_status <> fnd_api.g_ret_sts_success THEN
3820: ROLLBACK TO Reserve_Unconfirmed_Qty_PUB;
3821: ELSE
3822: -- Standard call to commit
3823: IF p_commit = fnd_api.g_true THEN
3824: COMMIT;
3825: END IF;
3826: END IF;
3827:
3825: END IF;
3826: END IF;
3827:
3828: EXCEPTION
3829: WHEN FND_API.G_EXC_ERROR THEN
3830: --
3831: x_return_status := FND_API.G_RET_STS_ERROR;
3832: --
3833: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3827:
3828: EXCEPTION
3829: WHEN FND_API.G_EXC_ERROR THEN
3830: --
3831: x_return_status := FND_API.G_RET_STS_ERROR;
3832: --
3833: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3834: , p_data => x_msg_data);
3835: --
3832: --
3833: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3834: , p_data => x_msg_data);
3835: --
3836: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3837: --
3838: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3839: --
3840: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3834: , p_data => x_msg_data);
3835: --
3836: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3837: --
3838: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3839: --
3840: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3841: , p_data => x_msg_data);
3842: --
3842: --
3843: WHEN OTHERS THEN
3844: ROLLBACK TO Reserve_Unconfirmed_Qty_PUB;
3845: --
3846: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3847: --
3848: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
3849: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
3850: END IF;
3911: End If;
3912: --ROLLBACK TO Pick_Release_PUB;
3913: FND_MESSAGE.SET_NAME('INV','INV_WSH_ORG_NOT_FOUND');
3914: FND_MSG_PUB.Add;
3915: RAISE fnd_api.g_exc_unexpected_error;
3916: END;
3917:
3918: g_organization_id := p_org_id;
3919: g_print_mode := l_print_mode;
3935:
3936: WMS_CARTNZN_PUB.cartonize
3937: (
3938: p_api_version => 1,
3939: p_init_msg_list => fnd_api.g_false,
3940: p_commit => fnd_api.g_false,
3941: p_validation_level => fnd_api.g_valid_level_full,
3942: x_return_status => l_api_return_status,
3943: x_msg_count => x_msg_count,
3936: WMS_CARTNZN_PUB.cartonize
3937: (
3938: p_api_version => 1,
3939: p_init_msg_list => fnd_api.g_false,
3940: p_commit => fnd_api.g_false,
3941: p_validation_level => fnd_api.g_valid_level_full,
3942: x_return_status => l_api_return_status,
3943: x_msg_count => x_msg_count,
3944: x_msg_data => x_msg_data,
3937: (
3938: p_api_version => 1,
3939: p_init_msg_list => fnd_api.g_false,
3940: p_commit => fnd_api.g_false,
3941: p_validation_level => fnd_api.g_valid_level_full,
3942: x_return_status => l_api_return_status,
3943: x_msg_count => x_msg_count,
3944: x_msg_data => x_msg_data,
3945: p_out_bound => 'Y',
3945: p_out_bound => 'Y',
3946: p_org_id => p_org_id,
3947: p_move_order_header_id => p_move_order_header_id
3948: );
3949: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3950: l_api_return_status = fnd_api.g_ret_sts_error THEN
3951: If is_debug then
3952: print_debug('error from cartonize api',
3953: 'Inv_Pick_Release_Pub.Call_Cartonization');
3946: p_org_id => p_org_id,
3947: p_move_order_header_id => p_move_order_header_id
3948: );
3949: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3950: l_api_return_status = fnd_api.g_ret_sts_error THEN
3951: If is_debug then
3952: print_debug('error from cartonize api',
3953: 'Inv_Pick_Release_Pub.Call_Cartonization');
3954: print_debug('error count ' || x_msg_count,
3955: 'Inv_Pick_Release_Pub.Call_Cartonization');
3956: print_debug('error msg ' || x_msg_data,
3957: 'Inv_Pick_Release_Pub.Call_Cartonization');
3958: End If;
3959: x_return_status := fnd_api.g_ret_sts_error;
3960: ELSE
3961: IF (is_debug) THEN print_debug('PATCHSET J -- BULK PICKING --- START',
3962: 'Inv_Pick_Release_Pub.Call_Cartonization');
3963: print_debug('calling assign_pick_slip_number',
3970: p_move_order_header_id => p_move_order_header_id,
3971: p_ps_mode => l_print_mode,
3972: p_grouping_rule_id => p_grouping_rule_id,
3973: p_allow_partial_pick => p_allow_partial_pick);
3974: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3975: l_api_return_status = fnd_api.g_ret_sts_error THEN
3976: print_debug('error from assign_pick_slip_number api',
3977: 'Inv_Pick_Release_Pub.Call_Cartonization');
3978: print_debug('error count ' || x_msg_count,
3971: p_ps_mode => l_print_mode,
3972: p_grouping_rule_id => p_grouping_rule_id,
3973: p_allow_partial_pick => p_allow_partial_pick);
3974: IF l_api_return_status = fnd_api.g_ret_sts_unexp_error OR
3975: l_api_return_status = fnd_api.g_ret_sts_error THEN
3976: print_debug('error from assign_pick_slip_number api',
3977: 'Inv_Pick_Release_Pub.Call_Cartonization');
3978: print_debug('error count ' || x_msg_count,
3979: 'Inv_Pick_Release_Pub.Call_Cartonization');
3978: print_debug('error count ' || x_msg_count,
3979: 'Inv_Pick_Release_Pub.Call_Cartonization');
3980: print_debug('error msg ' || x_msg_data,
3981: 'Inv_Pick_Release_Pub.Call_Cartonization');
3982: x_return_status := fnd_api.g_ret_sts_error;
3983: END IF;
3984: END IF;
3985:
3986: If is_debug then
3988: 'Inv_Pick_Release_Pub.Call_Cartonization');
3989: End If;
3990: END IF; --l_do_Cartonization=1
3991: EXCEPTION
3992: WHEN FND_API.G_EXC_ERROR THEN
3993: --
3994: x_return_status := FND_API.G_RET_STS_ERROR;
3995: --
3996: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3990: END IF; --l_do_Cartonization=1
3991: EXCEPTION
3992: WHEN FND_API.G_EXC_ERROR THEN
3993: --
3994: x_return_status := FND_API.G_RET_STS_ERROR;
3995: --
3996: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3997: , p_data => x_msg_data);
3998: --
3995: --
3996: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3997: , p_data => x_msg_data);
3998: --
3999: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4000: --
4001: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4002: --
4003: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
3997: , p_data => x_msg_data);
3998: --
3999: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4000: --
4001: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4002: --
4003: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
4004: , p_data => x_msg_data);
4005: --
4005: --
4006: WHEN OTHERS THEN
4007: ROLLBACK TO PR_Call_cartonization;
4008: --
4009: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4010: --
4011: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
4012: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, 'Call_Cartonization');
4013: END IF;
4023:
4024: PROCEDURE Reserve_Unconfqty_lpn
4025: (
4026: p_api_version IN NUMBER
4027: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
4028: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
4029: ,x_return_status OUT NOCOPY VARCHAR2
4030: ,x_msg_count OUT NOCOPY NUMBER
4031: ,x_msg_data OUT NOCOPY VARCHAR2
4024: PROCEDURE Reserve_Unconfqty_lpn
4025: (
4026: p_api_version IN NUMBER
4027: ,p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
4028: ,p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
4029: ,x_return_status OUT NOCOPY VARCHAR2
4030: ,x_msg_count OUT NOCOPY NUMBER
4031: ,x_msg_data OUT NOCOPY VARCHAR2
4032: ,x_new_rsv_id OUT NOCOPY NUMBER -- bug8301348
4031: ,x_msg_data OUT NOCOPY VARCHAR2
4032: ,x_new_rsv_id OUT NOCOPY NUMBER -- bug8301348
4033: ,p_missing_quantity IN NUMBER
4034: ,p_secondary_missing_quantity IN NUMBER DEFAULT NULL /*9251210*/
4035: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
4036: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
4037: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
4038: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4032: ,x_new_rsv_id OUT NOCOPY NUMBER -- bug8301348
4033: ,p_missing_quantity IN NUMBER
4034: ,p_secondary_missing_quantity IN NUMBER DEFAULT NULL /*9251210*/
4035: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
4036: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
4037: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
4038: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4033: ,p_missing_quantity IN NUMBER
4034: ,p_secondary_missing_quantity IN NUMBER DEFAULT NULL /*9251210*/
4035: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
4036: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
4037: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
4038: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4041: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
4034: ,p_secondary_missing_quantity IN NUMBER DEFAULT NULL /*9251210*/
4035: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
4036: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
4037: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
4038: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4041: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
4042: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4035: ,p_reservation_id IN NUMBER DEFAULT fnd_api.g_miss_num
4036: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
4037: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
4038: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4041: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
4042: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4043: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4036: ,p_demand_source_header_id IN NUMBER DEFAULT fnd_api.g_miss_num
4037: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
4038: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4041: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
4042: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4043: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4044: ,p_lpn_id IN NUMBER DEFAULT fnd_api.g_miss_num
4037: ,p_demand_source_line_id IN NUMBER DEFAULT fnd_api.g_miss_num
4038: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4041: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
4042: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4043: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4044: ,p_lpn_id IN NUMBER DEFAULT fnd_api.g_miss_num
4045: ) IS
4038: ,p_organization_id IN NUMBER DEFAULT fnd_api.g_miss_num
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4041: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
4042: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4043: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4044: ,p_lpn_id IN NUMBER DEFAULT fnd_api.g_miss_num
4045: ) IS
4046: l_api_version CONSTANT NUMBER := 1.0;
4039: ,p_inventory_item_id IN NUMBER DEFAULT fnd_api.g_miss_num
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4041: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
4042: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4043: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4044: ,p_lpn_id IN NUMBER DEFAULT fnd_api.g_miss_num
4045: ) IS
4046: l_api_version CONSTANT NUMBER := 1.0;
4047: l_api_name CONSTANT VARCHAR2(30) := 'Reserve_Unconfirmed_Quantity';
4040: ,p_subinventory_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4041: ,p_locator_id IN NUMBER DEFAULT fnd_api.g_miss_num
4042: ,p_revision IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4043: ,p_lot_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
4044: ,p_lpn_id IN NUMBER DEFAULT fnd_api.g_miss_num
4045: ) IS
4046: l_api_version CONSTANT NUMBER := 1.0;
4047: l_api_name CONSTANT VARCHAR2(30) := 'Reserve_Unconfirmed_Quantity';
4048:
4081: -- Set savepoint for this API
4082: SAVEPOINT Reserve_Unconfirmed_Qty_PUB;
4083:
4084: -- Standard Call to check for call compatibility
4085: IF NOT fnd_api.Compatible_API_Call(l_api_version
4086: , p_api_version
4087: , l_api_name
4088: , G_PKG_NAME) THEN
4089: RAISE fnd_api.g_exc_unexpected_error;
4085: IF NOT fnd_api.Compatible_API_Call(l_api_version
4086: , p_api_version
4087: , l_api_name
4088: , G_PKG_NAME) THEN
4089: RAISE fnd_api.g_exc_unexpected_error;
4090: END IF;
4091:
4092: -- Initialize message list if p_init_msg_list is set to true
4093: IF fnd_api.to_Boolean(p_init_msg_list) THEN
4089: RAISE fnd_api.g_exc_unexpected_error;
4090: END IF;
4091:
4092: -- Initialize message list if p_init_msg_list is set to true
4093: IF fnd_api.to_Boolean(p_init_msg_list) THEN
4094: fnd_msg_pub.initialize;
4095: END IF;
4096:
4097: -- Initialize API return status to success
4094: fnd_msg_pub.initialize;
4095: END IF;
4096:
4097: -- Initialize API return status to success
4098: x_return_status := fnd_api.g_ret_sts_success;
4099:
4100: -- Validate parameters
4101:
4102: -- First make sure that missing quantity is not <= 0
4102: -- First make sure that missing quantity is not <= 0
4103: IF p_missing_quantity <= 0 THEN
4104: FND_MESSAGE.SET_NAME('INV','INV_NO_QTY_TO_TRANSFER');
4105: FND_MSG_PUB.Add;
4106: RAISE fnd_api.g_exc_unexpected_error;
4107: END IF;
4108:
4109: -- Determine whether the reservation id was given, or if it must be derived
4110: -- based on the supply source parameters.
4107: END IF;
4108:
4109: -- Determine whether the reservation id was given, or if it must be derived
4110: -- based on the supply source parameters.
4111: IF p_reservation_id <> fnd_api.g_miss_num AND
4112: p_reservation_id IS NOT NULL THEN
4113: -- Initialize the reservation querying record with the reservation ID
4114: l_reservation_id := p_reservation_id;
4115: l_reservation_rec.reservation_id := l_reservation_id;
4116: ELSE
4117: -- Initialize the reservation record with the demand/supply source
4118: -- information. At minimum, must have a demand source type, line and header,
4119: -- and an item and organization ID
4120: IF p_inventory_item_id = fnd_api.g_miss_num OR
4121: p_inventory_item_id IS NULL OR
4122: p_organization_id = fnd_api.g_miss_num OR
4123: p_organization_id IS NULL OR
4124: p_demand_source_header_id = fnd_api.g_miss_num OR
4118: -- information. At minimum, must have a demand source type, line and header,
4119: -- and an item and organization ID
4120: IF p_inventory_item_id = fnd_api.g_miss_num OR
4121: p_inventory_item_id IS NULL OR
4122: p_organization_id = fnd_api.g_miss_num OR
4123: p_organization_id IS NULL OR
4124: p_demand_source_header_id = fnd_api.g_miss_num OR
4125: p_demand_source_header_id IS NULL OR
4126: p_demand_source_line_id = fnd_api.g_miss_num OR
4120: IF p_inventory_item_id = fnd_api.g_miss_num OR
4121: p_inventory_item_id IS NULL OR
4122: p_organization_id = fnd_api.g_miss_num OR
4123: p_organization_id IS NULL OR
4124: p_demand_source_header_id = fnd_api.g_miss_num OR
4125: p_demand_source_header_id IS NULL OR
4126: p_demand_source_line_id = fnd_api.g_miss_num OR
4127: p_demand_source_line_id IS NULL THEN
4128: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_ID_RSV');
4122: p_organization_id = fnd_api.g_miss_num OR
4123: p_organization_id IS NULL OR
4124: p_demand_source_header_id = fnd_api.g_miss_num OR
4125: p_demand_source_header_id IS NULL OR
4126: p_demand_source_line_id = fnd_api.g_miss_num OR
4127: p_demand_source_line_id IS NULL THEN
4128: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_ID_RSV');
4129: FND_MSG_PUB.Add;
4130: RAISE fnd_api.g_exc_unexpected_error;
4126: p_demand_source_line_id = fnd_api.g_miss_num OR
4127: p_demand_source_line_id IS NULL THEN
4128: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_ID_RSV');
4129: FND_MSG_PUB.Add;
4130: RAISE fnd_api.g_exc_unexpected_error;
4131: END IF;
4132:
4133: -- First attempt to convert the demand source header id given
4134: -- (the OE header id) to the MTL_SALES_ORDERS id to be used.
4136: inv_salesorder.get_salesorder_for_oeheader(p_demand_source_header_id);
4137: IF l_mso_header_id IS NULL THEN
4138: FND_MESSAGE.SET_NAME('INV','INV_COULD_NOT_GET_MSO_HEADER');
4139: FND_MSG_PUB.Add;
4140: RAISE fnd_api.g_exc_unexpected_error;
4141: END IF;*/
4142:
4143: l_reservation_rec.inventory_item_id := p_inventory_item_id;
4144: l_reservation_rec.organization_id := p_organization_id;
4146: INV_Reservation_GLOBAL.g_source_type_oe;
4147: l_reservation_rec.demand_source_header_id := p_demand_source_header_id;
4148: l_reservation_rec.demand_source_line_id := p_demand_source_line_id;
4149:
4150: IF p_subinventory_code <> fnd_api.g_miss_char THEN
4151: l_reservation_rec.subinventory_code := p_subinventory_code;
4152: ELSE
4153: l_reservation_rec.subinventory_code := NULL;
4154: END IF;
4152: ELSE
4153: l_reservation_rec.subinventory_code := NULL;
4154: END IF;
4155:
4156: IF p_locator_id <> fnd_api.g_miss_num THEN
4157: l_reservation_rec.locator_id := p_locator_id;
4158: ELSE
4159: l_reservation_rec.locator_id := NULL;
4160: END IF;
4158: ELSE
4159: l_reservation_rec.locator_id := NULL;
4160: END IF;
4161:
4162: IF p_revision <> fnd_api.g_miss_char THEN
4163: l_reservation_rec.revision := p_revision;
4164: ELSE
4165: l_reservation_rec.revision := NULL;
4166: END IF;
4164: ELSE
4165: l_reservation_rec.revision := NULL;
4166: END IF;
4167:
4168: IF p_lot_number <> fnd_api.g_miss_char THEN
4169: l_reservation_rec.lot_number := p_lot_number;
4170: ELSE
4171: l_reservation_rec.lot_number := NULL;
4172: END IF;
4171: l_reservation_rec.lot_number := NULL;
4172: END IF;
4173:
4174: /* Bug 7504490 - Checking for the allocated_lpn_id passed */
4175: IF p_lpn_id <> fnd_api.g_miss_char THEN
4176: l_reservation_rec.lpn_id := p_lpn_id;
4177: ELSE
4178: l_reservation_rec.lpn_id := NULL;
4179: END IF;
4182: -- Retrieve the reservation information
4183: INV_Reservation_PUB.Query_Reservation
4184: (
4185: p_api_version_number => 1.0
4186: , p_init_msg_lst => fnd_api.g_false
4187: , x_return_status => l_api_return_status
4188: , x_msg_count => x_msg_count
4189: , x_msg_data => x_msg_data
4190: , p_query_input => l_reservation_rec
4192: , x_mtl_reservation_tbl_count => l_reservation_count
4193: , x_error_code => l_api_error_code
4194: );
4195: -- Return an error if the query reservations call failed
4196: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
4197: FND_MESSAGE.SET_NAME('INV','INV_QRY_RSV_FAILED');
4198: FND_MSG_PUB.Add;
4199: RAISE fnd_api.g_exc_unexpected_error;
4200: END IF;
4195: -- Return an error if the query reservations call failed
4196: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
4197: FND_MESSAGE.SET_NAME('INV','INV_QRY_RSV_FAILED');
4198: FND_MSG_PUB.Add;
4199: RAISE fnd_api.g_exc_unexpected_error;
4200: END IF;
4201:
4202: -- Only 1 reservation record should have been returned, since the parameters
4203: -- passed are supposed to uniquely identify a reservation record.
4203: -- passed are supposed to uniquely identify a reservation record.
4204: IF l_reservation_count = 0 THEN
4205: FND_MESSAGE.SET_NAME('INV','INV_NO_RSVS_FOUND');
4206: FND_MSG_PUB.Add;
4207: RAISE fnd_api.g_exc_unexpected_error;
4208: END IF;
4209:
4210: IF l_reservation_count > 1 THEN
4211: FND_MESSAGE.SET_NAME('INV','INV_NON_UNIQUE_RSV');
4209:
4210: IF l_reservation_count > 1 THEN
4211: FND_MESSAGE.SET_NAME('INV','INV_NON_UNIQUE_RSV');
4212: FND_MSG_PUB.Add;
4213: RAISE fnd_api.g_exc_unexpected_error;
4214: END IF;
4215:
4216: -- Determine whether the quantity to transfer is greater
4217: -- than the currently reserved quantity
4217: -- than the currently reserved quantity
4218: IF p_missing_quantity > l_reservations_tbl(1).primary_reservation_quantity THEN
4219: FND_MESSAGE.SET_NAME('INV','INV_INSUFF_QTY_RSV');
4220: FND_MSG_PUB.Add;
4221: RAISE fnd_api.g_exc_unexpected_error;
4222: END IF;
4223:
4224: -- Initialize the querying record with the reservation ID so that the update
4225: -- will be more efficient.
4244: -- Make the call to the Transfer Reservation API
4245: INV_Reservation_PUB.Transfer_Reservation
4246: (
4247: p_api_version_number => 1.0
4248: , p_init_msg_lst => fnd_api.g_true
4249: , x_return_status => l_api_return_status
4250: , x_msg_count => x_msg_count
4251: , x_msg_data => x_msg_data
4252: , p_original_rsv_rec => l_reservation_rec
4252: , p_original_rsv_rec => l_reservation_rec
4253: , p_to_rsv_rec => l_cc_reservation_rec
4254: , p_original_serial_number => l_dummy_sn
4255: , p_to_serial_number => l_dummy_sn
4256: , p_validation_flag => fnd_api.g_true
4257: , x_to_reservation_id => l_new_rsv_id
4258: );
4259: -- Return an error if the transfer reservations call failed
4260: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
4256: , p_validation_flag => fnd_api.g_true
4257: , x_to_reservation_id => l_new_rsv_id
4258: );
4259: -- Return an error if the transfer reservations call failed
4260: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
4261: FND_MESSAGE.SET_NAME('INV','INV_TRANSFER_RSV_FAILED');
4262: FND_MSG_PUB.Add;
4263: RAISE fnd_api.g_exc_unexpected_error;
4264: END IF;
4259: -- Return an error if the transfer reservations call failed
4260: IF l_api_return_status <> fnd_api.g_ret_sts_success THEN
4261: FND_MESSAGE.SET_NAME('INV','INV_TRANSFER_RSV_FAILED');
4262: FND_MSG_PUB.Add;
4263: RAISE fnd_api.g_exc_unexpected_error;
4264: END IF;
4265: x_new_rsv_id := l_new_rsv_id ; --Bug#8301348
4266: -- Commit if necessary
4267: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4263: RAISE fnd_api.g_exc_unexpected_error;
4264: END IF;
4265: x_new_rsv_id := l_new_rsv_id ; --Bug#8301348
4266: -- Commit if necessary
4267: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4268: ROLLBACK TO Reserve_Unconfirmed_Qty_PUB;
4269: ELSE
4270: -- Standard call to commit
4271: IF p_commit = fnd_api.g_true THEN
4267: IF x_return_status <> fnd_api.g_ret_sts_success THEN
4268: ROLLBACK TO Reserve_Unconfirmed_Qty_PUB;
4269: ELSE
4270: -- Standard call to commit
4271: IF p_commit = fnd_api.g_true THEN
4272: COMMIT;
4273: END IF;
4274: END IF;
4275:
4273: END IF;
4274: END IF;
4275:
4276: EXCEPTION
4277: WHEN FND_API.G_EXC_ERROR THEN
4278: --
4279: x_return_status := FND_API.G_RET_STS_ERROR;
4280: --
4281: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
4275:
4276: EXCEPTION
4277: WHEN FND_API.G_EXC_ERROR THEN
4278: --
4279: x_return_status := FND_API.G_RET_STS_ERROR;
4280: --
4281: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
4282: , p_data => x_msg_data);
4283: --
4280: --
4281: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
4282: , p_data => x_msg_data);
4283: --
4284: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4285: --
4286: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4287: --
4288: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
4282: , p_data => x_msg_data);
4283: --
4284: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4285: --
4286: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4287: --
4288: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count
4289: , p_data => x_msg_data);
4290: --
4290: --
4291: WHEN OTHERS THEN
4292: ROLLBACK TO Reserve_Unconfirmed_Qty_PUB;
4293: --
4294: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4295: --
4296: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
4297: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
4298: END IF;