75: -- Modified
76: AND q.quota_type_code IN ('EXTERNAL', 'FORMULA');
77: BEGIN
78: -- Initialize API return status to success
79: x_return_status := fnd_api.g_ret_sts_success;
80: x_loading_status := p_loading_status;
81:
82: -- API body
83: -- Check if CP exist
96: fnd_msg_pub.ADD;
97: END IF;
98:
99: x_loading_status := 'CN_CP_NOT_EXIST';
100: RAISE fnd_api.g_exc_error;
101: END;
102:
103: -- Check if PE exist
104: BEGIN
118: fnd_msg_pub.ADD;
119: END IF;
120:
121: x_loading_status := 'CN_PLN_NOT_EXIST';
122: RAISE fnd_api.g_exc_error;
123: END;
124:
125: -- Check if already assigned( duplicate assigned )
126: BEGIN
166: fnd_msg_pub.ADD;
167: END IF;
168:
169: x_loading_status := 'PLN_PLAN_DUP_REV_CLASS';
170: RAISE fnd_api.g_exc_error;
171: END IF;
172: END IF;
173:
174: -- Date Range check for Plan element
197: fnd_msg_pub.ADD;
198: END IF;
199:
200: x_loading_status := 'CN_PLAN_ELT_DISJOINT';
201: RAISE fnd_api.g_exc_error;
202: END IF;
203:
204:
205: -- End of API body.
207: NULL;
208: -- Standard call to get message count and if count is 1, get message info.
209: fnd_msg_pub.count_and_get (p_count => x_msg_count,
210: p_data => x_msg_data,
211: p_encoded => fnd_api.g_false
212: );
213: EXCEPTION
214: WHEN fnd_api.g_exc_error
215: THEN
210: p_data => x_msg_data,
211: p_encoded => fnd_api.g_false
212: );
213: EXCEPTION
214: WHEN fnd_api.g_exc_error
215: THEN
216: x_return_status := fnd_api.g_ret_sts_error;
217: fnd_msg_pub.count_and_get (p_count => x_msg_count,
218: p_data => x_msg_data,
212: );
213: EXCEPTION
214: WHEN fnd_api.g_exc_error
215: THEN
216: x_return_status := fnd_api.g_ret_sts_error;
217: fnd_msg_pub.count_and_get (p_count => x_msg_count,
218: p_data => x_msg_data,
219: p_encoded => fnd_api.g_false
220: );
215: THEN
216: x_return_status := fnd_api.g_ret_sts_error;
217: fnd_msg_pub.count_and_get (p_count => x_msg_count,
218: p_data => x_msg_data,
219: p_encoded => fnd_api.g_false
220: );
221: WHEN fnd_api.g_exc_unexpected_error
222: THEN
223: x_return_status := fnd_api.g_ret_sts_unexp_error;
217: fnd_msg_pub.count_and_get (p_count => x_msg_count,
218: p_data => x_msg_data,
219: p_encoded => fnd_api.g_false
220: );
221: WHEN fnd_api.g_exc_unexpected_error
222: THEN
223: x_return_status := fnd_api.g_ret_sts_unexp_error;
224: x_loading_status := 'UNEXPECTED_ERR';
225: fnd_msg_pub.count_and_get (p_count => x_msg_count,
219: p_encoded => fnd_api.g_false
220: );
221: WHEN fnd_api.g_exc_unexpected_error
222: THEN
223: x_return_status := fnd_api.g_ret_sts_unexp_error;
224: x_loading_status := 'UNEXPECTED_ERR';
225: fnd_msg_pub.count_and_get (p_count => x_msg_count,
226: p_data => x_msg_data,
227: p_encoded => fnd_api.g_false
223: x_return_status := fnd_api.g_ret_sts_unexp_error;
224: x_loading_status := 'UNEXPECTED_ERR';
225: fnd_msg_pub.count_and_get (p_count => x_msg_count,
226: p_data => x_msg_data,
227: p_encoded => fnd_api.g_false
228: );
229: WHEN OTHERS
230: THEN
231: x_return_status := fnd_api.g_ret_sts_unexp_error;
227: p_encoded => fnd_api.g_false
228: );
229: WHEN OTHERS
230: THEN
231: x_return_status := fnd_api.g_ret_sts_unexp_error;
232: x_loading_status := 'UNEXPECTED_ERR';
233:
234: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error)
235: THEN
237: END IF;
238:
239: fnd_msg_pub.count_and_get (p_count => x_msg_count,
240: p_data => x_msg_data,
241: p_encoded => fnd_api.g_false
242: );
243: END valid_pe_assign;
244:
245: --| ----------------------------------------------------------------------+
247: --| Desc : Procedure to create a new plan element assigned
248: --| --------------------------------------------------------------------- +
249: PROCEDURE create_plan_element_assign (
250: p_api_version IN NUMBER,
251: p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
252: p_commit IN VARCHAR2 := fnd_api.g_false,
253: p_validation_level IN NUMBER
254: := fnd_api.g_valid_level_full,
255: x_return_status OUT NOCOPY VARCHAR2,
248: --| --------------------------------------------------------------------- +
249: PROCEDURE create_plan_element_assign (
250: p_api_version IN NUMBER,
251: p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
252: p_commit IN VARCHAR2 := fnd_api.g_false,
253: p_validation_level IN NUMBER
254: := fnd_api.g_valid_level_full,
255: x_return_status OUT NOCOPY VARCHAR2,
256: x_msg_count OUT NOCOPY NUMBER,
250: p_api_version IN NUMBER,
251: p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
252: p_commit IN VARCHAR2 := fnd_api.g_false,
253: p_validation_level IN NUMBER
254: := fnd_api.g_valid_level_full,
255: x_return_status OUT NOCOPY VARCHAR2,
256: x_msg_count OUT NOCOPY NUMBER,
257: x_msg_data OUT NOCOPY VARCHAR2,
258: p_comp_plan_name IN cn_comp_plans.NAME%TYPE,
274: -- Standard Start of API savepoint
275: SAVEPOINT create_plan_element_assign;
276:
277: -- Standard call to check for call compatibility.
278: IF NOT fnd_api.compatible_api_call (l_api_version,
279: p_api_version,
280: l_api_name,
281: g_pkg_name
282: )
280: l_api_name,
281: g_pkg_name
282: )
283: THEN
284: RAISE fnd_api.g_exc_unexpected_error;
285: END IF;
286:
287: -- Initialize message list if p_init_msg_list is set to TRUE.
288: IF fnd_api.to_boolean (p_init_msg_list)
284: RAISE fnd_api.g_exc_unexpected_error;
285: END IF;
286:
287: -- Initialize message list if p_init_msg_list is set to TRUE.
288: IF fnd_api.to_boolean (p_init_msg_list)
289: THEN
290: fnd_msg_pub.initialize;
291: END IF;
292:
290: fnd_msg_pub.initialize;
291: END IF;
292:
293: -- Initialize API return status to success
294: x_return_status := fnd_api.g_ret_sts_success;
295: l_loading_status := 'CN_INSERTED';
296: -- API body
297: --
298: -- Valid plan element assignment
313: x_pe_id => l_pe_id,
314: x_loading_status => x_loading_status
315: );
316:
317: IF (x_return_status <> fnd_api.g_ret_sts_success)
318: THEN
319: RAISE fnd_api.g_exc_error;
320: ELSIF x_loading_status <> 'PLN_QUOTA_ASSIGNED'
321: THEN
315: );
316:
317: IF (x_return_status <> fnd_api.g_ret_sts_success)
318: THEN
319: RAISE fnd_api.g_exc_error;
320: ELSIF x_loading_status <> 'PLN_QUOTA_ASSIGNED'
321: THEN
322: -- Create comp plan into cn_comp_plans
323: cn_quota_assigns_pkg.begin_record
338: x_loading_status => x_loading_status,
339: x_return_status => x_return_status
340: );
341:
342: IF (x_return_status <> fnd_api.g_ret_sts_success)
343: THEN
344: RAISE fnd_api.g_exc_error;
345: END IF;
346: END IF;
340: );
341:
342: IF (x_return_status <> fnd_api.g_ret_sts_success)
343: THEN
344: RAISE fnd_api.g_exc_error;
345: END IF;
346: END IF;
347:
348: -- End of API body.
346: END IF;
347:
348: -- End of API body.
349: -- Standard check of p_commit.
350: IF fnd_api.to_boolean (p_commit)
351: THEN
352: COMMIT WORK;
353: END IF;
354:
354:
355: -- Standard call to get message count and if count is 1, get message info.
356: fnd_msg_pub.count_and_get (p_count => x_msg_count,
357: p_data => x_msg_data,
358: p_encoded => fnd_api.g_false
359: );
360: EXCEPTION
361: WHEN fnd_api.g_exc_error
362: THEN
357: p_data => x_msg_data,
358: p_encoded => fnd_api.g_false
359: );
360: EXCEPTION
361: WHEN fnd_api.g_exc_error
362: THEN
363: ROLLBACK TO create_plan_element_assign;
364: x_return_status := fnd_api.g_ret_sts_error;
365: fnd_msg_pub.count_and_get (p_count => x_msg_count,
360: EXCEPTION
361: WHEN fnd_api.g_exc_error
362: THEN
363: ROLLBACK TO create_plan_element_assign;
364: x_return_status := fnd_api.g_ret_sts_error;
365: fnd_msg_pub.count_and_get (p_count => x_msg_count,
366: p_data => x_msg_data,
367: p_encoded => fnd_api.g_false
368: );
363: ROLLBACK TO create_plan_element_assign;
364: x_return_status := fnd_api.g_ret_sts_error;
365: fnd_msg_pub.count_and_get (p_count => x_msg_count,
366: p_data => x_msg_data,
367: p_encoded => fnd_api.g_false
368: );
369: WHEN fnd_api.g_exc_unexpected_error
370: THEN
371: ROLLBACK TO create_plan_element_assign;
365: fnd_msg_pub.count_and_get (p_count => x_msg_count,
366: p_data => x_msg_data,
367: p_encoded => fnd_api.g_false
368: );
369: WHEN fnd_api.g_exc_unexpected_error
370: THEN
371: ROLLBACK TO create_plan_element_assign;
372: x_loading_status := 'UNEXPECTED_ERR';
373: x_return_status := fnd_api.g_ret_sts_unexp_error;
369: WHEN fnd_api.g_exc_unexpected_error
370: THEN
371: ROLLBACK TO create_plan_element_assign;
372: x_loading_status := 'UNEXPECTED_ERR';
373: x_return_status := fnd_api.g_ret_sts_unexp_error;
374: fnd_msg_pub.count_and_get (p_count => x_msg_count,
375: p_data => x_msg_data,
376: p_encoded => fnd_api.g_false
377: );
372: x_loading_status := 'UNEXPECTED_ERR';
373: x_return_status := fnd_api.g_ret_sts_unexp_error;
374: fnd_msg_pub.count_and_get (p_count => x_msg_count,
375: p_data => x_msg_data,
376: p_encoded => fnd_api.g_false
377: );
378: WHEN OTHERS
379: THEN
380: ROLLBACK TO create_plan_element_assign;
378: WHEN OTHERS
379: THEN
380: ROLLBACK TO create_plan_element_assign;
381: x_loading_status := 'UNEXPECTED_ERR';
382: x_return_status := fnd_api.g_ret_sts_unexp_error;
383:
384: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error)
385: THEN
386: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
387: END IF;
388:
389: fnd_msg_pub.count_and_get (p_count => x_msg_count,
390: p_data => x_msg_data,
391: p_encoded => fnd_api.g_false
392: );
393: END create_plan_element_assign;
394:
395: --|--------------------------------------------------------------------------+
418:
419: l_cp_csr c_cp_csr%ROWTYPE;
420: l_lkup_meaning cn_lookups.meaning%TYPE;
421: BEGIN
422: x_return_status := fnd_api.g_ret_sts_success;
423: x_loading_status := p_loading_status;
424:
425: OPEN c_cp_csr;
426:
428: INTO l_cp_csr;
429:
430: IF c_cp_csr%NOTFOUND
431: THEN
432: RAISE fnd_api.g_exc_unexpected_error;
433: END IF;
434:
435: -- Check description consistent
436: IF (l_cp_csr.description <> p_cp_rec.description)
447: fnd_msg_pub.ADD;
448: END IF;
449:
450: x_loading_status := 'CN_CP_NOT_CONSISTENT';
451: RAISE fnd_api.g_exc_error;
452: END IF;
453:
454: -- Check start period consistent
455: IF (TRUNC (l_cp_csr.start_date) <> TRUNC (p_cp_rec.start_date))
466: fnd_msg_pub.ADD;
467: END IF;
468:
469: x_loading_status := 'CN_CP_NOT_CONSISTENT';
470: RAISE fnd_api.g_exc_error;
471: END IF;
472:
473: -- Check end period consistent
474: IF (NVL (TRUNC (l_cp_csr.end_date), fnd_api.g_miss_date) <>
470: RAISE fnd_api.g_exc_error;
471: END IF;
472:
473: -- Check end period consistent
474: IF (NVL (TRUNC (l_cp_csr.end_date), fnd_api.g_miss_date) <>
475: NVL (TRUNC (p_cp_rec.end_date), fnd_api.g_miss_date)
476: )
477: THEN
478: -- Error, check the msg level and add an error message to the
471: END IF;
472:
473: -- Check end period consistent
474: IF (NVL (TRUNC (l_cp_csr.end_date), fnd_api.g_miss_date) <>
475: NVL (TRUNC (p_cp_rec.end_date), fnd_api.g_miss_date)
476: )
477: THEN
478: -- Error, check the msg level and add an error message to the
479: -- API message list
487: fnd_msg_pub.ADD;
488: END IF;
489:
490: x_loading_status := 'CN_CP_NOT_CONSISTENT';
491: RAISE fnd_api.g_exc_error;
492: END IF;
493:
494: -- Check allow rc overlap consistent
495: IF (l_cp_csr.allow_rev_class_overlap <> p_cp_rec.rc_overlap)
506: fnd_msg_pub.ADD;
507: END IF;
508:
509: x_loading_status := 'CN_CP_NOT_CONSISTENT';
510: RAISE fnd_api.g_exc_error;
511: END IF;
512:
513: CLOSE c_cp_csr;
514: EXCEPTION
511: END IF;
512:
513: CLOSE c_cp_csr;
514: EXCEPTION
515: WHEN fnd_api.g_exc_error
516: THEN
517: x_return_status := fnd_api.g_ret_sts_error;
518: WHEN fnd_api.g_exc_unexpected_error
519: THEN
513: CLOSE c_cp_csr;
514: EXCEPTION
515: WHEN fnd_api.g_exc_error
516: THEN
517: x_return_status := fnd_api.g_ret_sts_error;
518: WHEN fnd_api.g_exc_unexpected_error
519: THEN
520: x_return_status := fnd_api.g_ret_sts_unexp_error;
521: x_loading_status := 'UNEXPECTED_ERR';
514: EXCEPTION
515: WHEN fnd_api.g_exc_error
516: THEN
517: x_return_status := fnd_api.g_ret_sts_error;
518: WHEN fnd_api.g_exc_unexpected_error
519: THEN
520: x_return_status := fnd_api.g_ret_sts_unexp_error;
521: x_loading_status := 'UNEXPECTED_ERR';
522: WHEN OTHERS
516: THEN
517: x_return_status := fnd_api.g_ret_sts_error;
518: WHEN fnd_api.g_exc_unexpected_error
519: THEN
520: x_return_status := fnd_api.g_ret_sts_unexp_error;
521: x_loading_status := 'UNEXPECTED_ERR';
522: WHEN OTHERS
523: THEN
524: x_return_status := fnd_api.g_ret_sts_unexp_error;
520: x_return_status := fnd_api.g_ret_sts_unexp_error;
521: x_loading_status := 'UNEXPECTED_ERR';
522: WHEN OTHERS
523: THEN
524: x_return_status := fnd_api.g_ret_sts_unexp_error;
525: x_loading_status := 'UNEXPECTED_ERR';
526:
527: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error)
528: THEN
550: l_lkup_meaning cn_lookups.meaning%TYPE;
551: l_loading_status VARCHAR2 (30);
552: BEGIN
553: -- Initialize API return status to success
554: x_return_status := fnd_api.g_ret_sts_success;
555: x_loading_status := p_loading_status;
556: -- API body
557: -- Check if comp plan name is null
558: l_lkup_meaning := cn_api.get_lkup_meaning ('CP_NAME', 'CP_OBJECT_TYPE');
562: p_obj_name => l_lkup_meaning,
563: p_loading_status => l_loading_status,
564: x_loading_status => x_loading_status
565: )
566: ) = fnd_api.g_true
567: )
568: THEN
569: RAISE fnd_api.g_exc_error;
570: END IF;
565: )
566: ) = fnd_api.g_true
567: )
568: THEN
569: RAISE fnd_api.g_exc_error;
570: END IF;
571:
572: -- Check Start Date can not be missing or NULL
573: l_lkup_meaning :=
579: p_para_name => l_lkup_meaning,
580: p_loading_status => l_loading_status,
581: x_loading_status => x_loading_status
582: )
583: ) = fnd_api.g_true
584: )
585: THEN
586: RAISE fnd_api.g_exc_error;
587: ELSIF ((cn_chk_plan_element_pkg.chk_null_date_para
582: )
583: ) = fnd_api.g_true
584: )
585: THEN
586: RAISE fnd_api.g_exc_error;
587: ELSIF ((cn_chk_plan_element_pkg.chk_null_date_para
588: (p_date_para => p_cp_rec.start_date,
589: p_obj_name => l_lkup_meaning,
590: p_loading_status => l_loading_status,
589: p_obj_name => l_lkup_meaning,
590: p_loading_status => l_loading_status,
591: x_loading_status => x_loading_status
592: )
593: ) = fnd_api.g_true
594: )
595: THEN
596: RAISE fnd_api.g_exc_error;
597: END IF;
592: )
593: ) = fnd_api.g_true
594: )
595: THEN
596: RAISE fnd_api.g_exc_error;
597: END IF;
598:
599: -- Check if rc_overlap is null and must be 'Y' or 'N'
600: l_lkup_meaning :=
609: fnd_msg_pub.ADD;
610: END IF;
611:
612: x_loading_status := 'CN_INVALID_DATA';
613: RAISE fnd_api.g_exc_error;
614: END IF;
615:
616: l_loading_status := x_loading_status; -- copy status to override NOCOPY
617:
619: p_obj_name => l_lkup_meaning,
620: p_loading_status => l_loading_status,
621: x_loading_status => x_loading_status
622: )
623: ) = fnd_api.g_true
624: )
625: THEN
626: RAISE fnd_api.g_exc_error;
627: END IF;
622: )
623: ) = fnd_api.g_true
624: )
625: THEN
626: RAISE fnd_api.g_exc_error;
627: END IF;
628:
629: -- Check if CP already exist, if so , check for consistency otherwise
630: -- check for start/end period range
652: p_loading_status => l_loading_status,
653: x_loading_status => x_loading_status
654: );
655:
656: IF (x_return_status <> fnd_api.g_ret_sts_success)
657: THEN
658: RAISE fnd_api.g_exc_error;
659: END IF;
660: ELSE
654: );
655:
656: IF (x_return_status <> fnd_api.g_ret_sts_success)
657: THEN
658: RAISE fnd_api.g_exc_error;
659: END IF;
660: ELSE
661: --
662: -- Validate Rule : End period must be greater than Start period
671: fnd_msg_pub.ADD;
672: END IF;
673:
674: x_loading_status := 'INVALID_END_DATE';
675: RAISE fnd_api.g_exc_error;
676: END IF;
677: END IF;
678:
679: -- End of API body.
681: NULL;
682: -- Standard call to get message count and if count is 1, get message info.
683: fnd_msg_pub.count_and_get (p_count => x_msg_count,
684: p_data => x_msg_data,
685: p_encoded => fnd_api.g_false
686: );
687: EXCEPTION
688: WHEN fnd_api.g_exc_error
689: THEN
684: p_data => x_msg_data,
685: p_encoded => fnd_api.g_false
686: );
687: EXCEPTION
688: WHEN fnd_api.g_exc_error
689: THEN
690: x_return_status := fnd_api.g_ret_sts_error;
691: fnd_msg_pub.count_and_get (p_count => x_msg_count,
692: p_data => x_msg_data,
686: );
687: EXCEPTION
688: WHEN fnd_api.g_exc_error
689: THEN
690: x_return_status := fnd_api.g_ret_sts_error;
691: fnd_msg_pub.count_and_get (p_count => x_msg_count,
692: p_data => x_msg_data,
693: p_encoded => fnd_api.g_false
694: );
689: THEN
690: x_return_status := fnd_api.g_ret_sts_error;
691: fnd_msg_pub.count_and_get (p_count => x_msg_count,
692: p_data => x_msg_data,
693: p_encoded => fnd_api.g_false
694: );
695: WHEN fnd_api.g_exc_unexpected_error
696: THEN
697: x_return_status := fnd_api.g_ret_sts_unexp_error;
691: fnd_msg_pub.count_and_get (p_count => x_msg_count,
692: p_data => x_msg_data,
693: p_encoded => fnd_api.g_false
694: );
695: WHEN fnd_api.g_exc_unexpected_error
696: THEN
697: x_return_status := fnd_api.g_ret_sts_unexp_error;
698: x_loading_status := 'UNEXPECTED_ERR';
699: fnd_msg_pub.count_and_get (p_count => x_msg_count,
693: p_encoded => fnd_api.g_false
694: );
695: WHEN fnd_api.g_exc_unexpected_error
696: THEN
697: x_return_status := fnd_api.g_ret_sts_unexp_error;
698: x_loading_status := 'UNEXPECTED_ERR';
699: fnd_msg_pub.count_and_get (p_count => x_msg_count,
700: p_data => x_msg_data,
701: p_encoded => fnd_api.g_false
697: x_return_status := fnd_api.g_ret_sts_unexp_error;
698: x_loading_status := 'UNEXPECTED_ERR';
699: fnd_msg_pub.count_and_get (p_count => x_msg_count,
700: p_data => x_msg_data,
701: p_encoded => fnd_api.g_false
702: );
703: WHEN OTHERS
704: THEN
705: x_return_status := fnd_api.g_ret_sts_unexp_error;
701: p_encoded => fnd_api.g_false
702: );
703: WHEN OTHERS
704: THEN
705: x_return_status := fnd_api.g_ret_sts_unexp_error;
706: x_loading_status := 'UNEXPECTED_ERR';
707:
708: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error)
709: THEN
711: END IF;
712:
713: fnd_msg_pub.count_and_get (p_count => x_msg_count,
714: p_data => x_msg_data,
715: p_encoded => fnd_api.g_false
716: );
717: END valid_comp_plan;
718:
719: --| ----------------------------------------------------------------------+
761: -- Standard Start of API savepoint
762: SAVEPOINT create_comp_plan;
763:
764: -- Standard call to check for call compatibility.
765: IF NOT fnd_api.compatible_api_call (l_api_version,
766: p_api_version,
767: l_api_name,
768: g_pkg_name
769: )
767: l_api_name,
768: g_pkg_name
769: )
770: THEN
771: RAISE fnd_api.g_exc_unexpected_error;
772: END IF;
773:
774: -- Initialize message list if p_init_msg_list is set to TRUE.
775: IF fnd_api.to_boolean (p_init_msg_list)
771: RAISE fnd_api.g_exc_unexpected_error;
772: END IF;
773:
774: -- Initialize message list if p_init_msg_list is set to TRUE.
775: IF fnd_api.to_boolean (p_init_msg_list)
776: THEN
777: fnd_msg_pub.initialize;
778: END IF;
779:
777: fnd_msg_pub.initialize;
778: END IF;
779:
780: -- Initialize API return status to success
781: x_return_status := fnd_api.g_ret_sts_success;
782: x_loading_status := 'CN_INSERTED';
783: -- API body
784: l_p_comp_plan_rec := p_comp_plan_rec;
785:
795: THEN
796: cn_comp_plan_cuhk.create_comp_plan_pre
797: (p_api_version => p_api_version,
798: p_init_msg_list => p_init_msg_list,
799: p_commit => fnd_api.g_false,
800: p_validation_level => p_validation_level,
801: x_return_status => x_return_status,
802: x_msg_count => x_msg_count,
803: x_msg_data => x_msg_data,
804: p_comp_plan_rec => l_p_comp_plan_rec,
805: x_loading_status => x_loading_status
806: );
807:
808: IF (x_return_status = fnd_api.g_ret_sts_error)
809: THEN
810: RAISE fnd_api.g_exc_error;
811: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
812: THEN
806: );
807:
808: IF (x_return_status = fnd_api.g_ret_sts_error)
809: THEN
810: RAISE fnd_api.g_exc_error;
811: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
812: THEN
813: RAISE fnd_api.g_exc_unexpected_error;
814: END IF;
807:
808: IF (x_return_status = fnd_api.g_ret_sts_error)
809: THEN
810: RAISE fnd_api.g_exc_error;
811: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
812: THEN
813: RAISE fnd_api.g_exc_unexpected_error;
814: END IF;
815: END IF;
809: THEN
810: RAISE fnd_api.g_exc_error;
811: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
812: THEN
813: RAISE fnd_api.g_exc_unexpected_error;
814: END IF;
815: END IF;
816:
817: IF jtf_usr_hks.ok_to_execute ('CN_COMP_PLAN_PUB',
822: THEN
823: cn_comp_plan_vuhk.create_comp_plan_pre
824: (p_api_version => p_api_version,
825: p_init_msg_list => p_init_msg_list,
826: p_commit => fnd_api.g_false,
827: p_validation_level => p_validation_level,
828: x_return_status => x_return_status,
829: x_msg_count => x_msg_count,
830: x_msg_data => x_msg_data,
831: p_comp_plan_rec => l_p_comp_plan_rec,
832: x_loading_status => x_loading_status
833: );
834:
835: IF (x_return_status = fnd_api.g_ret_sts_error)
836: THEN
837: RAISE fnd_api.g_exc_error;
838: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
839: THEN
833: );
834:
835: IF (x_return_status = fnd_api.g_ret_sts_error)
836: THEN
837: RAISE fnd_api.g_exc_error;
838: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
839: THEN
840: RAISE fnd_api.g_exc_unexpected_error;
841: END IF;
834:
835: IF (x_return_status = fnd_api.g_ret_sts_error)
836: THEN
837: RAISE fnd_api.g_exc_error;
838: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
839: THEN
840: RAISE fnd_api.g_exc_unexpected_error;
841: END IF;
842: END IF;
836: THEN
837: RAISE fnd_api.g_exc_error;
838: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
839: THEN
840: RAISE fnd_api.g_exc_unexpected_error;
841: END IF;
842: END IF;
843:
844: --dbms_output.put_line('Executed for pre processing API');
844: --dbms_output.put_line('Executed for pre processing API');
845:
846: -- Trim spaces before/after user input string and assign default value
847: SELECT DECODE (l_p_comp_plan_rec.NAME,
848: fnd_api.g_miss_char, NULL,
849: LTRIM (RTRIM (l_p_comp_plan_rec.NAME))
850: )
851: INTO l_cp_rec.NAME
852: FROM SYS.DUAL;
851: INTO l_cp_rec.NAME
852: FROM SYS.DUAL;
853:
854: SELECT DECODE (l_p_comp_plan_rec.start_date,
855: fnd_api.g_miss_date, NULL,
856: l_p_comp_plan_rec.start_date
857: )
858: INTO l_cp_rec.start_date
859: FROM SYS.DUAL;
858: INTO l_cp_rec.start_date
859: FROM SYS.DUAL;
860:
861: SELECT DECODE (l_p_comp_plan_rec.end_date,
862: fnd_api.g_miss_date, NULL,
863: l_p_comp_plan_rec.end_date
864: )
865: INTO l_cp_rec.end_date
866: FROM SYS.DUAL;
865: INTO l_cp_rec.end_date
866: FROM SYS.DUAL;
867:
868: SELECT DECODE (l_p_comp_plan_rec.description,
869: fnd_api.g_miss_char, NULL,
870: LTRIM (RTRIM (l_p_comp_plan_rec.description))
871: )
872: INTO l_cp_rec.description
873: FROM SYS.DUAL;
872: INTO l_cp_rec.description
873: FROM SYS.DUAL;
874:
875: SELECT DECODE (l_p_comp_plan_rec.plan_element_name,
876: fnd_api.g_miss_char, NULL,
877: LTRIM (RTRIM (l_p_comp_plan_rec.plan_element_name))
878: )
879: INTO l_cp_rec.plan_element_name
880: FROM SYS.DUAL;
879: INTO l_cp_rec.plan_element_name
880: FROM SYS.DUAL;
881:
882: SELECT DECODE (l_p_comp_plan_rec.org_id,
883: fnd_api.g_miss_char, NULL,
884: LTRIM (RTRIM (l_p_comp_plan_rec.org_id))
885: )
886: INTO l_cp_rec.org_id
887: FROM SYS.DUAL;
894: l_cp_rec.status := 'INCOMPLETE';
895:
896: -- Get rc_overlap lookup_code
897: SELECT DECODE (l_p_comp_plan_rec.rc_overlap,
898: fnd_api.g_miss_char, 'No',
899: LTRIM (RTRIM (l_p_comp_plan_rec.rc_overlap))
900: )
901: INTO l_lk_meaning
902: FROM SYS.DUAL;
910: WHEN no_data_found THEN
911: l_cp_rec.rc_overlap := SUBSTRB(l_lk_meaning,1,1);
912: END; */
913: SELECT DECODE (l_p_comp_plan_rec.rc_overlap,
914: fnd_api.g_miss_char, 'N',
915: NULL, 'N',
916: LTRIM (RTRIM (l_p_comp_plan_rec.rc_overlap))
917: )
918: INTO l_cp_rec.rc_overlap
929: p_loading_status => l_loading_status,
930: x_loading_status => x_loading_status
931: );
932:
933: IF (x_return_status <> fnd_api.g_ret_sts_success)
934: THEN
935: RAISE fnd_api.g_exc_error;
936: ELSIF x_loading_status <> 'CP_EXIST'
937: THEN
931: );
932:
933: IF (x_return_status <> fnd_api.g_ret_sts_success)
934: THEN
935: RAISE fnd_api.g_exc_error;
936: ELSIF x_loading_status <> 'CP_EXIST'
937: THEN
938: -- Create comp plan into cn_comp_plans
939: cn_comp_plans_pkg.begin_record
1018: p_org_id => l_p_comp_plan_rec.org_id,
1019: x_loading_status => x_loading_status
1020: );
1021:
1022: IF (x_return_status <> fnd_api.g_ret_sts_success)
1023: THEN
1024: -- fail validate
1025: RAISE fnd_api.g_exc_error;
1026: ELSIF (x_loading_status = 'PLN_QUOTA_ASSIGNED')
1021:
1022: IF (x_return_status <> fnd_api.g_ret_sts_success)
1023: THEN
1024: -- fail validate
1025: RAISE fnd_api.g_exc_error;
1026: ELSIF (x_loading_status = 'PLN_QUOTA_ASSIGNED')
1027: THEN
1028: -- PE already assigned to this cp, need to show error mesg in upload
1029: -- function
1072: THEN
1073: cn_comp_plan_vuhk.create_comp_plan_post
1074: (p_api_version => p_api_version,
1075: p_init_msg_list => p_init_msg_list,
1076: p_commit => fnd_api.g_false,
1077: p_validation_level => p_validation_level,
1078: x_return_status => x_return_status,
1079: x_msg_count => x_msg_count,
1080: x_msg_data => x_msg_data,
1081: p_comp_plan_rec => l_p_comp_plan_rec,
1082: x_loading_status => x_loading_status
1083: );
1084:
1085: IF (x_return_status = fnd_api.g_ret_sts_error)
1086: THEN
1087: RAISE fnd_api.g_exc_error;
1088: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1089: THEN
1083: );
1084:
1085: IF (x_return_status = fnd_api.g_ret_sts_error)
1086: THEN
1087: RAISE fnd_api.g_exc_error;
1088: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1089: THEN
1090: RAISE fnd_api.g_exc_unexpected_error;
1091: END IF;
1084:
1085: IF (x_return_status = fnd_api.g_ret_sts_error)
1086: THEN
1087: RAISE fnd_api.g_exc_error;
1088: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1089: THEN
1090: RAISE fnd_api.g_exc_unexpected_error;
1091: END IF;
1092: END IF;
1086: THEN
1087: RAISE fnd_api.g_exc_error;
1088: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1089: THEN
1090: RAISE fnd_api.g_exc_unexpected_error;
1091: END IF;
1092: END IF;
1093:
1094: IF jtf_usr_hks.ok_to_execute ('CN_COMP_PLAN_PUB',
1099: THEN
1100: cn_comp_plan_cuhk.create_comp_plan_post
1101: (p_api_version => p_api_version,
1102: p_init_msg_list => p_init_msg_list,
1103: p_commit => fnd_api.g_false,
1104: p_validation_level => p_validation_level,
1105: x_return_status => x_return_status,
1106: x_msg_count => x_msg_count,
1107: x_msg_data => x_msg_data,
1108: p_comp_plan_rec => l_p_comp_plan_rec,
1109: x_loading_status => x_loading_status
1110: );
1111:
1112: IF (x_return_status = fnd_api.g_ret_sts_error)
1113: THEN
1114: RAISE fnd_api.g_exc_error;
1115: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1116: THEN
1110: );
1111:
1112: IF (x_return_status = fnd_api.g_ret_sts_error)
1113: THEN
1114: RAISE fnd_api.g_exc_error;
1115: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1116: THEN
1117: RAISE fnd_api.g_exc_unexpected_error;
1118: END IF;
1111:
1112: IF (x_return_status = fnd_api.g_ret_sts_error)
1113: THEN
1114: RAISE fnd_api.g_exc_error;
1115: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1116: THEN
1117: RAISE fnd_api.g_exc_unexpected_error;
1118: END IF;
1119: END IF;
1113: THEN
1114: RAISE fnd_api.g_exc_error;
1115: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1116: THEN
1117: RAISE fnd_api.g_exc_unexpected_error;
1118: END IF;
1119: END IF;
1120:
1121: --dbms_output.put_line(' Executed for post processing API');
1150: p_oai_array => l_oai_array,
1151: x_return_code => x_return_status
1152: );
1153:
1154: IF (x_return_status = fnd_api.g_ret_sts_error)
1155: THEN
1156: RAISE fnd_api.g_exc_error;
1157: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1158: THEN
1152: );
1153:
1154: IF (x_return_status = fnd_api.g_ret_sts_error)
1155: THEN
1156: RAISE fnd_api.g_exc_error;
1157: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1158: THEN
1159: RAISE fnd_api.g_exc_unexpected_error;
1160: END IF;
1153:
1154: IF (x_return_status = fnd_api.g_ret_sts_error)
1155: THEN
1156: RAISE fnd_api.g_exc_error;
1157: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1158: THEN
1159: RAISE fnd_api.g_exc_unexpected_error;
1160: END IF;
1161: END IF;
1155: THEN
1156: RAISE fnd_api.g_exc_error;
1157: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1158: THEN
1159: RAISE fnd_api.g_exc_unexpected_error;
1160: END IF;
1161: END IF;
1162: END IF;
1163:
1160: END IF;
1161: END IF;
1162: END IF;
1163:
1164: x_return_status := fnd_api.g_ret_sts_success;
1165:
1166: -- Standard check of p_commit.
1167: IF fnd_api.to_boolean (p_commit)
1168: THEN
1163:
1164: x_return_status := fnd_api.g_ret_sts_success;
1165:
1166: -- Standard check of p_commit.
1167: IF fnd_api.to_boolean (p_commit)
1168: THEN
1169: COMMIT WORK;
1170: END IF;
1171:
1171:
1172: -- Standard call to get message count and if count is 1, get message info.
1173: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1174: p_data => x_msg_data,
1175: p_encoded => fnd_api.g_false
1176: );
1177: EXCEPTION
1178: WHEN fnd_api.g_exc_error
1179: THEN
1174: p_data => x_msg_data,
1175: p_encoded => fnd_api.g_false
1176: );
1177: EXCEPTION
1178: WHEN fnd_api.g_exc_error
1179: THEN
1180: ROLLBACK TO create_comp_plan;
1181: x_return_status := fnd_api.g_ret_sts_error;
1182: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1177: EXCEPTION
1178: WHEN fnd_api.g_exc_error
1179: THEN
1180: ROLLBACK TO create_comp_plan;
1181: x_return_status := fnd_api.g_ret_sts_error;
1182: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1183: p_data => x_msg_data,
1184: p_encoded => fnd_api.g_false
1185: );
1180: ROLLBACK TO create_comp_plan;
1181: x_return_status := fnd_api.g_ret_sts_error;
1182: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1183: p_data => x_msg_data,
1184: p_encoded => fnd_api.g_false
1185: );
1186: WHEN fnd_api.g_exc_unexpected_error
1187: THEN
1188: ROLLBACK TO create_comp_plan;
1182: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1183: p_data => x_msg_data,
1184: p_encoded => fnd_api.g_false
1185: );
1186: WHEN fnd_api.g_exc_unexpected_error
1187: THEN
1188: ROLLBACK TO create_comp_plan;
1189: x_loading_status := 'UNEXPECTED_ERR';
1190: x_return_status := fnd_api.g_ret_sts_unexp_error;
1186: WHEN fnd_api.g_exc_unexpected_error
1187: THEN
1188: ROLLBACK TO create_comp_plan;
1189: x_loading_status := 'UNEXPECTED_ERR';
1190: x_return_status := fnd_api.g_ret_sts_unexp_error;
1191: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1192: p_data => x_msg_data,
1193: p_encoded => fnd_api.g_false
1194: );
1189: x_loading_status := 'UNEXPECTED_ERR';
1190: x_return_status := fnd_api.g_ret_sts_unexp_error;
1191: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1192: p_data => x_msg_data,
1193: p_encoded => fnd_api.g_false
1194: );
1195: WHEN OTHERS
1196: THEN
1197: ROLLBACK TO create_comp_plan;
1195: WHEN OTHERS
1196: THEN
1197: ROLLBACK TO create_comp_plan;
1198: x_loading_status := 'UNEXPECTED_ERR';
1199: x_return_status := fnd_api.g_ret_sts_unexp_error;
1200:
1201: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error)
1202: THEN
1203: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1204: END IF;
1205:
1206: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1207: p_data => x_msg_data,
1208: p_encoded => fnd_api.g_false
1209: );
1210: END create_comp_plan;
1211: END cn_comp_plan_pub;