63:
64: -- Hint: Primary key needs to be returned.
65: PROCEDURE Create_Offers(
66: p_api_version_number IN NUMBER,
67: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
68: p_commit IN VARCHAR2 := FND_API.G_FALSE,
69: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
70:
71: x_return_status OUT NOCOPY VARCHAR2,
64: -- Hint: Primary key needs to be returned.
65: PROCEDURE Create_Offers(
66: p_api_version_number IN NUMBER,
67: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
68: p_commit IN VARCHAR2 := FND_API.G_FALSE,
69: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
70:
71: x_return_status OUT NOCOPY VARCHAR2,
72: x_msg_count OUT NOCOPY NUMBER,
65: PROCEDURE Create_Offers(
66: p_api_version_number IN NUMBER,
67: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
68: p_commit IN VARCHAR2 := FND_API.G_FALSE,
69: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
70:
71: x_return_status OUT NOCOPY VARCHAR2,
72: x_msg_count OUT NOCOPY NUMBER,
73: x_msg_data OUT NOCOPY VARCHAR2,
79: IS
80: l_api_name CONSTANT VARCHAR2(30) := 'Create_Offers';
81: l_api_version_number CONSTANT NUMBER := 1.0;
82: l_object_version_number NUMBER := 1;
83: l_org_id NUMBER := FND_API.G_MISS_NUM;
84: l_offer_id NUMBER;
85: l_dummy NUMBER;
86:
87: CURSOR c_id IS
117: -- Standard Start of API savepoint
118: SAVEPOINT CREATE_Offers_PVT;
119:
120: -- Standard call to check for call compatibility.
121: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
122: p_api_version_number,
123: l_api_name,
124: G_PKG_NAME)
125: THEN
122: p_api_version_number,
123: l_api_name,
124: G_PKG_NAME)
125: THEN
126: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
127: END IF;
128:
129: -- Initialize message list if p_init_msg_list is set to TRUE.
130: IF FND_API.to_Boolean( p_init_msg_list )
126: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
127: END IF;
128:
129: -- Initialize message list if p_init_msg_list is set to TRUE.
130: IF FND_API.to_Boolean( p_init_msg_list )
131: THEN
132: FND_MSG_PUB.initialize;
133: END IF;
134:
132: FND_MSG_PUB.initialize;
133: END IF;
134:
135: -- Initialize API return status to SUCCESS
136: x_return_status := FND_API.G_RET_STS_SUCCESS;
137:
138: -- Local variable initialization
139:
140: IF p_offers_rec.OFFER_ID IS NULL OR p_offers_rec.OFFER_ID = FND_API.g_miss_num THEN
136: x_return_status := FND_API.G_RET_STS_SUCCESS;
137:
138: -- Local variable initialization
139:
140: IF p_offers_rec.OFFER_ID IS NULL OR p_offers_rec.OFFER_ID = FND_API.g_miss_num THEN
141: LOOP
142: l_dummy := NULL;
143: OPEN c_id;
144: FETCH c_id INTO l_OFFER_ID;
152: l_offers_rec.offer_id := l_offer_id;
153: END IF;
154:
155:
156: IF p_offers_rec.user_status_id = FND_API.G_MISS_NUM
157: OR p_offers_rec.user_status_id IS NULL
158: THEN
159: handle_status(
160: x_status_id => l_status_id
159: handle_status(
160: x_status_id => l_status_id
161: ,x_return_status => x_return_status
162: );
163: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
164: RAISE FND_API.G_EXC_ERROR;
165: ELSIF x_return_status =FND_API.G_RET_STS_SUCCESS THEN
166: l_offers_rec.user_status_id := l_status_id;
167: END IF;
160: x_status_id => l_status_id
161: ,x_return_status => x_return_status
162: );
163: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
164: RAISE FND_API.G_EXC_ERROR;
165: ELSIF x_return_status =FND_API.G_RET_STS_SUCCESS THEN
166: l_offers_rec.user_status_id := l_status_id;
167: END IF;
168: END IF;
161: ,x_return_status => x_return_status
162: );
163: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
164: RAISE FND_API.G_EXC_ERROR;
165: ELSIF x_return_status =FND_API.G_RET_STS_SUCCESS THEN
166: l_offers_rec.user_status_id := l_status_id;
167: END IF;
168: END IF;
169:
168: END IF;
169:
170:
171: -- get the status_code for the the user_status_id
172: IF l_offers_rec.user_status_id <> FND_API.G_MISS_NUM
173: AND l_offers_rec.user_status_id IS NOT NULL
174: THEN
175: handle_status(
176: p_user_status_id => l_offers_rec.user_status_id
176: p_user_status_id => l_offers_rec.user_status_id
177: ,x_status_code => l_status_code
178: ,x_return_status => x_return_status
179: );
180: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
181: RAISE FND_API.G_EXC_ERROR;
182: ELSIF x_return_status =FND_API.G_RET_STS_SUCCESS THEN
183: l_offers_rec.status_code := l_status_code;
184: END IF;
177: ,x_status_code => l_status_code
178: ,x_return_status => x_return_status
179: );
180: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
181: RAISE FND_API.G_EXC_ERROR;
182: ELSIF x_return_status =FND_API.G_RET_STS_SUCCESS THEN
183: l_offers_rec.status_code := l_status_code;
184: END IF;
185: END IF;
178: ,x_return_status => x_return_status
179: );
180: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
181: RAISE FND_API.G_EXC_ERROR;
182: ELSIF x_return_status =FND_API.G_RET_STS_SUCCESS THEN
183: l_offers_rec.status_code := l_status_code;
184: END IF;
185: END IF;
186:
186:
187:
188: --getting the source code for the offers
189: IF p_offers_rec.offer_code IS NULL
190: OR p_offers_rec.offer_code = FND_API.g_miss_CHAR
191: THEN
192: l_offers_rec.offer_code := AMS_SourceCode_PVT.get_new_source_code (
193: p_object_type => 'OFFR',
194: p_custsetup_id => p_offers_rec.custom_setup_id,
191: THEN
192: l_offers_rec.offer_code := AMS_SourceCode_PVT.get_new_source_code (
193: p_object_type => 'OFFR',
194: p_custsetup_id => p_offers_rec.custom_setup_id,
195: p_global_flag => FND_API.g_false
196: );
197: END IF;
198:
199: -- =========================================================================
202:
203: IF FND_GLOBAL.User_Id IS NULL
204: THEN
205: OZF_Utility_PVT.Error_Message(p_message_name => 'USER_PROFILE_MISSING');
206: RAISE FND_API.G_EXC_ERROR;
207: END IF;
208:
209: IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
210: THEN
205: OZF_Utility_PVT.Error_Message(p_message_name => 'USER_PROFILE_MISSING');
206: RAISE FND_API.G_EXC_ERROR;
207: END IF;
208:
209: IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
210: THEN
211: -- Invoke validation procedures
212: Validate_offers(
213: p_api_version_number => 1.0,
210: THEN
211: -- Invoke validation procedures
212: Validate_offers(
213: p_api_version_number => 1.0,
214: p_init_msg_list => FND_API.G_FALSE,
215: p_validation_level => p_validation_level,
216: p_offers_rec => l_offers_rec,
217: x_return_status => x_return_status,
218: x_msg_count => x_msg_count,
217: x_return_status => x_return_status,
218: x_msg_count => x_msg_count,
219: x_msg_data => x_msg_data);
220: END IF;
221: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
222: RAISE FND_API.G_EXC_ERROR;
223: END IF;
224:
225: -- julou defaulting last_recal_date to offer start date
218: x_msg_count => x_msg_count,
219: x_msg_data => x_msg_data);
220: END IF;
221: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
222: RAISE FND_API.G_EXC_ERROR;
223: END IF;
224:
225: -- julou defaulting last_recal_date to offer start date
226: OPEN c_get_start_date;
289: p_sales_method_flag => l_offers_rec.sales_method_flag,
290: p_org_id => l_offers_rec.org_id,
291: p_fund_request_curr_code => nvl(l_offers_rec.transaction_currency_Code,FND_PROFILE.VALUE('JTF_PROFILE_DEFAULT_CURRENCY'))
292: );
293: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
294: RAISE FND_API.G_EXC_ERROR;
295: END IF;
296:
297: x_offer_id := l_offer_id;
290: p_org_id => l_offers_rec.org_id,
291: p_fund_request_curr_code => nvl(l_offers_rec.transaction_currency_Code,FND_PROFILE.VALUE('JTF_PROFILE_DEFAULT_CURRENCY'))
292: );
293: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
294: RAISE FND_API.G_EXC_ERROR;
295: END IF;
296:
297: x_offer_id := l_offer_id;
298: -- added by julou 07/29/2002 offer security. create an entry in ams_act_access
311:
312: -- create access for the owner of the offer
313: AMS_access_PVT.create_access(
314: p_api_version => l_api_version_number,
315: p_init_msg_list => FND_API.g_false,
316: p_commit => FND_API.g_false,
317: p_validation_level => FND_API.g_valid_level_full,
318: x_return_status => x_return_status,
319: x_msg_count => x_msg_count,
312: -- create access for the owner of the offer
313: AMS_access_PVT.create_access(
314: p_api_version => l_api_version_number,
315: p_init_msg_list => FND_API.g_false,
316: p_commit => FND_API.g_false,
317: p_validation_level => FND_API.g_valid_level_full,
318: x_return_status => x_return_status,
319: x_msg_count => x_msg_count,
320: x_msg_data => x_msg_data,
313: AMS_access_PVT.create_access(
314: p_api_version => l_api_version_number,
315: p_init_msg_list => FND_API.g_false,
316: p_commit => FND_API.g_false,
317: p_validation_level => FND_API.g_valid_level_full,
318: x_return_status => x_return_status,
319: x_msg_count => x_msg_count,
320: x_msg_data => x_msg_data,
321: p_access_rec => l_access_rec,
328: l_access_rec.owner_flag := 'N';
329: l_access_rec.arc_user_or_role_type := 'GROUP';
330: AMS_access_PVT.create_access(
331: p_api_version => l_api_version_number,
332: p_init_msg_list => FND_API.g_false,
333: p_commit => FND_API.g_false,
334: p_validation_level => FND_API.g_valid_level_full,
335: x_return_status => x_return_status,
336: x_msg_count => x_msg_count,
329: l_access_rec.arc_user_or_role_type := 'GROUP';
330: AMS_access_PVT.create_access(
331: p_api_version => l_api_version_number,
332: p_init_msg_list => FND_API.g_false,
333: p_commit => FND_API.g_false,
334: p_validation_level => FND_API.g_valid_level_full,
335: x_return_status => x_return_status,
336: x_msg_count => x_msg_count,
337: x_msg_data => x_msg_data,
330: AMS_access_PVT.create_access(
331: p_api_version => l_api_version_number,
332: p_init_msg_list => FND_API.g_false,
333: p_commit => FND_API.g_false,
334: p_validation_level => FND_API.g_valid_level_full,
335: x_return_status => x_return_status,
336: x_msg_count => x_msg_count,
337: x_msg_data => x_msg_data,
338: p_access_rec => l_access_rec,
346: -- End of API body
347: --
348:
349: -- Standard check for p_commit
350: IF FND_API.to_Boolean( p_commit )
351: THEN
352: COMMIT WORK;
353: END IF;
354:
359: );
360: EXCEPTION
361:
362: WHEN OZF_Utility_PVT.resource_locked THEN
363: x_return_status := FND_API.g_ret_sts_error;
364: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
365:
366: WHEN FND_API.G_EXC_ERROR THEN
367: ROLLBACK TO CREATE_Offers_PVT;
362: WHEN OZF_Utility_PVT.resource_locked THEN
363: x_return_status := FND_API.g_ret_sts_error;
364: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
365:
366: WHEN FND_API.G_EXC_ERROR THEN
367: ROLLBACK TO CREATE_Offers_PVT;
368: x_return_status := FND_API.G_RET_STS_ERROR;
369: -- Standard call to get message count and if count=1, get the message
370: FND_MSG_PUB.Count_And_Get (
364: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
365:
366: WHEN FND_API.G_EXC_ERROR THEN
367: ROLLBACK TO CREATE_Offers_PVT;
368: x_return_status := FND_API.G_RET_STS_ERROR;
369: -- Standard call to get message count and if count=1, get the message
370: FND_MSG_PUB.Count_And_Get (
371: p_encoded => FND_API.G_FALSE,
372: p_count => x_msg_count,
367: ROLLBACK TO CREATE_Offers_PVT;
368: x_return_status := FND_API.G_RET_STS_ERROR;
369: -- Standard call to get message count and if count=1, get the message
370: FND_MSG_PUB.Count_And_Get (
371: p_encoded => FND_API.G_FALSE,
372: p_count => x_msg_count,
373: p_data => x_msg_data
374: );
375:
372: p_count => x_msg_count,
373: p_data => x_msg_data
374: );
375:
376: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
377: ROLLBACK TO CREATE_Offers_PVT;
378: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
379: -- Standard call to get message count and if count=1, get the message
380: FND_MSG_PUB.Count_And_Get (
374: );
375:
376: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
377: ROLLBACK TO CREATE_Offers_PVT;
378: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
379: -- Standard call to get message count and if count=1, get the message
380: FND_MSG_PUB.Count_And_Get (
381: p_encoded => FND_API.G_FALSE,
382: p_count => x_msg_count,
377: ROLLBACK TO CREATE_Offers_PVT;
378: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
379: -- Standard call to get message count and if count=1, get the message
380: FND_MSG_PUB.Count_And_Get (
381: p_encoded => FND_API.G_FALSE,
382: p_count => x_msg_count,
383: p_data => x_msg_data
384: );
385:
384: );
385:
386: WHEN OTHERS THEN
387: ROLLBACK TO CREATE_Offers_PVT;
388: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
389: IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
390: THEN
391: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
392: END IF;
391: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
392: END IF;
393: -- Standard call to get message count and if count=1, get the message
394: FND_MSG_PUB.Count_And_Get (
395: p_encoded => FND_API.G_FALSE,
396: p_count => x_msg_count,
397: p_data => x_msg_data
398: );
399: End Create_Offers;
415: FETCH c_complete INTO l_offers_rec;
416: CLOSE c_complete;
417:
418: -- offer_id
419: IF p_offers_rec.offer_id = FND_API.g_miss_num THEN
420: x_complete_rec.offer_id := l_offers_rec.offer_id;
421: END IF;
422:
423: -- qp_list_header_id
420: x_complete_rec.offer_id := l_offers_rec.offer_id;
421: END IF;
422:
423: -- qp_list_header_id
424: IF p_offers_rec.qp_list_header_id = FND_API.g_miss_num THEN
425: x_complete_rec.qp_list_header_id := l_offers_rec.qp_list_header_id;
426: END IF;
427:
428: -- offer_type
425: x_complete_rec.qp_list_header_id := l_offers_rec.qp_list_header_id;
426: END IF;
427:
428: -- offer_type
429: IF p_offers_rec.offer_type = FND_API.g_miss_char THEN
430: x_complete_rec.offer_type := l_offers_rec.offer_type;
431: END IF;
432:
433: -- offer_code
430: x_complete_rec.offer_type := l_offers_rec.offer_type;
431: END IF;
432:
433: -- offer_code
434: IF p_offers_rec.offer_code = FND_API.g_miss_char THEN
435: x_complete_rec.offer_code := l_offers_rec.offer_code;
436: END IF;
437:
438: -- activity_media_id
435: x_complete_rec.offer_code := l_offers_rec.offer_code;
436: END IF;
437:
438: -- activity_media_id
439: IF p_offers_rec.activity_media_id = FND_API.g_miss_num THEN
440: x_complete_rec.activity_media_id := l_offers_rec.activity_media_id;
441: END IF;
442:
443: -- reusable
440: x_complete_rec.activity_media_id := l_offers_rec.activity_media_id;
441: END IF;
442:
443: -- reusable
444: IF p_offers_rec.reusable = FND_API.g_miss_char THEN
445: x_complete_rec.reusable := l_offers_rec.reusable;
446: END IF;
447:
448: -- user_status_id
445: x_complete_rec.reusable := l_offers_rec.reusable;
446: END IF;
447:
448: -- user_status_id
449: IF p_offers_rec.user_status_id = FND_API.g_miss_num THEN
450: x_complete_rec.user_status_id := l_offers_rec.user_status_id;
451: END IF;
452: -- owner_id
453: IF p_offers_rec.owner_id = FND_API.g_miss_num THEN
449: IF p_offers_rec.user_status_id = FND_API.g_miss_num THEN
450: x_complete_rec.user_status_id := l_offers_rec.user_status_id;
451: END IF;
452: -- owner_id
453: IF p_offers_rec.owner_id = FND_API.g_miss_num THEN
454: x_complete_rec.owner_id := l_offers_rec.owner_id;
455: END IF;
456: -- wf_item_key
457: IF p_offers_rec.wf_item_key = FND_API.g_miss_char THEN
453: IF p_offers_rec.owner_id = FND_API.g_miss_num THEN
454: x_complete_rec.owner_id := l_offers_rec.owner_id;
455: END IF;
456: -- wf_item_key
457: IF p_offers_rec.wf_item_key = FND_API.g_miss_char THEN
458: x_complete_rec.wf_item_key := l_offers_rec.wf_item_key;
459: END IF;
460:
461: -- customer_reference
458: x_complete_rec.wf_item_key := l_offers_rec.wf_item_key;
459: END IF;
460:
461: -- customer_reference
462: IF p_offers_rec.customer_reference = FND_API.g_miss_char THEN
463: x_complete_rec.customer_reference := l_offers_rec.customer_reference;
464: END IF;
465:
466: -- buying_group_contact_id
463: x_complete_rec.customer_reference := l_offers_rec.customer_reference;
464: END IF;
465:
466: -- buying_group_contact_id
467: IF p_offers_rec.buying_group_contact_id = FND_API.g_miss_num THEN
468: x_complete_rec.buying_group_contact_id := l_offers_rec.buying_group_contact_id;
469: END IF;
470:
471: -- last_update_date
468: x_complete_rec.buying_group_contact_id := l_offers_rec.buying_group_contact_id;
469: END IF;
470:
471: -- last_update_date
472: IF p_offers_rec.last_update_date = FND_API.g_miss_date THEN
473: x_complete_rec.last_update_date := l_offers_rec.last_update_date;
474: END IF;
475:
476: -- last_updated_by
473: x_complete_rec.last_update_date := l_offers_rec.last_update_date;
474: END IF;
475:
476: -- last_updated_by
477: IF p_offers_rec.last_updated_by = FND_API.g_miss_num THEN
478: x_complete_rec.last_updated_by := l_offers_rec.last_updated_by;
479: END IF;
480:
481: -- creation_date
478: x_complete_rec.last_updated_by := l_offers_rec.last_updated_by;
479: END IF;
480:
481: -- creation_date
482: IF p_offers_rec.creation_date = FND_API.g_miss_date THEN
483: x_complete_rec.creation_date := l_offers_rec.creation_date;
484: END IF;
485:
486: -- created_by
483: x_complete_rec.creation_date := l_offers_rec.creation_date;
484: END IF;
485:
486: -- created_by
487: IF p_offers_rec.created_by = FND_API.g_miss_num THEN
488: x_complete_rec.created_by := l_offers_rec.created_by;
489: END IF;
490:
491: -- last_update_login
488: x_complete_rec.created_by := l_offers_rec.created_by;
489: END IF;
490:
491: -- last_update_login
492: IF p_offers_rec.last_update_login = FND_API.g_miss_num THEN
493: x_complete_rec.last_update_login := l_offers_rec.last_update_login;
494: END IF;
495:
496: -- object_version_number
493: x_complete_rec.last_update_login := l_offers_rec.last_update_login;
494: END IF;
495:
496: -- object_version_number
497: IF p_offers_rec.object_version_number = FND_API.g_miss_num THEN
498: x_complete_rec.object_version_number := l_offers_rec.object_version_number;
499: END IF;
500:
501:
499: END IF;
500:
501:
502: -- perf_date_from
503: IF p_offers_rec.perf_date_from = FND_API.g_miss_date THEN
504: x_complete_rec.perf_date_from := l_offers_rec.perf_date_from;
505: END IF;
506:
507: -- perf_date_to
504: x_complete_rec.perf_date_from := l_offers_rec.perf_date_from;
505: END IF;
506:
507: -- perf_date_to
508: IF p_offers_rec.perf_date_to = FND_API.g_miss_date THEN
509: x_complete_rec.perf_date_to := l_offers_rec.perf_date_to;
510: END IF;
511:
512: -- status_code
509: x_complete_rec.perf_date_to := l_offers_rec.perf_date_to;
510: END IF;
511:
512: -- status_code
513: IF p_offers_rec.status_code = FND_API.g_miss_char THEN
514: x_complete_rec.status_code := l_offers_rec.status_code;
515: END IF;
516:
517: -- status_date
514: x_complete_rec.status_code := l_offers_rec.status_code;
515: END IF;
516:
517: -- status_date
518: IF p_offers_rec.status_date = FND_API.g_miss_date THEN
519: x_complete_rec.status_date := l_offers_rec.status_date;
520: END IF;
521:
522: -- modifier_level_code
519: x_complete_rec.status_date := l_offers_rec.status_date;
520: END IF;
521:
522: -- modifier_level_code
523: IF p_offers_rec.modifier_level_code = FND_API.g_miss_char THEN
524: x_complete_rec.modifier_level_code := l_offers_rec.modifier_level_code;
525: END IF;
526:
527: -- order_value_discount_type
524: x_complete_rec.modifier_level_code := l_offers_rec.modifier_level_code;
525: END IF;
526:
527: -- order_value_discount_type
528: IF p_offers_rec.order_value_discount_type = FND_API.g_miss_char THEN
529: x_complete_rec.order_value_discount_type := l_offers_rec.order_value_discount_type;
530: END IF;
531:
532: -- offer_amount
529: x_complete_rec.order_value_discount_type := l_offers_rec.order_value_discount_type;
530: END IF;
531:
532: -- offer_amount
533: IF p_offers_rec.offer_amount = FND_API.g_miss_num THEN
534: x_complete_rec.offer_amount := l_offers_rec.offer_amount;
535: END IF;
536:
537: -- lumpsum_amount
534: x_complete_rec.offer_amount := l_offers_rec.offer_amount;
535: END IF;
536:
537: -- lumpsum_amount
538: IF p_offers_rec.lumpsum_amount = FND_API.g_miss_num THEN
539: x_complete_rec.lumpsum_amount := l_offers_rec.lumpsum_amount;
540: END IF;
541:
542: -- lumpsum_payment_type
539: x_complete_rec.lumpsum_amount := l_offers_rec.lumpsum_amount;
540: END IF;
541:
542: -- lumpsum_payment_type
543: IF p_offers_rec.lumpsum_payment_type = FND_API.g_miss_char THEN
544: x_complete_rec.lumpsum_payment_type := l_offers_rec.lumpsum_payment_type;
545: END IF;
546:
547: -- custom_setup_id
544: x_complete_rec.lumpsum_payment_type := l_offers_rec.lumpsum_payment_type;
545: END IF;
546:
547: -- custom_setup_id
548: IF p_offers_rec.custom_setup_id = FND_API.g_miss_num THEN
549: x_complete_rec.custom_setup_id := l_offers_rec.custom_setup_id;
550: END IF;
551:
552: -- security_group_id
549: x_complete_rec.custom_setup_id := l_offers_rec.custom_setup_id;
550: END IF;
551:
552: -- security_group_id
553: IF p_offers_rec.security_group_id = FND_API.g_miss_num THEN
554: x_complete_rec.security_group_id := l_offers_rec.security_group_id;
555: END IF;
556:
557: -- budget_amount_tc
554: x_complete_rec.security_group_id := l_offers_rec.security_group_id;
555: END IF;
556:
557: -- budget_amount_tc
558: IF p_offers_rec.budget_amount_tc = FND_API.g_miss_num THEN
559: x_complete_rec.budget_amount_tc := l_offers_rec.budget_amount_tc;
560: END IF;
561:
562: -- security_group_id
559: x_complete_rec.budget_amount_tc := l_offers_rec.budget_amount_tc;
560: END IF;
561:
562: -- security_group_id
563: IF p_offers_rec.budget_amount_fc = FND_API.g_miss_num THEN
564: x_complete_rec.budget_amount_fc := l_offers_rec.budget_amount_fc;
565: END IF;
566:
567: -- transaction_currency_code
564: x_complete_rec.budget_amount_fc := l_offers_rec.budget_amount_fc;
565: END IF;
566:
567: -- transaction_currency_code
568: IF p_offers_rec.transaction_currency_code = FND_API.g_miss_char THEN
569: x_complete_rec.transaction_currency_code := l_offers_rec.transaction_currency_code;
570: END IF;
571:
572: -- functional_currency_Code
569: x_complete_rec.transaction_currency_code := l_offers_rec.transaction_currency_code;
570: END IF;
571:
572: -- functional_currency_Code
573: IF p_offers_rec.functional_currency_Code = FND_API.g_miss_char THEN
574: x_complete_rec.functional_currency_Code := l_offers_rec.functional_currency_Code;
575: END IF;
576:
577: -- qualifier_type
574: x_complete_rec.functional_currency_Code := l_offers_rec.functional_currency_Code;
575: END IF;
576:
577: -- qualifier_type
578: IF p_offers_rec.qualifier_type = FND_API.g_miss_char THEN
579: x_complete_rec.qualifier_type := l_offers_rec.qualifier_type;
580: END IF;
581:
582: -- qualifier_id
579: x_complete_rec.qualifier_type := l_offers_rec.qualifier_type;
580: END IF;
581:
582: -- qualifier_id
583: IF p_offers_rec.qualifier_id = FND_API.g_miss_num THEN
584: x_complete_rec.qualifier_id := l_offers_rec.qualifier_id;
585: END IF;
586:
587: -- distribution_type
584: x_complete_rec.qualifier_id := l_offers_rec.qualifier_id;
585: END IF;
586:
587: -- distribution_type
588: IF p_offers_rec.distribution_type = FND_API.g_miss_char THEN
589: x_complete_rec.distribution_type := l_offers_rec.distribution_type;
590: END IF;
591:
592: -- account_closed_flag
589: x_complete_rec.distribution_type := l_offers_rec.distribution_type;
590: END IF;
591:
592: -- account_closed_flag
593: IF p_offers_rec.account_closed_flag = FND_API.g_miss_char THEN
594: x_complete_rec.account_closed_flag := l_offers_rec.account_closed_flag;
595: END IF;
596:
597: -- budget_offer_yn
594: x_complete_rec.account_closed_flag := l_offers_rec.account_closed_flag;
595: END IF;
596:
597: -- budget_offer_yn
598: IF p_offers_rec.budget_offer_yn = FND_API.g_miss_char THEN
599: x_complete_rec.budget_offer_yn := l_offers_rec.budget_offer_yn;
600: END IF;
601:
602: -- break_type
599: x_complete_rec.budget_offer_yn := l_offers_rec.budget_offer_yn;
600: END IF;
601:
602: -- break_type
603: IF p_offers_rec.break_type = FND_API.g_miss_char THEN
604: x_complete_rec.break_type := l_offers_rec.break_type;
605: END IF;
606:
607: -- budget_source_type
604: x_complete_rec.break_type := l_offers_rec.break_type;
605: END IF;
606:
607: -- budget_source_type
608: IF p_offers_rec.budget_source_type = FND_API.g_miss_char THEN
609: x_complete_rec.budget_source_type := l_offers_rec.budget_source_type;
610: END IF;
611:
612: -- budget_source_id
609: x_complete_rec.budget_source_type := l_offers_rec.budget_source_type;
610: END IF;
611:
612: -- budget_source_id
613: IF p_offers_rec.budget_source_id = FND_API.g_miss_num THEN
614: x_complete_rec.budget_source_id := l_offers_rec.budget_source_id;
615: END IF;
616:
617: -- confidential_flag
614: x_complete_rec.budget_source_id := l_offers_rec.budget_source_id;
615: END IF;
616:
617: -- confidential_flag
618: IF p_offers_rec.confidential_flag = FND_API.g_miss_char THEN
619: x_complete_rec.confidential_flag := l_offers_rec.confidential_flag;
620: END IF;
621:
622: IF p_offers_rec.source_from_parent = FND_API.g_miss_char THEN
618: IF p_offers_rec.confidential_flag = FND_API.g_miss_char THEN
619: x_complete_rec.confidential_flag := l_offers_rec.confidential_flag;
620: END IF;
621:
622: IF p_offers_rec.source_from_parent = FND_API.g_miss_char THEN
623: x_complete_rec.source_from_parent := l_offers_rec.source_from_parent;
624: END IF;
625:
626: IF p_offers_rec.buyer_name = FND_API.g_miss_char THEN
622: IF p_offers_rec.source_from_parent = FND_API.g_miss_char THEN
623: x_complete_rec.source_from_parent := l_offers_rec.source_from_parent;
624: END IF;
625:
626: IF p_offers_rec.buyer_name = FND_API.g_miss_char THEN
627: x_complete_rec.buyer_name := l_offers_rec.buyer_name;
628: END IF;
629:
630: IF p_offers_rec.last_recal_date = FND_API.g_miss_date THEN
626: IF p_offers_rec.buyer_name = FND_API.g_miss_char THEN
627: x_complete_rec.buyer_name := l_offers_rec.buyer_name;
628: END IF;
629:
630: IF p_offers_rec.last_recal_date = FND_API.g_miss_date THEN
631: x_complete_rec.last_recal_date := l_offers_rec.last_recal_date;
632: END IF;
633:
634: -- autopay_flag
631: x_complete_rec.last_recal_date := l_offers_rec.last_recal_date;
632: END IF;
633:
634: -- autopay_flag
635: IF p_offers_rec.autopay_flag = FND_API.g_miss_char THEN
636: x_complete_rec.autopay_flag := l_offers_rec.autopay_flag;
637: END IF;
638:
639: -- autopay_days
636: x_complete_rec.autopay_flag := l_offers_rec.autopay_flag;
637: END IF;
638:
639: -- autopay_days
640: IF p_offers_rec.autopay_days = FND_API.g_miss_num THEN
641: x_complete_rec.autopay_days := l_offers_rec.autopay_days;
642: END IF;
643:
644: -- autopay_method
641: x_complete_rec.autopay_days := l_offers_rec.autopay_days;
642: END IF;
643:
644: -- autopay_method
645: IF p_offers_rec.autopay_method = FND_API.g_miss_char THEN
646: x_complete_rec.autopay_method := l_offers_rec.autopay_method;
647: END IF;
648:
649: -- autopay_party_attr
646: x_complete_rec.autopay_method := l_offers_rec.autopay_method;
647: END IF;
648:
649: -- autopay_party_attr
650: IF p_offers_rec.autopay_party_attr = FND_API.g_miss_char THEN
651: x_complete_rec.autopay_party_attr := l_offers_rec.autopay_party_attr;
652: END IF;
653:
654: -- autopay_party_id
651: x_complete_rec.autopay_party_attr := l_offers_rec.autopay_party_attr;
652: END IF;
653:
654: -- autopay_party_id
655: IF p_offers_rec.autopay_party_id = FND_API.g_miss_num THEN
656: x_complete_rec.autopay_party_id := l_offers_rec.autopay_party_id;
657: END IF;
658:
659: IF p_offers_rec.tier_level = FND_API.g_miss_char THEN
655: IF p_offers_rec.autopay_party_id = FND_API.g_miss_num THEN
656: x_complete_rec.autopay_party_id := l_offers_rec.autopay_party_id;
657: END IF;
658:
659: IF p_offers_rec.tier_level = FND_API.g_miss_char THEN
660: -- x_complete_rec.tier_level := l_offers_rec.tier_level;
661: x_complete_rec.tier_level := l_offers_rec.tier_level;
662: END IF;
663:
661: x_complete_rec.tier_level := l_offers_rec.tier_level;
662: END IF;
663:
664:
665: IF p_offers_rec.na_rule_header_id = FND_API.g_miss_num THEN
666: x_complete_rec.na_rule_header_id := l_offers_rec.na_rule_header_id;
667: END IF;
668:
669: IF p_offers_rec.beneficiary_account_id = FND_API.g_miss_num THEN
665: IF p_offers_rec.na_rule_header_id = FND_API.g_miss_num THEN
666: x_complete_rec.na_rule_header_id := l_offers_rec.na_rule_header_id;
667: END IF;
668:
669: IF p_offers_rec.beneficiary_account_id = FND_API.g_miss_num THEN
670: x_complete_rec.beneficiary_account_id := l_offers_rec.beneficiary_account_id;
671: END IF;
672:
673: IF p_offers_rec.sales_method_flag = FND_API.G_MISS_CHAR THEN
669: IF p_offers_rec.beneficiary_account_id = FND_API.g_miss_num THEN
670: x_complete_rec.beneficiary_account_id := l_offers_rec.beneficiary_account_id;
671: END IF;
672:
673: IF p_offers_rec.sales_method_flag = FND_API.G_MISS_CHAR THEN
674: x_complete_rec.sales_method_flag := l_offers_rec.sales_method_flag;
675: END IF;
676:
677: IF p_offers_rec.org_id = FND_API.g_miss_num THEN
673: IF p_offers_rec.sales_method_flag = FND_API.G_MISS_CHAR THEN
674: x_complete_rec.sales_method_flag := l_offers_rec.sales_method_flag;
675: END IF;
676:
677: IF p_offers_rec.org_id = FND_API.g_miss_num THEN
678: x_complete_rec.org_id := l_offers_rec.org_id;
679: END IF;
680:
681: -- Note: Developers need to modify the procedure
684: END Complete_offers_Rec;
685:
686: PROCEDURE Update_Offers(
687: p_api_version_number IN NUMBER,
688: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
689: p_commit IN VARCHAR2 := FND_API.G_FALSE,
690: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
691:
692: x_return_status OUT NOCOPY VARCHAR2,
685:
686: PROCEDURE Update_Offers(
687: p_api_version_number IN NUMBER,
688: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
689: p_commit IN VARCHAR2 := FND_API.G_FALSE,
690: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
691:
692: x_return_status OUT NOCOPY VARCHAR2,
693: x_msg_count OUT NOCOPY NUMBER,
686: PROCEDURE Update_Offers(
687: p_api_version_number IN NUMBER,
688: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
689: p_commit IN VARCHAR2 := FND_API.G_FALSE,
690: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
691:
692: x_return_status OUT NOCOPY VARCHAR2,
693: x_msg_count OUT NOCOPY NUMBER,
694: x_msg_data OUT NOCOPY VARCHAR2,
736: -- Standard Start of API savepoint
737: SAVEPOINT UPDATE_Offers_PVT;
738:
739: -- Standard call to check for call compatibility.
740: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
741: p_api_version_number,
742: l_api_name,
743: G_PKG_NAME)
744: THEN
741: p_api_version_number,
742: l_api_name,
743: G_PKG_NAME)
744: THEN
745: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
746: END IF;
747:
748: -- Initialize message list if p_init_msg_list is set to TRUE.
749: IF FND_API.to_Boolean( p_init_msg_list )
745: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
746: END IF;
747:
748: -- Initialize message list if p_init_msg_list is set to TRUE.
749: IF FND_API.to_Boolean( p_init_msg_list )
750: THEN
751: FND_MSG_PUB.initialize;
752: END IF;
753:
751: FND_MSG_PUB.initialize;
752: END IF;
753:
754: -- Initialize API return status to SUCCESS
755: x_return_status := FND_API.G_RET_STS_SUCCESS;
756:
757: OPEN c_get_Offers( l_tar_offers_rec.qp_list_header_id);
758: FETCH c_get_Offers INTO l_object_version_number;
759:
760: If ( c_get_Offers%NOTFOUND) THEN
761: OZF_Utility_PVT.Error_Message(p_message_name => 'API_MISSING_UPDATE_TARGET',
762: p_token_name => 'INFO',
763: p_token_value => 'Offers') ;
764: RAISE FND_API.G_EXC_ERROR;
765: END IF;
766: CLOSE c_get_Offers;
767:
768: -- Check Whether record has been changed by someone else
766: CLOSE c_get_Offers;
767:
768: -- Check Whether record has been changed by someone else
769: If l_tar_offers_rec.object_version_number IS NOT NULL
770: AND l_tar_offers_rec.object_version_number <> FND_API.G_MISS_NUM
771: AND l_tar_offers_rec.object_version_number <> l_object_version_number Then
772: OZF_Utility_PVT.Error_Message(p_message_name => 'API_RECORD_CHANGED',
773: p_token_name => 'INFO',
774: p_token_value => 'Offers') ;
771: AND l_tar_offers_rec.object_version_number <> l_object_version_number Then
772: OZF_Utility_PVT.Error_Message(p_message_name => 'API_RECORD_CHANGED',
773: p_token_name => 'INFO',
774: p_token_value => 'Offers') ;
775: raise FND_API.G_EXC_ERROR;
776: End if;
777: IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
778: THEN
779: -- Invoke validation procedures
773: p_token_name => 'INFO',
774: p_token_value => 'Offers') ;
775: raise FND_API.G_EXC_ERROR;
776: End if;
777: IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
778: THEN
779: -- Invoke validation procedures
780: Validate_offers(
781: p_api_version_number => 1.0,
778: THEN
779: -- Invoke validation procedures
780: Validate_offers(
781: p_api_version_number => 1.0,
782: p_init_msg_list => FND_API.G_FALSE,
783: p_validation_level => p_validation_level,
784: p_offers_rec => p_offers_rec,
785: x_return_status => x_return_status,
786: x_msg_count => x_msg_count,
786: x_msg_count => x_msg_count,
787: x_msg_data => x_msg_data);
788: END IF;
789:
790: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
791: RAISE FND_API.G_EXC_ERROR;
792: END IF;
793:
794: -- added by julou 07/29/2002 check if the owner is changed. if so, update the owner inof in ams_act_access
787: x_msg_data => x_msg_data);
788: END IF;
789:
790: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
791: RAISE FND_API.G_EXC_ERROR;
792: END IF;
793:
794: -- added by julou 07/29/2002 check if the owner is changed. if so, update the owner inof in ams_act_access
795: -- only the owner and super user can change the owner
813:
814: IF l_is_owner = 'Y' OR l_is_admin THEN -- curent user is owner/admin, changing owner is allowed
815: AMS_access_PVT.update_object_owner(
816: p_api_version => l_api_version_number,
817: p_init_msg_list => FND_API.g_false,
818: p_commit => FND_API.g_false,
819: p_validation_level => FND_API.g_valid_level_full,
820: x_return_status => x_return_status,
821: x_msg_count => x_msg_count,
814: IF l_is_owner = 'Y' OR l_is_admin THEN -- curent user is owner/admin, changing owner is allowed
815: AMS_access_PVT.update_object_owner(
816: p_api_version => l_api_version_number,
817: p_init_msg_list => FND_API.g_false,
818: p_commit => FND_API.g_false,
819: p_validation_level => FND_API.g_valid_level_full,
820: x_return_status => x_return_status,
821: x_msg_count => x_msg_count,
822: x_msg_data => x_msg_data,
815: AMS_access_PVT.update_object_owner(
816: p_api_version => l_api_version_number,
817: p_init_msg_list => FND_API.g_false,
818: p_commit => FND_API.g_false,
819: p_validation_level => FND_API.g_valid_level_full,
820: x_return_status => x_return_status,
821: x_msg_count => x_msg_count,
822: x_msg_data => x_msg_data,
823: p_object_type => 'OFFR',
824: p_object_id => l_offers_rec.qp_list_header_id,
825: p_resource_id => l_offers_rec.owner_id,
826: p_old_resource_id => l_old_owner_id);
827:
828: IF x_return_status = fnd_api.g_ret_sts_error THEN
829: RAISE FND_API.g_exc_error;
830: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
831: RAISE FND_API.g_exc_unexpected_error;
832: END IF;
825: p_resource_id => l_offers_rec.owner_id,
826: p_old_resource_id => l_old_owner_id);
827:
828: IF x_return_status = fnd_api.g_ret_sts_error THEN
829: RAISE FND_API.g_exc_error;
830: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
831: RAISE FND_API.g_exc_unexpected_error;
832: END IF;
833: ELSE -- not owner nor super user
826: p_old_resource_id => l_old_owner_id);
827:
828: IF x_return_status = fnd_api.g_ret_sts_error THEN
829: RAISE FND_API.g_exc_error;
830: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
831: RAISE FND_API.g_exc_unexpected_error;
832: END IF;
833: ELSE -- not owner nor super user
834: OZF_Utility_PVT.error_message('OZF_OFFR_UPDT_OWNER_PERM');
827:
828: IF x_return_status = fnd_api.g_ret_sts_error THEN
829: RAISE FND_API.g_exc_error;
830: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
831: RAISE FND_API.g_exc_unexpected_error;
832: END IF;
833: ELSE -- not owner nor super user
834: OZF_Utility_PVT.error_message('OZF_OFFR_UPDT_OWNER_PERM');
835: RAISE FND_API.g_exc_error;
831: RAISE FND_API.g_exc_unexpected_error;
832: END IF;
833: ELSE -- not owner nor super user
834: OZF_Utility_PVT.error_message('OZF_OFFR_UPDT_OWNER_PERM');
835: RAISE FND_API.g_exc_error;
836: END IF;
837: END IF;
838: -- end of offer security change
839: -- julou defaulting last_recal_date to offer start date
897: p_budget_source_id => l_offers_rec.budget_source_id,
898: p_source_from_parent => l_offers_rec.source_from_parent,
899: p_buyer_name => l_offers_rec.buyer_name,
900: p_last_recal_date => l_last_recal_date,
901: p_date_qualifier => FND_API.G_MISS_CHAR,
902: p_autopay_flag => l_offers_rec.autopay_flag,
903: p_autopay_days => l_offers_rec.autopay_days,
904: p_autopay_method => l_offers_rec.autopay_method,
905: p_autopay_party_attr => l_offers_rec.autopay_party_attr,
915: -- End of API body.
916: --
917:
918: -- Standard check for p_commit
919: IF FND_API.to_Boolean( p_commit )
920: THEN
921: COMMIT WORK;
922: END IF;
923:
924: -- Standard call to get message count and if count is 1, get message info.
925: FND_MSG_PUB.Count_And_Get
926: (p_count => x_msg_count,
927: p_data => x_msg_data,
928: p_encoded => FND_API.G_FALSE
929: );
930: EXCEPTION
931:
932: WHEN OZF_Utility_PVT.resource_locked THEN
929: );
930: EXCEPTION
931:
932: WHEN OZF_Utility_PVT.resource_locked THEN
933: x_return_status := FND_API.g_ret_sts_error;
934: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
935:
936: WHEN FND_API.G_EXC_ERROR THEN
937: ROLLBACK TO UPDATE_Offers_PVT;
932: WHEN OZF_Utility_PVT.resource_locked THEN
933: x_return_status := FND_API.g_ret_sts_error;
934: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
935:
936: WHEN FND_API.G_EXC_ERROR THEN
937: ROLLBACK TO UPDATE_Offers_PVT;
938: x_return_status := FND_API.G_RET_STS_ERROR;
939: -- Standard call to get message count and if count=1, get the message
940: FND_MSG_PUB.Count_And_Get (
934: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
935:
936: WHEN FND_API.G_EXC_ERROR THEN
937: ROLLBACK TO UPDATE_Offers_PVT;
938: x_return_status := FND_API.G_RET_STS_ERROR;
939: -- Standard call to get message count and if count=1, get the message
940: FND_MSG_PUB.Count_And_Get (
941: p_encoded => FND_API.G_FALSE,
942: p_count => x_msg_count,
937: ROLLBACK TO UPDATE_Offers_PVT;
938: x_return_status := FND_API.G_RET_STS_ERROR;
939: -- Standard call to get message count and if count=1, get the message
940: FND_MSG_PUB.Count_And_Get (
941: p_encoded => FND_API.G_FALSE,
942: p_count => x_msg_count,
943: p_data => x_msg_data
944: );
945:
942: p_count => x_msg_count,
943: p_data => x_msg_data
944: );
945:
946: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
947: ROLLBACK TO UPDATE_Offers_PVT;
948: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
949: -- Standard call to get message count and if count=1, get the message
950: FND_MSG_PUB.Count_And_Get (
944: );
945:
946: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
947: ROLLBACK TO UPDATE_Offers_PVT;
948: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
949: -- Standard call to get message count and if count=1, get the message
950: FND_MSG_PUB.Count_And_Get (
951: p_encoded => FND_API.G_FALSE,
952: p_count => x_msg_count,
947: ROLLBACK TO UPDATE_Offers_PVT;
948: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
949: -- Standard call to get message count and if count=1, get the message
950: FND_MSG_PUB.Count_And_Get (
951: p_encoded => FND_API.G_FALSE,
952: p_count => x_msg_count,
953: p_data => x_msg_data
954: );
955: /*
954: );
955: /*
956: WHEN OTHERS THEN
957: ROLLBACK TO UPDATE_Offers_PVT;
958: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
959: IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
960: THEN
961: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
962: END IF;
961: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
962: END IF;
963: -- Standard call to get message count and if count=1, get the message
964: FND_MSG_PUB.Count_And_Get (
965: p_encoded => FND_API.G_FALSE,
966: p_count => x_msg_count,
967: p_data => x_msg_data
968: );
969: */
971:
972:
973: PROCEDURE Delete_Offers(
974: p_api_version_number IN NUMBER,
975: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
976: p_commit IN VARCHAR2 := FND_API.G_FALSE,
977: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
978: x_return_status OUT NOCOPY VARCHAR2,
979: x_msg_count OUT NOCOPY NUMBER,
972:
973: PROCEDURE Delete_Offers(
974: p_api_version_number IN NUMBER,
975: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
976: p_commit IN VARCHAR2 := FND_API.G_FALSE,
977: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
978: x_return_status OUT NOCOPY VARCHAR2,
979: x_msg_count OUT NOCOPY NUMBER,
980: x_msg_data OUT NOCOPY VARCHAR2,
973: PROCEDURE Delete_Offers(
974: p_api_version_number IN NUMBER,
975: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
976: p_commit IN VARCHAR2 := FND_API.G_FALSE,
977: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
978: x_return_status OUT NOCOPY VARCHAR2,
979: x_msg_count OUT NOCOPY NUMBER,
980: x_msg_data OUT NOCOPY VARCHAR2,
981: p_offer_id IN NUMBER,
991: -- Standard Start of API savepoint
992: SAVEPOINT DELETE_Offers_PVT;
993:
994: -- Standard call to check for call compatibility.
995: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
996: p_api_version_number,
997: l_api_name,
998: G_PKG_NAME)
999: THEN
996: p_api_version_number,
997: l_api_name,
998: G_PKG_NAME)
999: THEN
1000: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1001: END IF;
1002:
1003: -- Initialize message list if p_init_msg_list is set to TRUE.
1004: IF FND_API.to_Boolean( p_init_msg_list )
1000: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1001: END IF;
1002:
1003: -- Initialize message list if p_init_msg_list is set to TRUE.
1004: IF FND_API.to_Boolean( p_init_msg_list )
1005: THEN
1006: FND_MSG_PUB.initialize;
1007: END IF;
1008:
1006: FND_MSG_PUB.initialize;
1007: END IF;
1008:
1009: -- Initialize API return status to SUCCESS
1010: x_return_status := FND_API.G_RET_STS_SUCCESS;
1011:
1012: --
1013: -- Api body
1014: --
1020: -- End of API body
1021: --
1022:
1023: -- Standard check for p_commit
1024: IF FND_API.to_Boolean( p_commit )
1025: THEN
1026: COMMIT WORK;
1027: END IF;
1028:
1033: );
1034: EXCEPTION
1035:
1036: WHEN OZF_Utility_PVT.resource_locked THEN
1037: x_return_status := FND_API.g_ret_sts_error;
1038: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1039:
1040: WHEN FND_API.G_EXC_ERROR THEN
1041: ROLLBACK TO DELETE_Offers_PVT;
1036: WHEN OZF_Utility_PVT.resource_locked THEN
1037: x_return_status := FND_API.g_ret_sts_error;
1038: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1039:
1040: WHEN FND_API.G_EXC_ERROR THEN
1041: ROLLBACK TO DELETE_Offers_PVT;
1042: x_return_status := FND_API.G_RET_STS_ERROR;
1043: -- Standard call to get message count and if count=1, get the message
1044: FND_MSG_PUB.Count_And_Get (
1038: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1039:
1040: WHEN FND_API.G_EXC_ERROR THEN
1041: ROLLBACK TO DELETE_Offers_PVT;
1042: x_return_status := FND_API.G_RET_STS_ERROR;
1043: -- Standard call to get message count and if count=1, get the message
1044: FND_MSG_PUB.Count_And_Get (
1045: p_encoded => FND_API.G_FALSE,
1046: p_count => x_msg_count,
1041: ROLLBACK TO DELETE_Offers_PVT;
1042: x_return_status := FND_API.G_RET_STS_ERROR;
1043: -- Standard call to get message count and if count=1, get the message
1044: FND_MSG_PUB.Count_And_Get (
1045: p_encoded => FND_API.G_FALSE,
1046: p_count => x_msg_count,
1047: p_data => x_msg_data
1048: );
1049:
1046: p_count => x_msg_count,
1047: p_data => x_msg_data
1048: );
1049:
1050: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1051: ROLLBACK TO DELETE_Offers_PVT;
1052: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1053: -- Standard call to get message count and if count=1, get the message
1054: FND_MSG_PUB.Count_And_Get (
1048: );
1049:
1050: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1051: ROLLBACK TO DELETE_Offers_PVT;
1052: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1053: -- Standard call to get message count and if count=1, get the message
1054: FND_MSG_PUB.Count_And_Get (
1055: p_encoded => FND_API.G_FALSE,
1056: p_count => x_msg_count,
1051: ROLLBACK TO DELETE_Offers_PVT;
1052: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1053: -- Standard call to get message count and if count=1, get the message
1054: FND_MSG_PUB.Count_And_Get (
1055: p_encoded => FND_API.G_FALSE,
1056: p_count => x_msg_count,
1057: p_data => x_msg_data
1058: );
1059:
1058: );
1059:
1060: WHEN OTHERS THEN
1061: ROLLBACK TO DELETE_Offers_PVT;
1062: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1063: IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1064: THEN
1065: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1066: END IF;
1065: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1066: END IF;
1067: -- Standard call to get message count and if count=1, get the message
1068: FND_MSG_PUB.Count_And_Get (
1069: p_encoded => FND_API.G_FALSE,
1070: p_count => x_msg_count,
1071: p_data => x_msg_data
1072: );
1073: End Delete_Offers;
1076:
1077: -- Hint: Primary key needs to be returned.
1078: PROCEDURE Lock_Offers(
1079: p_api_version_number IN NUMBER,
1080: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1081:
1082: x_return_status OUT NOCOPY VARCHAR2,
1083: x_msg_count OUT NOCOPY NUMBER,
1084: x_msg_data OUT NOCOPY VARCHAR2,
1102:
1103: BEGIN
1104:
1105: -- Initialize message list if p_init_msg_list is set to TRUE.
1106: IF FND_API.to_Boolean( p_init_msg_list )
1107: THEN
1108: FND_MSG_PUB.initialize;
1109: END IF;
1110:
1108: FND_MSG_PUB.initialize;
1109: END IF;
1110:
1111: -- Standard call to check for call compatibility.
1112: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
1113: p_api_version_number,
1114: l_api_name,
1115: G_PKG_NAME)
1116: THEN
1113: p_api_version_number,
1114: l_api_name,
1115: G_PKG_NAME)
1116: THEN
1117: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1118: END IF;
1119:
1120:
1121: -- Initialize API return status to SUCCESS
1118: END IF;
1119:
1120:
1121: -- Initialize API return status to SUCCESS
1122: x_return_status := FND_API.G_RET_STS_SUCCESS;
1123:
1124:
1125: ------------------------ lock -------------------------
1126:
1133: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
1134: FND_MESSAGE.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1135: FND_MSG_PUB.add;
1136: END IF;
1137: RAISE FND_API.g_exc_error;
1138: END IF;
1139:
1140: CLOSE c_Offers;
1141:
1140: CLOSE c_Offers;
1141:
1142: -------------------- finish --------------------------
1143: FND_MSG_PUB.count_and_get(
1144: p_encoded => FND_API.g_false,
1145: p_count => x_msg_count,
1146: p_data => x_msg_data);
1147:
1148: EXCEPTION
1147:
1148: EXCEPTION
1149:
1150: WHEN OZF_Utility_PVT.resource_locked THEN
1151: x_return_status := FND_API.g_ret_sts_error;
1152: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1153:
1154: WHEN FND_API.G_EXC_ERROR THEN
1155: ROLLBACK TO LOCK_Offers_PVT;
1150: WHEN OZF_Utility_PVT.resource_locked THEN
1151: x_return_status := FND_API.g_ret_sts_error;
1152: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1153:
1154: WHEN FND_API.G_EXC_ERROR THEN
1155: ROLLBACK TO LOCK_Offers_PVT;
1156: x_return_status := FND_API.G_RET_STS_ERROR;
1157: -- Standard call to get message count and if count=1, get the message
1158: FND_MSG_PUB.Count_And_Get (
1152: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1153:
1154: WHEN FND_API.G_EXC_ERROR THEN
1155: ROLLBACK TO LOCK_Offers_PVT;
1156: x_return_status := FND_API.G_RET_STS_ERROR;
1157: -- Standard call to get message count and if count=1, get the message
1158: FND_MSG_PUB.Count_And_Get (
1159: p_encoded => FND_API.G_FALSE,
1160: p_count => x_msg_count,
1155: ROLLBACK TO LOCK_Offers_PVT;
1156: x_return_status := FND_API.G_RET_STS_ERROR;
1157: -- Standard call to get message count and if count=1, get the message
1158: FND_MSG_PUB.Count_And_Get (
1159: p_encoded => FND_API.G_FALSE,
1160: p_count => x_msg_count,
1161: p_data => x_msg_data
1162: );
1163:
1160: p_count => x_msg_count,
1161: p_data => x_msg_data
1162: );
1163:
1164: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1165: ROLLBACK TO LOCK_Offers_PVT;
1166: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1167: -- Standard call to get message count and if count=1, get the message
1168: FND_MSG_PUB.Count_And_Get (
1162: );
1163:
1164: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1165: ROLLBACK TO LOCK_Offers_PVT;
1166: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1167: -- Standard call to get message count and if count=1, get the message
1168: FND_MSG_PUB.Count_And_Get (
1169: p_encoded => FND_API.G_FALSE,
1170: p_count => x_msg_count,
1165: ROLLBACK TO LOCK_Offers_PVT;
1166: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1167: -- Standard call to get message count and if count=1, get the message
1168: FND_MSG_PUB.Count_And_Get (
1169: p_encoded => FND_API.G_FALSE,
1170: p_count => x_msg_count,
1171: p_data => x_msg_data
1172: );
1173:
1172: );
1173:
1174: WHEN OTHERS THEN
1175: ROLLBACK TO LOCK_Offers_PVT;
1176: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1177: IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1178: THEN
1179: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1180: END IF;
1179: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1180: END IF;
1181: -- Standard call to get message count and if count=1, get the message
1182: FND_MSG_PUB.Count_And_Get (
1183: p_encoded => FND_API.G_FALSE,
1184: p_count => x_msg_count,
1185: p_data => x_msg_data
1186: );
1187: End Lock_Offers;
1194: IS
1195: l_valid_flag VARCHAR2(1);
1196:
1197: BEGIN
1198: x_return_status := FND_API.g_ret_sts_success;
1199: IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1200:
1201: l_valid_flag := OZF_Utility_PVT.check_uniqueness(
1202: 'OZF_OFFERS',
1204: );
1205:
1206: END IF;
1207:
1208: IF l_valid_flag = FND_API.g_false THEN
1209: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFER_ID_DUPLICATE');
1210: x_return_status := FND_API.g_ret_sts_error;
1211: RETURN;
1212: END IF;
1206: END IF;
1207:
1208: IF l_valid_flag = FND_API.g_false THEN
1209: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFER_ID_DUPLICATE');
1210: x_return_status := FND_API.g_ret_sts_error;
1211: RETURN;
1212: END IF;
1213:
1214: IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1219: );
1220:
1221: END IF;
1222:
1223: IF l_valid_flag = FND_API.g_false THEN
1224: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFER_QP_ID_DUPLICATE');
1225: x_return_status := FND_API.g_ret_sts_error;
1226: RETURN;
1227: END IF;
1221: END IF;
1222:
1223: IF l_valid_flag = FND_API.g_false THEN
1224: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFER_QP_ID_DUPLICATE');
1225: x_return_status := FND_API.g_ret_sts_error;
1226: RETURN;
1227: END IF;
1228:
1229:
1243:
1244: l_offer_end_date DATE;
1245:
1246: BEGIN
1247: x_return_status := FND_API.g_ret_sts_success;
1248:
1249: IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1250:
1251:
1248:
1249: IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1250:
1251:
1252: IF p_offers_rec.offer_id = FND_API.g_miss_num OR p_offers_rec.offer_id IS NULL THEN
1253: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_ID');
1254: x_return_status := FND_API.g_ret_sts_error;
1255: RETURN;
1256: END IF;
1250:
1251:
1252: IF p_offers_rec.offer_id = FND_API.g_miss_num OR p_offers_rec.offer_id IS NULL THEN
1253: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_ID');
1254: x_return_status := FND_API.g_ret_sts_error;
1255: RETURN;
1256: END IF;
1257:
1258:
1255: RETURN;
1256: END IF;
1257:
1258:
1259: IF p_offers_rec.qp_list_header_id = FND_API.g_miss_num OR p_offers_rec.qp_list_header_id IS NULL THEN
1260: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_LIST_HEADER_ID');
1261: x_return_status := FND_API.g_ret_sts_error;
1262: RETURN;
1263: END IF;
1257:
1258:
1259: IF p_offers_rec.qp_list_header_id = FND_API.g_miss_num OR p_offers_rec.qp_list_header_id IS NULL THEN
1260: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_LIST_HEADER_ID');
1261: x_return_status := FND_API.g_ret_sts_error;
1262: RETURN;
1263: END IF;
1264:
1265:
1262: RETURN;
1263: END IF;
1264:
1265:
1266: IF p_offers_rec.offer_type = FND_API.g_miss_char OR p_offers_rec.offer_type IS NULL THEN
1267: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_TYPE');
1268: x_return_status := FND_API.g_ret_sts_error;
1269: RETURN;
1270: END IF;
1264:
1265:
1266: IF p_offers_rec.offer_type = FND_API.g_miss_char OR p_offers_rec.offer_type IS NULL THEN
1267: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_TYPE');
1268: x_return_status := FND_API.g_ret_sts_error;
1269: RETURN;
1270: END IF;
1271:
1272:
1269: RETURN;
1270: END IF;
1271:
1272:
1273: IF p_offers_rec.offer_code = FND_API.g_miss_char OR p_offers_rec.offer_code IS NULL THEN
1274: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_CODE');
1275: x_return_status := FND_API.g_ret_sts_error;
1276: RETURN;
1277: END IF;
1271:
1272:
1273: IF p_offers_rec.offer_code = FND_API.g_miss_char OR p_offers_rec.offer_code IS NULL THEN
1274: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_CODE');
1275: x_return_status := FND_API.g_ret_sts_error;
1276: RETURN;
1277: END IF;
1278:
1279: IF p_offers_rec.user_status_id = FND_API.g_miss_num OR p_offers_rec.user_status_id IS NULL THEN
1275: x_return_status := FND_API.g_ret_sts_error;
1276: RETURN;
1277: END IF;
1278:
1279: IF p_offers_rec.user_status_id = FND_API.g_miss_num OR p_offers_rec.user_status_id IS NULL THEN
1280: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_USER_STATUS_ID');
1281: x_return_status := FND_API.g_ret_sts_error;
1282: RETURN;
1283: END IF;
1277: END IF;
1278:
1279: IF p_offers_rec.user_status_id = FND_API.g_miss_num OR p_offers_rec.user_status_id IS NULL THEN
1280: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_USER_STATUS_ID');
1281: x_return_status := FND_API.g_ret_sts_error;
1282: RETURN;
1283: END IF;
1284:
1285: IF p_offers_rec.offer_type = 'SCAN_DATA' THEN
1282: RETURN;
1283: END IF;
1284:
1285: IF p_offers_rec.offer_type = 'SCAN_DATA' THEN
1286: IF p_offers_rec.activity_media_id = FND_API.g_miss_num OR p_offers_rec.activity_media_id IS NULL THEN
1287: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_ACTIVITY');
1288: x_return_status := FND_API.g_ret_sts_error;
1289: RETURN;
1290: END IF;
1284:
1285: IF p_offers_rec.offer_type = 'SCAN_DATA' THEN
1286: IF p_offers_rec.activity_media_id = FND_API.g_miss_num OR p_offers_rec.activity_media_id IS NULL THEN
1287: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_ACTIVITY');
1288: x_return_status := FND_API.g_ret_sts_error;
1289: RETURN;
1290: END IF;
1291: END IF;
1292:
1292:
1293: IF p_offers_rec.autopay_flag = 'Y' THEN
1294: IF p_offers_rec.autopay_days IS NULL THEN
1295: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_NO_AUTOPAY_DAYS');
1296: x_return_status := FND_API.g_ret_sts_error;
1297: RETURN;
1298: END IF;
1299:
1300: IF p_offers_rec.autopay_method IS NULL THEN
1298: END IF;
1299:
1300: IF p_offers_rec.autopay_method IS NULL THEN
1301: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_NO_AUTOPAY_METHOD');
1302: x_return_status := FND_API.g_ret_sts_error;
1303: RETURN;
1304: END IF;
1305:
1306: IF p_offers_rec.autopay_party_id IS NULL THEN
1304: END IF;
1305:
1306: IF p_offers_rec.autopay_party_id IS NULL THEN
1307: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_NO_AUTOPAY_PARTY_ID');
1308: x_return_status := FND_API.g_ret_sts_error;
1309: RETURN;
1310: END IF;
1311:
1312: OPEN c_offer_end_date;
1313: FETCH c_offer_end_date INTO l_offer_end_date;
1314: CLOSE c_offer_end_date;
1315: IF l_offer_end_date IS NULL THEN
1316: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_NO_END_DATE');
1317: x_return_status := FND_API.g_ret_sts_error;
1318: RETURN;
1319: END IF;
1320: END IF;
1321:
1319: END IF;
1320: END IF;
1321:
1322: IF p_offers_rec.offer_type = 'NET_ACCRUAL' THEN
1323: IF p_offers_rec.tier_level = FND_API.g_miss_char OR p_offers_rec.tier_level IS NULL THEN
1324: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_INVALID_TIER_LVL');
1325: x_return_status := FND_API.g_ret_sts_error;
1326: RETURN;
1327: END IF;
1321:
1322: IF p_offers_rec.offer_type = 'NET_ACCRUAL' THEN
1323: IF p_offers_rec.tier_level = FND_API.g_miss_char OR p_offers_rec.tier_level IS NULL THEN
1324: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_INVALID_TIER_LVL');
1325: x_return_status := FND_API.g_ret_sts_error;
1326: RETURN;
1327: END IF;
1328:
1329: IF p_offers_rec.custom_setup_id <> 105 THEN -- customer not required for PV offer
1326: RETURN;
1327: END IF;
1328:
1329: IF p_offers_rec.custom_setup_id <> 105 THEN -- customer not required for PV offer
1330: IF p_offers_rec.qualifier_id IS NULL OR p_offers_rec.qualifier_id = FND_API.g_miss_num THEN
1331: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_NO_CUSTOMER');
1332: x_return_status := FND_API.g_ret_sts_error;
1333: RETURN;
1334: END IF;
1328:
1329: IF p_offers_rec.custom_setup_id <> 105 THEN -- customer not required for PV offer
1330: IF p_offers_rec.qualifier_id IS NULL OR p_offers_rec.qualifier_id = FND_API.g_miss_num THEN
1331: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_NO_CUSTOMER');
1332: x_return_status := FND_API.g_ret_sts_error;
1333: RETURN;
1334: END IF;
1335: END IF;
1336: END IF;
1338:
1339:
1340: IF p_offers_rec.offer_id IS NULL THEN
1341: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_ID');
1342: x_return_status := FND_API.g_ret_sts_error;
1343: RETURN;
1344: END IF;
1345:
1346:
1345:
1346:
1347: IF p_offers_rec.qp_list_header_id IS NULL THEN
1348: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_LIST_HEADER_ID');
1349: x_return_status := FND_API.g_ret_sts_error;
1350: RETURN;
1351: END IF;
1352:
1353:
1352:
1353:
1354: IF p_offers_rec.offer_type IS NULL THEN
1355: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_TYPE');
1356: x_return_status := FND_API.g_ret_sts_error;
1357: RETURN;
1358: END IF;
1359:
1360:
1359:
1360:
1361: IF p_offers_rec.offer_code IS NULL THEN
1362: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_OFFER_CODE');
1363: x_return_status := FND_API.g_ret_sts_error;
1364: RETURN;
1365: END IF;
1366:
1367: IF p_offers_rec.user_status_id IS NULL THEN
1365: END IF;
1366:
1367: IF p_offers_rec.user_status_id IS NULL THEN
1368: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_USER_STATUS_ID');
1369: x_return_status := FND_API.g_ret_sts_error;
1370: RETURN;
1371: END IF;
1372:
1373: IF p_offers_rec.offer_type = 'SCAN_DATA' THEN
1370: RETURN;
1371: END IF;
1372:
1373: IF p_offers_rec.offer_type = 'SCAN_DATA' THEN
1374: IF p_offers_rec.activity_media_id IS NULL OR p_offers_rec.activity_media_id = FND_API.g_miss_num THEN
1375: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_ACTIVITY');
1376: x_return_status := FND_API.g_ret_sts_error;
1377: RETURN;
1378: END IF;
1372:
1373: IF p_offers_rec.offer_type = 'SCAN_DATA' THEN
1374: IF p_offers_rec.activity_media_id IS NULL OR p_offers_rec.activity_media_id = FND_API.g_miss_num THEN
1375: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFERS_NO_ACTIVITY');
1376: x_return_status := FND_API.g_ret_sts_error;
1377: RETURN;
1378: END IF;
1379: END IF;
1380:
1378: END IF;
1379: END IF;
1380:
1381: IF p_offers_rec.offer_type = 'NET_ACCRUAL' THEN
1382: IF p_offers_rec.tier_level = FND_API.g_miss_char OR p_offers_rec.tier_level IS NULL THEN
1383: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_INVALID_TIER_LVL');
1384: x_return_status := FND_API.g_ret_sts_error;
1385: RETURN;
1386: END IF;
1380:
1381: IF p_offers_rec.offer_type = 'NET_ACCRUAL' THEN
1382: IF p_offers_rec.tier_level = FND_API.g_miss_char OR p_offers_rec.tier_level IS NULL THEN
1383: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_INVALID_TIER_LVL');
1384: x_return_status := FND_API.g_ret_sts_error;
1385: RETURN;
1386: END IF;
1387:
1388: IF p_offers_rec.custom_setup_id <> 105 THEN -- customer not required for PV offer
1385: RETURN;
1386: END IF;
1387:
1388: IF p_offers_rec.custom_setup_id <> 105 THEN -- customer not required for PV offer
1389: IF p_offers_rec.qualifier_id IS NULL OR p_offers_rec.qualifier_id = FND_API.g_miss_num THEN
1390: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_NO_CUSTOMER');
1391: x_return_status := FND_API.g_ret_sts_error;
1392: RETURN;
1393: END IF;
1387:
1388: IF p_offers_rec.custom_setup_id <> 105 THEN -- customer not required for PV offer
1389: IF p_offers_rec.qualifier_id IS NULL OR p_offers_rec.qualifier_id = FND_API.g_miss_num THEN
1390: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_OFFR_NO_CUSTOMER');
1391: x_return_status := FND_API.g_ret_sts_error;
1392: RETURN;
1393: END IF;
1394: END IF;
1395: END IF;
1412:
1413: l_dummy NUMBER;
1414:
1415: BEGIN
1416: x_return_status := FND_API.g_ret_sts_success;
1417:
1418: --- checking the owner_id
1419: IF p_offers_rec.owner_id <> FND_API.g_miss_num THEN
1420: IF OZF_Utility_PVT.check_fk_exists(
1415: BEGIN
1416: x_return_status := FND_API.g_ret_sts_success;
1417:
1418: --- checking the owner_id
1419: IF p_offers_rec.owner_id <> FND_API.g_miss_num THEN
1420: IF OZF_Utility_PVT.check_fk_exists(
1421: 'jtf_rs_resource_extns',
1422: 'resource_id',
1423: p_offers_rec.owner_id ) = FND_API.g_false
1419: IF p_offers_rec.owner_id <> FND_API.g_miss_num THEN
1420: IF OZF_Utility_PVT.check_fk_exists(
1421: 'jtf_rs_resource_extns',
1422: 'resource_id',
1423: p_offers_rec.owner_id ) = FND_API.g_false
1424: THEN
1425: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_USER_ID');
1426: x_return_status := FND_API.g_ret_sts_error;
1427: RETURN;
1422: 'resource_id',
1423: p_offers_rec.owner_id ) = FND_API.g_false
1424: THEN
1425: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_USER_ID');
1426: x_return_status := FND_API.g_ret_sts_error;
1427: RETURN;
1428: END IF;
1429: END IF;
1430:
1428: END IF;
1429: END IF;
1430:
1431: --- checking the qp_list_header_id
1432: IF p_offers_rec.qp_list_header_id <> FND_API.G_MISS_NUM THEN
1433: IF OZF_Utility_PVT.check_fk_exists(
1434: 'qp_list_headers_b'
1435: ,'list_header_id '
1436: ,p_offers_rec.qp_list_header_id) = FND_API.g_false
1432: IF p_offers_rec.qp_list_header_id <> FND_API.G_MISS_NUM THEN
1433: IF OZF_Utility_PVT.check_fk_exists(
1434: 'qp_list_headers_b'
1435: ,'list_header_id '
1436: ,p_offers_rec.qp_list_header_id) = FND_API.g_false
1437: THEN
1438: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_QP_LIST_HEADER_ID');
1439: x_return_status := FND_API.g_ret_sts_error;
1440: RETURN;
1435: ,'list_header_id '
1436: ,p_offers_rec.qp_list_header_id) = FND_API.g_false
1437: THEN
1438: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_QP_LIST_HEADER_ID');
1439: x_return_status := FND_API.g_ret_sts_error;
1440: RETURN;
1441: END IF;
1442: END IF;
1443:
1441: END IF;
1442: END IF;
1443:
1444: -- checking the custom_setup_id
1445: IF p_offers_rec.custom_setup_id <> FND_API.g_miss_num
1446: AND p_offers_rec.custom_setup_id IS NOT NULL
1447: THEN
1448: IF OZF_Utility_PVT.check_fk_exists(
1449: 'ams_custom_setups_vl'
1447: THEN
1448: IF OZF_Utility_PVT.check_fk_exists(
1449: 'ams_custom_setups_vl'
1450: ,'custom_setup_id '
1451: ,p_offers_rec.custom_setup_id) = FND_API.g_false
1452: THEN
1453: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_CUSTOM_SETUP_ID');
1454: x_return_status := FND_API.g_ret_sts_error;
1455: RETURN;
1450: ,'custom_setup_id '
1451: ,p_offers_rec.custom_setup_id) = FND_API.g_false
1452: THEN
1453: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_CUSTOM_SETUP_ID');
1454: x_return_status := FND_API.g_ret_sts_error;
1455: RETURN;
1456: END IF;
1457: END IF;
1458:
1456: END IF;
1457: END IF;
1458:
1459: -- checking the user_status_id
1460: IF p_offers_rec.user_status_id <> FND_API.G_MISS_NUM
1461: AND p_offers_rec.user_status_id IS NOT NULL
1462: THEN
1463: IF OZF_Utility_PVT.check_fk_exists(
1464: 'ams_user_statuses_vl'
1462: THEN
1463: IF OZF_Utility_PVT.check_fk_exists(
1464: 'ams_user_statuses_vl'
1465: ,'user_status_id '
1466: ,p_offers_rec.user_status_id) = FND_API.g_false
1467: THEN
1468: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_USER_STATUS_ID');
1469: x_return_status := FND_API.g_ret_sts_error;
1470: RETURN;
1465: ,'user_status_id '
1466: ,p_offers_rec.user_status_id) = FND_API.g_false
1467: THEN
1468: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_USER_STATUS_ID');
1469: x_return_status := FND_API.g_ret_sts_error;
1470: RETURN;
1471: END IF;
1472: END IF;
1473:
1472: END IF;
1473:
1474:
1475: -- checking the activity_media_id
1476: IF p_offers_rec.activity_media_id <> FND_API.G_MISS_NUM
1477: AND p_offers_rec.activity_media_id IS NOT NULL
1478: THEN
1479: OPEN c_media_id(p_offers_rec.activity_media_id);
1480: FETCH c_media_id INTO l_dummy;
1482:
1483: IF l_dummy IS NULL
1484: THEN
1485: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_MEDIA_ID');
1486: x_return_status := FND_API.g_ret_sts_error;
1487: RETURN;
1488: END IF;
1489: END IF;
1490:
1488: END IF;
1489: END IF;
1490:
1491: IF p_offers_rec.offer_type = 'NET_ACCRUAL' THEN
1492: IF p_offers_rec.na_rule_header_id IS NOT NULL AND p_offers_rec.na_rule_header_id <> FND_API.G_MISS_NUM THEN
1493: IF ozf_utility_pvt.check_fk_exists('ozf_na_rule_headers_b'
1494: ,'NA_RULE_HEADER_ID'
1495: ,p_offers_rec.na_rule_header_id) = FND_API.G_FALSE
1496: THEN
1491: IF p_offers_rec.offer_type = 'NET_ACCRUAL' THEN
1492: IF p_offers_rec.na_rule_header_id IS NOT NULL AND p_offers_rec.na_rule_header_id <> FND_API.G_MISS_NUM THEN
1493: IF ozf_utility_pvt.check_fk_exists('ozf_na_rule_headers_b'
1494: ,'NA_RULE_HEADER_ID'
1495: ,p_offers_rec.na_rule_header_id) = FND_API.G_FALSE
1496: THEN
1497: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_NA_RULE_HEADER_ID');
1498: x_return_status := FND_API.g_ret_sts_error;
1499: RETURN;
1494: ,'NA_RULE_HEADER_ID'
1495: ,p_offers_rec.na_rule_header_id) = FND_API.G_FALSE
1496: THEN
1497: OZF_Utility_PVT.Error_Message('OZF_OFFR_BAD_NA_RULE_HEADER_ID');
1498: x_return_status := FND_API.g_ret_sts_error;
1499: RETURN;
1500: END IF;
1501: END IF;
1502: END IF;
1507: x_return_status OUT NOCOPY VARCHAR2
1508: )
1509: IS
1510: BEGIN
1511: x_return_status := FND_API.g_ret_sts_success;
1512:
1513: -- modifier_level_code
1514: IF p_offers_rec.modifier_level_code <> FND_API.g_miss_char
1515: AND p_offers_rec.modifier_level_code IS NOT NULL
1510: BEGIN
1511: x_return_status := FND_API.g_ret_sts_success;
1512:
1513: -- modifier_level_code
1514: IF p_offers_rec.modifier_level_code <> FND_API.g_miss_char
1515: AND p_offers_rec.modifier_level_code IS NOT NULL
1516: THEN
1517: IF OZF_Utility_PVT.check_lookup_exists(
1518: p_lookup_table_name => 'qp_lookups'
1517: IF OZF_Utility_PVT.check_lookup_exists(
1518: p_lookup_table_name => 'qp_lookups'
1519: ,p_lookup_type => 'MODIFIER_LEVEL_CODE'
1520: ,p_lookup_code => p_offers_rec.modifier_level_code
1521: ) = FND_API.g_false
1522: THEN
1523: --OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_MODIFIER_LEVEL_CODE') ;
1524: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
1525: THEN
1525: THEN
1526: FND_MESSAGE.set_name('OZF', 'OZF_OFR_BAD_MODIFIER_LEVEL_COD');
1527: FND_MSG_PUB.add;
1528: END IF;
1529: x_return_status := FND_API.g_ret_sts_error;
1530: RETURN;
1531: END IF;
1532: END IF;
1533:
1532: END IF;
1533:
1534: --- order_value_discount_type
1535: --- reminder : This lookup has to be created . -musman 04/20
1536: IF p_offers_rec.order_value_discount_type <> FND_API.g_miss_char
1537: AND p_offers_rec.order_value_discount_type IS NOT NULL
1538: THEN
1539: IF OZF_Utility_PVT.check_lookup_exists(
1540: p_lookup_type => 'OZF_OFFER_OV_DISCOUNT_TYPE',
1538: THEN
1539: IF OZF_Utility_PVT.check_lookup_exists(
1540: p_lookup_type => 'OZF_OFFER_OV_DISCOUNT_TYPE',
1541: p_lookup_code => p_offers_rec.order_value_discount_type
1542: ) = FND_API.g_false
1543: THEN
1544: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_DISCOUNT_TYPE') ;
1545: x_return_status := FND_API.g_ret_sts_error;
1546: RETURN;
1541: p_lookup_code => p_offers_rec.order_value_discount_type
1542: ) = FND_API.g_false
1543: THEN
1544: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_DISCOUNT_TYPE') ;
1545: x_return_status := FND_API.g_ret_sts_error;
1546: RETURN;
1547: END IF;
1548: END IF;
1549:
1546: RETURN;
1547: END IF;
1548: END IF;
1549:
1550: IF p_offers_rec.lumpsum_payment_type <> FND_API.g_miss_char
1551: AND p_offers_rec.lumpsum_payment_type IS NOT NULL
1552: THEN
1553: IF OZF_Utility_PVT.check_lookup_exists(
1554: p_lookup_type => 'OZF_OFFER_LUMPSUM_PAYMENT',
1552: THEN
1553: IF OZF_Utility_PVT.check_lookup_exists(
1554: p_lookup_type => 'OZF_OFFER_LUMPSUM_PAYMENT',
1555: p_lookup_code => p_offers_rec.lumpsum_payment_type
1556: ) = FND_API.g_false
1557: THEN
1558: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_DISCOUNT_TYPE') ;
1559: x_return_status := FND_API.g_ret_sts_error;
1560: RETURN;
1555: p_lookup_code => p_offers_rec.lumpsum_payment_type
1556: ) = FND_API.g_false
1557: THEN
1558: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_DISCOUNT_TYPE') ;
1559: x_return_status := FND_API.g_ret_sts_error;
1560: RETURN;
1561: END IF;
1562: END IF;
1563:
1561: END IF;
1562: END IF;
1563:
1564: -- status code
1565: IF p_offers_rec.status_code <> FND_API.g_miss_char
1566: AND p_offers_rec.status_code IS NOT NULL
1567: THEN
1568: IF OZF_Utility_PVT.check_lookup_exists(
1569: p_lookup_type => 'OZF_OFFER_STATUS',
1567: THEN
1568: IF OZF_Utility_PVT.check_lookup_exists(
1569: p_lookup_type => 'OZF_OFFER_STATUS',
1570: p_lookup_code => p_offers_rec.status_code
1571: ) = FND_API.g_false
1572: THEN
1573: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_STATUS_CODE') ;
1574: x_return_status := FND_API.g_ret_sts_error;
1575: RETURN;
1570: p_lookup_code => p_offers_rec.status_code
1571: ) = FND_API.g_false
1572: THEN
1573: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_STATUS_CODE') ;
1574: x_return_status := FND_API.g_ret_sts_error;
1575: RETURN;
1576: END IF;
1577: END IF;
1578:
1576: END IF;
1577: END IF;
1578:
1579: -- offer_type
1580: IF p_offers_rec.offer_type <> FND_API.g_miss_char
1581: AND p_offers_rec.offer_type IS NOT NULL
1582: THEN
1583: IF OZF_Utility_PVT.check_lookup_exists(
1584: p_lookup_type => 'OZF_OFFER_TYPE',
1582: THEN
1583: IF OZF_Utility_PVT.check_lookup_exists(
1584: p_lookup_type => 'OZF_OFFER_TYPE',
1585: p_lookup_code => p_offers_rec.offer_type
1586: ) = FND_API.g_false
1587: THEN
1588: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_OFFER_TYPE') ;
1589: x_return_status := FND_API.g_ret_sts_error;
1590: RETURN;
1585: p_lookup_code => p_offers_rec.offer_type
1586: ) = FND_API.g_false
1587: THEN
1588: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_OFFER_TYPE') ;
1589: x_return_status := FND_API.g_ret_sts_error;
1590: RETURN;
1591: END IF;
1592: END IF;
1593:
1595: IF p_offers_rec.offer_type = 'OID' THEN
1596: IF OZF_Utility_PVT.check_lookup_exists(
1597: p_lookup_type => 'OZF_OFFER_BREAK_TYPE',
1598: p_lookup_code => p_offers_rec.break_type
1599: ) = FND_API.g_false
1600: THEN
1601: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_BREAK_TYPE') ;
1602: x_return_status := FND_API.g_ret_sts_error;
1603: RETURN;
1598: p_lookup_code => p_offers_rec.break_type
1599: ) = FND_API.g_false
1600: THEN
1601: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_BREAK_TYPE') ;
1602: x_return_status := FND_API.g_ret_sts_error;
1603: RETURN;
1604: END IF;
1605: END IF;
1606: /*
1603: RETURN;
1604: END IF;
1605: END IF;
1606: /*
1607: IF p_offers_rec.autopay_method <> FND_API.g_miss_char
1608: AND p_offers_rec.autopay_method IS NOT NULL
1609: THEN
1610: IF OZF_Utility_PVT.check_lookup_exists(
1611: p_lookup_table_name => 'OZF_lookups'
1610: IF OZF_Utility_PVT.check_lookup_exists(
1611: p_lookup_table_name => 'OZF_lookups'
1612: ,p_lookup_type => 'OZF_OFFER_AUTOPAY_METHOD'
1613: ,p_lookup_code => p_offers_rec.autopay_method
1614: ) = FND_API.g_false
1615: THEN
1616: --OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_MODIFIER_LEVEL_CODE') ;
1617: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
1618: THEN
1618: THEN
1619: FND_MESSAGE.set_name('OZF', 'OZF_OFFR_BAD_PAYMENT_METHOD');
1620: FND_MSG_PUB.add;
1621: END IF;
1622: x_return_status := FND_API.g_ret_sts_error;
1623: RETURN;
1624: END IF;
1625: END IF;
1626:
1623: RETURN;
1624: END IF;
1625: END IF;
1626:
1627: IF p_offers_rec.autopay_party_attr <> FND_API.g_miss_char
1628: AND p_offers_rec.autopay_party_attr IS NOT NULL
1629: THEN
1630: IF OZF_Utility_PVT.check_lookup_exists(
1631: p_lookup_table_name => 'ozf_lookups'
1630: IF OZF_Utility_PVT.check_lookup_exists(
1631: p_lookup_table_name => 'ozf_lookups'
1632: ,p_lookup_type => 'OZF_AUTOPAY_CUST_TYPES'
1633: ,p_lookup_code => p_offers_rec.autopay_party_attr
1634: ) = FND_API.g_false
1635: THEN
1636: --OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_MODIFIER_LEVEL_CODE') ;
1637: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
1638: THEN
1638: THEN
1639: FND_MESSAGE.set_name('OZF', 'OZF_OFFR_BAD_AUTOPAY_CUSTTYPE');
1640: FND_MSG_PUB.add;
1641: END IF;
1642: x_return_status := FND_API.g_ret_sts_error;
1643: RETURN;
1644: END IF;
1645: END IF;
1646: */
1652: )
1653: IS
1654: BEGIN
1655:
1656: x_return_status := FND_API.g_ret_sts_success;
1657:
1658: ----------------------- active_flag ------------------------
1659: IF p_offers_rec.reusable <> FND_API.g_miss_char
1660: AND p_offers_rec.reusable IS NOT NULL
1655:
1656: x_return_status := FND_API.g_ret_sts_success;
1657:
1658: ----------------------- active_flag ------------------------
1659: IF p_offers_rec.reusable <> FND_API.g_miss_char
1660: AND p_offers_rec.reusable IS NOT NULL
1661: THEN
1662: IF OZF_Utility_PVT.is_Y_or_N(p_offers_rec.reusable) = FND_API.g_false
1663: THEN
1658: ----------------------- active_flag ------------------------
1659: IF p_offers_rec.reusable <> FND_API.g_miss_char
1660: AND p_offers_rec.reusable IS NOT NULL
1661: THEN
1662: IF OZF_Utility_PVT.is_Y_or_N(p_offers_rec.reusable) = FND_API.g_false
1663: THEN
1664: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_REUSABLE_FLAG');
1665: x_return_status := FND_API.g_ret_sts_error;
1666: RETURN;
1661: THEN
1662: IF OZF_Utility_PVT.is_Y_or_N(p_offers_rec.reusable) = FND_API.g_false
1663: THEN
1664: OZF_Utility_PVT.Error_Message('OZF_OFR_BAD_REUSABLE_FLAG');
1665: x_return_status := FND_API.g_ret_sts_error;
1666: RETURN;
1667: END IF;
1668: END IF;
1669:
1680: l_end_date DATE;
1681:
1682: BEGIN
1683:
1684: x_return_status := FND_API.g_ret_sts_success;
1685:
1686: --checking the perf date from and to
1687:
1688: IF p_offers_rec.perf_date_from IS NOT NULL
1685:
1686: --checking the perf date from and to
1687:
1688: IF p_offers_rec.perf_date_from IS NOT NULL
1689: AND p_offers_rec.perf_date_from <> FND_API.G_MISS_DATE
1690: AND p_offers_rec.perf_date_to IS NOT NULL
1691: AND p_offers_rec.perf_date_to <> FND_API.G_MISS_DATE
1692: THEN
1693: l_start_date := p_offers_rec.perf_date_from;
1687:
1688: IF p_offers_rec.perf_date_from IS NOT NULL
1689: AND p_offers_rec.perf_date_from <> FND_API.G_MISS_DATE
1690: AND p_offers_rec.perf_date_to IS NOT NULL
1691: AND p_offers_rec.perf_date_to <> FND_API.G_MISS_DATE
1692: THEN
1693: l_start_date := p_offers_rec.perf_date_from;
1694: l_end_date := p_offers_rec.perf_date_to;
1695: IF l_start_date > l_end_date THEN
1697: THEN
1698: FND_MESSAGE.set_name('OZF', 'OZF_OFR_SHIP_START_AFTER_END');
1699: FND_MSG_PUB.add;
1700: END IF;
1701: x_return_status := FND_API.g_ret_sts_error;
1702: END IF;
1703: END IF;
1704:
1705: END check_offers_inter_entity;
1718: check_offers_uk_items(
1719: p_offers_rec => p_offers_rec,
1720: p_validation_mode => p_validation_mode,
1721: x_return_status => x_return_status);
1722: IF x_return_status <> FND_API.g_ret_sts_success THEN
1723: RETURN;
1724: END IF;
1725:
1726: -- Check Items Required/NOT NULL API calls
1727: check_offers_req_items(
1728: p_offers_rec => p_offers_rec,
1729: p_validation_mode => p_validation_mode,
1730: x_return_status => x_return_status);
1731: IF x_return_status <> FND_API.g_ret_sts_success THEN
1732: RETURN;
1733: END IF;
1734:
1735: -- Check Items Foreign Keys API calls
1736:
1737: check_offers_FK_items(
1738: p_offers_rec => p_offers_rec,
1739: x_return_status => x_return_status);
1740: IF x_return_status <> FND_API.g_ret_sts_success THEN
1741: RETURN;
1742: END IF;
1743:
1744: -- Check Items Lookups
1745:
1746: check_offers_Lookup_items(
1747: p_offers_rec => p_offers_rec,
1748: x_return_status => x_return_status);
1749: IF x_return_status <> FND_API.g_ret_sts_success THEN
1750: RETURN;
1751: END IF;
1752:
1753: -- check the flags
1754:
1755: check_offers_flag_items(
1756: p_offers_rec => p_offers_rec
1757: ,x_return_status => x_return_status);
1758: IF x_return_status <> FND_API.g_ret_sts_success THEN
1759: RETURN;
1760: END IF;
1761:
1762: --check the offer inter entity
1762: --check the offer inter entity
1763: check_offers_inter_entity(
1764: p_offers_rec => p_offers_rec
1765: ,x_return_status => x_return_status);
1766: IF x_return_status <> FND_API.g_ret_sts_success THEN
1767: RETURN;
1768: END IF;
1769:
1770: END Check_offers_Items;
1772:
1773:
1774: PROCEDURE Validate_offers(
1775: p_api_version_number IN NUMBER,
1776: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1777: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1778: p_offers_rec IN offers_rec_type,
1779: x_return_status OUT NOCOPY VARCHAR2,
1780: x_msg_count OUT NOCOPY NUMBER,
1773:
1774: PROCEDURE Validate_offers(
1775: p_api_version_number IN NUMBER,
1776: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1777: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1778: p_offers_rec IN offers_rec_type,
1779: x_return_status OUT NOCOPY VARCHAR2,
1780: x_msg_count OUT NOCOPY NUMBER,
1781: x_msg_data OUT NOCOPY VARCHAR2
1791: -- Standard Start of API savepoint
1792: SAVEPOINT VALIDATE_Offers_;
1793:
1794: -- Standard call to check for call compatibility.
1795: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
1796: p_api_version_number,
1797: l_api_name,
1798: G_PKG_NAME)
1799: THEN
1796: p_api_version_number,
1797: l_api_name,
1798: G_PKG_NAME)
1799: THEN
1800: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1801: END IF;
1802:
1803: -- Initialize message list if p_init_msg_list is set to TRUE.
1804: IF FND_API.to_Boolean( p_init_msg_list )
1800: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1801: END IF;
1802:
1803: -- Initialize message list if p_init_msg_list is set to TRUE.
1804: IF FND_API.to_Boolean( p_init_msg_list )
1805: THEN
1806: FND_MSG_PUB.initialize;
1807: END IF;
1808:
1805: THEN
1806: FND_MSG_PUB.initialize;
1807: END IF;
1808:
1809: x_return_status := FND_API.g_ret_sts_success;
1810:
1811: Complete_offers_Rec(
1812: p_offers_rec => p_offers_rec,
1813: x_complete_rec => l_offers_rec
1819: p_validation_mode => JTF_PLSQL_API.g_update,
1820: x_return_status => x_return_status
1821: );
1822:
1823: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1824: RAISE FND_API.G_EXC_ERROR;
1825: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1826: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1827: END IF;
1820: x_return_status => x_return_status
1821: );
1822:
1823: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1824: RAISE FND_API.G_EXC_ERROR;
1825: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1826: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1827: END IF;
1828: END IF;
1821: );
1822:
1823: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1824: RAISE FND_API.G_EXC_ERROR;
1825: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1826: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1827: END IF;
1828: END IF;
1829:
1822:
1823: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1824: RAISE FND_API.G_EXC_ERROR;
1825: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1826: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1827: END IF;
1828: END IF;
1829:
1830: IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1829:
1830: IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1831: Validate_offers_Rec(
1832: p_api_version_number => 1.0,
1833: p_init_msg_list => FND_API.G_FALSE,
1834: x_return_status => x_return_status,
1835: x_msg_count => x_msg_count,
1836: x_msg_data => x_msg_data,
1837: p_offers_rec => l_offers_rec);
1835: x_msg_count => x_msg_count,
1836: x_msg_data => x_msg_data,
1837: p_offers_rec => l_offers_rec);
1838:
1839: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1840: RAISE FND_API.G_EXC_ERROR;
1841: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1842: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1843: END IF;
1836: x_msg_data => x_msg_data,
1837: p_offers_rec => l_offers_rec);
1838:
1839: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1840: RAISE FND_API.G_EXC_ERROR;
1841: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1842: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1843: END IF;
1844: END IF;
1837: p_offers_rec => l_offers_rec);
1838:
1839: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1840: RAISE FND_API.G_EXC_ERROR;
1841: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1842: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1843: END IF;
1844: END IF;
1845:
1838:
1839: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1840: RAISE FND_API.G_EXC_ERROR;
1841: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1842: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1843: END IF;
1844: END IF;
1845:
1846: -- Initialize API return status to SUCCESS
1843: END IF;
1844: END IF;
1845:
1846: -- Initialize API return status to SUCCESS
1847: x_return_status := FND_API.G_RET_STS_SUCCESS;
1848:
1849: -- Standard call to get message count and if count is 1, get message info.
1850: FND_MSG_PUB.Count_And_Get
1851: (p_count => x_msg_count,
1854:
1855: EXCEPTION
1856:
1857: WHEN OZF_Utility_PVT.resource_locked THEN
1858: x_return_status := FND_API.g_ret_sts_error;
1859: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1860:
1861: WHEN FND_API.G_EXC_ERROR THEN
1862: ROLLBACK TO VALIDATE_Offers_;
1857: WHEN OZF_Utility_PVT.resource_locked THEN
1858: x_return_status := FND_API.g_ret_sts_error;
1859: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1860:
1861: WHEN FND_API.G_EXC_ERROR THEN
1862: ROLLBACK TO VALIDATE_Offers_;
1863: x_return_status := FND_API.G_RET_STS_ERROR;
1864: -- Standard call to get message count and if count=1, get the message
1865: FND_MSG_PUB.Count_And_Get (
1859: OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1860:
1861: WHEN FND_API.G_EXC_ERROR THEN
1862: ROLLBACK TO VALIDATE_Offers_;
1863: x_return_status := FND_API.G_RET_STS_ERROR;
1864: -- Standard call to get message count and if count=1, get the message
1865: FND_MSG_PUB.Count_And_Get (
1866: p_encoded => FND_API.G_FALSE,
1867: p_count => x_msg_count,
1862: ROLLBACK TO VALIDATE_Offers_;
1863: x_return_status := FND_API.G_RET_STS_ERROR;
1864: -- Standard call to get message count and if count=1, get the message
1865: FND_MSG_PUB.Count_And_Get (
1866: p_encoded => FND_API.G_FALSE,
1867: p_count => x_msg_count,
1868: p_data => x_msg_data
1869: );
1870:
1867: p_count => x_msg_count,
1868: p_data => x_msg_data
1869: );
1870:
1871: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1872: ROLLBACK TO VALIDATE_Offers_;
1873: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1874: -- Standard call to get message count and if count=1, get the message
1875: FND_MSG_PUB.Count_And_Get (
1869: );
1870:
1871: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1872: ROLLBACK TO VALIDATE_Offers_;
1873: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1874: -- Standard call to get message count and if count=1, get the message
1875: FND_MSG_PUB.Count_And_Get (
1876: p_encoded => FND_API.G_FALSE,
1877: p_count => x_msg_count,
1872: ROLLBACK TO VALIDATE_Offers_;
1873: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1874: -- Standard call to get message count and if count=1, get the message
1875: FND_MSG_PUB.Count_And_Get (
1876: p_encoded => FND_API.G_FALSE,
1877: p_count => x_msg_count,
1878: p_data => x_msg_data
1879: );
1880:
1879: );
1880:
1881: WHEN OTHERS THEN
1882: ROLLBACK TO VALIDATE_Offers_;
1883: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1884: IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1885: THEN
1886: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1887: END IF;
1886: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1887: END IF;
1888: -- Standard call to get message count and if count=1, get the message
1889: FND_MSG_PUB.Count_And_Get (
1890: p_encoded => FND_API.G_FALSE,
1891: p_count => x_msg_count,
1892: p_data => x_msg_data
1893: );
1894: End Validate_Offers;
1895:
1896:
1897: PROCEDURE Validate_offers_rec(
1898: p_api_version_number IN NUMBER,
1899: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1900: x_return_status OUT NOCOPY VARCHAR2,
1901: x_msg_count OUT NOCOPY NUMBER,
1902: x_msg_data OUT NOCOPY VARCHAR2,
1903: p_offers_rec IN offers_rec_type
1906:
1907: l_api_name varchar2(20) := 'Validate_offers_rec';
1908: BEGIN
1909: -- Initialize message list if p_init_msg_list is set to TRUE.
1910: IF FND_API.to_Boolean( p_init_msg_list )
1911: THEN
1912: FND_MSG_PUB.initialize;
1913: END IF;
1914:
1912: FND_MSG_PUB.initialize;
1913: END IF;
1914:
1915: -- Initialize API return status to SUCCESS
1916: x_return_status := FND_API.G_RET_STS_SUCCESS;
1917:
1918: -- Hint: Validate data
1919: -- If data not valid
1920: -- THEN
1917:
1918: -- Hint: Validate data
1919: -- If data not valid
1920: -- THEN
1921: -- x_return_status := FND_API.G_RET_STS_ERROR;
1922:
1923: -- Standard call to get message count and if count is 1, get message info.
1924: FND_MSG_PUB.Count_And_Get
1925: (p_count => x_msg_count,
1944: AND enabled_flag = 'Y';
1945:
1946: BEGIN
1947:
1948: x_return_status := FND_API.g_ret_sts_success;
1949:
1950: OPEN c_status_code;
1951: FETCH c_status_code INTO l_status_code;
1952: CLOSE c_status_code;
1951: FETCH c_status_code INTO l_status_code;
1952: CLOSE c_status_code;
1953:
1954: IF l_status_code IS NULL THEN
1955: x_return_status := FND_API.g_ret_sts_error;
1956: OZF_Utility_PVT.error_message('OZF_OFFR_BAD_USER_STATUS_ID');
1957: END IF;
1958:
1959: x_status_code := l_status_code;
1977: AND enabled_flag = 'Y';
1978:
1979: BEGIN
1980:
1981: x_return_status := FND_API.g_ret_sts_success;
1982:
1983: OPEN c_status_id;
1984: FETCH c_status_id INTO l_status_id;
1985: CLOSE c_status_id;
1984: FETCH c_status_id INTO l_status_id;
1985: CLOSE c_status_id;
1986:
1987: IF l_status_id IS NULL THEN
1988: x_return_status := FND_API.g_ret_sts_error;
1989: OZF_Utility_PVT.error_message('OZF_OFFR_BAD_USER_STATUS_ID');
1990: END IF;
1991:
1992: x_status_id := l_status_id;