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;
913: END; */
914:
915: -- 7330382:R12.CN.B scannane
916: SELECT DECODE (l_p_comp_plan_rec.sum_trx,
917: fnd_api.g_miss_char, 'No',
918: LTRIM (RTRIM (l_p_comp_plan_rec.sum_trx))
919: )
920: INTO l_lk_meaning
921: FROM SYS.DUAL;
920: INTO l_lk_meaning
921: FROM SYS.DUAL;
922:
923: SELECT DECODE (l_p_comp_plan_rec.rc_overlap,
924: fnd_api.g_miss_char, 'N',
925: NULL, 'N',
926: LTRIM (RTRIM (l_p_comp_plan_rec.rc_overlap))
927: )
928: INTO l_cp_rec.rc_overlap
929: FROM SYS.DUAL;
930:
931: -- 7330382:R12.CN.B scannane
932: SELECT DECODE (l_p_comp_plan_rec.sum_trx,
933: fnd_api.g_miss_char, 'N',
934: NULL, 'N',
935: LTRIM (RTRIM (l_p_comp_plan_rec.sum_trx))
936: )
937: INTO l_cp_rec.sum_trx
948: p_loading_status => l_loading_status,
949: x_loading_status => x_loading_status
950: );
951:
952: IF (x_return_status <> fnd_api.g_ret_sts_success)
953: THEN
954: RAISE fnd_api.g_exc_error;
955: ELSIF x_loading_status <> 'CP_EXIST'
956: THEN
950: );
951:
952: IF (x_return_status <> fnd_api.g_ret_sts_success)
953: THEN
954: RAISE fnd_api.g_exc_error;
955: ELSIF x_loading_status <> 'CP_EXIST'
956: THEN
957: -- Create comp plan into cn_comp_plans
958: cn_comp_plans_pkg.begin_record
1038: p_org_id => l_p_comp_plan_rec.org_id,
1039: x_loading_status => x_loading_status
1040: );
1041:
1042: IF (x_return_status <> fnd_api.g_ret_sts_success)
1043: THEN
1044: -- fail validate
1045: RAISE fnd_api.g_exc_error;
1046: ELSIF (x_loading_status = 'PLN_QUOTA_ASSIGNED')
1041:
1042: IF (x_return_status <> fnd_api.g_ret_sts_success)
1043: THEN
1044: -- fail validate
1045: RAISE fnd_api.g_exc_error;
1046: ELSIF (x_loading_status = 'PLN_QUOTA_ASSIGNED')
1047: THEN
1048: -- PE already assigned to this cp, need to show error mesg in upload
1049: -- function
1092: THEN
1093: cn_comp_plan_vuhk.create_comp_plan_post
1094: (p_api_version => p_api_version,
1095: p_init_msg_list => p_init_msg_list,
1096: p_commit => fnd_api.g_false,
1097: p_validation_level => p_validation_level,
1098: x_return_status => x_return_status,
1099: x_msg_count => x_msg_count,
1100: x_msg_data => x_msg_data,
1101: p_comp_plan_rec => l_p_comp_plan_rec,
1102: x_loading_status => x_loading_status
1103: );
1104:
1105: IF (x_return_status = fnd_api.g_ret_sts_error)
1106: THEN
1107: RAISE fnd_api.g_exc_error;
1108: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1109: THEN
1103: );
1104:
1105: IF (x_return_status = fnd_api.g_ret_sts_error)
1106: THEN
1107: RAISE fnd_api.g_exc_error;
1108: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1109: THEN
1110: RAISE fnd_api.g_exc_unexpected_error;
1111: END IF;
1104:
1105: IF (x_return_status = fnd_api.g_ret_sts_error)
1106: THEN
1107: RAISE fnd_api.g_exc_error;
1108: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1109: THEN
1110: RAISE fnd_api.g_exc_unexpected_error;
1111: END IF;
1112: END IF;
1106: THEN
1107: RAISE fnd_api.g_exc_error;
1108: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1109: THEN
1110: RAISE fnd_api.g_exc_unexpected_error;
1111: END IF;
1112: END IF;
1113:
1114: IF jtf_usr_hks.ok_to_execute ('CN_COMP_PLAN_PUB',
1119: THEN
1120: cn_comp_plan_cuhk.create_comp_plan_post
1121: (p_api_version => p_api_version,
1122: p_init_msg_list => p_init_msg_list,
1123: p_commit => fnd_api.g_false,
1124: p_validation_level => p_validation_level,
1125: x_return_status => x_return_status,
1126: x_msg_count => x_msg_count,
1127: x_msg_data => x_msg_data,
1128: p_comp_plan_rec => l_p_comp_plan_rec,
1129: x_loading_status => x_loading_status
1130: );
1131:
1132: IF (x_return_status = fnd_api.g_ret_sts_error)
1133: THEN
1134: RAISE fnd_api.g_exc_error;
1135: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1136: THEN
1130: );
1131:
1132: IF (x_return_status = fnd_api.g_ret_sts_error)
1133: THEN
1134: RAISE fnd_api.g_exc_error;
1135: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1136: THEN
1137: RAISE fnd_api.g_exc_unexpected_error;
1138: END IF;
1131:
1132: IF (x_return_status = fnd_api.g_ret_sts_error)
1133: THEN
1134: RAISE fnd_api.g_exc_error;
1135: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1136: THEN
1137: RAISE fnd_api.g_exc_unexpected_error;
1138: END IF;
1139: END IF;
1133: THEN
1134: RAISE fnd_api.g_exc_error;
1135: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1136: THEN
1137: RAISE fnd_api.g_exc_unexpected_error;
1138: END IF;
1139: END IF;
1140:
1141: --dbms_output.put_line(' Executed for post processing API');
1170: p_oai_array => l_oai_array,
1171: x_return_code => x_return_status
1172: );
1173:
1174: IF (x_return_status = fnd_api.g_ret_sts_error)
1175: THEN
1176: RAISE fnd_api.g_exc_error;
1177: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1178: THEN
1172: );
1173:
1174: IF (x_return_status = fnd_api.g_ret_sts_error)
1175: THEN
1176: RAISE fnd_api.g_exc_error;
1177: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1178: THEN
1179: RAISE fnd_api.g_exc_unexpected_error;
1180: END IF;
1173:
1174: IF (x_return_status = fnd_api.g_ret_sts_error)
1175: THEN
1176: RAISE fnd_api.g_exc_error;
1177: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1178: THEN
1179: RAISE fnd_api.g_exc_unexpected_error;
1180: END IF;
1181: END IF;
1175: THEN
1176: RAISE fnd_api.g_exc_error;
1177: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
1178: THEN
1179: RAISE fnd_api.g_exc_unexpected_error;
1180: END IF;
1181: END IF;
1182: END IF;
1183:
1180: END IF;
1181: END IF;
1182: END IF;
1183:
1184: x_return_status := fnd_api.g_ret_sts_success;
1185:
1186: -- Standard check of p_commit.
1187: IF fnd_api.to_boolean (p_commit)
1188: THEN
1183:
1184: x_return_status := fnd_api.g_ret_sts_success;
1185:
1186: -- Standard check of p_commit.
1187: IF fnd_api.to_boolean (p_commit)
1188: THEN
1189: COMMIT WORK;
1190: END IF;
1191:
1191:
1192: -- Standard call to get message count and if count is 1, get message info.
1193: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1194: p_data => x_msg_data,
1195: p_encoded => fnd_api.g_false
1196: );
1197: EXCEPTION
1198: WHEN fnd_api.g_exc_error
1199: THEN
1194: p_data => x_msg_data,
1195: p_encoded => fnd_api.g_false
1196: );
1197: EXCEPTION
1198: WHEN fnd_api.g_exc_error
1199: THEN
1200: ROLLBACK TO create_comp_plan;
1201: x_return_status := fnd_api.g_ret_sts_error;
1202: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1197: EXCEPTION
1198: WHEN fnd_api.g_exc_error
1199: THEN
1200: ROLLBACK TO create_comp_plan;
1201: x_return_status := fnd_api.g_ret_sts_error;
1202: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1203: p_data => x_msg_data,
1204: p_encoded => fnd_api.g_false
1205: );
1200: ROLLBACK TO create_comp_plan;
1201: x_return_status := fnd_api.g_ret_sts_error;
1202: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1203: p_data => x_msg_data,
1204: p_encoded => fnd_api.g_false
1205: );
1206: WHEN fnd_api.g_exc_unexpected_error
1207: THEN
1208: ROLLBACK TO create_comp_plan;
1202: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1203: p_data => x_msg_data,
1204: p_encoded => fnd_api.g_false
1205: );
1206: WHEN fnd_api.g_exc_unexpected_error
1207: THEN
1208: ROLLBACK TO create_comp_plan;
1209: x_loading_status := 'UNEXPECTED_ERR';
1210: x_return_status := fnd_api.g_ret_sts_unexp_error;
1206: WHEN fnd_api.g_exc_unexpected_error
1207: THEN
1208: ROLLBACK TO create_comp_plan;
1209: x_loading_status := 'UNEXPECTED_ERR';
1210: x_return_status := fnd_api.g_ret_sts_unexp_error;
1211: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1212: p_data => x_msg_data,
1213: p_encoded => fnd_api.g_false
1214: );
1209: x_loading_status := 'UNEXPECTED_ERR';
1210: x_return_status := fnd_api.g_ret_sts_unexp_error;
1211: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1212: p_data => x_msg_data,
1213: p_encoded => fnd_api.g_false
1214: );
1215: WHEN OTHERS
1216: THEN
1217: ROLLBACK TO create_comp_plan;
1215: WHEN OTHERS
1216: THEN
1217: ROLLBACK TO create_comp_plan;
1218: x_loading_status := 'UNEXPECTED_ERR';
1219: x_return_status := fnd_api.g_ret_sts_unexp_error;
1220:
1221: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error)
1222: THEN
1223: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1224: END IF;
1225:
1226: fnd_msg_pub.count_and_get (p_count => x_msg_count,
1227: p_data => x_msg_data,
1228: p_encoded => fnd_api.g_false
1229: );
1230: END create_comp_plan;
1231: END cn_comp_plan_pub;