23: p_cust_account_rec IN OUT NOCOPY CUST_ACCOUNT_REC_TYPE,
24: p_person_rec IN OUT NOCOPY HZ_PARTY_V2PUB.PERSON_REC_TYPE,
25: p_organization_rec IN OUT NOCOPY HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE,
26: p_customer_profile_rec IN OUT NOCOPY HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE,
27: p_create_profile_amt IN VARCHAR2 := FND_API.G_TRUE,
28: x_cust_account_id OUT NOCOPY NUMBER,
29: x_account_number OUT NOCOPY VARCHAR2,
30: x_party_id OUT NOCOPY NUMBER,
31: x_party_number OUT NOCOPY VARCHAR2,
142: *
143: * ARGUMENTS
144: * IN:
145: * p_entity_type Either 'PERSON' or 'ORGANIZATION'.
146: * p_create_profile_amt If it is set to FND_API.G_TRUE, API create customer
147: * profile amounts by copying corresponding data
148: * from customer profile class amounts.
149: * IN/OUT:
150: * p_cust_account_rec Customer account record.
158: * API ceates a organization party based on this record.
159: * p_customer_profile_rec Customer profile record. One customer account
160: * must have a customer profile.
161: * x_return_status Return status after the call. The status can
162: * be FND_API.G_RET_STS_SUCCESS (success),
163: * FND_API.G_RET_STS_ERROR (error),
164: * OUT:
165: * x_cust_account_id Customer account ID.
166: * x_account_number Customer account number.
159: * p_customer_profile_rec Customer profile record. One customer account
160: * must have a customer profile.
161: * x_return_status Return status after the call. The status can
162: * be FND_API.G_RET_STS_SUCCESS (success),
163: * FND_API.G_RET_STS_ERROR (error),
164: * OUT:
165: * x_cust_account_id Customer account ID.
166: * x_account_number Customer account number.
167: * x_party_id Party ID of the party which this account belongs to.
243: p_prefix=>l_debug_prefix,
244: p_msg_level=>fnd_log.level_procedure);
245: END IF;
246:
247: if (p_cust_account_rec.orig_system is null OR p_cust_account_rec.orig_system = fnd_api.g_miss_char)
248: and (p_cust_account_rec.orig_system_reference is not null and
249: p_cust_account_rec.orig_system_reference <> fnd_api.g_miss_char)
250: then
251: p_cust_account_rec.orig_system := 'UNKNOWN';
245: END IF;
246:
247: if (p_cust_account_rec.orig_system is null OR p_cust_account_rec.orig_system = fnd_api.g_miss_char)
248: and (p_cust_account_rec.orig_system_reference is not null and
249: p_cust_account_rec.orig_system_reference <> fnd_api.g_miss_char)
250: then
251: p_cust_account_rec.orig_system := 'UNKNOWN';
252: end if;
253:
266: p_cust_account_rec => p_cust_account_rec,
267: p_rowid => NULL,
268: x_return_status => x_return_status );
269:
270: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
271: RAISE FND_API.G_EXC_ERROR;
272: END IF;
273:
274: -- Check if account is being create for an existing party.
267: p_rowid => NULL,
268: x_return_status => x_return_status );
269:
270: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
271: RAISE FND_API.G_EXC_ERROR;
272: END IF;
273:
274: -- Check if account is being create for an existing party.
275: -- Otherwise, create a new party and an account for this party.
280: l_party_id := p_organization_rec.party_rec.party_id;
281: END IF;
282:
283: IF l_party_id IS NOT NULL AND
284: l_party_id <> FND_API.G_MISS_NUM
285: THEN
286: BEGIN
287: SELECT party_type INTO l_party_type
288: FROM HZ_PARTIES
292: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_INVALID_PARTY_TYPE' );
293: FND_MESSAGE.SET_TOKEN( 'PARTY_ID', l_party_id);
294: FND_MESSAGE.SET_TOKEN( 'TYPE', p_entity_type);
295: FND_MSG_PUB.ADD;
296: RAISE FND_API.G_EXC_ERROR;
297: END IF;
298:
299: -- can go ahead and create an account for this existing party.
300:
310: */
311:
312: IF p_entity_type = 'PERSON' THEN
313: IF p_person_rec.party_rec.orig_system_reference IS NOT NULL AND
314: p_person_rec.party_rec.orig_system_reference <> FND_API.G_MISS_CHAR AND
315: p_person_rec.party_rec.orig_system IS NOT NULL AND
316: p_person_rec.party_rec.orig_system <> FND_API.G_MISS_CHAR THEN
317:
318: BEGIN
312: IF p_entity_type = 'PERSON' THEN
313: IF p_person_rec.party_rec.orig_system_reference IS NOT NULL AND
314: p_person_rec.party_rec.orig_system_reference <> FND_API.G_MISS_CHAR AND
315: p_person_rec.party_rec.orig_system IS NOT NULL AND
316: p_person_rec.party_rec.orig_system <> FND_API.G_MISS_CHAR THEN
317:
318: BEGIN
319: SELECT owner_table_id /* party_id would also do */
320: INTO l_party_id
336: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_INVALID_PARTY_TYPE' );
337: FND_MESSAGE.SET_TOKEN( 'PARTY_ID', l_party_id);
338: FND_MESSAGE.SET_TOKEN( 'TYPE', p_entity_type);
339: FND_MSG_PUB.ADD;
340: RAISE FND_API.G_EXC_ERROR;
341: END IF;
342: EXCEPTION
343: WHEN NO_DATA_FOUND THEN
344: l_create_party := TRUE;
348: END IF;
349:
350: ELSE -- i.e. p_entity_type = 'ORGANIZATION'
351: IF p_organization_rec.party_rec.orig_system_reference IS NOT NULL AND
352: p_organization_rec.party_rec.orig_system_reference <> FND_API.G_MISS_CHAR AND
353: p_organization_rec.party_rec.orig_system IS NOT NULL AND
354: p_organization_rec.party_rec.orig_system <> FND_API.G_MISS_CHAR THEN
355:
356: BEGIN
350: ELSE -- i.e. p_entity_type = 'ORGANIZATION'
351: IF p_organization_rec.party_rec.orig_system_reference IS NOT NULL AND
352: p_organization_rec.party_rec.orig_system_reference <> FND_API.G_MISS_CHAR AND
353: p_organization_rec.party_rec.orig_system IS NOT NULL AND
354: p_organization_rec.party_rec.orig_system <> FND_API.G_MISS_CHAR THEN
355:
356: BEGIN
357: SELECT owner_table_id /* party_id would also do */
358: INTO l_party_id
374: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_INVALID_PARTY_TYPE' );
375: FND_MESSAGE.SET_TOKEN( 'PARTY_ID', l_party_id);
376: FND_MESSAGE.SET_TOKEN( 'TYPE', p_entity_type);
377: FND_MSG_PUB.ADD;
378: RAISE FND_API.G_EXC_ERROR;
379: END IF;
380: EXCEPTION
381: WHEN NO_DATA_FOUND THEN
382: l_create_party := TRUE;
432: x_msg_count => l_msg_count,
433: x_msg_data => l_msg_data );
434: END IF;
435:
436: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
437: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
438: RAISE FND_API.G_EXC_ERROR;
439: ELSE
440: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
433: x_msg_data => l_msg_data );
434: END IF;
435:
436: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
437: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
438: RAISE FND_API.G_EXC_ERROR;
439: ELSE
440: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
441: END IF;
434: END IF;
435:
436: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
437: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
438: RAISE FND_API.G_EXC_ERROR;
439: ELSE
440: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
441: END IF;
442: END IF;
436: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
437: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
438: RAISE FND_API.G_EXC_ERROR;
439: ELSE
440: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
441: END IF;
442: END IF;
443:
444: l_party_usg_validation_level := HZ_PARTY_USG_ASSIGNMENT_PVT.G_VALID_LEVEL_NONE;
570: p_prefix=>l_debug_prefix,
571: p_msg_level=>fnd_log.level_procedure);
572: END IF;
573:
574: if (p_cust_account_rec.orig_system is not null and p_cust_account_rec.orig_system <>fnd_api.g_miss_char)
575: then
576: l_orig_system_ref_rec.orig_system := p_cust_account_rec.orig_system;
577: l_orig_system_ref_rec.orig_system_reference := l_orig_system_reference;
578: l_orig_system_ref_rec.owner_table_name := 'HZ_CUST_ACCOUNTS';
579: l_orig_system_ref_rec.owner_table_id := p_cust_account_rec.cust_account_id;
580: l_orig_system_ref_rec.created_by_module := p_cust_account_rec.created_by_module;
581:
582: hz_orig_system_ref_pub.create_orig_system_reference(
583: FND_API.G_FALSE,
584: l_orig_system_ref_rec,
585: x_return_status,
586: l_msg_count,
587: l_msg_data);
584: l_orig_system_ref_rec,
585: x_return_status,
586: l_msg_count,
587: l_msg_data);
588: IF x_return_status <> fnd_api.g_ret_sts_success THEN
589: RAISE FND_API.G_EXC_ERROR;
590: END IF;
591:
592: end if;
585: x_return_status,
586: l_msg_count,
587: l_msg_data);
588: IF x_return_status <> fnd_api.g_ret_sts_success THEN
589: RAISE FND_API.G_EXC_ERROR;
590: END IF;
591:
592: end if;
593:
609: --bug 2310474: add party_id for Cust Account Profile
610: p_customer_profile_rec.party_id := l_party_id;
611:
612: IF p_customer_profile_rec.site_use_id IS NOT NULL AND
613: p_customer_profile_rec.site_use_id <> FND_API.G_MISS_NUM
614: THEN
615: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_COLUMN_SHOULD_BE_NULL' );
616: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'site_use_id' );
617: FND_MESSAGE.SET_TOKEN( 'TABLE', 'hz_customer_profiles' );
615: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_COLUMN_SHOULD_BE_NULL' );
616: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'site_use_id' );
617: FND_MESSAGE.SET_TOKEN( 'TABLE', 'hz_customer_profiles' );
618: FND_MSG_PUB.ADD;
619: RAISE FND_API.G_EXC_ERROR;
620: END IF;
621:
622: p_customer_profile_rec.created_by_module := p_cust_account_rec.created_by_module;
623: p_customer_profile_rec.application_id := p_cust_account_rec.application_id;
629: x_return_status => x_return_status,
630: x_msg_count => l_msg_count,
631: x_msg_data => l_msg_data );
632:
633: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
634: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
635: RAISE FND_API.G_EXC_ERROR;
636: ELSE
637: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
630: x_msg_count => l_msg_count,
631: x_msg_data => l_msg_data );
632:
633: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
634: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
635: RAISE FND_API.G_EXC_ERROR;
636: ELSE
637: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
638: END IF;
631: x_msg_data => l_msg_data );
632:
633: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
634: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
635: RAISE FND_API.G_EXC_ERROR;
636: ELSE
637: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
638: END IF;
639: END IF;
633: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
634: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
635: RAISE FND_API.G_EXC_ERROR;
636: ELSE
637: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
638: END IF;
639: END IF;
640:
641: --
663: );
664: END IF;
665: CLOSE c_has_active_account;
666:
667: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
668: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
669: RAISE FND_API.G_EXC_ERROR;
670: ELSE
671: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
664: END IF;
665: CLOSE c_has_active_account;
666:
667: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
668: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
669: RAISE FND_API.G_EXC_ERROR;
670: ELSE
671: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
672: END IF;
665: CLOSE c_has_active_account;
666:
667: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
668: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
669: RAISE FND_API.G_EXC_ERROR;
670: ELSE
671: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
672: END IF;
673: END IF;
667: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
668: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
669: RAISE FND_API.G_EXC_ERROR;
670: ELSE
671: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
672: END IF;
673: END IF;
674:
675: x_cust_account_id := p_cust_account_rec.cust_account_id;
701: * IN/OUT:
702: * p_cust_account_rec Customer account record.
703: * p_object_version_number Used for locking the being updated record.
704: * x_return_status Return status after the call. The status can
705: * be FND_API.G_RET_STS_SUCCESS (success),
706: * FND_API.G_RET_STS_ERROR (error),
707: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
708: *
709: * NOTES
702: * p_cust_account_rec Customer account record.
703: * p_object_version_number Used for locking the being updated record.
704: * x_return_status Return status after the call. The status can
705: * be FND_API.G_RET_STS_SUCCESS (success),
706: * FND_API.G_RET_STS_ERROR (error),
707: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
708: *
709: * NOTES
710: * This procedure should always raise exception to main API.
703: * p_object_version_number Used for locking the being updated record.
704: * x_return_status Return status after the call. The status can
705: * be FND_API.G_RET_STS_SUCCESS (success),
706: * FND_API.G_RET_STS_ERROR (error),
707: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
708: *
709: * NOTES
710: * This procedure should always raise exception to main API.
711: *
778: THEN
779: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_RECORD_CHANGED' );
780: FND_MESSAGE.SET_TOKEN( 'TABLE', 'hz_cust_accounts' );
781: FND_MSG_PUB.ADD;
782: RAISE FND_API.G_EXC_ERROR;
783: END IF;
784:
785: p_object_version_number := NVL( l_object_version_number, 1 ) + 1;
786:
790: FND_MESSAGE.SET_TOKEN( 'RECORD', 'customer account' );
791: FND_MESSAGE.SET_TOKEN( 'VALUE',
792: NVL( TO_CHAR( p_cust_account_rec.cust_account_id ), 'null' ) );
793: FND_MSG_PUB.ADD;
794: RAISE FND_API.G_EXC_ERROR;
795: END;
796:
797:
798: -- Validate cust account record
801: p_cust_account_rec => p_cust_account_rec,
802: p_rowid => l_rowid,
803: x_return_status => x_return_status );
804:
805: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
806: RAISE FND_API.G_EXC_ERROR;
807: END IF;
808:
809: if (p_cust_account_rec.orig_system is not null
802: p_rowid => l_rowid,
803: x_return_status => x_return_status );
804:
805: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
806: RAISE FND_API.G_EXC_ERROR;
807: END IF;
808:
809: if (p_cust_account_rec.orig_system is not null
810: and p_cust_account_rec.orig_system <>fnd_api.g_miss_char)
806: RAISE FND_API.G_EXC_ERROR;
807: END IF;
808:
809: if (p_cust_account_rec.orig_system is not null
810: and p_cust_account_rec.orig_system <>fnd_api.g_miss_char)
811: and (p_cust_account_rec.orig_system_reference is not null
812: and p_cust_account_rec.orig_system_reference <>fnd_api.g_miss_char)
813: then
814: p_cust_account_rec.orig_system_reference := null;
808:
809: if (p_cust_account_rec.orig_system is not null
810: and p_cust_account_rec.orig_system <>fnd_api.g_miss_char)
811: and (p_cust_account_rec.orig_system_reference is not null
812: and p_cust_account_rec.orig_system_reference <>fnd_api.g_miss_char)
813: then
814: p_cust_account_rec.orig_system_reference := null;
815: -- In mosr, we have bypassed osr nonupdateable validation
816: -- but we should not update existing osr, set it to null
976: END IF;
977: END IF;
978: CLOSE c_has_active_account;
979:
980: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
981: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
982: RAISE FND_API.G_EXC_ERROR;
983: ELSE
984: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
977: END IF;
978: CLOSE c_has_active_account;
979:
980: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
981: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
982: RAISE FND_API.G_EXC_ERROR;
983: ELSE
984: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
985: END IF;
978: CLOSE c_has_active_account;
979:
980: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
981: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
982: RAISE FND_API.G_EXC_ERROR;
983: ELSE
984: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
985: END IF;
986: END IF;
980: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
981: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
982: RAISE FND_API.G_EXC_ERROR;
983: ELSE
984: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
985: END IF;
986: END IF;
987: END IF;
988:
1008: * ARGUMENTS
1009: * IN/OUT:
1010: * p_cust_acct_relate_rec Customer account relate record.
1011: * x_return_status Return status after the call. The status can
1012: * be FND_API.G_RET_STS_SUCCESS (success),
1013: * FND_API.G_RET_STS_ERROR (error),
1014: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1015: *
1016: * NOTES
1009: * IN/OUT:
1010: * p_cust_acct_relate_rec Customer account relate record.
1011: * x_return_status Return status after the call. The status can
1012: * be FND_API.G_RET_STS_SUCCESS (success),
1013: * FND_API.G_RET_STS_ERROR (error),
1014: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1015: *
1016: * NOTES
1017: * This procedure should always raise exception to main API.
1010: * p_cust_acct_relate_rec Customer account relate record.
1011: * x_return_status Return status after the call. The status can
1012: * be FND_API.G_RET_STS_SUCCESS (success),
1013: * FND_API.G_RET_STS_ERROR (error),
1014: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1015: *
1016: * NOTES
1017: * This procedure should always raise exception to main API.
1018: *
1059: MO_GLOBAL.validate_orgid_pub_api(p_cust_acct_relate_rec.org_id,'N',l_return_status);
1060: EXCEPTION
1061: WHEN OTHERS
1062: THEN
1063: RAISE FND_API.G_EXC_ERROR;
1064: END;
1065:
1066:
1067: -- Validate cust acct relate record
1070: p_cust_acct_relate_rec => p_cust_acct_relate_rec,
1071: p_cust_acct_relate_id => NULL, -- Bug 4529413
1072: x_return_status => x_return_status );
1073:
1074: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1075: RAISE FND_API.G_EXC_ERROR;
1076: END IF;
1077:
1078: -- Debug info.
1071: p_cust_acct_relate_id => NULL, -- Bug 4529413
1072: x_return_status => x_return_status );
1073:
1074: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1075: RAISE FND_API.G_EXC_ERROR;
1076: END IF;
1077:
1078: -- Debug info.
1079: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1128:
1129: IF p_cust_acct_relate_rec.customer_reciprocal_flag = 'Y' AND
1130: (NVL(p_cust_acct_relate_rec.status,'A') ='A' -- Bug 3449118
1131: OR
1132: p_cust_acct_relate_rec.status = FND_API.G_MISS_CHAR -- Bug 3702516
1133: )
1134: THEN
1135: BEGIN
1136:
1173: x_return_status => x_return_status,
1174: x_msg_count => l_msg_count,
1175: x_msg_data => l_msg_data );
1176:
1177: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1178: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1179: RAISE FND_API.G_EXC_ERROR;
1180: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1181: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1174: x_msg_count => l_msg_count,
1175: x_msg_data => l_msg_data );
1176:
1177: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1178: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1179: RAISE FND_API.G_EXC_ERROR;
1180: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1181: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1182: END IF;
1175: x_msg_data => l_msg_data );
1176:
1177: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1178: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1179: RAISE FND_API.G_EXC_ERROR;
1180: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1181: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1182: END IF;
1183: END IF;
1176:
1177: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1178: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1179: RAISE FND_API.G_EXC_ERROR;
1180: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1181: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1182: END IF;
1183: END IF;
1184: END;
1177: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1178: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1179: RAISE FND_API.G_EXC_ERROR;
1180: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1181: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1182: END IF;
1183: END IF;
1184: END;
1185: END IF;
1207: * IN/OUT:
1208: * p_cust_acct_relate_rec Customer account relate record.
1209: * p_object_version_number Used for locking the being updated record.
1210: * x_return_status Return status after the call. The status can
1211: * be FND_API.G_RET_STS_SUCCESS (success),
1212: * FND_API.G_RET_STS_ERROR (error),
1213: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1214: *
1215: * NOTES
1208: * p_cust_acct_relate_rec Customer account relate record.
1209: * p_object_version_number Used for locking the being updated record.
1210: * x_return_status Return status after the call. The status can
1211: * be FND_API.G_RET_STS_SUCCESS (success),
1212: * FND_API.G_RET_STS_ERROR (error),
1213: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1214: *
1215: * NOTES
1216: * This procedure should always raise exception to main API.
1209: * p_object_version_number Used for locking the being updated record.
1210: * x_return_status Return status after the call. The status can
1211: * be FND_API.G_RET_STS_SUCCESS (success),
1212: * FND_API.G_RET_STS_ERROR (error),
1213: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1214: *
1215: * NOTES
1216: * This procedure should always raise exception to main API.
1217: *
1281: FND_MESSAGE.SET_NAME('AR','HZ_API_NO_ACTIVE_RECORD');
1282: FND_MESSAGE.SET_TOKEN( 'ACCOUNT1',p_cust_acct_relate_rec.cust_account_id);
1283: FND_MESSAGE.SET_TOKEN( 'ACCOUNT2',p_cust_acct_relate_rec.related_cust_account_id);
1284: FND_MSG_PUB.ADD;
1285: x_return_status := FND_API.G_RET_STS_ERROR;
1286: RAISE FND_API.G_EXC_ERROR;
1287: END;
1288: ELSE --- Bug 3449118.
1289:
1282: FND_MESSAGE.SET_TOKEN( 'ACCOUNT1',p_cust_acct_relate_rec.cust_account_id);
1283: FND_MESSAGE.SET_TOKEN( 'ACCOUNT2',p_cust_acct_relate_rec.related_cust_account_id);
1284: FND_MSG_PUB.ADD;
1285: x_return_status := FND_API.G_RET_STS_ERROR;
1286: RAISE FND_API.G_EXC_ERROR;
1287: END;
1288: ELSE --- Bug 3449118.
1289:
1290: IF p_cust_acct_relate_rec.cust_acct_relate_id IS NULL THEN -- Bug 4529413
1300: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NO_RECORD' );
1301: FND_MESSAGE.SET_TOKEN( 'RECORD', 'customer account relate' );
1302: FND_MESSAGE.SET_TOKEN( 'VALUE',p_rowid);
1303: FND_MSG_PUB.ADD;
1304: x_return_status := FND_API.G_RET_STS_ERROR;
1305: RAISE FND_API.G_EXC_ERROR;
1306: END;
1307: ELSE
1308: l_cust_acct_relate_id := p_cust_acct_relate_rec.cust_acct_relate_id;
1301: FND_MESSAGE.SET_TOKEN( 'RECORD', 'customer account relate' );
1302: FND_MESSAGE.SET_TOKEN( 'VALUE',p_rowid);
1303: FND_MSG_PUB.ADD;
1304: x_return_status := FND_API.G_RET_STS_ERROR;
1305: RAISE FND_API.G_EXC_ERROR;
1306: END;
1307: ELSE
1308: l_cust_acct_relate_id := p_cust_acct_relate_rec.cust_acct_relate_id;
1309:
1325: FOR UPDATE NOWAIT;
1326:
1327: -- cust_account_id is not updateable.
1328: IF p_cust_acct_relate_rec.cust_account_id IS NOT NULL AND
1329: (p_cust_acct_relate_rec.cust_account_id = FND_API.G_MISS_NUM OR
1330: l_cust_account_id <> p_cust_acct_relate_rec.cust_account_id)
1331: THEN
1332: FND_MESSAGE.SET_NAME ('AR','HZ_API_NONUPDATEABLE_COLUMN');
1333: FND_MESSAGE.SET_TOKEN('COLUMN','CUST_ACCOUNT_ID');
1331: THEN
1332: FND_MESSAGE.SET_NAME ('AR','HZ_API_NONUPDATEABLE_COLUMN');
1333: FND_MESSAGE.SET_TOKEN('COLUMN','CUST_ACCOUNT_ID');
1334: FND_MSG_PUB.ADD;
1335: x_return_status := FND_API.G_RET_STS_ERROR;
1336: END IF;
1337:
1338: -- related_cust_account_id is not updateable.
1339: IF p_cust_acct_relate_rec.related_cust_account_id IS NOT NULL AND
1336: END IF;
1337:
1338: -- related_cust_account_id is not updateable.
1339: IF p_cust_acct_relate_rec.related_cust_account_id IS NOT NULL AND
1340: (p_cust_acct_relate_rec.related_cust_account_id = FND_API.G_MISS_NUM OR
1341: l_related_cust_account_id <> p_cust_acct_relate_rec.related_cust_account_id)
1342: THEN
1343: FND_MESSAGE.SET_NAME ('AR','HZ_API_NONUPDATEABLE_COLUMN');
1344: FND_MESSAGE.SET_TOKEN('COLUMN','RELATED_CUST_ACCOUNT_ID');
1342: THEN
1343: FND_MESSAGE.SET_NAME ('AR','HZ_API_NONUPDATEABLE_COLUMN');
1344: FND_MESSAGE.SET_TOKEN('COLUMN','RELATED_CUST_ACCOUNT_ID');
1345: FND_MSG_PUB.ADD;
1346: x_return_status := FND_API.G_RET_STS_ERROR;
1347: END IF;
1348:
1349: -- If status is updated to Active
1350: IF p_cust_acct_relate_rec.status = 'A'
1363: FND_MESSAGE.SET_NAME ('AR','HZ_ACTIVE_CUST_ACCT_RELATE');
1364: FND_MESSAGE.SET_TOKEN('ACCOUNT1',l_cust_account_id);
1365: FND_MESSAGE.SET_TOKEN('ACCOUNT2',l_related_cust_account_id);
1366: FND_MSG_PUB.ADD;
1367: x_return_status := FND_API.G_RET_STS_ERROR;
1368: END IF;
1369:
1370: END IF;
1371:
1374: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NO_RECORD' );
1375: FND_MESSAGE.SET_TOKEN( 'RECORD', 'customer account relate' );
1376: FND_MESSAGE.SET_TOKEN( 'VALUE', l_cust_acct_relate_id);
1377: FND_MSG_PUB.ADD;
1378: x_return_status := FND_API.G_RET_STS_ERROR;
1379: RAISE FND_API.G_EXC_ERROR;
1380: END;
1381: END IF;
1382:
1375: FND_MESSAGE.SET_TOKEN( 'RECORD', 'customer account relate' );
1376: FND_MESSAGE.SET_TOKEN( 'VALUE', l_cust_acct_relate_id);
1377: FND_MSG_PUB.ADD;
1378: x_return_status := FND_API.G_RET_STS_ERROR;
1379: RAISE FND_API.G_EXC_ERROR;
1380: END;
1381: END IF;
1382:
1383: IF NOT (
1388: THEN
1389: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_RECORD_CHANGED' );
1390: FND_MESSAGE.SET_TOKEN( 'TABLE', 'hz_cust_acct_relate' );
1391: FND_MSG_PUB.ADD;
1392: RAISE FND_API.G_EXC_ERROR;
1393: END IF;
1394:
1395: p_object_version_number := NVL( l_object_version_number, 1 ) + 1;
1396:
1402: p_cust_acct_relate_id => l_cust_acct_relate_id, -- Bug 4529413
1403: x_return_status => x_return_status );
1404:
1405:
1406: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1407: RAISE FND_API.G_EXC_ERROR;
1408: END IF;
1409:
1410: -- Debug info.
1403: x_return_status => x_return_status );
1404:
1405:
1406: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1407: RAISE FND_API.G_EXC_ERROR;
1408: END IF;
1409:
1410: -- Debug info.
1411: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1482: *
1483: * ARGUMENTS
1484: * IN:
1485: * p_init_msg_list Initialize message stack if it is set to
1486: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
1487: * p_cust_account_rec Customer account record.
1488: * p_person_rec Person party record which being created account
1489: * belongs to. If party_id in person record is not
1490: * passed in or party_id does not exist in hz_parties,
1490: * passed in or party_id does not exist in hz_parties,
1491: * API ceates a person party based on this record.
1492: * p_customer_profile_rec Customer profile record. One customer account
1493: * must have a customer profile.
1494: * p_create_profile_amt If it is set to FND_API.G_TRUE, API create customer
1495: * profile amounts by copying corresponding data
1496: * from customer profile class amounts.
1497: * IN/OUT:
1498: * OUT:
1503: * x_party_number Party number of the person party which this account
1504: * belongs to.
1505: * x_profile_id Person profile ID.
1506: * x_return_status Return status after the call. The status can
1507: * be FND_API.G_RET_STS_SUCCESS (success),
1508: * FND_API.G_RET_STS_ERROR (error),
1509: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1510: * x_msg_count Number of messages in message stack.
1511: * x_msg_data Message text if x_msg_count is 1.
1504: * belongs to.
1505: * x_profile_id Person profile ID.
1506: * x_return_status Return status after the call. The status can
1507: * be FND_API.G_RET_STS_SUCCESS (success),
1508: * FND_API.G_RET_STS_ERROR (error),
1509: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1510: * x_msg_count Number of messages in message stack.
1511: * x_msg_data Message text if x_msg_count is 1.
1512: *
1505: * x_profile_id Person profile ID.
1506: * x_return_status Return status after the call. The status can
1507: * be FND_API.G_RET_STS_SUCCESS (success),
1508: * FND_API.G_RET_STS_ERROR (error),
1509: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1510: * x_msg_count Number of messages in message stack.
1511: * x_msg_data Message text if x_msg_count is 1.
1512: *
1513: * NOTES
1518: *
1519: */
1520:
1521: PROCEDURE create_cust_account (
1522: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1523: p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE,
1524: p_person_rec IN HZ_PARTY_V2PUB.PERSON_REC_TYPE,
1525: p_customer_profile_rec IN HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE,
1526: p_create_profile_amt IN VARCHAR2 := FND_API.G_TRUE,
1522: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1523: p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE,
1524: p_person_rec IN HZ_PARTY_V2PUB.PERSON_REC_TYPE,
1525: p_customer_profile_rec IN HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE,
1526: p_create_profile_amt IN VARCHAR2 := FND_API.G_TRUE,
1527: x_cust_account_id OUT NOCOPY NUMBER,
1528: x_account_number OUT NOCOPY VARCHAR2,
1529: x_party_id OUT NOCOPY NUMBER,
1530: x_party_number OUT NOCOPY VARCHAR2,
1553: p_msg_level=>fnd_log.level_procedure);
1554: END IF;
1555:
1556: -- Initialize message list if p_init_msg_list is set to TRUE.
1557: IF FND_API.to_Boolean(p_init_msg_list) THEN
1558: FND_MSG_PUB.initialize;
1559: END IF;
1560:
1561: -- Initialize API return status to success.
1558: FND_MSG_PUB.initialize;
1559: END IF;
1560:
1561: -- Initialize API return status to success.
1562: x_return_status := FND_API.G_RET_STS_SUCCESS;
1563:
1564: -- report error on obsolete columns based on profile
1565: IF NVL(FND_PROFILE.VALUE('HZ_API_ERR_ON_OBSOLETE_COLUMN'), 'Y') = 'Y' THEN
1566: check_obsolete_columns (
1568: p_cust_account_rec => l_cust_account_rec,
1569: x_return_status => x_return_status
1570: );
1571:
1572: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1573: RAISE FND_API.G_EXC_ERROR;
1574: END IF;
1575: END IF;
1576:
1569: x_return_status => x_return_status
1570: );
1571:
1572: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1573: RAISE FND_API.G_EXC_ERROR;
1574: END IF;
1575: END IF;
1576:
1577: -- Call to business logic.
1589: x_profile_id,
1590: x_return_status );
1591:
1592:
1593: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
1594: IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
1595: -- Invoke business event system.
1596: HZ_BUSINESS_EVENT_V2PVT.create_cust_account_event (
1597: l_cust_account_rec,
1612: HZ_DQM_SYNC.sync_cust_account(l_cust_account_rec.CUST_ACCOUNT_ID,'C');
1613:
1614: -- Standard call to get message count and if count is 1, get message info.
1615: FND_MSG_PUB.Count_And_Get(
1616: p_encoded => FND_API.G_FALSE,
1617: p_count => x_msg_count,
1618: p_data => x_msg_data );
1619:
1620: -- Debug info.
1633: -- Check if API is called in debug mode. If yes, disable debug.
1634: --disable_debug;
1635:
1636: EXCEPTION
1637: WHEN FND_API.G_EXC_ERROR THEN
1638: ROLLBACK TO create_cust_account;
1639: x_return_status := FND_API.G_RET_STS_ERROR;
1640:
1641: FND_MSG_PUB.Count_And_Get(
1635:
1636: EXCEPTION
1637: WHEN FND_API.G_EXC_ERROR THEN
1638: ROLLBACK TO create_cust_account;
1639: x_return_status := FND_API.G_RET_STS_ERROR;
1640:
1641: FND_MSG_PUB.Count_And_Get(
1642: p_encoded => FND_API.G_FALSE,
1643: p_count => x_msg_count,
1638: ROLLBACK TO create_cust_account;
1639: x_return_status := FND_API.G_RET_STS_ERROR;
1640:
1641: FND_MSG_PUB.Count_And_Get(
1642: p_encoded => FND_API.G_FALSE,
1643: p_count => x_msg_count,
1644: p_data => x_msg_data );
1645:
1646: -- Debug info.
1659:
1660: -- Check if API is called in debug mode. If yes, disable debug.
1661: --disable_debug;
1662:
1663: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1664: ROLLBACK TO create_cust_account;
1665: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1666:
1667: FND_MSG_PUB.Count_And_Get(
1661: --disable_debug;
1662:
1663: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1664: ROLLBACK TO create_cust_account;
1665: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1666:
1667: FND_MSG_PUB.Count_And_Get(
1668: p_encoded => FND_API.G_FALSE,
1669: p_count => x_msg_count,
1664: ROLLBACK TO create_cust_account;
1665: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1666:
1667: FND_MSG_PUB.Count_And_Get(
1668: p_encoded => FND_API.G_FALSE,
1669: p_count => x_msg_count,
1670: p_data => x_msg_data );
1671:
1672: -- Debug info.
1687: --disable_debug;
1688:
1689: WHEN OTHERS THEN
1690: ROLLBACK TO create_cust_account;
1691: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1692:
1693: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
1694: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
1695: FND_MSG_PUB.ADD;
1694: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
1695: FND_MSG_PUB.ADD;
1696:
1697: FND_MSG_PUB.Count_And_Get(
1698: p_encoded => FND_API.G_FALSE,
1699: p_count => x_msg_count,
1700: p_data => x_msg_data );
1701:
1702: -- Debug info.
1731: *
1732: * ARGUMENTS
1733: * IN:
1734: * p_init_msg_list Initialize message stack if it is set to
1735: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
1736: * p_cust_account_rec Customer account record.
1737: * p_organization_rec Organization party record which being created account
1738: * belongs to. If party_id in organization record is not
1739: * passed in or party_id does not exist in hz_parties,
1739: * passed in or party_id does not exist in hz_parties,
1740: * API ceates a organization party based on this record.
1741: * p_customer_profile_rec Customer profile record. One customer account
1742: * must have a customer profile.
1743: * p_create_profile_amt If it is set to FND_API.G_TRUE, API create customer
1744: * profile amounts by copying corresponding data
1745: * from customer profile class amounts.
1746: * IN/OUT:
1747: * OUT:
1752: * x_party_number Party number of the organization party which this
1753: * account belongs to.
1754: * x_profile_id Organization profile ID.
1755: * x_return_status Return status after the call. The status can
1756: * be FND_API.G_RET_STS_SUCCESS (success),
1757: * FND_API.G_RET_STS_ERROR (error),
1758: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1759: * x_msg_count Number of messages in message stack.
1760: * x_msg_data Message text if x_msg_count is 1.
1753: * account belongs to.
1754: * x_profile_id Organization profile ID.
1755: * x_return_status Return status after the call. The status can
1756: * be FND_API.G_RET_STS_SUCCESS (success),
1757: * FND_API.G_RET_STS_ERROR (error),
1758: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1759: * x_msg_count Number of messages in message stack.
1760: * x_msg_data Message text if x_msg_count is 1.
1761: *
1754: * x_profile_id Organization profile ID.
1755: * x_return_status Return status after the call. The status can
1756: * be FND_API.G_RET_STS_SUCCESS (success),
1757: * FND_API.G_RET_STS_ERROR (error),
1758: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1759: * x_msg_count Number of messages in message stack.
1760: * x_msg_data Message text if x_msg_count is 1.
1761: *
1762: * NOTES
1767: *
1768: */
1769:
1770: PROCEDURE create_cust_account (
1771: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1772: p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE,
1773: p_organization_rec IN HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE,
1774: p_customer_profile_rec IN HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE,
1775: p_create_profile_amt IN VARCHAR2 := FND_API.G_TRUE,
1771: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1772: p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE,
1773: p_organization_rec IN HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE,
1774: p_customer_profile_rec IN HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE,
1775: p_create_profile_amt IN VARCHAR2 := FND_API.G_TRUE,
1776: x_cust_account_id OUT NOCOPY NUMBER,
1777: x_account_number OUT NOCOPY VARCHAR2,
1778: x_party_id OUT NOCOPY NUMBER,
1779: x_party_number OUT NOCOPY VARCHAR2,
1802: p_msg_level=>fnd_log.level_procedure);
1803: END IF;
1804:
1805: -- Initialize message list if p_init_msg_list is set to TRUE.
1806: IF FND_API.to_Boolean(p_init_msg_list) THEN
1807: FND_MSG_PUB.initialize;
1808: END IF;
1809:
1810: -- Initialize API return status to success.
1807: FND_MSG_PUB.initialize;
1808: END IF;
1809:
1810: -- Initialize API return status to success.
1811: x_return_status := FND_API.G_RET_STS_SUCCESS;
1812:
1813: -- report error on obsolete columns based on profile
1814: IF NVL(FND_PROFILE.VALUE('HZ_API_ERR_ON_OBSOLETE_COLUMN'), 'Y') = 'Y' THEN
1815: check_obsolete_columns (
1817: p_cust_account_rec => l_cust_account_rec,
1818: x_return_status => x_return_status
1819: );
1820:
1821: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1822: RAISE FND_API.G_EXC_ERROR;
1823: END IF;
1824: END IF;
1825:
1818: x_return_status => x_return_status
1819: );
1820:
1821: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1822: RAISE FND_API.G_EXC_ERROR;
1823: END IF;
1824: END IF;
1825:
1826: -- Call to business logic.
1837: x_party_number,
1838: x_profile_id,
1839: x_return_status );
1840:
1841: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
1842: IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
1843: -- Invoke business event system.
1844: HZ_BUSINESS_EVENT_V2PVT.create_cust_account_event (
1845: l_cust_account_rec,
1860: HZ_DQM_SYNC.sync_cust_account(l_cust_account_rec.CUST_ACCOUNT_ID,'C');
1861:
1862: -- Standard call to get message count and if count is 1, get message info.
1863: FND_MSG_PUB.Count_And_Get(
1864: p_encoded => FND_API.G_FALSE,
1865: p_count => x_msg_count,
1866: p_data => x_msg_data );
1867:
1868: -- Debug info.
1882: -- Check if API is called in debug mode. If yes, disable debug.
1883: --disable_debug;
1884:
1885: EXCEPTION
1886: WHEN FND_API.G_EXC_ERROR THEN
1887: ROLLBACK TO create_cust_account;
1888: x_return_status := FND_API.G_RET_STS_ERROR;
1889:
1890: FND_MSG_PUB.Count_And_Get(
1884:
1885: EXCEPTION
1886: WHEN FND_API.G_EXC_ERROR THEN
1887: ROLLBACK TO create_cust_account;
1888: x_return_status := FND_API.G_RET_STS_ERROR;
1889:
1890: FND_MSG_PUB.Count_And_Get(
1891: p_encoded => FND_API.G_FALSE,
1892: p_count => x_msg_count,
1887: ROLLBACK TO create_cust_account;
1888: x_return_status := FND_API.G_RET_STS_ERROR;
1889:
1890: FND_MSG_PUB.Count_And_Get(
1891: p_encoded => FND_API.G_FALSE,
1892: p_count => x_msg_count,
1893: p_data => x_msg_data );
1894:
1895: -- Debug info.
1908:
1909: -- Check if API is called in debug mode. If yes, disable debug.
1910: --disable_debug;
1911:
1912: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1913: ROLLBACK TO create_cust_account;
1914: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1915:
1916: FND_MSG_PUB.Count_And_Get(
1910: --disable_debug;
1911:
1912: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1913: ROLLBACK TO create_cust_account;
1914: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1915:
1916: FND_MSG_PUB.Count_And_Get(
1917: p_encoded => FND_API.G_FALSE,
1918: p_count => x_msg_count,
1913: ROLLBACK TO create_cust_account;
1914: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1915:
1916: FND_MSG_PUB.Count_And_Get(
1917: p_encoded => FND_API.G_FALSE,
1918: p_count => x_msg_count,
1919: p_data => x_msg_data );
1920:
1921: -- Debug info.
1936: --disable_debug;
1937:
1938: WHEN OTHERS THEN
1939: ROLLBACK TO create_cust_account;
1940: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1941:
1942: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
1943: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
1944: FND_MSG_PUB.ADD;
1943: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
1944: FND_MSG_PUB.ADD;
1945:
1946: FND_MSG_PUB.Count_And_Get(
1947: p_encoded => FND_API.G_FALSE,
1948: p_count => x_msg_count,
1949: p_data => x_msg_data );
1950:
1951: -- Debug info.
1980: *
1981: * ARGUMENTS
1982: * IN:
1983: * p_init_msg_list Initialize message stack if it is set to
1984: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
1985: * p_cust_account_rec Customer account record.
1986: * IN/OUT:
1987: * p_object_version_number Used for locking the being updated record.
1988: * OUT:
1986: * IN/OUT:
1987: * p_object_version_number Used for locking the being updated record.
1988: * OUT:
1989: * x_return_status Return status after the call. The status can
1990: * be FND_API.G_RET_STS_SUCCESS (success),
1991: * FND_API.G_RET_STS_ERROR (error),
1992: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1993: * x_msg_count Number of messages in message stack.
1994: * x_msg_data Message text if x_msg_count is 1.
1987: * p_object_version_number Used for locking the being updated record.
1988: * OUT:
1989: * x_return_status Return status after the call. The status can
1990: * be FND_API.G_RET_STS_SUCCESS (success),
1991: * FND_API.G_RET_STS_ERROR (error),
1992: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1993: * x_msg_count Number of messages in message stack.
1994: * x_msg_data Message text if x_msg_count is 1.
1995: *
1988: * OUT:
1989: * x_return_status Return status after the call. The status can
1990: * be FND_API.G_RET_STS_SUCCESS (success),
1991: * FND_API.G_RET_STS_ERROR (error),
1992: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1993: * x_msg_count Number of messages in message stack.
1994: * x_msg_data Message text if x_msg_count is 1.
1995: *
1996: * NOTES
2001: *
2002: */
2003:
2004: PROCEDURE update_cust_account (
2005: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2006: p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE,
2007: p_object_version_number IN OUT NOCOPY NUMBER,
2008: x_return_status OUT NOCOPY VARCHAR2,
2009: x_msg_count OUT NOCOPY NUMBER,
2029: p_msg_level=>fnd_log.level_procedure);
2030: END IF;
2031:
2032: -- Initialize message list if p_init_msg_list is set to TRUE.
2033: IF FND_API.to_Boolean(p_init_msg_list) THEN
2034: FND_MSG_PUB.initialize;
2035: END IF;
2036:
2037: -- Initialize API return status to success.
2034: FND_MSG_PUB.initialize;
2035: END IF;
2036:
2037: -- Initialize API return status to success.
2038: x_return_status := FND_API.G_RET_STS_SUCCESS;
2039:
2040: IF (p_cust_account_rec.orig_system is not null and p_cust_account_rec.orig_system <>fnd_api.g_miss_char)
2041: and (p_cust_account_rec.orig_system_reference is not null and p_cust_account_rec.orig_system_reference <>fnd_api.g_miss_char)
2042: and (p_cust_account_rec.cust_account_id = FND_API.G_MISS_NUM or p_cust_account_rec.cust_account_id is null) THEN
2036:
2037: -- Initialize API return status to success.
2038: x_return_status := FND_API.G_RET_STS_SUCCESS;
2039:
2040: IF (p_cust_account_rec.orig_system is not null and p_cust_account_rec.orig_system <>fnd_api.g_miss_char)
2041: and (p_cust_account_rec.orig_system_reference is not null and p_cust_account_rec.orig_system_reference <>fnd_api.g_miss_char)
2042: and (p_cust_account_rec.cust_account_id = FND_API.G_MISS_NUM or p_cust_account_rec.cust_account_id is null) THEN
2043: hz_orig_system_ref_pub.get_owner_table_id
2044: (p_orig_system => p_cust_account_rec.orig_system,
2037: -- Initialize API return status to success.
2038: x_return_status := FND_API.G_RET_STS_SUCCESS;
2039:
2040: IF (p_cust_account_rec.orig_system is not null and p_cust_account_rec.orig_system <>fnd_api.g_miss_char)
2041: and (p_cust_account_rec.orig_system_reference is not null and p_cust_account_rec.orig_system_reference <>fnd_api.g_miss_char)
2042: and (p_cust_account_rec.cust_account_id = FND_API.G_MISS_NUM or p_cust_account_rec.cust_account_id is null) THEN
2043: hz_orig_system_ref_pub.get_owner_table_id
2044: (p_orig_system => p_cust_account_rec.orig_system,
2045: p_orig_system_reference => p_cust_account_rec.orig_system_reference,
2038: x_return_status := FND_API.G_RET_STS_SUCCESS;
2039:
2040: IF (p_cust_account_rec.orig_system is not null and p_cust_account_rec.orig_system <>fnd_api.g_miss_char)
2041: and (p_cust_account_rec.orig_system_reference is not null and p_cust_account_rec.orig_system_reference <>fnd_api.g_miss_char)
2042: and (p_cust_account_rec.cust_account_id = FND_API.G_MISS_NUM or p_cust_account_rec.cust_account_id is null) THEN
2043: hz_orig_system_ref_pub.get_owner_table_id
2044: (p_orig_system => p_cust_account_rec.orig_system,
2045: p_orig_system_reference => p_cust_account_rec.orig_system_reference,
2046: p_owner_table_name => 'HZ_CUST_ACCOUNTS',
2045: p_orig_system_reference => p_cust_account_rec.orig_system_reference,
2046: p_owner_table_name => 'HZ_CUST_ACCOUNTS',
2047: x_owner_table_id => l_cust_account_rec.cust_account_id,
2048: x_return_status => x_return_status);
2049: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2050: RAISE FND_API.G_EXC_ERROR;
2051: END IF;
2052:
2053: END IF;
2046: p_owner_table_name => 'HZ_CUST_ACCOUNTS',
2047: x_owner_table_id => l_cust_account_rec.cust_account_id,
2048: x_return_status => x_return_status);
2049: IF x_return_status <> fnd_api.g_ret_sts_success THEN
2050: RAISE FND_API.G_EXC_ERROR;
2051: END IF;
2052:
2053: END IF;
2054:
2059: x_return_status => x_return_status,
2060: x_msg_count => x_msg_count,
2061: x_msg_data => x_msg_data);
2062:
2063: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2064: RAISE FND_API.G_EXC_ERROR;
2065: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2066: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2067: END IF;
2060: x_msg_count => x_msg_count,
2061: x_msg_data => x_msg_data);
2062:
2063: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2064: RAISE FND_API.G_EXC_ERROR;
2065: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2066: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2067: END IF;
2068:
2061: x_msg_data => x_msg_data);
2062:
2063: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2064: RAISE FND_API.G_EXC_ERROR;
2065: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2066: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2067: END IF;
2068:
2069: -- report error on obsolete columns based on profile
2062:
2063: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2064: RAISE FND_API.G_EXC_ERROR;
2065: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2066: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2067: END IF;
2068:
2069: -- report error on obsolete columns based on profile
2070: IF NVL(FND_PROFILE.VALUE('HZ_API_ERR_ON_OBSOLETE_COLUMN'), 'Y') = 'Y' THEN
2074: p_old_cust_account_rec => l_old_cust_account_rec,
2075: x_return_status => x_return_status
2076: );
2077:
2078: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2079: RAISE FND_API.G_EXC_ERROR;
2080: END IF;
2081: END IF;
2082:
2075: x_return_status => x_return_status
2076: );
2077:
2078: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2079: RAISE FND_API.G_EXC_ERROR;
2080: END IF;
2081: END IF;
2082:
2083: -- Call to business logic.
2085: l_cust_account_rec,
2086: p_object_version_number,
2087: x_return_status );
2088:
2089: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
2090: -- Invoke business event system.
2091: l_old_cust_account_rec.orig_system := l_cust_account_rec.orig_system;
2092: IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
2093: HZ_BUSINESS_EVENT_V2PVT.update_cust_account_event (
2106: HZ_DQM_SYNC.sync_cust_account(l_cust_account_rec.CUST_ACCOUNT_ID,'U');
2107:
2108: -- Standard call to get message count and if count is 1, get message info.
2109: FND_MSG_PUB.Count_And_Get(
2110: p_encoded => FND_API.G_FALSE,
2111: p_count => x_msg_count,
2112: p_data => x_msg_data );
2113:
2114: -- Debug info.
2127: -- Check if API is called in debug mode. If yes, disable debug.
2128: --disable_debug;
2129:
2130: EXCEPTION
2131: WHEN FND_API.G_EXC_ERROR THEN
2132: ROLLBACK TO update_cust_account;
2133: x_return_status := FND_API.G_RET_STS_ERROR;
2134:
2135: FND_MSG_PUB.Count_And_Get(
2129:
2130: EXCEPTION
2131: WHEN FND_API.G_EXC_ERROR THEN
2132: ROLLBACK TO update_cust_account;
2133: x_return_status := FND_API.G_RET_STS_ERROR;
2134:
2135: FND_MSG_PUB.Count_And_Get(
2136: p_encoded => FND_API.G_FALSE,
2137: p_count => x_msg_count,
2132: ROLLBACK TO update_cust_account;
2133: x_return_status := FND_API.G_RET_STS_ERROR;
2134:
2135: FND_MSG_PUB.Count_And_Get(
2136: p_encoded => FND_API.G_FALSE,
2137: p_count => x_msg_count,
2138: p_data => x_msg_data );
2139:
2140: -- Debug info.
2153:
2154: -- Check if API is called in debug mode. If yes, disable debug.
2155: --disable_debug;
2156:
2157: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2158: ROLLBACK TO update_cust_account;
2159: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2160:
2161: FND_MSG_PUB.Count_And_Get(
2155: --disable_debug;
2156:
2157: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2158: ROLLBACK TO update_cust_account;
2159: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2160:
2161: FND_MSG_PUB.Count_And_Get(
2162: p_encoded => FND_API.G_FALSE,
2163: p_count => x_msg_count,
2158: ROLLBACK TO update_cust_account;
2159: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2160:
2161: FND_MSG_PUB.Count_And_Get(
2162: p_encoded => FND_API.G_FALSE,
2163: p_count => x_msg_count,
2164: p_data => x_msg_data );
2165:
2166: -- Debug info.
2181: --disable_debug;
2182:
2183: WHEN OTHERS THEN
2184: ROLLBACK TO update_cust_account;
2185: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2186:
2187: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
2188: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2189: FND_MSG_PUB.ADD;
2188: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2189: FND_MSG_PUB.ADD;
2190:
2191: FND_MSG_PUB.Count_And_Get(
2192: p_encoded => FND_API.G_FALSE,
2193: p_count => x_msg_count,
2194: p_data => x_msg_data );
2195:
2196: -- Debug info.
2224: *
2225: * ARGUMENTS
2226: * IN:
2227: * p_init_msg_list Initialize message stack if it is set to
2228: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
2229: * p_cust_account_id Customer account id.
2230: * IN/OUT:
2231: * OUT:
2232: * x_cust_account_rec Returned customer account record.
2231: * OUT:
2232: * x_cust_account_rec Returned customer account record.
2233: * x_customer_profile_rec Returned customer profile record.
2234: * x_return_status Return status after the call. The status can
2235: * be FND_API.G_RET_STS_SUCCESS (success),
2236: * FND_API.G_RET_STS_ERROR (error),
2237: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2238: * x_msg_count Number of messages in message stack.
2239: * x_msg_data Message text if x_msg_count is 1.
2232: * x_cust_account_rec Returned customer account record.
2233: * x_customer_profile_rec Returned customer profile record.
2234: * x_return_status Return status after the call. The status can
2235: * be FND_API.G_RET_STS_SUCCESS (success),
2236: * FND_API.G_RET_STS_ERROR (error),
2237: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2238: * x_msg_count Number of messages in message stack.
2239: * x_msg_data Message text if x_msg_count is 1.
2240: *
2233: * x_customer_profile_rec Returned customer profile record.
2234: * x_return_status Return status after the call. The status can
2235: * be FND_API.G_RET_STS_SUCCESS (success),
2236: * FND_API.G_RET_STS_ERROR (error),
2237: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2238: * x_msg_count Number of messages in message stack.
2239: * x_msg_data Message text if x_msg_count is 1.
2240: *
2241: * NOTES
2246: *
2247: */
2248:
2249: PROCEDURE get_cust_account_rec (
2250: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2251: p_cust_account_id IN NUMBER,
2252: x_cust_account_rec OUT NOCOPY CUST_ACCOUNT_REC_TYPE,
2253: x_customer_profile_rec OUT NOCOPY HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE,
2254: x_return_status OUT NOCOPY VARCHAR2,
2270: p_msg_level=>fnd_log.level_procedure);
2271: END IF;
2272:
2273: -- Initialize message list if p_init_msg_list is set to TRUE.
2274: IF FND_API.to_Boolean(p_init_msg_list) THEN
2275: FND_MSG_PUB.initialize;
2276: END IF;
2277:
2278: -- Initialize message list if p_init_msg_list is set to TRUE.
2275: FND_MSG_PUB.initialize;
2276: END IF;
2277:
2278: -- Initialize message list if p_init_msg_list is set to TRUE.
2279: IF FND_API.to_Boolean(p_init_msg_list) THEN
2280: FND_MSG_PUB.initialize;
2281: END IF;
2282:
2283: -- Initialize API return status to success.
2280: FND_MSG_PUB.initialize;
2281: END IF;
2282:
2283: -- Initialize API return status to success.
2284: x_return_status := FND_API.G_RET_STS_SUCCESS;
2285:
2286: -- Check whether primary key has been passed in.
2287: IF p_cust_account_id IS NULL OR
2288: p_cust_account_id = FND_API.G_MISS_NUM THEN
2284: x_return_status := FND_API.G_RET_STS_SUCCESS;
2285:
2286: -- Check whether primary key has been passed in.
2287: IF p_cust_account_id IS NULL OR
2288: p_cust_account_id = FND_API.G_MISS_NUM THEN
2289: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
2290: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'cust_account_id' );
2291: FND_MSG_PUB.ADD;
2292: RAISE FND_API.G_EXC_ERROR;
2288: p_cust_account_id = FND_API.G_MISS_NUM THEN
2289: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
2290: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'cust_account_id' );
2291: FND_MSG_PUB.ADD;
2292: RAISE FND_API.G_EXC_ERROR;
2293: END IF;
2294:
2295: x_cust_account_rec.cust_account_id := p_cust_account_id;
2296:
2422: x_return_status => x_return_status,
2423: x_msg_count => x_msg_count,
2424: x_msg_data => x_msg_data );
2425:
2426: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2427: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2428: RAISE FND_API.G_EXC_ERROR;
2429: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2430: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2423: x_msg_count => x_msg_count,
2424: x_msg_data => x_msg_data );
2425:
2426: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2427: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2428: RAISE FND_API.G_EXC_ERROR;
2429: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2430: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2431: END IF;
2424: x_msg_data => x_msg_data );
2425:
2426: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2427: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2428: RAISE FND_API.G_EXC_ERROR;
2429: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2430: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2431: END IF;
2432: END IF;
2425:
2426: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2427: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2428: RAISE FND_API.G_EXC_ERROR;
2429: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2430: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2431: END IF;
2432: END IF;
2433:
2426: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2427: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2428: RAISE FND_API.G_EXC_ERROR;
2429: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2430: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2431: END IF;
2432: END IF;
2433:
2434: -- Standard call to get message count and if count is 1, get message info.
2432: END IF;
2433:
2434: -- Standard call to get message count and if count is 1, get message info.
2435: FND_MSG_PUB.Count_And_Get(
2436: p_encoded => FND_API.G_FALSE,
2437: p_count => x_msg_count,
2438: p_data => x_msg_data );
2439:
2440: -- Debug info.
2453: -- Check if API is called in debug mode. If yes, disable debug.
2454: --disable_debug;
2455:
2456: EXCEPTION
2457: WHEN FND_API.G_EXC_ERROR THEN
2458: x_return_status := FND_API.G_RET_STS_ERROR;
2459:
2460: FND_MSG_PUB.Count_And_Get(
2461: p_encoded => FND_API.G_FALSE,
2454: --disable_debug;
2455:
2456: EXCEPTION
2457: WHEN FND_API.G_EXC_ERROR THEN
2458: x_return_status := FND_API.G_RET_STS_ERROR;
2459:
2460: FND_MSG_PUB.Count_And_Get(
2461: p_encoded => FND_API.G_FALSE,
2462: p_count => x_msg_count,
2457: WHEN FND_API.G_EXC_ERROR THEN
2458: x_return_status := FND_API.G_RET_STS_ERROR;
2459:
2460: FND_MSG_PUB.Count_And_Get(
2461: p_encoded => FND_API.G_FALSE,
2462: p_count => x_msg_count,
2463: p_data => x_msg_data );
2464:
2465: -- Debug info.
2478:
2479: -- Check if API is called in debug mode. If yes, disable debug.
2480: --disable_debug;
2481:
2482: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2483: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2484:
2485: FND_MSG_PUB.Count_And_Get(
2486: p_encoded => FND_API.G_FALSE,
2479: -- Check if API is called in debug mode. If yes, disable debug.
2480: --disable_debug;
2481:
2482: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2483: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2484:
2485: FND_MSG_PUB.Count_And_Get(
2486: p_encoded => FND_API.G_FALSE,
2487: p_count => x_msg_count,
2482: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2483: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2484:
2485: FND_MSG_PUB.Count_And_Get(
2486: p_encoded => FND_API.G_FALSE,
2487: p_count => x_msg_count,
2488: p_data => x_msg_data );
2489:
2490: -- Debug info.
2505: -- Check if API is called in debug mode. If yes, disable debug.
2506: --disable_debug;
2507:
2508: WHEN OTHERS THEN
2509: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2510:
2511: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
2512: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2513: FND_MSG_PUB.ADD;
2512: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2513: FND_MSG_PUB.ADD;
2514:
2515: FND_MSG_PUB.Count_And_Get(
2516: p_encoded => FND_API.G_FALSE,
2517: p_count => x_msg_count,
2518: p_data => x_msg_data );
2519:
2520: -- Debug info.
2547: *
2548: * ARGUMENTS
2549: * IN:
2550: * p_init_msg_list Initialize message stack if it is set to
2551: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
2552: * p_cust_acct_relate_rec Customer account relate record.
2553: * IN/OUT:
2554: * OUT:
2555: * x_return_status Return status after the call. The status can
2552: * p_cust_acct_relate_rec Customer account relate record.
2553: * IN/OUT:
2554: * OUT:
2555: * x_return_status Return status after the call. The status can
2556: * be FND_API.G_RET_STS_SUCCESS (success),
2557: * FND_API.G_RET_STS_ERROR (error),
2558: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2559: * x_msg_count Number of messages in message stack.
2560: * x_msg_data Message text if x_msg_count is 1.
2553: * IN/OUT:
2554: * OUT:
2555: * x_return_status Return status after the call. The status can
2556: * be FND_API.G_RET_STS_SUCCESS (success),
2557: * FND_API.G_RET_STS_ERROR (error),
2558: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2559: * x_msg_count Number of messages in message stack.
2560: * x_msg_data Message text if x_msg_count is 1.
2561: *
2554: * OUT:
2555: * x_return_status Return status after the call. The status can
2556: * be FND_API.G_RET_STS_SUCCESS (success),
2557: * FND_API.G_RET_STS_ERROR (error),
2558: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2559: * x_msg_count Number of messages in message stack.
2560: * x_msg_data Message text if x_msg_count is 1.
2561: *
2562: * NOTES
2568: * with x_cust_acct_relate_id parameter.
2569: */
2570:
2571: PROCEDURE create_cust_acct_relate (
2572: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2573: p_cust_acct_relate_rec IN CUST_ACCT_RELATE_REC_TYPE,
2574: x_return_status OUT NOCOPY VARCHAR2,
2575: x_msg_count OUT NOCOPY NUMBER,
2576: x_msg_data OUT NOCOPY VARCHAR2
2595: *
2596: * ARGUMENTS
2597: * IN:
2598: * p_init_msg_list Initialize message stack if it is set to
2599: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
2600: * p_cust_acct_relate_rec Customer account relate record.
2601: * IN/OUT:
2602: * OUT:
2603: * x_cust_acct_relate_id Return the created records primary key.
2601: * IN/OUT:
2602: * OUT:
2603: * x_cust_acct_relate_id Return the created records primary key.
2604: * x_return_status Return status after the call. The status can
2605: * be FND_API.G_RET_STS_SUCCESS (success),
2606: * FND_API.G_RET_STS_ERROR (error),
2607: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2608: * x_msg_count Number of messages in message stack.
2609: * x_msg_data Message text if x_msg_count is 1.
2602: * OUT:
2603: * x_cust_acct_relate_id Return the created records primary key.
2604: * x_return_status Return status after the call. The status can
2605: * be FND_API.G_RET_STS_SUCCESS (success),
2606: * FND_API.G_RET_STS_ERROR (error),
2607: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2608: * x_msg_count Number of messages in message stack.
2609: * x_msg_data Message text if x_msg_count is 1.
2610: *
2603: * x_cust_acct_relate_id Return the created records primary key.
2604: * x_return_status Return status after the call. The status can
2605: * be FND_API.G_RET_STS_SUCCESS (success),
2606: * FND_API.G_RET_STS_ERROR (error),
2607: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2608: * x_msg_count Number of messages in message stack.
2609: * x_msg_data Message text if x_msg_count is 1.
2610: *
2611: * NOTES
2616: *
2617: */
2618:
2619: PROCEDURE create_cust_acct_relate (
2620: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2621: p_cust_acct_relate_rec IN CUST_ACCT_RELATE_REC_TYPE,
2622: x_cust_acct_relate_id OUT NOCOPY NUMBER,
2623: x_return_status OUT NOCOPY VARCHAR2,
2624: x_msg_count OUT NOCOPY NUMBER,
2642: p_msg_level=>fnd_log.level_procedure);
2643: END IF;
2644:
2645: -- Initialize message list if p_init_msg_list is set to TRUE.
2646: IF FND_API.to_Boolean(p_init_msg_list) THEN
2647: FND_MSG_PUB.initialize;
2648: END IF;
2649:
2650: -- Initialize API return status to success.
2647: FND_MSG_PUB.initialize;
2648: END IF;
2649:
2650: -- Initialize API return status to success.
2651: x_return_status := FND_API.G_RET_STS_SUCCESS;
2652:
2653: -- Call to business logic.
2654: do_create_cust_acct_relate (
2655: l_cust_acct_relate_rec,
2656: x_return_status );
2657:
2658: x_cust_acct_relate_id := l_cust_acct_relate_rec.cust_acct_relate_id;
2659:
2660: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
2661: IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
2662: -- Invoke business event system.
2663: HZ_BUSINESS_EVENT_V2PVT.create_cust_acct_relate_event (
2664: l_cust_acct_relate_rec );
2673: END IF;
2674:
2675: -- Standard call to get message count and if count is 1, get message info.
2676: FND_MSG_PUB.Count_And_Get(
2677: p_encoded => FND_API.G_FALSE,
2678: p_count => x_msg_count,
2679: p_data => x_msg_data );
2680:
2681: -- Debug info.
2694: -- Check if API is called in debug mode. If yes, disable debug.
2695: --disable_debug;
2696:
2697: EXCEPTION
2698: WHEN FND_API.G_EXC_ERROR THEN
2699: ROLLBACK TO create_cust_acct_relate;
2700: x_return_status := FND_API.G_RET_STS_ERROR;
2701:
2702: FND_MSG_PUB.Count_And_Get(
2696:
2697: EXCEPTION
2698: WHEN FND_API.G_EXC_ERROR THEN
2699: ROLLBACK TO create_cust_acct_relate;
2700: x_return_status := FND_API.G_RET_STS_ERROR;
2701:
2702: FND_MSG_PUB.Count_And_Get(
2703: p_encoded => FND_API.G_FALSE,
2704: p_count => x_msg_count,
2699: ROLLBACK TO create_cust_acct_relate;
2700: x_return_status := FND_API.G_RET_STS_ERROR;
2701:
2702: FND_MSG_PUB.Count_And_Get(
2703: p_encoded => FND_API.G_FALSE,
2704: p_count => x_msg_count,
2705: p_data => x_msg_data );
2706:
2707: -- Debug info.
2720:
2721: -- Check if API is called in debug mode. If yes, disable debug.
2722: --disable_debug;
2723:
2724: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2725: ROLLBACK TO create_cust_acct_relate;
2726: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2727:
2728: FND_MSG_PUB.Count_And_Get(
2722: --disable_debug;
2723:
2724: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2725: ROLLBACK TO create_cust_acct_relate;
2726: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2727:
2728: FND_MSG_PUB.Count_And_Get(
2729: p_encoded => FND_API.G_FALSE,
2730: p_count => x_msg_count,
2725: ROLLBACK TO create_cust_acct_relate;
2726: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2727:
2728: FND_MSG_PUB.Count_And_Get(
2729: p_encoded => FND_API.G_FALSE,
2730: p_count => x_msg_count,
2731: p_data => x_msg_data );
2732:
2733: -- Debug info.
2748: --disable_debug;
2749:
2750: WHEN OTHERS THEN
2751: ROLLBACK TO create_cust_acct_relate;
2752: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2753:
2754: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
2755: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2756: FND_MSG_PUB.ADD;
2755: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2756: FND_MSG_PUB.ADD;
2757:
2758: FND_MSG_PUB.Count_And_Get(
2759: p_encoded => FND_API.G_FALSE,
2760: p_count => x_msg_count,
2761: p_data => x_msg_data );
2762:
2763: -- Debug info.
2790: *
2791: * ARGUMENTS
2792: * IN:
2793: * p_init_msg_list Initialize message stack if it is set to
2794: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
2795: * p_cust_acct_relate_rec Customer account relate record.
2796: * IN/OUT:
2797: * p_object_version_number Used for locking the being updated record.
2798: * OUT:
2796: * IN/OUT:
2797: * p_object_version_number Used for locking the being updated record.
2798: * OUT:
2799: * x_return_status Return status after the call. The status can
2800: * be FND_API.G_RET_STS_SUCCESS (success),
2801: * FND_API.G_RET_STS_ERROR (error),
2802: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2803: * x_msg_count Number of messages in message stack.
2804: * x_msg_data Message text if x_msg_count is 1.
2797: * p_object_version_number Used for locking the being updated record.
2798: * OUT:
2799: * x_return_status Return status after the call. The status can
2800: * be FND_API.G_RET_STS_SUCCESS (success),
2801: * FND_API.G_RET_STS_ERROR (error),
2802: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2803: * x_msg_count Number of messages in message stack.
2804: * x_msg_data Message text if x_msg_count is 1.
2805: *
2798: * OUT:
2799: * x_return_status Return status after the call. The status can
2800: * be FND_API.G_RET_STS_SUCCESS (success),
2801: * FND_API.G_RET_STS_ERROR (error),
2802: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2803: * x_msg_count Number of messages in message stack.
2804: * x_msg_data Message text if x_msg_count is 1.
2805: *
2806: * NOTES
2815: *
2816: */
2817:
2818: PROCEDURE update_cust_acct_relate (
2819: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2820: p_cust_acct_relate_rec IN CUST_ACCT_RELATE_REC_TYPE,
2821: p_object_version_number IN OUT NOCOPY NUMBER,
2822: x_return_status OUT NOCOPY VARCHAR2,
2823: x_msg_count OUT NOCOPY NUMBER,
2842: p_msg_level=>fnd_log.level_procedure);
2843: END IF;
2844:
2845: -- Initialize message list if p_init_msg_list is set to TRUE.
2846: IF FND_API.to_Boolean(p_init_msg_list) THEN
2847: FND_MSG_PUB.initialize;
2848: END IF;
2849:
2850: -- Initialize API return status to success.
2847: FND_MSG_PUB.initialize;
2848: END IF;
2849:
2850: -- Initialize API return status to success.
2851: x_return_status := FND_API.G_RET_STS_SUCCESS;
2852:
2853: -- Bug 3456489 (Org id is required for identifying correct account relationship record.)
2854: l_old_cust_acct_relate_rec.org_id := p_cust_acct_relate_rec.org_id;
2855:
2864: x_msg_count => x_msg_count,
2865: x_msg_data => x_msg_data);
2866:
2867:
2868: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2869: RAISE FND_API.G_EXC_ERROR;
2870: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2871: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2872: END IF;
2865: x_msg_data => x_msg_data);
2866:
2867:
2868: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2869: RAISE FND_API.G_EXC_ERROR;
2870: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2871: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2872: END IF;
2873:
2866:
2867:
2868: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2869: RAISE FND_API.G_EXC_ERROR;
2870: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2871: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2872: END IF;
2873:
2874: -- Call to business logic.
2867:
2868: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2869: RAISE FND_API.G_EXC_ERROR;
2870: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2871: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2872: END IF;
2873:
2874: -- Call to business logic.
2875: do_update_cust_acct_relate (
2877: p_object_version_number,
2878: NULL, /* Bug 3449118 pass NULL for rowid */
2879: x_return_status );
2880:
2881: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
2882: IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
2883: -- Invoke business event system.
2884: HZ_BUSINESS_EVENT_V2PVT.update_cust_acct_relate_event (
2885: l_cust_acct_relate_rec , l_old_cust_acct_relate_rec);
2894: END IF;
2895:
2896: -- Standard call to get message count and if count is 1, get message info.
2897: FND_MSG_PUB.Count_And_Get(
2898: p_encoded => FND_API.G_FALSE,
2899: p_count => x_msg_count,
2900: p_data => x_msg_data );
2901:
2902: -- Debug info.
2915: -- Check if API is called in debug mode. If yes, disable debug.
2916: --disable_debug;
2917:
2918: EXCEPTION
2919: WHEN FND_API.G_EXC_ERROR THEN
2920: ROLLBACK TO update_cust_acct_relate;
2921: x_return_status := FND_API.G_RET_STS_ERROR;
2922:
2923: FND_MSG_PUB.Count_And_Get(
2917:
2918: EXCEPTION
2919: WHEN FND_API.G_EXC_ERROR THEN
2920: ROLLBACK TO update_cust_acct_relate;
2921: x_return_status := FND_API.G_RET_STS_ERROR;
2922:
2923: FND_MSG_PUB.Count_And_Get(
2924: p_encoded => FND_API.G_FALSE,
2925: p_count => x_msg_count,
2920: ROLLBACK TO update_cust_acct_relate;
2921: x_return_status := FND_API.G_RET_STS_ERROR;
2922:
2923: FND_MSG_PUB.Count_And_Get(
2924: p_encoded => FND_API.G_FALSE,
2925: p_count => x_msg_count,
2926: p_data => x_msg_data );
2927:
2928: -- Debug info.
2941:
2942: -- Check if API is called in debug mode. If yes, disable debug.
2943: --disable_debug;
2944:
2945: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2946: ROLLBACK TO update_cust_acct_relate;
2947: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2948:
2949: FND_MSG_PUB.Count_And_Get(
2943: --disable_debug;
2944:
2945: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2946: ROLLBACK TO update_cust_acct_relate;
2947: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2948:
2949: FND_MSG_PUB.Count_And_Get(
2950: p_encoded => FND_API.G_FALSE,
2951: p_count => x_msg_count,
2946: ROLLBACK TO update_cust_acct_relate;
2947: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2948:
2949: FND_MSG_PUB.Count_And_Get(
2950: p_encoded => FND_API.G_FALSE,
2951: p_count => x_msg_count,
2952: p_data => x_msg_data );
2953:
2954: -- Debug info.
2969: --disable_debug;
2970:
2971: WHEN OTHERS THEN
2972: ROLLBACK TO update_cust_acct_relate;
2973: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2974:
2975: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
2976: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2977: FND_MSG_PUB.ADD;
2976: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2977: FND_MSG_PUB.ADD;
2978:
2979: FND_MSG_PUB.Count_And_Get(
2980: p_encoded => FND_API.G_FALSE,
2981: p_count => x_msg_count,
2982: p_data => x_msg_data );
2983:
2984: -- Debug info.
3015: *
3016: * ARGUMENTS
3017: * IN:
3018: * p_init_msg_list Initialize message stack if it is set to
3019: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3020: * p_cust_acct_relate_rec Customer account relate record.
3021: * p_rowid Rowid of record that the user is trying to update.
3022: *
3023: * IN/OUT:
3024: * p_object_version_number Used for locking the being updated record.
3025: *
3026: * OUT:
3027: * x_return_status Return status after the call. The status can
3028: * be FND_API.G_RET_STS_SUCCESS (success),
3029: * FND_API.G_RET_STS_ERROR (error),
3030: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3031: * x_msg_count Number of messages in message stack.
3032: * x_msg_data Message text if x_msg_count is 1.
3025: *
3026: * OUT:
3027: * x_return_status Return status after the call. The status can
3028: * be FND_API.G_RET_STS_SUCCESS (success),
3029: * FND_API.G_RET_STS_ERROR (error),
3030: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3031: * x_msg_count Number of messages in message stack.
3032: * x_msg_data Message text if x_msg_count is 1.
3033: *
3026: * OUT:
3027: * x_return_status Return status after the call. The status can
3028: * be FND_API.G_RET_STS_SUCCESS (success),
3029: * FND_API.G_RET_STS_ERROR (error),
3030: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3031: * x_msg_count Number of messages in message stack.
3032: * x_msg_data Message text if x_msg_count is 1.
3033: *
3034: * NOTES
3041: * 12-AUG-2005 Idris Ali o Bug 4529413:modified the call to get_cust_acct_relate_rec
3042: */
3043:
3044: PROCEDURE update_cust_acct_relate (
3045: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3046: p_cust_acct_relate_rec IN CUST_ACCT_RELATE_REC_TYPE,
3047: p_rowid IN ROWID,
3048: p_object_version_number IN OUT NOCOPY NUMBER,
3049: x_return_status OUT NOCOPY VARCHAR2,
3069: p_msg_level=>fnd_log.level_procedure);
3070: END IF;
3071:
3072: -- Initialize message list if p_init_msg_list is set to TRUE.
3073: IF FND_API.to_Boolean(p_init_msg_list) THEN
3074: FND_MSG_PUB.initialize;
3075: END IF;
3076:
3077: -- Initialize API return status to success.
3074: FND_MSG_PUB.initialize;
3075: END IF;
3076:
3077: -- Initialize API return status to success.
3078: x_return_status := FND_API.G_RET_STS_SUCCESS;
3079:
3080: -- Bug 3456489. If API is called with NULL for rowid, then we need org_id to identify the record.
3081: l_old_cust_acct_relate_rec.org_id := p_cust_acct_relate_rec.org_id;
3082:
3090: x_return_status => x_return_status,
3091: x_msg_count => x_msg_count,
3092: x_msg_data => x_msg_data);
3093:
3094: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3095: RAISE FND_API.G_EXC_ERROR;
3096: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3097: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3098: END IF;
3091: x_msg_count => x_msg_count,
3092: x_msg_data => x_msg_data);
3093:
3094: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3095: RAISE FND_API.G_EXC_ERROR;
3096: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3097: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3098: END IF;
3099:
3092: x_msg_data => x_msg_data);
3093:
3094: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3095: RAISE FND_API.G_EXC_ERROR;
3096: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3097: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3098: END IF;
3099:
3100: -- Call to business logic.
3093:
3094: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3095: RAISE FND_API.G_EXC_ERROR;
3096: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3097: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3098: END IF;
3099:
3100: -- Call to business logic.
3101: do_update_cust_acct_relate (
3103: p_object_version_number,
3104: p_rowid,
3105: x_return_status );
3106:
3107: IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
3108: IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
3109: -- Invoke business event system.
3110: HZ_BUSINESS_EVENT_V2PVT.update_cust_acct_relate_event (
3111: l_cust_acct_relate_rec , l_old_cust_acct_relate_rec);
3120: END IF;
3121:
3122: -- Standard call to get message count and if count is 1, get message info.
3123: FND_MSG_PUB.Count_And_Get(
3124: p_encoded => FND_API.G_FALSE,
3125: p_count => x_msg_count,
3126: p_data => x_msg_data );
3127:
3128: -- Debug info.
3141: -- Check if API is called in debug mode. If yes, disable debug.
3142: --disable_debug;
3143:
3144: EXCEPTION
3145: WHEN FND_API.G_EXC_ERROR THEN
3146: ROLLBACK TO update_cust_acct_relate;
3147: x_return_status := FND_API.G_RET_STS_ERROR;
3148:
3149: FND_MSG_PUB.Count_And_Get(
3143:
3144: EXCEPTION
3145: WHEN FND_API.G_EXC_ERROR THEN
3146: ROLLBACK TO update_cust_acct_relate;
3147: x_return_status := FND_API.G_RET_STS_ERROR;
3148:
3149: FND_MSG_PUB.Count_And_Get(
3150: p_encoded => FND_API.G_FALSE,
3151: p_count => x_msg_count,
3146: ROLLBACK TO update_cust_acct_relate;
3147: x_return_status := FND_API.G_RET_STS_ERROR;
3148:
3149: FND_MSG_PUB.Count_And_Get(
3150: p_encoded => FND_API.G_FALSE,
3151: p_count => x_msg_count,
3152: p_data => x_msg_data );
3153:
3154: -- Debug info.
3167:
3168: -- Check if API is called in debug mode. If yes, disable debug.
3169: --disable_debug;
3170:
3171: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3172: ROLLBACK TO update_cust_acct_relate;
3173: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3174:
3175: FND_MSG_PUB.Count_And_Get(
3169: --disable_debug;
3170:
3171: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3172: ROLLBACK TO update_cust_acct_relate;
3173: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3174:
3175: FND_MSG_PUB.Count_And_Get(
3176: p_encoded => FND_API.G_FALSE,
3177: p_count => x_msg_count,
3172: ROLLBACK TO update_cust_acct_relate;
3173: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3174:
3175: FND_MSG_PUB.Count_And_Get(
3176: p_encoded => FND_API.G_FALSE,
3177: p_count => x_msg_count,
3178: p_data => x_msg_data );
3179:
3180: -- Debug info.
3195: --disable_debug;
3196:
3197: WHEN OTHERS THEN
3198: ROLLBACK TO update_cust_acct_relate;
3199: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3200:
3201: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
3202: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
3203: FND_MSG_PUB.ADD;
3202: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
3203: FND_MSG_PUB.ADD;
3204:
3205: FND_MSG_PUB.Count_And_Get(
3206: p_encoded => FND_API.G_FALSE,
3207: p_count => x_msg_count,
3208: p_data => x_msg_data );
3209:
3210: -- Debug info.
3238: *
3239: * ARGUMENTS
3240: * IN:
3241: * p_init_msg_list Initialize message stack if it is set to
3242: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3243: * p_cust_account_id Customer account id.
3244: * p_related_cust_account_id Related customer account id.
3245: * IN/OUT:
3246: * OUT:
3245: * IN/OUT:
3246: * OUT:
3247: * x_cust_acct_relate_rec Returned customer account relate record.
3248: * x_return_status Return status after the call. The status can
3249: * be FND_API.G_RET_STS_SUCCESS (success),
3250: * FND_API.G_RET_STS_ERROR (error),
3251: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3252: * x_msg_count Number of messages in message stack.
3253: * x_msg_data Message text if x_msg_count is 1.
3246: * OUT:
3247: * x_cust_acct_relate_rec Returned customer account relate record.
3248: * x_return_status Return status after the call. The status can
3249: * be FND_API.G_RET_STS_SUCCESS (success),
3250: * FND_API.G_RET_STS_ERROR (error),
3251: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3252: * x_msg_count Number of messages in message stack.
3253: * x_msg_data Message text if x_msg_count is 1.
3254: *
3247: * x_cust_acct_relate_rec Returned customer account relate record.
3248: * x_return_status Return status after the call. The status can
3249: * be FND_API.G_RET_STS_SUCCESS (success),
3250: * FND_API.G_RET_STS_ERROR (error),
3251: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3252: * x_msg_count Number of messages in message stack.
3253: * x_msg_data Message text if x_msg_count is 1.
3254: *
3255: * NOTES
3265: * 12-AUG-2005 Idris Ali o Bug 4529413:Added parameter cust_acct_relate_id to get_cust_acct_relate
3266: */
3267:
3268: PROCEDURE get_cust_acct_relate_rec (
3269: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3270: p_cust_account_id IN NUMBER,
3271: p_related_cust_account_id IN NUMBER,
3272: p_cust_acct_relate_id IN NUMBER, -- Bug 4529413
3273: p_rowid IN ROWID, -- Bug 3449118
3289: p_msg_level=>fnd_log.level_procedure);
3290: END IF;
3291:
3292: -- Initialize message list if p_init_msg_list is set to TRUE.
3293: IF FND_API.to_Boolean(p_init_msg_list) THEN
3294: FND_MSG_PUB.initialize;
3295: END IF;
3296:
3297: -- Initialize API return status to success.
3294: FND_MSG_PUB.initialize;
3295: END IF;
3296:
3297: -- Initialize API return status to success.
3298: x_return_status := FND_API.G_RET_STS_SUCCESS;
3299:
3300: IF p_cust_acct_relate_id IS NULL THEN
3301:
3302: -- Check whether primary key has been passed in.
3300: IF p_cust_acct_relate_id IS NULL THEN
3301:
3302: -- Check whether primary key has been passed in.
3303: IF p_cust_account_id IS NULL OR
3304: p_cust_account_id = FND_API.G_MISS_NUM THEN
3305: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
3306: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'cust_account_id' );
3307: FND_MSG_PUB.ADD;
3308: RAISE FND_API.G_EXC_ERROR;
3304: p_cust_account_id = FND_API.G_MISS_NUM THEN
3305: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
3306: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'cust_account_id' );
3307: FND_MSG_PUB.ADD;
3308: RAISE FND_API.G_EXC_ERROR;
3309: END IF;
3310:
3311: IF p_related_cust_account_id IS NULL OR
3312: p_related_cust_account_id = FND_API.G_MISS_NUM THEN
3308: RAISE FND_API.G_EXC_ERROR;
3309: END IF;
3310:
3311: IF p_related_cust_account_id IS NULL OR
3312: p_related_cust_account_id = FND_API.G_MISS_NUM THEN
3313: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
3314: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'related_cust_account_id' );
3315: FND_MSG_PUB.ADD;
3316: RAISE FND_API.G_EXC_ERROR;
3312: p_related_cust_account_id = FND_API.G_MISS_NUM THEN
3313: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
3314: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'related_cust_account_id' );
3315: FND_MSG_PUB.ADD;
3316: RAISE FND_API.G_EXC_ERROR;
3317: END IF;
3318: END IF;
3319:
3320: x_cust_acct_relate_rec.cust_account_id := p_cust_account_id;
3406: END IF;
3407:
3408: -- Standard call to get message count and if count is 1, get message info.
3409: FND_MSG_PUB.Count_And_Get(
3410: p_encoded => FND_API.G_FALSE,
3411: p_count => x_msg_count,
3412: p_data => x_msg_data );
3413:
3414: -- Debug info.
3428: --disable_debug;
3429:
3430:
3431: EXCEPTION
3432: WHEN FND_API.G_EXC_ERROR THEN
3433: x_return_status := FND_API.G_RET_STS_ERROR;
3434:
3435: FND_MSG_PUB.Count_And_Get(
3436: p_encoded => FND_API.G_FALSE,
3429:
3430:
3431: EXCEPTION
3432: WHEN FND_API.G_EXC_ERROR THEN
3433: x_return_status := FND_API.G_RET_STS_ERROR;
3434:
3435: FND_MSG_PUB.Count_And_Get(
3436: p_encoded => FND_API.G_FALSE,
3437: p_count => x_msg_count,
3432: WHEN FND_API.G_EXC_ERROR THEN
3433: x_return_status := FND_API.G_RET_STS_ERROR;
3434:
3435: FND_MSG_PUB.Count_And_Get(
3436: p_encoded => FND_API.G_FALSE,
3437: p_count => x_msg_count,
3438: p_data => x_msg_data );
3439:
3440: -- Debug info.
3453:
3454: -- Check if API is called in debug mode. If yes, disable debug.
3455: --disable_debug;
3456:
3457: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3458: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3459:
3460: FND_MSG_PUB.Count_And_Get(
3461: p_encoded => FND_API.G_FALSE,
3454: -- Check if API is called in debug mode. If yes, disable debug.
3455: --disable_debug;
3456:
3457: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3458: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3459:
3460: FND_MSG_PUB.Count_And_Get(
3461: p_encoded => FND_API.G_FALSE,
3462: p_count => x_msg_count,
3457: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3458: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3459:
3460: FND_MSG_PUB.Count_And_Get(
3461: p_encoded => FND_API.G_FALSE,
3462: p_count => x_msg_count,
3463: p_data => x_msg_data );
3464:
3465: -- Debug info.
3479: -- Check if API is called in debug mode. If yes, disable debug.
3480: --disable_debug;
3481:
3482: WHEN OTHERS THEN
3483: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3484:
3485: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
3486: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
3487: FND_MSG_PUB.ADD;
3486: FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
3487: FND_MSG_PUB.ADD;
3488:
3489: FND_MSG_PUB.Count_And_Get(
3490: p_encoded => FND_API.G_FALSE,
3491: p_count => x_msg_count,
3492: p_data => x_msg_data );
3493:
3494: -- Debug info.
3537:
3538: -- check account_activation_date
3539: IF (p_create_update_flag = 'C' AND
3540: p_cust_account_rec.account_activation_date IS NOT NULL AND
3541: p_cust_account_rec.account_activation_date <> FND_API.G_MISS_DATE) OR
3542: (p_create_update_flag = 'U' AND
3543: p_cust_account_rec.account_activation_date IS NOT NULL AND
3544: p_cust_account_rec.account_activation_date <> p_old_cust_account_rec.account_activation_date)
3545: THEN
3545: THEN
3546: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3547: FND_MESSAGE.SET_TOKEN('COLUMN', 'account_activation_date');
3548: FND_MSG_PUB.ADD;
3549: x_return_status := FND_API.G_RET_STS_ERROR;
3550: END IF;
3551:
3552: -- check account_liable_flag
3553: IF (p_create_update_flag = 'C' AND
3551:
3552: -- check account_liable_flag
3553: IF (p_create_update_flag = 'C' AND
3554: p_cust_account_rec.account_liable_flag IS NOT NULL AND
3555: p_cust_account_rec.account_liable_flag <> FND_API.G_MISS_CHAR) OR
3556: (p_create_update_flag = 'U' AND
3557: p_cust_account_rec.account_liable_flag IS NOT NULL AND
3558: p_cust_account_rec.account_liable_flag <> p_old_cust_account_rec.account_liable_flag)
3559: THEN
3559: THEN
3560: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3561: FND_MESSAGE.SET_TOKEN('COLUMN', 'account_liable_flag');
3562: FND_MSG_PUB.ADD;
3563: x_return_status := FND_API.G_RET_STS_ERROR;
3564: END IF;
3565:
3566: -- check account_termination_date
3567: IF (p_create_update_flag = 'C' AND
3565:
3566: -- check account_termination_date
3567: IF (p_create_update_flag = 'C' AND
3568: p_cust_account_rec.account_termination_date IS NOT NULL AND
3569: p_cust_account_rec.account_termination_date <> FND_API.G_MISS_DATE) OR
3570: (p_create_update_flag = 'U' AND
3571: p_cust_account_rec.account_termination_date IS NOT NULL AND
3572: p_cust_account_rec.account_termination_date <> p_old_cust_account_rec.account_termination_date)
3573: THEN
3573: THEN
3574: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3575: FND_MESSAGE.SET_TOKEN('COLUMN', 'account_termination_date');
3576: FND_MSG_PUB.ADD;
3577: x_return_status := FND_API.G_RET_STS_ERROR;
3578: END IF;
3579:
3580: -- check acct_life_cycle_status
3581: IF (p_create_update_flag = 'C' AND
3579:
3580: -- check acct_life_cycle_status
3581: IF (p_create_update_flag = 'C' AND
3582: p_cust_account_rec.acct_life_cycle_status IS NOT NULL AND
3583: p_cust_account_rec.acct_life_cycle_status <> FND_API.G_MISS_CHAR) OR
3584: (p_create_update_flag = 'U' AND
3585: p_cust_account_rec.acct_life_cycle_status IS NOT NULL AND
3586: p_cust_account_rec.acct_life_cycle_status <> p_old_cust_account_rec.acct_life_cycle_status)
3587: THEN
3587: THEN
3588: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3589: FND_MESSAGE.SET_TOKEN('COLUMN', 'acct_life_cycle_status');
3590: FND_MSG_PUB.ADD;
3591: x_return_status := FND_API.G_RET_STS_ERROR;
3592: END IF;
3593:
3594: -- check current_balance
3595: IF (p_create_update_flag = 'C' AND
3593:
3594: -- check current_balance
3595: IF (p_create_update_flag = 'C' AND
3596: p_cust_account_rec.current_balance IS NOT NULL AND
3597: p_cust_account_rec.current_balance <> FND_API.G_MISS_NUM) OR
3598: (p_create_update_flag = 'U' AND
3599: p_cust_account_rec.current_balance IS NOT NULL AND
3600: p_cust_account_rec.current_balance <> p_old_cust_account_rec.current_balance)
3601: THEN
3601: THEN
3602: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3603: FND_MESSAGE.SET_TOKEN('COLUMN', 'current_balance');
3604: FND_MSG_PUB.ADD;
3605: x_return_status := FND_API.G_RET_STS_ERROR;
3606: END IF;
3607:
3608: -- check department
3609: IF (p_create_update_flag = 'C' AND
3607:
3608: -- check department
3609: IF (p_create_update_flag = 'C' AND
3610: p_cust_account_rec.department IS NOT NULL AND
3611: p_cust_account_rec.department <> FND_API.G_MISS_CHAR) OR
3612: (p_create_update_flag = 'U' AND
3613: p_cust_account_rec.department IS NOT NULL AND
3614: p_cust_account_rec.department <> p_old_cust_account_rec.department)
3615: THEN
3615: THEN
3616: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3617: FND_MESSAGE.SET_TOKEN('COLUMN', 'department');
3618: FND_MSG_PUB.ADD;
3619: x_return_status := FND_API.G_RET_STS_ERROR;
3620: END IF;
3621:
3622: -- check dormant_account_flag
3623: IF (p_create_update_flag = 'C' AND
3621:
3622: -- check dormant_account_flag
3623: IF (p_create_update_flag = 'C' AND
3624: p_cust_account_rec.dormant_account_flag IS NOT NULL AND
3625: p_cust_account_rec.dormant_account_flag <> FND_API.G_MISS_CHAR) OR
3626: (p_create_update_flag = 'U' AND
3627: p_cust_account_rec.dormant_account_flag IS NOT NULL AND
3628: p_cust_account_rec.dormant_account_flag <> p_old_cust_account_rec.dormant_account_flag)
3629: THEN
3629: THEN
3630: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3631: FND_MESSAGE.SET_TOKEN('COLUMN', 'dormant_account_flag');
3632: FND_MSG_PUB.ADD;
3633: x_return_status := FND_API.G_RET_STS_ERROR;
3634: END IF;
3635:
3636: -- check notify_flag
3637: IF (p_create_update_flag = 'C' AND
3635:
3636: -- check notify_flag
3637: IF (p_create_update_flag = 'C' AND
3638: p_cust_account_rec.notify_flag IS NOT NULL AND
3639: p_cust_account_rec.notify_flag <> FND_API.G_MISS_CHAR) OR
3640: (p_create_update_flag = 'U' AND
3641: p_cust_account_rec.notify_flag IS NOT NULL AND
3642: p_cust_account_rec.notify_flag <> p_old_cust_account_rec.notify_flag)
3643: THEN
3643: THEN
3644: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3645: FND_MESSAGE.SET_TOKEN('COLUMN', 'notify_flag');
3646: FND_MSG_PUB.ADD;
3647: x_return_status := FND_API.G_RET_STS_ERROR;
3648: END IF;
3649:
3650: -- check order_type_id
3651: IF (p_create_update_flag = 'C' AND
3649:
3650: -- check order_type_id
3651: IF (p_create_update_flag = 'C' AND
3652: p_cust_account_rec.order_type_id IS NOT NULL AND
3653: p_cust_account_rec.order_type_id <> FND_API.G_MISS_NUM) OR
3654: (p_create_update_flag = 'U' AND
3655: p_cust_account_rec.order_type_id IS NOT NULL AND
3656: p_cust_account_rec.order_type_id <> p_old_cust_account_rec.order_type_id)
3657: THEN
3657: THEN
3658: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3659: FND_MESSAGE.SET_TOKEN('COLUMN', 'order_type_id');
3660: FND_MSG_PUB.ADD;
3661: x_return_status := FND_API.G_RET_STS_ERROR;
3662: END IF;
3663:
3664: -- check primary_salesrep_id
3665: IF (p_create_update_flag = 'C' AND
3663:
3664: -- check primary_salesrep_id
3665: IF (p_create_update_flag = 'C' AND
3666: p_cust_account_rec.primary_salesrep_id IS NOT NULL AND
3667: p_cust_account_rec.primary_salesrep_id <> FND_API.G_MISS_NUM) OR
3668: (p_create_update_flag = 'U' AND
3669: p_cust_account_rec.primary_salesrep_id IS NOT NULL AND
3670: p_cust_account_rec.primary_salesrep_id <> p_old_cust_account_rec.primary_salesrep_id)
3671: THEN
3671: THEN
3672: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3673: FND_MESSAGE.SET_TOKEN('COLUMN', 'primary_salesrep_id');
3674: FND_MSG_PUB.ADD;
3675: x_return_status := FND_API.G_RET_STS_ERROR;
3676: END IF;
3677:
3678: -- check realtime_rate_flag
3679: IF (p_create_update_flag = 'C' AND
3677:
3678: -- check realtime_rate_flag
3679: IF (p_create_update_flag = 'C' AND
3680: p_cust_account_rec.realtime_rate_flag IS NOT NULL AND
3681: p_cust_account_rec.realtime_rate_flag <> FND_API.G_MISS_CHAR) OR
3682: (p_create_update_flag = 'U' AND
3683: p_cust_account_rec.realtime_rate_flag IS NOT NULL AND
3684: p_cust_account_rec.realtime_rate_flag <> p_old_cust_account_rec.realtime_rate_flag)
3685: THEN
3685: THEN
3686: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3687: FND_MESSAGE.SET_TOKEN('COLUMN', 'realtime_rate_flag');
3688: FND_MSG_PUB.ADD;
3689: x_return_status := FND_API.G_RET_STS_ERROR;
3690: END IF;
3691:
3692: -- check suspension_date
3693: IF (p_create_update_flag = 'C' AND
3691:
3692: -- check suspension_date
3693: IF (p_create_update_flag = 'C' AND
3694: p_cust_account_rec.suspension_date IS NOT NULL AND
3695: p_cust_account_rec.suspension_date <> FND_API.G_MISS_DATE) OR
3696: (p_create_update_flag = 'U' AND
3697: p_cust_account_rec.suspension_date IS NOT NULL AND
3698: p_cust_account_rec.suspension_date <> p_old_cust_account_rec.suspension_date)
3699: THEN
3699: THEN
3700: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3701: FND_MESSAGE.SET_TOKEN('COLUMN', 'suspension_date');
3702: FND_MSG_PUB.ADD;
3703: x_return_status := FND_API.G_RET_STS_ERROR;
3704: END IF;
3705:
3706: -- check tax_code
3707: -- Bug 4713150
3706: -- check tax_code
3707: -- Bug 4713150
3708: /* IF (p_create_update_flag = 'C' AND
3709: p_cust_account_rec.tax_code IS NOT NULL AND
3710: p_cust_account_rec.tax_code <> FND_API.G_MISS_CHAR) OR
3711: (p_create_update_flag = 'U' AND
3712: p_cust_account_rec.tax_code IS NOT NULL AND
3713: p_cust_account_rec.tax_code <> p_old_cust_account_rec.tax_code)
3714: THEN
3714: THEN
3715: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OBSOLETE_COLUMN');
3716: FND_MESSAGE.SET_TOKEN('COLUMN', 'tax_code');
3717: FND_MSG_PUB.ADD;
3718: x_return_status := FND_API.G_RET_STS_ERROR;
3719: END IF;
3720: */
3721: END check_obsolete_columns;
3722: