4496: THEN
4497: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4498: END IF;
4499:
4500: aso_debug_pub.g_debug_flag := nvl(fnd_profile.value('ASO_ENABLE_DEBUG'),'N');
4501:
4502: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
4503: aso_debug_pub.add('Start of Validate_Promotion .....',1,'Y');
4504: END IF;
4977: END IF;
4978:
4979: -- Inititalizing Global Debug Flag Variable.
4980:
4981: aso_debug_pub.g_debug_flag := nvl(fnd_profile.value('ASO_ENABLE_DEBUG'),'N');
4982:
4983: -- Initialize API return status to success
4984: x_return_status := FND_API.G_RET_STS_SUCCESS;
4985:
5035: END IF;
5036:
5037: -- Inititalizing Global Debug Flag Variable.
5038:
5039: aso_debug_pub.g_debug_flag := nvl(fnd_profile.value('ASO_ENABLE_DEBUG'),'N');
5040:
5041: -- Initialize API return status to success
5042: x_return_status := FND_API.G_RET_STS_SUCCESS;
5043:
5123: END IF;
5124:
5125: -- Inititalizing Global Debug Flag Variable.
5126:
5127: aso_debug_pub.g_debug_flag := nvl(fnd_profile.value('ASO_ENABLE_DEBUG'),'N');
5128:
5129: -- Initialize API return status to success
5130: x_return_status := FND_API.G_RET_STS_SUCCESS;
5131:
6010: l_manager_flag VARCHAR2(1);
6011:
6012: BEGIN
6013:
6014: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'F' THEN --Base Query
6015:
6016: aso_debug_pub.add('Before Opening the cursor...C_CUST_PARTY', 1, 'Y');
6017:
6018: OPEN C_CUST_PARTY ;
6072: aso_debug_pub.add('After Closing the Cursor...C_CUST_PARTY', 1, 'Y');
6073: END IF;
6074:
6075:
6076: IF (NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'T' AND p_resource_id IS NOT NULL) THEN
6077:
6078: aso_debug_pub.add('Before Opening the cursor...C_Mgr_Check', 1, 'Y');
6079: OPEN C_Mgr_Check ; --Assigning the manager flag
6080: aso_debug_pub.add('After Opening the cursor...C_Mgr_Check', 1, 'Y');
6517: BEGIN
6518:
6519: --Case:1 ==================================Enforced Account Relationship is set to 'Y'(Start)=========================================================
6520:
6521: IF NVL(FND_PROFILE.value('ASO_ENFORCE_ACCOUNT_RELATIONSHIPS'),'N') = 'Y'
6522: AND p_cust_acct_id IS NOT NULL THEN
6523:
6524: IF P_FLAG = 'BILL' THEN
6525: aso_debug_pub.add('Before Opening the cursor...C_INVOICE_TO_CUSTOMER', 1, 'Y');
6588: END IF;
6589:
6590: --Case:2==================================Enforced Account Relationship is set to 'N' =========================================================
6591:
6592: IF NVL(FND_PROFILE.value('ASO_ENFORCE_ACCOUNT_RELATIONSHIPS'),'N') = 'N' THEN
6593: --Case 2a
6594: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'F' THEN --Put the base query
6595: aso_debug_pub.add('Before Opening the cursor...C_CUSTOMER', 1, 'Y');
6596: OPEN C_CUSTOMER ;
6590: --Case:2==================================Enforced Account Relationship is set to 'N' =========================================================
6591:
6592: IF NVL(FND_PROFILE.value('ASO_ENFORCE_ACCOUNT_RELATIONSHIPS'),'N') = 'N' THEN
6593: --Case 2a
6594: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'F' THEN --Put the base query
6595: aso_debug_pub.add('Before Opening the cursor...C_CUSTOMER', 1, 'Y');
6596: OPEN C_CUSTOMER ;
6597: aso_debug_pub.add('Before Fetching the cursor...C_CUSTOMER', 1, 'Y');
6598: FETCH C_CUSTOMER INTO l_data_exists ;
6655: END IF;
6656:
6657: --Case 2b
6658:
6659: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'T' then --Check for the manager flag
6660:
6661: OPEN C_Mgr_Check ; --Assigning the manager flag
6662: FETCH C_Mgr_Check INTO l_data_exists ;
6663: IF C_Mgr_Check%FOUND THEN
7045:
7046: BEGIN
7047:
7048: --Case:1 ==================================Enforced Account Relationship is set to 'Y'(Start)=========================================================
7049: IF NVL(FND_PROFILE.value('ASO_ENFORCE_ACCOUNT_RELATIONSHIPS'),'N') = 'Y' then
7050:
7051: IF P_FLAG = 'BILL' THEN
7052: aso_debug_pub.add('Before opening the cursor...C_INVOICE_TO_CUST_ACCOUNT', 1, 'Y');
7053: OPEN C_INVOICE_TO_CUST_ACCOUNT;
7113: END IF;
7114: END IF;
7115: --Case:2==================================Enforced Account Relationship is set to 'N' =========================================================
7116:
7117: IF NVL(FND_PROFILE.value('ASO_ENFORCE_ACCOUNT_RELATIONSHIPS'),'N') = 'N' THEN
7118:
7119: --Case 2a
7120: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'F' THEN --Put the base query
7121: aso_debug_pub.add('Before Opening the cursor...C_CUST_ACCOUNT', 1, 'Y');
7116:
7117: IF NVL(FND_PROFILE.value('ASO_ENFORCE_ACCOUNT_RELATIONSHIPS'),'N') = 'N' THEN
7118:
7119: --Case 2a
7120: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'F' THEN --Put the base query
7121: aso_debug_pub.add('Before Opening the cursor...C_CUST_ACCOUNT', 1, 'Y');
7122: OPEN C_CUST_ACCOUNT;
7123: aso_debug_pub.add('Before Fetching the cursor...C_CUST_ACCOUNT', 1, 'Y');
7124: FETCH C_CUST_ACCOUNT INTO l_data_exists ;
7174:
7175: END IF;
7176:
7177: --Case 2b
7178: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'T' then --Check for the manager flag
7179:
7180: OPEN C_Mgr_Check ; --Assigning the manager flag
7181: FETCH C_Mgr_Check INTO l_data_exists ;
7182:
7802:
7803: BEGIN
7804: --case:1 When sold-to or End Customer customer is specified
7805:
7806: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'F' AND p_cust_party_id is not null THEN
7807: aso_debug_pub.add('Before opeing the cursor...C_SOLD_TO_ACCOUNT', 1, 'Y');
7808: OPEN C_SOLD_TO_ACCOUNT;
7809: FETCH C_SOLD_TO_ACCOUNT INTO l_data_exists ;
7810:
7851: END IF;
7852:
7853: --Case:2 When ASN:Customer Access Privilege is set to Sales Team and resource_id is not null
7854:
7855: IF NVL(FND_PROFILE.VALUE('ASN_CUST_ACCESS'),'T') = 'T' AND p_resource_id IS NOT NULL THEN
7856:
7857:
7858: OPEN C_Mgr_Check; --Checking the manager flag
7859: FETCH C_Mgr_Check INTO l_data_exists ;
8374: END;
8375:
8376: BEGIN
8377:
8378: aso_debug_pub.g_debug_flag := nvl(fnd_profile.value('ASO_ENABLE_DEBUG'),'N');
8379:
8380: IF aso_debug_pub.g_debug_flag = 'Y' THEN
8381: aso_debug_pub.add('******************************************************', 1, 'Y');
8382: aso_debug_pub.add('Begin VALIDATE_DEFAULTING_DATA', 1, 'Y');
8416: END IF;
8417:
8418:
8419: --For charged periodicity
8420: l_periodicity_profile := FND_PROFILE.value('ONT_UOM_CLASS_CHARGE_PERIODICITY');
8421: IF aso_debug_pub.g_debug_flag = 'Y' THEN
8422: aso_debug_pub.add('Value of profile ONT_UOM_CLASS_CHARGE_PERIODICITY : '||l_periodicity_profile, 1, 'Y');
8423: END IF;
8424: