40: -- Item category ID of the transaction flow, if one exists.
41: --p_transaction_date
42: --OUT:
43: --x_return_status
44: -- FND_API.g_ret_sts_success - if the procedure completed successfully
45: -- FND_API.g_ret_sts_error - if an error occurred
46: -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
47: --x_transaction_flow_header_id
48: -- The unique header ID of the transaction flow, if any valid inter-company
41: --p_transaction_date
42: --OUT:
43: --x_return_status
44: -- FND_API.g_ret_sts_success - if the procedure completed successfully
45: -- FND_API.g_ret_sts_error - if an error occurred
46: -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
47: --x_transaction_flow_header_id
48: -- The unique header ID of the transaction flow, if any valid inter-company
49: -- relationship exists. If not flow was found, then this is NULL.
42: --OUT:
43: --x_return_status
44: -- FND_API.g_ret_sts_success - if the procedure completed successfully
45: -- FND_API.g_ret_sts_error - if an error occurred
46: -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
47: --x_transaction_flow_header_id
48: -- The unique header ID of the transaction flow, if any valid inter-company
49: -- relationship exists. If not flow was found, then this is NULL.
50: -- (MTL_TRANSACTION_FLOW_HEADERS.header_id%TYPE)
79: BEGIN
80: l_progress := '000';
81:
82: -- Start standard API initialization
83: IF FND_API.to_boolean(p_init_msg_list) THEN
84: FND_MSG_PUB.initialize;
85: END IF;
86: x_return_status := FND_API.g_ret_sts_success;
87: -- End standard API initialization
82: -- Start standard API initialization
83: IF FND_API.to_boolean(p_init_msg_list) THEN
84: FND_MSG_PUB.initialize;
85: END IF;
86: x_return_status := FND_API.g_ret_sts_success;
87: -- End standard API initialization
88:
89: l_progress := '010';
90:
117: PO_CORE_S.get_inv_org_ou_id(x_return_status => x_return_status,
118: p_inv_org_id => p_ship_to_org_id,
119: x_ou_id => l_end_ou_id);
120:
121: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
122: RAISE FND_API.g_exc_unexpected_error;
123: END IF;
124: END IF;
125:
118: p_inv_org_id => p_ship_to_org_id,
119: x_ou_id => l_end_ou_id);
120:
121: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
122: RAISE FND_API.g_exc_unexpected_error;
123: END IF;
124: END IF;
125:
126: l_progress := '030';
161: x_header_id => x_transaction_flow_header_id,
162: x_new_accounting_flag => l_new_accounting_flag,
163: x_transaction_flow_exists => l_txn_flow_exists);
164:
165: IF (x_return_status = FND_API.g_ret_sts_error) THEN
166: l_progress := '050';
167: RAISE FND_API.g_exc_error;
168: ELSIF (x_return_status = FND_API.g_ret_sts_unexp_error) THEN
169: l_progress := '060';
163: x_transaction_flow_exists => l_txn_flow_exists);
164:
165: IF (x_return_status = FND_API.g_ret_sts_error) THEN
166: l_progress := '050';
167: RAISE FND_API.g_exc_error;
168: ELSIF (x_return_status = FND_API.g_ret_sts_unexp_error) THEN
169: l_progress := '060';
170: RAISE FND_API.g_exc_unexpected_error;
171: END IF;
164:
165: IF (x_return_status = FND_API.g_ret_sts_error) THEN
166: l_progress := '050';
167: RAISE FND_API.g_exc_error;
168: ELSIF (x_return_status = FND_API.g_ret_sts_unexp_error) THEN
169: l_progress := '060';
170: RAISE FND_API.g_exc_unexpected_error;
171: END IF;
172:
166: l_progress := '050';
167: RAISE FND_API.g_exc_error;
168: ELSIF (x_return_status = FND_API.g_ret_sts_unexp_error) THEN
169: l_progress := '060';
170: RAISE FND_API.g_exc_unexpected_error;
171: END IF;
172:
173: l_progress := '070';
174:
186: p_message => 'transaction flow = '||x_transaction_flow_header_id);
187: END IF;
188:
189: EXCEPTION
190: WHEN FND_API.g_exc_error THEN
191: x_return_status := FND_API.g_ret_sts_error;
192: x_transaction_flow_header_id := NULL;
193: IF g_debug_stmt THEN
194: PO_DEBUG.debug_stmt
187: END IF;
188:
189: EXCEPTION
190: WHEN FND_API.g_exc_error THEN
191: x_return_status := FND_API.g_ret_sts_error;
192: x_transaction_flow_header_id := NULL;
193: IF g_debug_stmt THEN
194: PO_DEBUG.debug_stmt
195: (p_log_head => g_module_prefix||'check_transaction_flow',
195: (p_log_head => g_module_prefix||'check_transaction_flow',
196: p_token => l_progress,
197: p_message => 'Expected error occurred.');
198: END IF;
199: WHEN FND_API.g_exc_unexpected_error THEN
200: x_return_status := FND_API.g_ret_sts_unexp_error;
201: x_transaction_flow_header_id := NULL;
202: IF g_debug_unexp THEN
203: PO_DEBUG.debug_exc
196: p_token => l_progress,
197: p_message => 'Expected error occurred.');
198: END IF;
199: WHEN FND_API.g_exc_unexpected_error THEN
200: x_return_status := FND_API.g_ret_sts_unexp_error;
201: x_transaction_flow_header_id := NULL;
202: IF g_debug_unexp THEN
203: PO_DEBUG.debug_exc
204: (p_log_head => g_module_prefix||'check_transaction_flow',
204: (p_log_head => g_module_prefix||'check_transaction_flow',
205: p_progress => l_progress);
206: END IF;
207: WHEN OTHERS THEN
208: x_return_status := FND_API.g_ret_sts_unexp_error;
209: x_transaction_flow_header_id := NULL;
210: FND_MSG_PUB.add_exc_msg(p_pkg_name => g_pkg_name,
211: p_procedure_name => 'check_transaction_flow',
212: p_error_text => 'Progress: '||l_progress||
298: --x_coa_id OUT NOCOPY NUMBER,
299: -- The Chart of Account (COA) tied to a Set of Books that, in turn, is
300: -- tied to a Operating Unit to which a given Inventory Org belongs.
301: --x_return_status OUT NOCOPY VARCHAR2
302: -- FND_API.g_ret_sts_success: if the query is executed successfully.
303: -- FND_API.g_ret_sts_error: if NO_DATA_FOUND exception occurs.
304: -- FND_API.g_ret_sts_unexp_error: if any other exception occurs.
305: --Testing:
306: --End of Comments
299: -- The Chart of Account (COA) tied to a Set of Books that, in turn, is
300: -- tied to a Operating Unit to which a given Inventory Org belongs.
301: --x_return_status OUT NOCOPY VARCHAR2
302: -- FND_API.g_ret_sts_success: if the query is executed successfully.
303: -- FND_API.g_ret_sts_error: if NO_DATA_FOUND exception occurs.
304: -- FND_API.g_ret_sts_unexp_error: if any other exception occurs.
305: --Testing:
306: --End of Comments
307: ---------------------------------------------------------------------------
300: -- tied to a Operating Unit to which a given Inventory Org belongs.
301: --x_return_status OUT NOCOPY VARCHAR2
302: -- FND_API.g_ret_sts_success: if the query is executed successfully.
303: -- FND_API.g_ret_sts_error: if NO_DATA_FOUND exception occurs.
304: -- FND_API.g_ret_sts_unexp_error: if any other exception occurs.
305: --Testing:
306: --End of Comments
307: ---------------------------------------------------------------------------
308: PROCEDURE get_ou_and_coa_from_inv_org
327: AND mp.organization_id = hoi.organization_id
328: AND hoi.org_information_context = 'Accounting Information'
329: AND TO_NUMBER(hoi.org_information1) = gsb.set_of_books_id;
330:
331: x_return_status := FND_API.g_ret_sts_success;
332: EXCEPTION
333: WHEN NO_DATA_FOUND THEN
334: -- may be raised as an exception in the calling program
335: x_return_status := FND_API.g_ret_sts_error;
331: x_return_status := FND_API.g_ret_sts_success;
332: EXCEPTION
333: WHEN NO_DATA_FOUND THEN
334: -- may be raised as an exception in the calling program
335: x_return_status := FND_API.g_ret_sts_error;
336: WHEN OTHERS THEN
337: IF ( g_debug_stmt )
338: THEN
339: PO_DEBUG.debug_exc ( p_log_head => g_module_prefix || 'get_ou_and_coa_from_inv_org'
338: THEN
339: PO_DEBUG.debug_exc ( p_log_head => g_module_prefix || 'get_ou_and_coa_from_inv_org'
340: , p_progress => '000' );
341: END IF;
342: x_return_status := FND_API.g_ret_sts_unexp_error;
343: END get_ou_and_coa_from_inv_org;
344:
345: ---------------------------------------------------------------------------
346: --Start of Comments
572: BEGIN
573:
574: l_progress := '001';
575: -- Standard call to check for call compatibility.
576: IF NOT fnd_api.compatible_api_call (l_api_version,
577: p_api_version,
578: l_api_name,
579: g_pkg_name
580: )
578: l_api_name,
579: g_pkg_name
580: )
581: THEN
582: RAISE fnd_api.g_exc_unexpected_error;
583: END IF;
584:
585: l_progress := '002';
586:
596: IF ( p_document_type = 'STANDARD' ) THEN --
597:
598: IF p_vmi_flag = 'Y' THEN
599: x_error_msg_name := 'PO_CROSS_OU_VMI_CHECK';
600: x_return_status := FND_API.G_RET_STS_ERROR;
601: Return;
602: END IF;
603:
604: END IF;
610: IF ( p_document_type = 'STANDARD' ) THEN --
611:
612: IF p_cons_from_supp_flag = 'Y' THEN
613: x_error_msg_name := 'PO_CROSS_OU_CONSIGNED_CHECK';
614: x_return_status := FND_API.G_RET_STS_ERROR;
615: Return;
616: END IF;
617:
618: END IF;
630: p_do_osp_check => TRUE,
631: x_return_status => l_item_valid_status,
632: x_item_valid_msg_name => l_item_valid_msg_name);
633:
634: IF l_item_valid_status = FND_API.G_RET_STS_ERROR THEN
635: x_error_msg_name := l_item_valid_msg_name;
636: x_return_status := FND_API.G_RET_STS_ERROR;
637: Return;
638: END IF;
632: x_item_valid_msg_name => l_item_valid_msg_name);
633:
634: IF l_item_valid_status = FND_API.G_RET_STS_ERROR THEN
635: x_error_msg_name := l_item_valid_msg_name;
636: x_return_status := FND_API.G_RET_STS_ERROR;
637: Return;
638: END IF;
639:
640: do_item_validity_checks(
644: p_do_osp_check => TRUE,
645: x_return_status => l_item_valid_status,
646: x_item_valid_msg_name => l_item_valid_msg_name);
647:
648: IF l_item_valid_status = FND_API.G_RET_STS_ERROR THEN
649: x_error_msg_name := l_item_valid_msg_name;
650: x_return_status := FND_API.G_RET_STS_ERROR;
651: Return;
652: END IF;
646: x_item_valid_msg_name => l_item_valid_msg_name);
647:
648: IF l_item_valid_status = FND_API.G_RET_STS_ERROR THEN
649: x_error_msg_name := l_item_valid_msg_name;
650: x_return_status := FND_API.G_RET_STS_ERROR;
651: Return;
652: END IF;
653:
654: ELSE
659: p_do_osp_check => FALSE,
660: x_return_status => l_item_valid_status,
661: x_item_valid_msg_name => l_item_valid_msg_name);
662:
663: IF l_item_valid_status = FND_API.G_RET_STS_ERROR THEN
664: x_error_msg_name := l_item_valid_msg_name;
665: x_return_status := FND_API.G_RET_STS_ERROR;
666: Return;
667: END IF;
661: x_item_valid_msg_name => l_item_valid_msg_name);
662:
663: IF l_item_valid_status = FND_API.G_RET_STS_ERROR THEN
664: x_error_msg_name := l_item_valid_msg_name;
665: x_return_status := FND_API.G_RET_STS_ERROR;
666: Return;
667: END IF;
668:
669: END IF;
679: l_pa_project := is_pa_project_referenced(p_requisition_line_id);
680:
681: IF l_pa_project THEN
682: x_error_msg_name := 'PO_CROSS_OU_PA_PROJECT_CHECK';
683: x_return_status := FND_API.G_RET_STS_ERROR;
684: Return;
685: END IF;
686:
687: END IF;
708:
709: IF (PO_GML_DB_COMMON.check_process_org(l_dest_inv_org_id) = 'Y') THEN
710:
711: x_error_msg_name := 'PO_CROSS_OU_OPM_INV_CHECK';
712: x_return_status := FND_API.G_RET_STS_ERROR;
713: Return;
714:
715: END IF;
716:
724: PO_CORE_S.get_inv_org_ou_id(x_return_status => x_return_status,
725: p_inv_org_id => l_dest_inv_org_id,
726: x_ou_id => l_dest_inv_org_ou_id);
727:
728: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
729: RAISE FND_API.g_exc_unexpected_error;
730: END IF;
731: END IF;
732:
725: p_inv_org_id => l_dest_inv_org_id,
726: x_ou_id => l_dest_inv_org_ou_id);
727:
728: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
729: RAISE FND_API.g_exc_unexpected_error;
730: END IF;
731: END IF;
732:
733: l_progress := '010';
740: IF (l_dest_inv_org_ou_id = p_purchasing_org_id AND
741:
742: l_dest_inv_org_ou_id <> p_requesting_org_id) THEN
743: x_error_msg_name := 'PO_CROSS_OU_DEST_OU_CHECK';
744: x_return_status := FND_API.G_RET_STS_ERROR;
745: Return;
746:
747: END IF;
748:
758:
759: IF ( p_document_type = 'STANDARD' ) THEN --
760:
761: Check_transaction_flow(
762: p_init_msg_list => FND_API.G_FALSE,
763: x_return_status => l_transaction_flow_status,
764: p_start_ou_id => p_purchasing_org_id,
765: p_end_ou_id => l_dest_inv_org_ou_id,
766: p_ship_to_org_id => l_dest_inv_org_id,
772: l_progress := '012';
773:
774: --If transaction flow does not exist then return error
775:
776: IF ((l_transaction_flow_status <> FND_API.G_RET_STS_SUCCESS) OR
777: l_transaction_flow_header_id is NULL) THEN
778: x_error_msg_name := 'PO_CROSS_OU_TRNX_FLOW_CHECK';
779: x_return_status := FND_API.G_RET_STS_ERROR;
780: Return;
775:
776: IF ((l_transaction_flow_status <> FND_API.G_RET_STS_SUCCESS) OR
777: l_transaction_flow_header_id is NULL) THEN
778: x_error_msg_name := 'PO_CROSS_OU_TRNX_FLOW_CHECK';
779: x_return_status := FND_API.G_RET_STS_ERROR;
780: Return;
781: END IF;
782:
783: -- Bug 3433867 Start
792: p_item_id => p_item_id,
793: p_transaction_flow_header_id => l_transaction_flow_header_id,
794: x_item_in_linv_pou => l_item_in_linv_pou);
795:
796: IF (l_transaction_flow_status <> FND_API.g_ret_sts_success) OR
797: (l_item_in_linv_pou <> 'Y')
798: THEN
799: x_error_msg_name := 'PO_ITEM_IN_LINV_POU_CHECK';
800: x_return_status := FND_API.G_RET_STS_ERROR;
796: IF (l_transaction_flow_status <> FND_API.g_ret_sts_success) OR
797: (l_item_in_linv_pou <> 'Y')
798: THEN
799: x_error_msg_name := 'PO_ITEM_IN_LINV_POU_CHECK';
800: x_return_status := FND_API.G_RET_STS_ERROR;
801: return;
802: END IF;
803:
804: END IF;
832: IF (l_purchase_basis = 'TEMP LABOR') AND
833: (l_pou_bus_group_id <> l_rou_bus_group_id)
834: THEN
835: x_error_msg_name := 'PO_CROSS_OU_SERVICES_CHECK';
836: x_return_status := FND_API.G_RET_STS_ERROR;
837: Return;
838: END IF;
839: END IF; --cross business group profile check
840:
859:
860: IF (l_is_customer_location = 'Y' AND
861: (NOT OE_CODE_CONTROL.code_release_level >= '110510')) THEN
862: x_error_msg_name := 'PO_CROSS_OU_CUST_LOC_CHECK';
863: x_return_status := FND_API.G_RET_STS_ERROR;
864: Return;
865: END IF;
866:
867: --
878: PO_CORE_S.is_encumbrance_on(p_doc_type => 'ANY',p_org_id => p_purchasing_org_id)
879: )
880: THEN
881: x_error_msg_name := 'PO_GA_ENCUMBRANCE_CHECK';
882: x_return_status := FND_API.G_RET_STS_ERROR;
883: Return;
884: END IF;
885:
886: END IF;
912: PO_CORE_S.get_inv_org_ou_id(x_return_status => x_return_status,
913: p_inv_org_id => l_dest_inv_org_id,
914: x_ou_id => l_dest_inv_org_ou_id);
915:
916: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
917: RAISE FND_API.g_exc_unexpected_error;
918: END IF;
919: END IF;
920:
913: p_inv_org_id => l_dest_inv_org_id,
914: x_ou_id => l_dest_inv_org_ou_id);
915:
916: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
917: RAISE FND_API.g_exc_unexpected_error;
918: END IF;
919: END IF;
920:
921: l_progress := '019';
919: END IF;
920:
921: l_progress := '019';
922: check_transaction_flow(
923: p_init_msg_list => FND_API.G_FALSE,
924: x_return_status => l_transaction_flow_status,
925: p_start_ou_id => p_purchasing_org_id,
926: p_end_ou_id => l_dest_inv_org_ou_id,
927: p_ship_to_org_id => l_dest_inv_org_id,
930: x_transaction_flow_header_id => l_transaction_flow_header_id
931: );
932:
933: l_progress := '020';
934: IF (l_transaction_flow_status <> FND_API.g_ret_sts_success) THEN
935: RAISE FND_API.g_exc_unexpected_error;
936: END IF;
937:
938: l_progress := '021';
931: );
932:
933: l_progress := '020';
934: IF (l_transaction_flow_status <> FND_API.g_ret_sts_success) THEN
935: RAISE FND_API.g_exc_unexpected_error;
936: END IF;
937:
938: l_progress := '021';
939: --If transaction flow exists and project is attached, return error
938: l_progress := '021';
939: --If transaction flow exists and project is attached, return error
940: IF l_transaction_flow_header_id is NOT NULL THEN
941: x_error_msg_name := 'PO_CROSS_OU_PA_PROJECT_CHECK';
942: x_return_status := FND_API.G_RET_STS_ERROR;
943: return;
944: END IF;
945:
946: END IF; -- l_pa_project is TRUE
948: END IF; -- p_requesting_org_id != p_purchasing_org_id
949: -- Bug 3379488 End
950:
951: --All checks passed. Return success
952: x_return_status := FND_API.G_RET_STS_SUCCESS;
953:
954: EXCEPTION
955: WHEN fnd_api.g_exc_error THEN
956: x_return_status := fnd_api.g_ret_sts_error;
951: --All checks passed. Return success
952: x_return_status := FND_API.G_RET_STS_SUCCESS;
953:
954: EXCEPTION
955: WHEN fnd_api.g_exc_error THEN
956: x_return_status := fnd_api.g_ret_sts_error;
957: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
958: WHEN fnd_api.g_exc_unexpected_error THEN
959: x_return_status := fnd_api.g_ret_sts_unexp_error;
952: x_return_status := FND_API.G_RET_STS_SUCCESS;
953:
954: EXCEPTION
955: WHEN fnd_api.g_exc_error THEN
956: x_return_status := fnd_api.g_ret_sts_error;
957: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
958: WHEN fnd_api.g_exc_unexpected_error THEN
959: x_return_status := fnd_api.g_ret_sts_unexp_error;
960: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
954: EXCEPTION
955: WHEN fnd_api.g_exc_error THEN
956: x_return_status := fnd_api.g_ret_sts_error;
957: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
958: WHEN fnd_api.g_exc_unexpected_error THEN
959: x_return_status := fnd_api.g_ret_sts_unexp_error;
960: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
961: WHEN OTHERS THEN
962: x_return_status := fnd_api.g_ret_sts_unexp_error;
955: WHEN fnd_api.g_exc_error THEN
956: x_return_status := fnd_api.g_ret_sts_error;
957: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
958: WHEN fnd_api.g_exc_unexpected_error THEN
959: x_return_status := fnd_api.g_ret_sts_unexp_error;
960: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
961: WHEN OTHERS THEN
962: x_return_status := fnd_api.g_ret_sts_unexp_error;
963: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name,
958: WHEN fnd_api.g_exc_unexpected_error THEN
959: x_return_status := fnd_api.g_ret_sts_unexp_error;
960: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
961: WHEN OTHERS THEN
962: x_return_status := fnd_api.g_ret_sts_unexp_error;
963: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name,
964: SUBSTRB(SQLERRM , 1 , 200) || ' at location ' || l_progress);
965: fnd_message.parse_encoded(FND_MSG_PUB.get,x_app_name,x_error_msg_name);
966: END validate_cross_ou_purchasing;
1055: );
1056:
1057: -- Set OUT parameters.
1058: --
1059: IF ( l_return_status = FND_API.G_RET_STS_SUCCESS )
1060: THEN
1061: l_valid_flag_tbl(i) := 'Y';
1062: l_error_msg_tbl(i) := NULL;
1063: ELSE
1096: --p_inv_org_id
1097: -- The inventory org ID to be validated against.
1098: --OUT:
1099: --x_return_status
1100: -- FND_API.g_ret_sts_success - if the procedure completed successfully
1101: -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
1102: --x_in_inv_org
1103: -- TRUE if:
1104: -- - item is a one-time item
1097: -- The inventory org ID to be validated against.
1098: --OUT:
1099: --x_return_status
1100: -- FND_API.g_ret_sts_success - if the procedure completed successfully
1101: -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
1102: --x_in_inv_org
1103: -- TRUE if:
1104: -- - item is a one-time item
1105: -- OR
1128: BEGIN
1129: l_progress := '000';
1130:
1131: -- Start standard API initialization
1132: IF FND_API.to_boolean(p_init_msg_list) THEN
1133: FND_MSG_PUB.initialize;
1134: END IF;
1135: x_return_status := FND_API.g_ret_sts_success;
1136: -- End standard API initialization
1131: -- Start standard API initialization
1132: IF FND_API.to_boolean(p_init_msg_list) THEN
1133: FND_MSG_PUB.initialize;
1134: END IF;
1135: x_return_status := FND_API.g_ret_sts_success;
1136: -- End standard API initialization
1137:
1138: l_progress := '010';
1139:
1201: END IF;
1202:
1203: EXCEPTION
1204: WHEN OTHERS THEN
1205: x_return_status := FND_API.g_ret_sts_unexp_error;
1206: x_in_inv_org := FALSE;
1207: FND_MSG_PUB.add_exc_msg
1208: (p_pkg_name => g_pkg_name,
1209: p_procedure_name => 'check_item_in_inventory_org',
1247: --p_item_category_id
1248: -- The category ID of the line item for this shipment
1249: --OUT:
1250: --x_return_status
1251: -- FND_API.g_ret_sts_success - if the procedure completed successfully
1252: -- FND_API.g_ret_sts_error - if an error occurred
1253: -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
1254: --x_is_valid
1255: -- TRUE if validation succeeds. FALSE otherwise.
1248: -- The category ID of the line item for this shipment
1249: --OUT:
1250: --x_return_status
1251: -- FND_API.g_ret_sts_success - if the procedure completed successfully
1252: -- FND_API.g_ret_sts_error - if an error occurred
1253: -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
1254: --x_is_valid
1255: -- TRUE if validation succeeds. FALSE otherwise.
1256: --x_in_current_sob
1249: --OUT:
1250: --x_return_status
1251: -- FND_API.g_ret_sts_success - if the procedure completed successfully
1252: -- FND_API.g_ret_sts_error - if an error occurred
1253: -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
1254: --x_is_valid
1255: -- TRUE if validation succeeds. FALSE otherwise.
1256: --x_in_current_sob
1257: -- TRUE if the ship-to org is in the current OU's set of books.
1296: BEGIN
1297: l_progress := '000';
1298:
1299: -- Start standard API initialization
1300: IF FND_API.to_boolean(p_init_msg_list) THEN
1301: FND_MSG_PUB.initialize;
1302: END IF;
1303: x_return_status := FND_API.g_ret_sts_success;
1304: -- End standard API initialization
1299: -- Start standard API initialization
1300: IF FND_API.to_boolean(p_init_msg_list) THEN
1301: FND_MSG_PUB.initialize;
1302: END IF;
1303: x_return_status := FND_API.g_ret_sts_success;
1304: -- End standard API initialization
1305:
1306: l_progress := '010';
1307:
1386: l_progress := '060';
1387:
1388: -- Try to get a valid transaction flow
1389: check_transaction_flow
1390: (p_init_msg_list => FND_API.g_false,
1391: x_return_status => l_return_status,
1392: p_start_ou_id => l_current_ou_id,
1393: p_end_ou_id => l_end_ou_id,
1394: p_ship_to_org_id => p_ship_to_org_id,
1395: p_item_category_id => p_item_category_id,
1396: p_transaction_date => SYSDATE,
1397: x_transaction_flow_header_id => x_transaction_flow_header_id);
1398:
1399: IF (l_return_status = FND_API.g_ret_sts_error) THEN
1400: l_progress := '070';
1401: RAISE FND_API.g_exc_error;
1402: ELSIF (l_return_status = FND_API.g_ret_sts_unexp_error) THEN
1403: l_progress := '080';
1397: x_transaction_flow_header_id => x_transaction_flow_header_id);
1398:
1399: IF (l_return_status = FND_API.g_ret_sts_error) THEN
1400: l_progress := '070';
1401: RAISE FND_API.g_exc_error;
1402: ELSIF (l_return_status = FND_API.g_ret_sts_unexp_error) THEN
1403: l_progress := '080';
1404: RAISE FND_API.g_exc_unexpected_error;
1405: END IF;
1398:
1399: IF (l_return_status = FND_API.g_ret_sts_error) THEN
1400: l_progress := '070';
1401: RAISE FND_API.g_exc_error;
1402: ELSIF (l_return_status = FND_API.g_ret_sts_unexp_error) THEN
1403: l_progress := '080';
1404: RAISE FND_API.g_exc_unexpected_error;
1405: END IF;
1406:
1400: l_progress := '070';
1401: RAISE FND_API.g_exc_error;
1402: ELSIF (l_return_status = FND_API.g_ret_sts_unexp_error) THEN
1403: l_progress := '080';
1404: RAISE FND_API.g_exc_unexpected_error;
1405: END IF;
1406:
1407: l_progress := '090';
1408:
1414: (x_return_status => l_return_status,
1415: p_item_id => p_item_id,
1416: p_transaction_flow_header_id => x_transaction_flow_header_id,
1417: x_item_in_linv_pou => l_item_in_linv_pou);
1418: IF l_return_status = FND_API.g_ret_sts_error THEN
1419: l_progress := '091';
1420: RAISE FND_API.g_exc_error;
1421: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
1422: l_progress := '092';
1416: p_transaction_flow_header_id => x_transaction_flow_header_id,
1417: x_item_in_linv_pou => l_item_in_linv_pou);
1418: IF l_return_status = FND_API.g_ret_sts_error THEN
1419: l_progress := '091';
1420: RAISE FND_API.g_exc_error;
1421: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
1422: l_progress := '092';
1423: RAISE FND_API.g_exc_unexpected_error;
1424: ELSIF l_return_status = FND_API.g_ret_sts_success
1417: x_item_in_linv_pou => l_item_in_linv_pou);
1418: IF l_return_status = FND_API.g_ret_sts_error THEN
1419: l_progress := '091';
1420: RAISE FND_API.g_exc_error;
1421: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
1422: l_progress := '092';
1423: RAISE FND_API.g_exc_unexpected_error;
1424: ELSIF l_return_status = FND_API.g_ret_sts_success
1425: AND (l_item_in_linv_pou <> 'Y') THEN
1419: l_progress := '091';
1420: RAISE FND_API.g_exc_error;
1421: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
1422: l_progress := '092';
1423: RAISE FND_API.g_exc_unexpected_error;
1424: ELSIF l_return_status = FND_API.g_ret_sts_success
1425: AND (l_item_in_linv_pou <> 'Y') THEN
1426: x_is_valid := FALSE;
1427: x_transaction_flow_header_id := NULL;
1420: RAISE FND_API.g_exc_error;
1421: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
1422: l_progress := '092';
1423: RAISE FND_API.g_exc_unexpected_error;
1424: ELSIF l_return_status = FND_API.g_ret_sts_success
1425: AND (l_item_in_linv_pou <> 'Y') THEN
1426: x_is_valid := FALSE;
1427: x_transaction_flow_header_id := NULL;
1428: ELSE
1460: p_value => x_is_valid);
1461: END IF;
1462:
1463: EXCEPTION
1464: WHEN FND_API.g_exc_error THEN
1465: -- There should be an error message appended to the API message list
1466: x_return_status := FND_API.g_ret_sts_error;
1467: x_is_valid := FALSE;
1468: IF g_debug_stmt THEN
1462:
1463: EXCEPTION
1464: WHEN FND_API.g_exc_error THEN
1465: -- There should be an error message appended to the API message list
1466: x_return_status := FND_API.g_ret_sts_error;
1467: x_is_valid := FALSE;
1468: IF g_debug_stmt THEN
1469: PO_DEBUG.debug_stmt
1470: (p_log_head => g_module_prefix||'validate_ship_to_org',
1470: (p_log_head => g_module_prefix||'validate_ship_to_org',
1471: p_token => l_progress,
1472: p_message => 'Expected error occurred.');
1473: END IF;
1474: WHEN FND_API.g_exc_unexpected_error THEN
1475: -- There should be an error message appended to the API message list
1476: x_return_status := FND_API.g_ret_sts_unexp_error;
1477: x_is_valid := FALSE;
1478: IF g_debug_unexp THEN
1472: p_message => 'Expected error occurred.');
1473: END IF;
1474: WHEN FND_API.g_exc_unexpected_error THEN
1475: -- There should be an error message appended to the API message list
1476: x_return_status := FND_API.g_ret_sts_unexp_error;
1477: x_is_valid := FALSE;
1478: IF g_debug_unexp THEN
1479: PO_DEBUG.debug_exc
1480: (p_log_head => g_module_prefix||'validate_ship_to_org',
1480: (p_log_head => g_module_prefix||'validate_ship_to_org',
1481: p_progress => l_progress);
1482: END IF;
1483: WHEN OTHERS THEN
1484: x_return_status := FND_API.g_ret_sts_unexp_error;
1485: x_is_valid := FALSE;
1486: FND_MSG_PUB.add_exc_msg(p_pkg_name => g_pkg_name,
1487: p_procedure_name => 'validate_ship_to_org',
1488: p_error_text => 'Progress: '||l_progress||
1581: x_is_purchasable => l_is_purchasable,
1582: x_is_same_uom_class => l_is_same_uom_class,
1583: x_is_not_osp_item => l_is_not_osp_item);
1584:
1585: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
1586: RAISE FND_API.g_exc_unexpected_error;
1587: END IF;
1588:
1589: IF NOT l_is_purchasable
1582: x_is_same_uom_class => l_is_same_uom_class,
1583: x_is_not_osp_item => l_is_not_osp_item);
1584:
1585: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
1586: RAISE FND_API.g_exc_unexpected_error;
1587: END IF;
1588:
1589: IF NOT l_is_purchasable
1590: THEN
1588:
1589: IF NOT l_is_purchasable
1590: THEN
1591: x_item_valid_msg_name := 'PO_CROSS_OU_ITEM_PURCH_CHECK';
1592: RAISE FND_API.g_exc_error;
1593:
1594: ELSIF NOT l_is_same_uom_class
1595: THEN
1596: x_item_valid_msg_name := 'PO_CROSS_OU_UOM_CHECK';
1593:
1594: ELSIF NOT l_is_same_uom_class
1595: THEN
1596: x_item_valid_msg_name := 'PO_CROSS_OU_UOM_CHECK';
1597: RAISE FND_API.g_exc_error;
1598:
1599: ELSIF (p_do_osp_check AND NOT l_is_not_osp_item)
1600: THEN
1601: x_item_valid_msg_name := 'PO_CROSS_OU_OSP_CHECK';
1598:
1599: ELSIF (p_do_osp_check AND NOT l_is_not_osp_item)
1600: THEN
1601: x_item_valid_msg_name := 'PO_CROSS_OU_OSP_CHECK';
1602: RAISE FND_API.g_exc_error;
1603: END IF;
1604:
1605: EXCEPTION
1606: WHEN FND_API.g_exc_error THEN
1602: RAISE FND_API.g_exc_error;
1603: END IF;
1604:
1605: EXCEPTION
1606: WHEN FND_API.g_exc_error THEN
1607: x_return_status := FND_API.g_ret_sts_error;
1608: WHEN FND_API.g_exc_unexpected_error THEN
1609: x_return_status := FND_API.g_ret_sts_unexp_error;
1610: WHEN OTHERS THEN
1603: END IF;
1604:
1605: EXCEPTION
1606: WHEN FND_API.g_exc_error THEN
1607: x_return_status := FND_API.g_ret_sts_error;
1608: WHEN FND_API.g_exc_unexpected_error THEN
1609: x_return_status := FND_API.g_ret_sts_unexp_error;
1610: WHEN OTHERS THEN
1611: x_return_status := FND_API.g_ret_sts_unexp_error;
1604:
1605: EXCEPTION
1606: WHEN FND_API.g_exc_error THEN
1607: x_return_status := FND_API.g_ret_sts_error;
1608: WHEN FND_API.g_exc_unexpected_error THEN
1609: x_return_status := FND_API.g_ret_sts_unexp_error;
1610: WHEN OTHERS THEN
1611: x_return_status := FND_API.g_ret_sts_unexp_error;
1612: FND_MSG_PUB.add_exc_msg(p_pkg_name => g_pkg_name,
1605: EXCEPTION
1606: WHEN FND_API.g_exc_error THEN
1607: x_return_status := FND_API.g_ret_sts_error;
1608: WHEN FND_API.g_exc_unexpected_error THEN
1609: x_return_status := FND_API.g_ret_sts_unexp_error;
1610: WHEN OTHERS THEN
1611: x_return_status := FND_API.g_ret_sts_unexp_error;
1612: FND_MSG_PUB.add_exc_msg(p_pkg_name => g_pkg_name,
1613: p_procedure_name => 'do_item_validity_checks',
1607: x_return_status := FND_API.g_ret_sts_error;
1608: WHEN FND_API.g_exc_unexpected_error THEN
1609: x_return_status := FND_API.g_ret_sts_unexp_error;
1610: WHEN OTHERS THEN
1611: x_return_status := FND_API.g_ret_sts_unexp_error;
1612: FND_MSG_PUB.add_exc_msg(p_pkg_name => g_pkg_name,
1613: p_procedure_name => 'do_item_validity_checks',
1614: p_error_text => NULL);
1615: IF g_debug_unexp THEN
1728: --p_item_id
1729: -- Item ID, unqiue identifier of items
1730: --OUT
1731: --x_return_status:
1732: -- FND_API.g_ret_sts_success: if the procedure completed successfully
1733: -- FND_API.g_ret_sts_unexp_error: if unexpected error occured
1734: --x_item_in_linv_pou
1735: -- If 'Y', the item exists in the logical inventory org of the POU; otherwise,
1736: -- it does not
1729: -- Item ID, unqiue identifier of items
1730: --OUT
1731: --x_return_status:
1732: -- FND_API.g_ret_sts_success: if the procedure completed successfully
1733: -- FND_API.g_ret_sts_unexp_error: if unexpected error occured
1734: --x_item_in_linv_pou
1735: -- If 'Y', the item exists in the logical inventory org of the POU; otherwise,
1736: -- it does not
1737: --End of Comments
1760: || p_transaction_flow_header_id
1761: || 'Item id: ' || p_item_id);
1762: END IF;
1763:
1764: x_return_status := FND_API.g_ret_sts_success;
1765: x_item_in_linv_pou := 'N';
1766:
1767: IF p_transaction_flow_header_id IS NULL THEN
1768: return;
1791: p_item_revision => NULL,
1792: p_inv_org_id => l_logical_inv_org_id,
1793: x_in_inv_org => l_item_in_inv_org
1794: );
1795: IF x_return_status <> FND_API.g_ret_sts_success THEN
1796: l_progress := '040';
1797: RAISE FND_API.g_exc_unexpected_error;
1798: END IF;
1799: ELSE
1793: x_in_inv_org => l_item_in_inv_org
1794: );
1795: IF x_return_status <> FND_API.g_ret_sts_success THEN
1796: l_progress := '040';
1797: RAISE FND_API.g_exc_unexpected_error;
1798: END IF;
1799: ELSE
1800: l_progress := '050';
1801: x_return_status := FND_API.g_ret_sts_unexp_error;
1797: RAISE FND_API.g_exc_unexpected_error;
1798: END IF;
1799: ELSE
1800: l_progress := '050';
1801: x_return_status := FND_API.g_ret_sts_unexp_error;
1802: RAISE FND_API.g_exc_unexpected_error;
1803: END IF;
1804:
1805: l_progress := '060';
1798: END IF;
1799: ELSE
1800: l_progress := '050';
1801: x_return_status := FND_API.g_ret_sts_unexp_error;
1802: RAISE FND_API.g_exc_unexpected_error;
1803: END IF;
1804:
1805: l_progress := '060';
1806:
1809: END IF;
1810:
1811: EXCEPTION
1812: WHEN OTHERS THEN
1813: x_return_status := FND_API.g_ret_sts_unexp_error;
1814: x_item_in_linv_pou := 'N';
1815: IF g_debug_unexp THEN
1816: PO_DEBUG.debug_exc(p_log_head => l_log_head,
1817: p_progress => l_progress);