78:
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;
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:
91: IF g_debug_stmt THEN
390: l_is_SPS_distribution BOOLEAN := FALSE;
391: BEGIN
392: -- A distribution is a SPS distribution, if it meets the following 4
393: -- conditions:
394: -- 1. The PO is a Standard PO.
395: -- 2. DOU <> POU.
396: -- 3. A transaction flow is defined between DOU and POU.
397: -- 4. For Expense destination types, NO Project is specified on the
398: -- distribution.
396: -- 3. A transaction flow is defined between DOU and POU.
397: -- 4. For Expense destination types, NO Project is specified on the
398: -- distribution.
399: l_is_SPS_distribution := FALSE;
400: IF ( (p_document_type_code = 'STANDARD') AND
401: (p_ship_to_ou_id <> p_purchasing_ou_id) AND
402: (p_transaction_flow_header_id IS NOT NULL) ) THEN
403: l_is_SPS_distribution := TRUE;
404: END IF;
480: -- None.
481: --Function:
482: -- This function validates that its OK to cross operating unit boundaries
483: -- for creation of Purchase Order. Following checks are done
484: -- (checks 1, 2, 4, 5, 6, 7, 8, 9, and 10 are performed only for Standard POs;
485: -- for Global Agreements, these checks will be performed upon creation
486: -- of the Standard PO release).
487: -- 1. Line is not VMI enabled
488: -- 2. Consigned relationship should not exist
482: -- This function validates that its OK to cross operating unit boundaries
483: -- for creation of Purchase Order. Following checks are done
484: -- (checks 1, 2, 4, 5, 6, 7, 8, 9, and 10 are performed only for Standard POs;
485: -- for Global Agreements, these checks will be performed upon creation
486: -- of the Standard PO release).
487: -- 1. Line is not VMI enabled
488: -- 2. Consigned relationship should not exist
489: -- 3. Item is valid in the involved Operating Units
490: -- 4. PA Project reference for destination type of expense should not exist
500: -- Purchasing Org should not be different than Requesting Org
501: --Parameters:
502: --IN
503: --p_api_version
504: -- standard parameter which specifies the API version
505: --p_requisition_line_id
506: -- The req line which needs to investigated
507: --p_requesting_org_id
508: -- The OU of requisition raising OU
517: -- 'Y' or 'N' indicating whether line is vmi enabled
518: --p_cons_from_supp_flag
519: -- 'Y' or 'N' corresponding to consigned_from_supp_flag
520: -- This attribute is obtained from ASL attributes.
521: --p_document_type DEFAULT 'STANDARD'
522: -- Document Type of the outcome document.
523: --OUT
524: --x_return_status
525: -- Standard return status parameter. This parameter tells
521: --p_document_type DEFAULT 'STANDARD'
522: -- Document Type of the outcome document.
523: --OUT
524: --x_return_status
525: -- Standard return status parameter. This parameter tells
526: -- whether all validations are passed.
527: --x_errormsg_name
528: -- This parameter contains relevant message when return status is
529: -- not G_RET_STS_SUCCESS
544: p_vmi_flag IN VARCHAR2,
545: p_cons_from_supp_flag IN VARCHAR2,
546: x_return_status OUT NOCOPY VARCHAR2,
547: x_error_msg_name OUT NOCOPY VARCHAR2,
548: p_document_type IN VARCHAR2 := 'STANDARD' --
550: IS
551:
552: l_pa_project BOOLEAN := FALSE;
571:
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
592: l_progress := '003';
593:
594: --CHECK 1: The line should not be VMI enabled
595:
596: IF ( p_document_type = 'STANDARD' ) THEN --
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;
606: l_progress := '004';
607:
608: --CHECK 2: If Consigned relationship exists then we error out
609:
610: IF ( p_document_type = 'STANDARD' ) THEN --
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;
673: --CHECK 4:Procurement across OUs is not supported for PA Projects
674: --Check whether destination type is expense for the line and project_id
675: --field on the corresponding distribution line is not NULL
676:
677: IF ( p_document_type = 'STANDARD' ) THEN --
679: l_pa_project := is_pa_project_referenced(p_requisition_line_id);
680:
681: IF l_pa_project THEN
703:
704: --CHECK 5:Procurment across OUs is not supported for OPM enabled
705: --destination inventory orgs
706:
707: IF ( p_document_type = 'STANDARD' ) THEN --
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';
734:
735: --CHECK 6:If (DOU=POU)<>ROU then we are preventing the PO creation.
736: --This is scoped out due to accounting complexities
737:
738: IF ( p_document_type = 'STANDARD' ) THEN --
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
755: --If the category_id is NOT NULL then we use it to find flow. The
756: --API forst check if a flow exists with given category otherwise it
757: --tries to find a non category specific transaction flow.
758:
759: IF ( p_document_type = 'STANDARD' ) THEN --
761: Check_transaction_flow(
762: p_init_msg_list => FND_API.G_FALSE,
763: x_return_status => l_transaction_flow_status,
803:
804: END IF;
805: -- Bug 3433867 End
806:
807: END IF; -- ( p_document_type = 'STANDARD' )
808:
809: l_progress := '013';
810:
811: --CHECK 8:For Services Line type, if 'HR: Cross Business Groups' is NO
811: --CHECK 8:For Services Line type, if 'HR: Cross Business Groups' is NO
812: --then ROU and POU should rollup to the same Business Group
813: --Identify if the line type is SERVICE type
814:
815: IF ( p_document_type = 'STANDARD' ) THEN --
817: IF nvl(hr_general.get_xbg_profile, 'N') = 'N' THEN
818:
819: SELECT prl.purchase_basis,
869:
870: --CHECK 10: If Encumbrance is enabled for Purchasing/Requesting Org and
871: --purchasing org is different than requesting org then we error out
872:
873: IF ( p_document_type = 'STANDARD' ) THEN --
875: IF p_requesting_org_id <> p_purchasing_org_id AND
876: (PO_CORE_S.is_encumbrance_on(p_doc_type => 'ANY',p_org_id => p_requesting_org_id)
877: OR
1127:
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;
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:
1140: IF g_debug_stmt THEN
1240: -- Appends to the API message list upon error.
1241: --Parameters:
1242: --IN:
1243: --p_init_msg_list
1244: -- Standard API parameter to initialize message list.
1245: --p_ship_to_org_id
1246: -- The ship-to org ID
1247: --p_item_category_id
1248: -- The category ID of the line item for this shipment
1295:
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;
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:
1308: IF g_debug_stmt THEN