16:
17: /* ------------------------------------------------------------------------- */
18:
19:
20: P_PA_DEBUG_MODE varchar2(1) := NVL(FND_PROFILE.value('PA_DEBUG_MODE'), 'N');
21:
22: --Bug 3964755. Introduced the parameter p_calling_context. Valid values are NULL and 'COPY_PROJECT'
23: procedure Submit_Current_Working
24: (p_calling_context IN VARCHAR2 DEFAULT NULL,
46: l_return_status VARCHAR2(2000);
47:
48: begin
49: FND_MSG_PUB.initialize;
50: IF P_PA_DEBUG_MODE = 'Y' THEN
51: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Submit_Current_Working');
52: END IF;
53: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
54: l_debug_mode := NVL(l_debug_mode, 'Y');
47:
48: begin
49: FND_MSG_PUB.initialize;
50: IF P_PA_DEBUG_MODE = 'Y' THEN
51: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Submit_Current_Working');
52: END IF;
53: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
54: l_debug_mode := NVL(l_debug_mode, 'Y');
55: IF P_PA_DEBUG_MODE = 'Y' THEN
49: FND_MSG_PUB.initialize;
50: IF P_PA_DEBUG_MODE = 'Y' THEN
51: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Submit_Current_Working');
52: END IF;
53: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
54: l_debug_mode := NVL(l_debug_mode, 'Y');
55: IF P_PA_DEBUG_MODE = 'Y' THEN
56: pa_debug.set_process('Submit_Current_Working: ' || 'PLSQL','LOG',l_debug_mode);
57: END IF;
51: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Submit_Current_Working');
52: END IF;
53: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
54: l_debug_mode := NVL(l_debug_mode, 'Y');
55: IF P_PA_DEBUG_MODE = 'Y' THEN
56: pa_debug.set_process('Submit_Current_Working: ' || 'PLSQL','LOG',l_debug_mode);
57: END IF;
58: x_msg_count := 0;
59: /* CHECK FOR BUSINESS RULES VIOLATIONS */
52: END IF;
53: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
54: l_debug_mode := NVL(l_debug_mode, 'Y');
55: IF P_PA_DEBUG_MODE = 'Y' THEN
56: pa_debug.set_process('Submit_Current_Working: ' || 'PLSQL','LOG',l_debug_mode);
57: END IF;
58: x_msg_count := 0;
59: /* CHECK FOR BUSINESS RULES VIOLATIONS */
60: /* check for null budget_version_id */
88: po.fin_plan_option_level_code = 'PLAN_VERSION' and
89: po.fin_plan_type_id = pt.fin_plan_type_id;
90: /* allow user to Submit a version that's already Submitted */
91: if not ((l_current_working_flag = 'Y') and (l_budget_status_code in ('W', 'S'))) then
92: IF P_PA_DEBUG_MODE = 'Y' THEN
93: pa_debug.write_file('Submit_Current_Working: ' || 'selected budget version is not a current working version');
94: END IF;
95: x_return_status := FND_API.G_RET_STS_ERROR;
96: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
89: po.fin_plan_type_id = pt.fin_plan_type_id;
90: /* allow user to Submit a version that's already Submitted */
91: if not ((l_current_working_flag = 'Y') and (l_budget_status_code in ('W', 'S'))) then
92: IF P_PA_DEBUG_MODE = 'Y' THEN
93: pa_debug.write_file('Submit_Current_Working: ' || 'selected budget version is not a current working version');
94: END IF;
95: x_return_status := FND_API.G_RET_STS_ERROR;
96: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
97: p_msg_name => 'PA_FP_SUBMIT_CURRENT_WORKING');
121: x_valid_flag => l_valid_flag,
122: x_return_status => l_return_status,
123: x_error_msg_code => l_error_msg_code);
124: if x_return_status = FND_API.G_RET_STS_ERROR then
125: IF P_PA_DEBUG_MODE = 'Y' THEN
126: pa_debug.write_file('Submit_Current_Working: ' || 'record version number error ');
127: END IF;
128: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
129: p_msg_name => l_error_msg_code);
122: x_return_status => l_return_status,
123: x_error_msg_code => l_error_msg_code);
124: if x_return_status = FND_API.G_RET_STS_ERROR then
125: IF P_PA_DEBUG_MODE = 'Y' THEN
126: pa_debug.write_file('Submit_Current_Working: ' || 'record version number error ');
127: END IF;
128: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
129: p_msg_name => l_error_msg_code);
130: end if;
157: x_msg_count := l_msg_count;
158: else
159: x_msg_count := l_msg_count;
160: end if;
161: pa_debug.reset_err_stack;
162: return;
163: end if;
164:
165: /* If There are NO Business Rules Violations , Then proceed with Submit Current Working */
162: return;
163: end if;
164:
165: /* If There are NO Business Rules Violations , Then proceed with Submit Current Working */
166: IF P_PA_DEBUG_MODE = 'Y' THEN
167: pa_debug.write_file('Submit_Current_Working: ' || 'no business rules violations');
168: END IF;
169: if l_msg_count = 0 then
170: SAVEPOINT PA_FIN_PLAN_PUB_SUBMIT_WORKING;
163: end if;
164:
165: /* If There are NO Business Rules Violations , Then proceed with Submit Current Working */
166: IF P_PA_DEBUG_MODE = 'Y' THEN
167: pa_debug.write_file('Submit_Current_Working: ' || 'no business rules violations');
168: END IF;
169: if l_msg_count = 0 then
170: SAVEPOINT PA_FIN_PLAN_PUB_SUBMIT_WORKING;
171:
209: x_msg_count := l_msg_count;
210: else
211: x_msg_count := l_msg_count;
212: end if;
213: pa_debug.reset_err_stack;
214: return;
215: end if;
216: end if; -- l_fin_plan_type_code
217:
216: end if; -- l_fin_plan_type_code
217:
218: end if;
219: x_return_status := FND_API.G_RET_STS_SUCCESS;
220: pa_debug.reset_err_stack;
221:
222: exception
223: when pa_fin_plan_pub.rollback_on_error then
224: IF P_PA_DEBUG_MODE = 'Y' THEN
220: pa_debug.reset_err_stack;
221:
222: exception
223: when pa_fin_plan_pub.rollback_on_error then
224: IF P_PA_DEBUG_MODE = 'Y' THEN
225: pa_debug.write_file('Submit_Current_Working: ' || 'Procedure Submit_working: rollback_on_error exception');
226: END IF;
227: rollback to PA_FIN_PLAN_PUB_SUBMIT_WORKING;
228: raise FND_API.G_EXC_UNEXPECTED_ERROR;
221:
222: exception
223: when pa_fin_plan_pub.rollback_on_error then
224: IF P_PA_DEBUG_MODE = 'Y' THEN
225: pa_debug.write_file('Submit_Current_Working: ' || 'Procedure Submit_working: rollback_on_error exception');
226: END IF;
227: rollback to PA_FIN_PLAN_PUB_SUBMIT_WORKING;
228: raise FND_API.G_EXC_UNEXPECTED_ERROR;
229:
233: x_msg_count := 1;
234: x_msg_data := SQLERRM;
235: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
236: p_procedure_name => 'Submit_Current_Working');
237: pa_debug.reset_err_stack;
238: raise FND_API.G_EXC_UNEXPECTED_ERROR;
239: end Submit_Current_Working;
240: /* ------------------------------------------------------------------------- */
241:
274: l_resource_list_id pa_budget_versions.resource_list_id%TYPE;
275:
276: begin
277: FND_MSG_PUB.initialize;
278: IF P_PA_DEBUG_MODE = 'Y' THEN
279: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Set_Current_Working');
280: END IF;
281: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
282: l_debug_mode := NVL(l_debug_mode, 'Y');
275:
276: begin
277: FND_MSG_PUB.initialize;
278: IF P_PA_DEBUG_MODE = 'Y' THEN
279: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Set_Current_Working');
280: END IF;
281: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
282: l_debug_mode := NVL(l_debug_mode, 'Y');
283: IF P_PA_DEBUG_MODE = 'Y' THEN
277: FND_MSG_PUB.initialize;
278: IF P_PA_DEBUG_MODE = 'Y' THEN
279: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Set_Current_Working');
280: END IF;
281: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
282: l_debug_mode := NVL(l_debug_mode, 'Y');
283: IF P_PA_DEBUG_MODE = 'Y' THEN
284: pa_debug.set_process('Set_Current_Working: ' || 'PLSQL','LOG',l_debug_mode);
285: END IF;
279: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Set_Current_Working');
280: END IF;
281: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
282: l_debug_mode := NVL(l_debug_mode, 'Y');
283: IF P_PA_DEBUG_MODE = 'Y' THEN
284: pa_debug.set_process('Set_Current_Working: ' || 'PLSQL','LOG',l_debug_mode);
285: END IF;
286: x_msg_count := 0;
287: /* CHECK FOR BUSINESS RULES VIOLATIONS */
280: END IF;
281: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
282: l_debug_mode := NVL(l_debug_mode, 'Y');
283: IF P_PA_DEBUG_MODE = 'Y' THEN
284: pa_debug.set_process('Set_Current_Working: ' || 'PLSQL','LOG',l_debug_mode);
285: END IF;
286: x_msg_count := 0;
287: /* CHECK FOR BUSINESS RULES VIOLATIONS */
288: /* check for null budget_version_id */
286: x_msg_count := 0;
287: /* CHECK FOR BUSINESS RULES VIOLATIONS */
288: /* check for null budget_version_id */
289: if p_budget_version_id is NULL then
290: IF P_PA_DEBUG_MODE = 'Y' THEN
291: pa_debug.write_file('Set_Current_Working: ' || 'no budget version id entered');
292: END IF;
293: x_return_status := FND_API.G_RET_STS_ERROR;
294: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
287: /* CHECK FOR BUSINESS RULES VIOLATIONS */
288: /* check for null budget_version_id */
289: if p_budget_version_id is NULL then
290: IF P_PA_DEBUG_MODE = 'Y' THEN
291: pa_debug.write_file('Set_Current_Working: ' || 'no budget version id entered');
292: END IF;
293: x_return_status := FND_API.G_RET_STS_ERROR;
294: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
295: p_msg_name => 'PA_FP_NO_PLAN_VERSION');
301: p_record_version_number => p_record_version_number,
302: x_valid_flag => l_valid1_flag,
303: x_return_status => l_return_status,
304: x_error_msg_code => l_error_msg_code);
305: IF P_PA_DEBUG_MODE = 'Y' THEN
306: pa_debug.write_file('Set_Current_Working: ' || 'record version check #1: return status is ' || l_valid1_flag);
307: END IF;
308: /* check to see if the old current working budget version has been updated */
309: /* by someone else already */
302: x_valid_flag => l_valid1_flag,
303: x_return_status => l_return_status,
304: x_error_msg_code => l_error_msg_code);
305: IF P_PA_DEBUG_MODE = 'Y' THEN
306: pa_debug.write_file('Set_Current_Working: ' || 'record version check #1: return status is ' || l_valid1_flag);
307: END IF;
308: /* check to see if the old current working budget version has been updated */
309: /* by someone else already */
310: /* BUT, need to check if there was an old current working version */
314: p_record_version_number => p_orig_record_version_number,
315: x_valid_flag => l_valid2_flag,
316: x_return_status => x_return_status,
317: x_error_msg_code => l_error_msg_code);
318: IF P_PA_DEBUG_MODE = 'Y' THEN
319: pa_debug.write_file('Set_Current_Working: ' || 'record version check #2: return status is ' || l_valid2_flag);
320: END IF;
321: if (not ((l_valid1_flag = 'Y')and (l_valid2_flag='Y'))) then
322: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
315: x_valid_flag => l_valid2_flag,
316: x_return_status => x_return_status,
317: x_error_msg_code => l_error_msg_code);
318: IF P_PA_DEBUG_MODE = 'Y' THEN
319: pa_debug.write_file('Set_Current_Working: ' || 'record version check #2: return status is ' || l_valid2_flag);
320: END IF;
321: if (not ((l_valid1_flag = 'Y')and (l_valid2_flag='Y'))) then
322: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
323: p_msg_name => l_error_msg_code);
358: x_msg_count := l_msg_count;
359: else
360: x_msg_count := l_msg_count;
361: end if;
362: pa_debug.reset_err_stack;
363: return;
364: end if;
365:
366: /* Fix for bug 2651851:
528: x_msg_count := l_msg_count;
529: else
530: x_msg_count := l_msg_count;
531: end if;
532: pa_debug.reset_err_stack;
533: return;
534: end if;
535: END IF;
536:
534: end if;
535: END IF;
536:
537: /* If There are NO Business Rules Violations , Then proceed with Set Current Working */
538: IF P_PA_DEBUG_MODE = 'Y' THEN
539: pa_debug.write_file('Set_Current_Working: ' || 'no business rules violations: beginning Set Current Working');
540: END IF;
541: if l_msg_count = 0 then
542: SAVEPOINT PA_FIN_PLAN_PUB_SET_WORKING;
535: END IF;
536:
537: /* If There are NO Business Rules Violations , Then proceed with Set Current Working */
538: IF P_PA_DEBUG_MODE = 'Y' THEN
539: pa_debug.write_file('Set_Current_Working: ' || 'no business rules violations: beginning Set Current Working');
540: END IF;
541: if l_msg_count = 0 then
542: SAVEPOINT PA_FIN_PLAN_PUB_SET_WORKING;
543: /* remove the CURRENT_WORKING status from the old current working version */
566: where
567: budget_version_id=p_budget_version_id;
568: end if;
569: x_return_status := FND_API.G_RET_STS_SUCCESS;
570: pa_debug.reset_err_stack;
571: exception
572: when pa_fin_plan_pub.rollback_on_error then
573: IF P_PA_DEBUG_MODE = 'Y' THEN
574: pa_debug.write_file('Procedure Set_Current_Working: rollback_on_error exception');
569: x_return_status := FND_API.G_RET_STS_SUCCESS;
570: pa_debug.reset_err_stack;
571: exception
572: when pa_fin_plan_pub.rollback_on_error then
573: IF P_PA_DEBUG_MODE = 'Y' THEN
574: pa_debug.write_file('Procedure Set_Current_Working: rollback_on_error exception');
575: END IF;
576: rollback to PA_FIN_PLAN_PUB_SET_WORKING;
577: raise FND_API.G_EXC_UNEXPECTED_ERROR;
570: pa_debug.reset_err_stack;
571: exception
572: when pa_fin_plan_pub.rollback_on_error then
573: IF P_PA_DEBUG_MODE = 'Y' THEN
574: pa_debug.write_file('Procedure Set_Current_Working: rollback_on_error exception');
575: END IF;
576: rollback to PA_FIN_PLAN_PUB_SET_WORKING;
577: raise FND_API.G_EXC_UNEXPECTED_ERROR;
578:
582: x_msg_count := 1;
583: x_msg_data := SQLERRM;
584: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
585: p_procedure_name => 'Set_Current_Working');
586: pa_debug.reset_err_stack;
587: raise FND_API.G_EXC_UNEXPECTED_ERROR;
588: end Set_Current_Working;
589: /* ------------------------------------------------------------------------- */
590:
609: l_return_status VARCHAR2(2000);
610:
611: begin
612: FND_MSG_PUB.initialize;
613: IF P_PA_DEBUG_MODE = 'Y' THEN
614: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Rework_Submitted');
615: END IF;
616: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
617: l_debug_mode := NVL(l_debug_mode, 'Y');
610:
611: begin
612: FND_MSG_PUB.initialize;
613: IF P_PA_DEBUG_MODE = 'Y' THEN
614: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Rework_Submitted');
615: END IF;
616: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
617: l_debug_mode := NVL(l_debug_mode, 'Y');
618: IF P_PA_DEBUG_MODE = 'Y' THEN
612: FND_MSG_PUB.initialize;
613: IF P_PA_DEBUG_MODE = 'Y' THEN
614: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Rework_Submitted');
615: END IF;
616: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
617: l_debug_mode := NVL(l_debug_mode, 'Y');
618: IF P_PA_DEBUG_MODE = 'Y' THEN
619: pa_debug.set_process('Rework_Submitted: ' || 'PLSQL','LOG',l_debug_mode);
620: END IF;
614: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Rework_Submitted');
615: END IF;
616: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
617: l_debug_mode := NVL(l_debug_mode, 'Y');
618: IF P_PA_DEBUG_MODE = 'Y' THEN
619: pa_debug.set_process('Rework_Submitted: ' || 'PLSQL','LOG',l_debug_mode);
620: END IF;
621: x_msg_count := 0;
622:
615: END IF;
616: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
617: l_debug_mode := NVL(l_debug_mode, 'Y');
618: IF P_PA_DEBUG_MODE = 'Y' THEN
619: pa_debug.set_process('Rework_Submitted: ' || 'PLSQL','LOG',l_debug_mode);
620: END IF;
621: x_msg_count := 0;
622:
623: /* CHECK FOR BUSINESS RULES VIOLATIONS */
639: pa_budget_versions
640: where
641: budget_version_id = p_budget_version_id;
642: if ((l_budget_status_code <> 'S') or (l_current_working_flag <> 'Y')) then
643: IF P_PA_DEBUG_MODE = 'Y' THEN
644: pa_debug.write_file('Rework_Submitted: ' || 'version is not a submitted current working version');
645: END IF;
646: x_return_status := FND_API.G_RET_STS_ERROR;
647: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
640: where
641: budget_version_id = p_budget_version_id;
642: if ((l_budget_status_code <> 'S') or (l_current_working_flag <> 'Y')) then
643: IF P_PA_DEBUG_MODE = 'Y' THEN
644: pa_debug.write_file('Rework_Submitted: ' || 'version is not a submitted current working version');
645: END IF;
646: x_return_status := FND_API.G_RET_STS_ERROR;
647: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
648: p_msg_name => 'PA_FP_REWORK_SUBMITTED');
675: x_msg_count := l_msg_count;
676: else
677: x_msg_count := l_msg_count;
678: end if;
679: pa_debug.reset_err_stack;
680: return;
681: end if;
682:
683: /* If There are NO Business Rules Violations , Then proceed with Rework Submitted */
681: end if;
682:
683: /* If There are NO Business Rules Violations , Then proceed with Rework Submitted */
684: if l_msg_count = 0 then
685: IF P_PA_DEBUG_MODE = 'Y' THEN
686: pa_debug.write_file('Rework_Submitted: ' || 'no business logic errors; proceeding with Rework Submitted');
687: END IF;
688: SAVEPOINT PA_FIN_PLAN_PUB_REWORK;
689: /* set the BUDGET_STATUS_CODE from 'W' to 'S' */
682:
683: /* If There are NO Business Rules Violations , Then proceed with Rework Submitted */
684: if l_msg_count = 0 then
685: IF P_PA_DEBUG_MODE = 'Y' THEN
686: pa_debug.write_file('Rework_Submitted: ' || 'no business logic errors; proceeding with Rework Submitted');
687: END IF;
688: SAVEPOINT PA_FIN_PLAN_PUB_REWORK;
689: /* set the BUDGET_STATUS_CODE from 'W' to 'S' */
690: update
698: where
699: budget_version_id=p_budget_version_id;
700: end if;
701: x_return_status := FND_API.G_RET_STS_SUCCESS;
702: pa_debug.reset_err_stack;
703:
704: exception
705: when pa_fin_plan_pub.rollback_on_error then
706: IF P_PA_DEBUG_MODE = 'Y' THEN
702: pa_debug.reset_err_stack;
703:
704: exception
705: when pa_fin_plan_pub.rollback_on_error then
706: IF P_PA_DEBUG_MODE = 'Y' THEN
707: pa_debug.write_file('Procedure Rework_Submitted: rollback_on_error exception');
708: END IF;
709: rollback to PA_FIN_PLAN_PUB_REWORK;
710: raise FND_API.G_EXC_UNEXPECTED_ERROR;
703:
704: exception
705: when pa_fin_plan_pub.rollback_on_error then
706: IF P_PA_DEBUG_MODE = 'Y' THEN
707: pa_debug.write_file('Procedure Rework_Submitted: rollback_on_error exception');
708: END IF;
709: rollback to PA_FIN_PLAN_PUB_REWORK;
710: raise FND_API.G_EXC_UNEXPECTED_ERROR;
711:
715: x_msg_count := 1;
716: x_msg_data := SQLERRM;
717: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
718: p_procedure_name => 'Rework_Submitted');
719: pa_debug.reset_err_stack;
720: raise FND_API.G_EXC_UNEXPECTED_ERROR;
721: end Rework_Submitted;
722: /* ------------------------------------------------------------------------- */
723:
742: l_msg_index_out NUMBER;
743:
744: begin
745: FND_MSG_PUB.initialize;
746: IF P_PA_DEBUG_MODE = 'Y' THEN
747: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Mark_As_Original');
748: END IF;
749: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
750: l_debug_mode := NVL(l_debug_mode, 'Y');
743:
744: begin
745: FND_MSG_PUB.initialize;
746: IF P_PA_DEBUG_MODE = 'Y' THEN
747: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Mark_As_Original');
748: END IF;
749: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
750: l_debug_mode := NVL(l_debug_mode, 'Y');
751: IF P_PA_DEBUG_MODE = 'Y' THEN
745: FND_MSG_PUB.initialize;
746: IF P_PA_DEBUG_MODE = 'Y' THEN
747: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Mark_As_Original');
748: END IF;
749: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
750: l_debug_mode := NVL(l_debug_mode, 'Y');
751: IF P_PA_DEBUG_MODE = 'Y' THEN
752: pa_debug.set_process('Mark_As_Original: ' || 'PLSQL','LOG',l_debug_mode);
753: END IF;
747: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Mark_As_Original');
748: END IF;
749: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
750: l_debug_mode := NVL(l_debug_mode, 'Y');
751: IF P_PA_DEBUG_MODE = 'Y' THEN
752: pa_debug.set_process('Mark_As_Original: ' || 'PLSQL','LOG',l_debug_mode);
753: END IF;
754: x_msg_count := 0;
755: /* CHECK FOR BUSINESS RULES VIOLATIONS */
748: END IF;
749: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
750: l_debug_mode := NVL(l_debug_mode, 'Y');
751: IF P_PA_DEBUG_MODE = 'Y' THEN
752: pa_debug.set_process('Mark_As_Original: ' || 'PLSQL','LOG',l_debug_mode);
753: END IF;
754: x_msg_count := 0;
755: /* CHECK FOR BUSINESS RULES VIOLATIONS */
756: /* check for null budget_version_id */
799: x_msg_count := l_msg_count;
800: else
801: x_msg_count := l_msg_count;
802: end if;
803: pa_debug.reset_err_stack;
804: return;
805: end if;
806:
807: /* If There are NO Business Rules Violations , Then proceed with Mark As Original */
805: end if;
806:
807: /* If There are NO Business Rules Violations , Then proceed with Mark As Original */
808: if l_msg_count = 0 then
809: IF P_PA_DEBUG_MODE = 'Y' THEN
810: pa_debug.write_file('Mark_As_Original: ' || 'no business violations; continuing with Mark As Original');
811: END IF;
812: SAVEPOINT PA_FIN_PLAN_PUB_MARK_ORIGINAL;
813: /* remove the ORIGINAL status from the old original version */
806:
807: /* If There are NO Business Rules Violations , Then proceed with Mark As Original */
808: if l_msg_count = 0 then
809: IF P_PA_DEBUG_MODE = 'Y' THEN
810: pa_debug.write_file('Mark_As_Original: ' || 'no business violations; continuing with Mark As Original');
811: END IF;
812: SAVEPOINT PA_FIN_PLAN_PUB_MARK_ORIGINAL;
813: /* remove the ORIGINAL status from the old original version */
814:
859:
860: DECLARE
861: l_budget_version_ids SYSTEM.pa_num_tbl_type := SYSTEM.pa_num_tbl_type(p_budget_version_id);
862: BEGIN
863: pa_debug.write('Mark_As_Original','Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_ORIGINAL ' ,5);
864: pa_debug.write('Mark_As_Original','p_baseline_version_id '|| p_budget_version_id,5);
865: PJI_FM_XBS_ACCUM_MAINT.PLAN_ORIGINAL (
866: p_original_version_id => p_budget_version_id,
867: x_return_status => l_return_status,
860: DECLARE
861: l_budget_version_ids SYSTEM.pa_num_tbl_type := SYSTEM.pa_num_tbl_type(p_budget_version_id);
862: BEGIN
863: pa_debug.write('Mark_As_Original','Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_ORIGINAL ' ,5);
864: pa_debug.write('Mark_As_Original','p_baseline_version_id '|| p_budget_version_id,5);
865: PJI_FM_XBS_ACCUM_MAINT.PLAN_ORIGINAL (
866: p_original_version_id => p_budget_version_id,
867: x_return_status => l_return_status,
868: x_msg_code => l_error_msg_code);
878:
879:
880: exception
881: when pa_fin_plan_pub.rollback_on_error then
882: IF P_PA_DEBUG_MODE = 'Y' THEN
883: pa_debug.write_file('Procedure Mark_As_Original: rollback_on_error exception');
884: END IF;
885: rollback to PA_FIN_PLAN_PUB_MARK_ORIGINAL;
886: raise FND_API.G_EXC_UNEXPECTED_ERROR;
879:
880: exception
881: when pa_fin_plan_pub.rollback_on_error then
882: IF P_PA_DEBUG_MODE = 'Y' THEN
883: pa_debug.write_file('Procedure Mark_As_Original: rollback_on_error exception');
884: END IF;
885: rollback to PA_FIN_PLAN_PUB_MARK_ORIGINAL;
886: raise FND_API.G_EXC_UNEXPECTED_ERROR;
887:
891: x_msg_count := 1;
892: x_msg_data := SQLERRM;
893: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
894: p_procedure_name => 'Mark_As_Original');
895: pa_debug.reset_err_stack;
896: raise FND_API.G_EXC_UNEXPECTED_ERROR;
897: end Mark_As_Original;
898: /* ------------------------------------------------------------------------- */
899:
952: l_resource_assignments_rec l_resource_assignments_csr%ROWTYPE;
953:
954: begin
955: FND_MSG_PUB.initialize;
956: IF P_PA_DEBUG_MODE = 'Y' THEN
957: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Delete_Version');
958: END IF;
959: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
960: l_debug_mode := NVL(l_debug_mode, 'Y');
953:
954: begin
955: FND_MSG_PUB.initialize;
956: IF P_PA_DEBUG_MODE = 'Y' THEN
957: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Delete_Version');
958: END IF;
959: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
960: l_debug_mode := NVL(l_debug_mode, 'Y');
961: IF P_PA_DEBUG_MODE = 'Y' THEN
955: FND_MSG_PUB.initialize;
956: IF P_PA_DEBUG_MODE = 'Y' THEN
957: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Delete_Version');
958: END IF;
959: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
960: l_debug_mode := NVL(l_debug_mode, 'Y');
961: IF P_PA_DEBUG_MODE = 'Y' THEN
962: pa_debug.set_process('Delete_Version: ' || 'PLSQL','LOG',l_debug_mode);
963: END IF;
957: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Delete_Version');
958: END IF;
959: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
960: l_debug_mode := NVL(l_debug_mode, 'Y');
961: IF P_PA_DEBUG_MODE = 'Y' THEN
962: pa_debug.set_process('Delete_Version: ' || 'PLSQL','LOG',l_debug_mode);
963: END IF;
964: x_msg_count := 0;
965:
958: END IF;
959: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
960: l_debug_mode := NVL(l_debug_mode, 'Y');
961: IF P_PA_DEBUG_MODE = 'Y' THEN
962: pa_debug.set_process('Delete_Version: ' || 'PLSQL','LOG',l_debug_mode);
963: END IF;
964: x_msg_count := 0;
965:
966: --------------------------------------------------------------------
968: --------------------------------------------------------------------
969: IF NOT ((p_context = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_BUDGET) OR
970: (p_context = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN)) THEN
971: IF l_debug_mode = 'Y' THEN
972: pa_debug.g_err_stage:='p_context value is invalid - p_context :' || p_context;
973: pa_debug.write('PA_FIN_PLAN_PUB.Delete_Version: ' || l_module_name,pa_debug.g_err_stage,5);
974: END IF;
975: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
976: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
969: IF NOT ((p_context = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_BUDGET) OR
970: (p_context = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN)) THEN
971: IF l_debug_mode = 'Y' THEN
972: pa_debug.g_err_stage:='p_context value is invalid - p_context :' || p_context;
973: pa_debug.write('PA_FIN_PLAN_PUB.Delete_Version: ' || l_module_name,pa_debug.g_err_stage,5);
974: END IF;
975: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
976: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
977: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
989: p_budget_version_id IS NULL AND
990: p_project_id IS NULL THEN
991:
992: IF l_debug_mode = 'Y' THEN
993: pa_debug.g_err_stage:= 'p_context '||p_context;
994: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
995:
996: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
997: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
990: p_project_id IS NULL THEN
991:
992: IF l_debug_mode = 'Y' THEN
993: pa_debug.g_err_stage:= 'p_context '||p_context;
994: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
995:
996: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
997: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
998:
992: IF l_debug_mode = 'Y' THEN
993: pa_debug.g_err_stage:= 'p_context '||p_context;
994: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
995:
996: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
997: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
998:
999: pa_debug.g_err_stage:= 'p_project_id '||p_project_id;
1000: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
993: pa_debug.g_err_stage:= 'p_context '||p_context;
994: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
995:
996: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
997: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
998:
999: pa_debug.g_err_stage:= 'p_project_id '||p_project_id;
1000: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1001:
995:
996: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
997: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
998:
999: pa_debug.g_err_stage:= 'p_project_id '||p_project_id;
1000: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1001:
1002: END IF;
1003:
996: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
997: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
998:
999: pa_debug.g_err_stage:= 'p_project_id '||p_project_id;
1000: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1001:
1002: END IF;
1003:
1004: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
1049: budget_version_id = p_budget_version_id;
1050:
1051: if l_budget_status_code <> 'W' then
1052: if l_budget_status_code = 'S' then
1053: IF P_PA_DEBUG_MODE = 'Y' THEN
1054: pa_debug.write_file('Delete_Version: ' || 'budget status code is S');
1055: END IF;
1056: x_return_status := FND_API.G_RET_STS_ERROR;
1057: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
1050:
1051: if l_budget_status_code <> 'W' then
1052: if l_budget_status_code = 'S' then
1053: IF P_PA_DEBUG_MODE = 'Y' THEN
1054: pa_debug.write_file('Delete_Version: ' || 'budget status code is S');
1055: END IF;
1056: x_return_status := FND_API.G_RET_STS_ERROR;
1057: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
1058: p_msg_name => 'PA_FP_DELETE_WORKING');
1076: where p.project_id = v.project_id
1077: and v.budget_version_id = p_budget_version_id;
1078: EXCEPTION
1079: WHEN NO_DATA_FOUND THEN
1080: pa_debug.write(l_module_name,'Error getting version details',3);
1081: RAISE;
1082: END;
1083:
1084: IF NOT (nvl(l_baseline_funding_flag,'N') = 'Y' AND
1172: x_msg_count := l_msg_count;
1173: else
1174: x_msg_count := l_msg_count;
1175: end if;
1176: pa_debug.reset_err_stack;
1177: return;
1178: end if;
1179:
1180:
1179:
1180:
1181: /* If There are NO Business Rules Violations , Then proceed with Delete Version */
1182: if l_msg_count = 0 then
1183: IF P_PA_DEBUG_MODE = 'Y' THEN
1184: pa_debug.write_file('Delete_Version: ' || 'no business errors: continuing with Delete Version');
1185: END IF;
1186: SAVEPOINT PA_FIN_PLAN_PUB_DELETE;
1187: IF p_context=PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN THEN
1180:
1181: /* If There are NO Business Rules Violations , Then proceed with Delete Version */
1182: if l_msg_count = 0 then
1183: IF P_PA_DEBUG_MODE = 'Y' THEN
1184: pa_debug.write_file('Delete_Version: ' || 'no business errors: continuing with Delete Version');
1185: END IF;
1186: SAVEPOINT PA_FIN_PLAN_PUB_DELETE;
1187: IF p_context=PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN THEN
1188:
1193: WHERE use_for_workplan_flag='Y';
1194: EXCEPTION
1195: WHEN NO_DATA_FOUND THEN
1196: IF l_debug_mode = 'Y' THEN
1197: pa_debug.g_err_stage:= 'Workplan plan type does not exist';
1198: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1199: END IF;
1200: RETURN;
1201: END;
1194: EXCEPTION
1195: WHEN NO_DATA_FOUND THEN
1196: IF l_debug_mode = 'Y' THEN
1197: pa_debug.g_err_stage:= 'Workplan plan type does not exist';
1198: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1199: END IF;
1200: RETURN;
1201: END;
1202:
1356:
1357: /* FP M - Reporting lines integration */
1358:
1359: BEGIN
1360: IF P_PA_DEBUG_MODE = 'Y' THEN
1361: pa_debug.write(l_module_name,'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_DELETE ' ,5);
1362: pa_debug.write(l_module_name,'p_fp_version_ids count '|| l_budget_version_id_tbl.count,5);
1363: END IF;
1364: /* Very sure that there is only one record in the plsql table. Just having the loop */
1357: /* FP M - Reporting lines integration */
1358:
1359: BEGIN
1360: IF P_PA_DEBUG_MODE = 'Y' THEN
1361: pa_debug.write(l_module_name,'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_DELETE ' ,5);
1362: pa_debug.write(l_module_name,'p_fp_version_ids count '|| l_budget_version_id_tbl.count,5);
1363: END IF;
1364: /* Very sure that there is only one record in the plsql table. Just having the loop */
1365: FOR I in 1..l_budget_version_id_tbl.count LOOP
1358:
1359: BEGIN
1360: IF P_PA_DEBUG_MODE = 'Y' THEN
1361: pa_debug.write(l_module_name,'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_DELETE ' ,5);
1362: pa_debug.write(l_module_name,'p_fp_version_ids count '|| l_budget_version_id_tbl.count,5);
1363: END IF;
1364: /* Very sure that there is only one record in the plsql table. Just having the loop */
1365: FOR I in 1..l_budget_version_id_tbl.count LOOP
1366: pa_debug.write(l_module_name,'p_fp_version_ids ('|| i || ')' || l_budget_version_id_tbl(i),5);
1362: pa_debug.write(l_module_name,'p_fp_version_ids count '|| l_budget_version_id_tbl.count,5);
1363: END IF;
1364: /* Very sure that there is only one record in the plsql table. Just having the loop */
1365: FOR I in 1..l_budget_version_id_tbl.count LOOP
1366: pa_debug.write(l_module_name,'p_fp_version_ids ('|| i || ')' || l_budget_version_id_tbl(i),5);
1367: END LOOP;
1368: IF l_budget_version_id_tbl.COUNT>0 THEN
1369: PJI_FM_XBS_ACCUM_MAINT.PLAN_DELETE (
1370: p_fp_version_ids => l_budget_version_id_tbl,
1380: END IF;
1381:
1382: END;
1383: x_return_status := FND_API.G_RET_STS_SUCCESS;
1384: pa_debug.reset_err_stack;
1385: end if;
1386:
1387: exception
1388:
1401: ELSE
1402: x_msg_count := l_msg_count;
1403: END IF;
1404: x_return_status := FND_API.G_RET_STS_ERROR;
1405: pa_debug.reset_curr_function;
1406:
1407: when pa_fin_plan_pub.rollback_on_error then
1408: IF P_PA_DEBUG_MODE = 'Y' THEN
1409: pa_debug.write_file('Procedure Delete_Version: rollback_on_error exception');
1404: x_return_status := FND_API.G_RET_STS_ERROR;
1405: pa_debug.reset_curr_function;
1406:
1407: when pa_fin_plan_pub.rollback_on_error then
1408: IF P_PA_DEBUG_MODE = 'Y' THEN
1409: pa_debug.write_file('Procedure Delete_Version: rollback_on_error exception');
1410: END IF;
1411: rollback to PA_FIN_PLAN_PUB_DELETE;
1412: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1405: pa_debug.reset_curr_function;
1406:
1407: when pa_fin_plan_pub.rollback_on_error then
1408: IF P_PA_DEBUG_MODE = 'Y' THEN
1409: pa_debug.write_file('Procedure Delete_Version: rollback_on_error exception');
1410: END IF;
1411: rollback to PA_FIN_PLAN_PUB_DELETE;
1412: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1413:
1417: x_msg_count := 1;
1418: x_msg_data := SQLERRM;
1419: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
1420: p_procedure_name => 'Delete_Version');
1421: pa_debug.reset_err_stack;
1422: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1423: end Delete_Version;
1424: /* ------------------------------------------------------------------------- */
1425:
1476: /*=================================================================
1477: BUG NO:- 2331201 for fin plan these two lines have been modified
1478: =================================================================*/
1479: --FND_MSG_PUB.initialize;
1480: --pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Delete_Version_Helper');
1481: x_return_status := FND_API.G_RET_STS_SUCCESS;
1482: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.Delete_Version_Helper');
1483:
1484: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
1478: =================================================================*/
1479: --FND_MSG_PUB.initialize;
1480: --pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Delete_Version_Helper');
1481: x_return_status := FND_API.G_RET_STS_SUCCESS;
1482: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.Delete_Version_Helper');
1483:
1484: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
1485: l_debug_mode := NVL(l_debug_mode, 'Y');
1486: IF P_PA_DEBUG_MODE = 'Y' THEN
1480: --pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Delete_Version_Helper');
1481: x_return_status := FND_API.G_RET_STS_SUCCESS;
1482: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.Delete_Version_Helper');
1483:
1484: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
1485: l_debug_mode := NVL(l_debug_mode, 'Y');
1486: IF P_PA_DEBUG_MODE = 'Y' THEN
1487: pa_debug.set_process('Delete_Version: ' || 'PLSQL','LOG',l_debug_mode);
1488: END IF;
1482: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.Delete_Version_Helper');
1483:
1484: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
1485: l_debug_mode := NVL(l_debug_mode, 'Y');
1486: IF P_PA_DEBUG_MODE = 'Y' THEN
1487: pa_debug.set_process('Delete_Version: ' || 'PLSQL','LOG',l_debug_mode);
1488: END IF;
1489: x_msg_count := 0;
1490: /* CHECK FOR BUSINESS RULES VIOLATIONS */
1483:
1484: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
1485: l_debug_mode := NVL(l_debug_mode, 'Y');
1486: IF P_PA_DEBUG_MODE = 'Y' THEN
1487: pa_debug.set_process('Delete_Version: ' || 'PLSQL','LOG',l_debug_mode);
1488: END IF;
1489: x_msg_count := 0;
1490: /* CHECK FOR BUSINESS RULES VIOLATIONS */
1491: /* check for null budget_version_id */
1491: /* check for null budget_version_id */
1492: IF NOT ((p_context = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_BUDGET) OR
1493: (p_context = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN)) THEN
1494: IF l_debug_mode = 'Y' THEN
1495: pa_debug.g_err_stage:='p_context value is invalid - p_context :' || p_context;
1496: pa_debug.write( l_module_name,pa_debug.g_err_stage,5);
1497: END IF;
1498: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
1499: p_msg_name => 'PA_FP_INV_PARAM_PASSED',
1492: IF NOT ((p_context = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_BUDGET) OR
1493: (p_context = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN)) THEN
1494: IF l_debug_mode = 'Y' THEN
1495: pa_debug.g_err_stage:='p_context value is invalid - p_context :' || p_context;
1496: pa_debug.write( l_module_name,pa_debug.g_err_stage,5);
1497: END IF;
1498: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
1499: p_msg_name => 'PA_FP_INV_PARAM_PASSED',
1500: p_token1 => 'PROCEDURENAME',
1512: p_budget_version_id IS NULL AND
1513: p_project_id IS NULL THEN
1514:
1515: IF l_debug_mode = 'Y' THEN
1516: pa_debug.g_err_stage:= 'p_context '||p_context;
1517: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1518:
1519: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
1520: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1513: p_project_id IS NULL THEN
1514:
1515: IF l_debug_mode = 'Y' THEN
1516: pa_debug.g_err_stage:= 'p_context '||p_context;
1517: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1518:
1519: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
1520: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1521:
1515: IF l_debug_mode = 'Y' THEN
1516: pa_debug.g_err_stage:= 'p_context '||p_context;
1517: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1518:
1519: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
1520: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1521:
1522: pa_debug.g_err_stage:= 'p_project_id '||p_project_id;
1523: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1516: pa_debug.g_err_stage:= 'p_context '||p_context;
1517: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1518:
1519: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
1520: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1521:
1522: pa_debug.g_err_stage:= 'p_project_id '||p_project_id;
1523: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1524:
1518:
1519: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
1520: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1521:
1522: pa_debug.g_err_stage:= 'p_project_id '||p_project_id;
1523: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1524:
1525: END IF;
1526:
1519: pa_debug.g_err_stage:= 'p_budget_version_id '||p_budget_version_id;
1520: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1521:
1522: pa_debug.g_err_stage:= 'p_project_id '||p_project_id;
1523: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1524:
1525: END IF;
1526:
1527: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
1545: x_msg_count := l_msg_count;
1546: else
1547: x_msg_count := l_msg_count;
1548: end if;
1549: pa_debug.reset_err_stack;
1550: return;
1551: end if;
1552:
1553: /* If There are NO Business Rules Violations , Then proceed with Delete Version Helper*/
1551: end if;
1552:
1553: /* If There are NO Business Rules Violations , Then proceed with Delete Version Helper*/
1554: if l_msg_count = 0 then
1555: IF P_PA_DEBUG_MODE = 'Y' THEN
1556: pa_debug.write_file('Delete_Version: ' || 'no business errors: continuing with Delete Version Helper');
1557: END IF;
1558: SAVEPOINT PA_FIN_PLAN_PUB_DELETE_H;
1559: IF p_context=PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN THEN
1552:
1553: /* If There are NO Business Rules Violations , Then proceed with Delete Version Helper*/
1554: if l_msg_count = 0 then
1555: IF P_PA_DEBUG_MODE = 'Y' THEN
1556: pa_debug.write_file('Delete_Version: ' || 'no business errors: continuing with Delete Version Helper');
1557: END IF;
1558: SAVEPOINT PA_FIN_PLAN_PUB_DELETE_H;
1559: IF p_context=PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN THEN
1560:
1565: WHERE use_for_workplan_flag='Y';
1566: EXCEPTION
1567: WHEN NO_DATA_FOUND THEN
1568: IF l_debug_mode = 'Y' THEN
1569: pa_debug.g_err_stage:= 'Workplan plan type does not exist';
1570: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1571: END IF;
1572: RETURN;
1573: END;
1566: EXCEPTION
1567: WHEN NO_DATA_FOUND THEN
1568: IF l_debug_mode = 'Y' THEN
1569: pa_debug.g_err_stage:= 'Workplan plan type does not exist';
1570: pa_debug.write(l_module_name,pa_debug.g_err_stage,3);
1571: END IF;
1572: RETURN;
1573: END;
1574:
1714: X_MSG_COUNT => l_msg_count,
1715: X_MSG_DATA => l_msg_data);
1716:
1717: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1718: IF P_PA_debug_mode = 'Y' THEN
1719: pa_debug.g_err_stage:= 'Error in PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
1720: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
1721: END IF;
1722: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
1715: X_MSG_DATA => l_msg_data);
1716:
1717: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1718: IF P_PA_debug_mode = 'Y' THEN
1719: pa_debug.g_err_stage:= 'Error in PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
1720: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
1721: END IF;
1722: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
1723: END IF;
1716:
1717: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1718: IF P_PA_debug_mode = 'Y' THEN
1719: pa_debug.g_err_stage:= 'Error in PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
1720: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
1721: END IF;
1722: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
1723: END IF;
1724:
1732: x_msg_count => l_msg_data);
1733:
1734:
1735: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1736: IF P_PA_debug_mode = 'Y' THEN
1737: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA';
1738: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
1739: END IF;
1740: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
1733:
1734:
1735: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1736: IF P_PA_debug_mode = 'Y' THEN
1737: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA';
1738: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
1739: END IF;
1740: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
1741: END IF;
1734:
1735: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1736: IF P_PA_debug_mode = 'Y' THEN
1737: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA';
1738: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
1739: END IF;
1740: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
1741: END IF;
1742: end if; --bug 5441949
1758: FROM pa_budget_versions
1759: WHERE budget_version_id = p_budget_version_id;
1760: EXCEPTION
1761: WHEN OTHERS THEN
1762: pa_debug.g_err_stage:= 'Error while Fetching the data for '||p_budget_version_id;
1763: IF P_PA_DEBUG_MODE = 'Y' THEN
1764: pa_debug.write('Delete_Version: ' || l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
1765: END IF;
1766: RAISE;
1759: WHERE budget_version_id = p_budget_version_id;
1760: EXCEPTION
1761: WHEN OTHERS THEN
1762: pa_debug.g_err_stage:= 'Error while Fetching the data for '||p_budget_version_id;
1763: IF P_PA_DEBUG_MODE = 'Y' THEN
1764: pa_debug.write('Delete_Version: ' || l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
1765: END IF;
1766: RAISE;
1767: END;
1760: EXCEPTION
1761: WHEN OTHERS THEN
1762: pa_debug.g_err_stage:= 'Error while Fetching the data for '||p_budget_version_id;
1763: IF P_PA_DEBUG_MODE = 'Y' THEN
1764: pa_debug.write('Delete_Version: ' || l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
1765: END IF;
1766: RAISE;
1767: END;
1768:
1815: gen_src_all_wp_version_id = p_budget_version_id );
1816: END IF;
1817: end if;
1818: x_return_status := FND_API.G_RET_STS_SUCCESS;
1819: pa_debug.reset_err_stack;
1820:
1821: exception
1822: when pa_fin_plan_pub.rollback_on_error then
1823: IF P_PA_DEBUG_MODE = 'Y' THEN
1819: pa_debug.reset_err_stack;
1820:
1821: exception
1822: when pa_fin_plan_pub.rollback_on_error then
1823: IF P_PA_DEBUG_MODE = 'Y' THEN
1824: pa_debug.write_file('Procedure Delete_Version_Helper: rollback_on_error exception');
1825: END IF;
1826: rollback to PA_FIN_PLAN_PUB_DELETE_H;
1827: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1820:
1821: exception
1822: when pa_fin_plan_pub.rollback_on_error then
1823: IF P_PA_DEBUG_MODE = 'Y' THEN
1824: pa_debug.write_file('Procedure Delete_Version_Helper: rollback_on_error exception');
1825: END IF;
1826: rollback to PA_FIN_PLAN_PUB_DELETE_H;
1827: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1828:
1832: x_msg_count := 1;
1833: x_msg_data := SQLERRM;
1834: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
1835: p_procedure_name => 'Delete_Version_Helper');
1836: pa_debug.reset_err_stack;
1837: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1838: end Delete_Version_Helper;
1839:
1840: --Bug 4290043. This is a private API called by copy version. This will return variables to indicate whether to
1856: l_debug_mode VARCHAR2(30);
1857: l_module_name VARCHAR2(100);
1858:
1859: BEGIN
1860: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
1861: l_debug_mode := NVL(l_debug_mode, 'Y');
1862: l_module_name := 'PAFPPUBB.get_copy_paramters';
1863:
1864: -- Set curr function
1862: l_module_name := 'PAFPPUBB.get_copy_paramters';
1863:
1864: -- Set curr function
1865: IF l_debug_mode = 'Y' THEN
1866: pa_debug.set_curr_function(
1867: p_function =>'PAFPPUBB.get_copy_paramters'
1868: ,p_debug_mode => l_debug_mode );
1869:
1870: pa_debug.g_err_stage:='In get_copy_paramters';
1866: pa_debug.set_curr_function(
1867: p_function =>'PAFPPUBB.get_copy_paramters'
1868: ,p_debug_mode => l_debug_mode );
1869:
1870: pa_debug.g_err_stage:='In get_copy_paramters';
1871: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1872:
1873: pa_debug.g_err_stage:='p_source_project_id '||p_source_project_id;
1874: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1867: p_function =>'PAFPPUBB.get_copy_paramters'
1868: ,p_debug_mode => l_debug_mode );
1869:
1870: pa_debug.g_err_stage:='In get_copy_paramters';
1871: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1872:
1873: pa_debug.g_err_stage:='p_source_project_id '||p_source_project_id;
1874: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1875:
1869:
1870: pa_debug.g_err_stage:='In get_copy_paramters';
1871: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1872:
1873: pa_debug.g_err_stage:='p_source_project_id '||p_source_project_id;
1874: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1875:
1876: pa_debug.g_err_stage:='p_target_project_id '||p_target_project_id;
1877: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1870: pa_debug.g_err_stage:='In get_copy_paramters';
1871: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1872:
1873: pa_debug.g_err_stage:='p_source_project_id '||p_source_project_id;
1874: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1875:
1876: pa_debug.g_err_stage:='p_target_project_id '||p_target_project_id;
1877: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1878:
1872:
1873: pa_debug.g_err_stage:='p_source_project_id '||p_source_project_id;
1874: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1875:
1876: pa_debug.g_err_stage:='p_target_project_id '||p_target_project_id;
1877: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1878:
1879: pa_debug.g_err_stage:='p_source_plan_class_code '||p_source_plan_class_code;
1880: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1873: pa_debug.g_err_stage:='p_source_project_id '||p_source_project_id;
1874: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1875:
1876: pa_debug.g_err_stage:='p_target_project_id '||p_target_project_id;
1877: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1878:
1879: pa_debug.g_err_stage:='p_source_plan_class_code '||p_source_plan_class_code;
1880: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1881:
1875:
1876: pa_debug.g_err_stage:='p_target_project_id '||p_target_project_id;
1877: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1878:
1879: pa_debug.g_err_stage:='p_source_plan_class_code '||p_source_plan_class_code;
1880: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1881:
1882: pa_debug.g_err_stage:='p_target_plan_class_code '||p_target_plan_class_code;
1883: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1876: pa_debug.g_err_stage:='p_target_project_id '||p_target_project_id;
1877: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1878:
1879: pa_debug.g_err_stage:='p_source_plan_class_code '||p_source_plan_class_code;
1880: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1881:
1882: pa_debug.g_err_stage:='p_target_plan_class_code '||p_target_plan_class_code;
1883: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1884:
1878:
1879: pa_debug.g_err_stage:='p_source_plan_class_code '||p_source_plan_class_code;
1880: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1881:
1882: pa_debug.g_err_stage:='p_target_plan_class_code '||p_target_plan_class_code;
1883: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1884:
1885: pa_debug.g_err_stage:='p_source_version_type '||p_source_version_type;
1886: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1879: pa_debug.g_err_stage:='p_source_plan_class_code '||p_source_plan_class_code;
1880: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1881:
1882: pa_debug.g_err_stage:='p_target_plan_class_code '||p_target_plan_class_code;
1883: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1884:
1885: pa_debug.g_err_stage:='p_source_version_type '||p_source_version_type;
1886: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1887:
1881:
1882: pa_debug.g_err_stage:='p_target_plan_class_code '||p_target_plan_class_code;
1883: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1884:
1885: pa_debug.g_err_stage:='p_source_version_type '||p_source_version_type;
1886: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1887:
1888: pa_debug.g_err_stage:='p_target_version_type '||p_target_version_type;
1889: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1882: pa_debug.g_err_stage:='p_target_plan_class_code '||p_target_plan_class_code;
1883: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1884:
1885: pa_debug.g_err_stage:='p_source_version_type '||p_source_version_type;
1886: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1887:
1888: pa_debug.g_err_stage:='p_target_version_type '||p_target_version_type;
1889: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1890:
1884:
1885: pa_debug.g_err_stage:='p_source_version_type '||p_source_version_type;
1886: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1887:
1888: pa_debug.g_err_stage:='p_target_version_type '||p_target_version_type;
1889: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1890:
1891: END IF;
1892:
1885: pa_debug.g_err_stage:='p_source_version_type '||p_source_version_type;
1886: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1887:
1888: pa_debug.g_err_stage:='p_target_version_type '||p_target_version_type;
1889: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1890:
1891: END IF;
1892:
1893: x_copy_actuals_flag:='Y';
1908:
1909: END IF;
1910:
1911: IF l_debug_mode = 'Y' THEN
1912: pa_debug.reset_curr_function;
1913:
1914: pa_debug.g_err_stage:='x_copy_actuals_flag '||x_copy_actuals_flag;
1915: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1916:
1910:
1911: IF l_debug_mode = 'Y' THEN
1912: pa_debug.reset_curr_function;
1913:
1914: pa_debug.g_err_stage:='x_copy_actuals_flag '||x_copy_actuals_flag;
1915: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1916:
1917: pa_debug.g_err_stage:='x_derv_rates_missing_amts_flag '||x_derv_rates_missing_amts_flag;
1918: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1911: IF l_debug_mode = 'Y' THEN
1912: pa_debug.reset_curr_function;
1913:
1914: pa_debug.g_err_stage:='x_copy_actuals_flag '||x_copy_actuals_flag;
1915: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1916:
1917: pa_debug.g_err_stage:='x_derv_rates_missing_amts_flag '||x_derv_rates_missing_amts_flag;
1918: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1919:
1913:
1914: pa_debug.g_err_stage:='x_copy_actuals_flag '||x_copy_actuals_flag;
1915: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1916:
1917: pa_debug.g_err_stage:='x_derv_rates_missing_amts_flag '||x_derv_rates_missing_amts_flag;
1918: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1919:
1920: pa_debug.g_err_stage:='Exiting get_copy_paramters';
1921: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1914: pa_debug.g_err_stage:='x_copy_actuals_flag '||x_copy_actuals_flag;
1915: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1916:
1917: pa_debug.g_err_stage:='x_derv_rates_missing_amts_flag '||x_derv_rates_missing_amts_flag;
1918: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1919:
1920: pa_debug.g_err_stage:='Exiting get_copy_paramters';
1921: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1922:
1916:
1917: pa_debug.g_err_stage:='x_derv_rates_missing_amts_flag '||x_derv_rates_missing_amts_flag;
1918: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1919:
1920: pa_debug.g_err_stage:='Exiting get_copy_paramters';
1921: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1922:
1923: END IF;
1924:
1917: pa_debug.g_err_stage:='x_derv_rates_missing_amts_flag '||x_derv_rates_missing_amts_flag;
1918: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1919:
1920: pa_debug.g_err_stage:='Exiting get_copy_paramters';
1921: pa_debug.write( l_module_name,pa_debug.g_err_stage,3);
1922:
1923: END IF;
1924:
1925:
2080:
2081:
2082: BEGIN
2083:
2084: pa_debug.set_err_stack ('PA_FIN_PLAN_PUB.Copy_Version');
2085: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
2086: l_debug_mode := NVL(l_debug_mode, 'Y');
2087: IF P_PA_DEBUG_MODE = 'Y' THEN
2088: pa_debug.set_process('Copy_Version: ' || 'PLSQL','LOG',l_debug_mode);
2081:
2082: BEGIN
2083:
2084: pa_debug.set_err_stack ('PA_FIN_PLAN_PUB.Copy_Version');
2085: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
2086: l_debug_mode := NVL(l_debug_mode, 'Y');
2087: IF P_PA_DEBUG_MODE = 'Y' THEN
2088: pa_debug.set_process('Copy_Version: ' || 'PLSQL','LOG',l_debug_mode);
2089: END IF;
2083:
2084: pa_debug.set_err_stack ('PA_FIN_PLAN_PUB.Copy_Version');
2085: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
2086: l_debug_mode := NVL(l_debug_mode, 'Y');
2087: IF P_PA_DEBUG_MODE = 'Y' THEN
2088: pa_debug.set_process('Copy_Version: ' || 'PLSQL','LOG',l_debug_mode);
2089: END IF;
2090: x_msg_count := 0;
2091: x_return_status := FND_API.G_RET_STS_SUCCESS;
2084: pa_debug.set_err_stack ('PA_FIN_PLAN_PUB.Copy_Version');
2085: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
2086: l_debug_mode := NVL(l_debug_mode, 'Y');
2087: IF P_PA_DEBUG_MODE = 'Y' THEN
2088: pa_debug.set_process('Copy_Version: ' || 'PLSQL','LOG',l_debug_mode);
2089: END IF;
2090: x_msg_count := 0;
2091: x_return_status := FND_API.G_RET_STS_SUCCESS;
2092:
2091: x_return_status := FND_API.G_RET_STS_SUCCESS;
2092:
2093: -- Check for business rules violations
2094:
2095: IF P_PA_DEBUG_MODE = 'Y' THEN
2096: pa_debug.g_err_stage := 'Parameter Validation';
2097: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2098: END IF;
2099:
2092:
2093: -- Check for business rules violations
2094:
2095: IF P_PA_DEBUG_MODE = 'Y' THEN
2096: pa_debug.g_err_stage := 'Parameter Validation';
2097: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2098: END IF;
2099:
2100: -- Check for null source_version_id
2093: -- Check for business rules violations
2094:
2095: IF P_PA_DEBUG_MODE = 'Y' THEN
2096: pa_debug.g_err_stage := 'Parameter Validation';
2097: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2098: END IF;
2099:
2100: -- Check for null source_version_id
2101:
2099:
2100: -- Check for null source_version_id
2101:
2102: IF p_source_version_id IS NULL THEN
2103: pa_debug.g_err_stage := 'Source_plan='||p_source_version_id;
2104: IF P_PA_DEBUG_MODE = 'Y' THEN
2105: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
2106: END IF;
2107:
2100: -- Check for null source_version_id
2101:
2102: IF p_source_version_id IS NULL THEN
2103: pa_debug.g_err_stage := 'Source_plan='||p_source_version_id;
2104: IF P_PA_DEBUG_MODE = 'Y' THEN
2105: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
2106: END IF;
2107:
2108: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
2101:
2102: IF p_source_version_id IS NULL THEN
2103: pa_debug.g_err_stage := 'Source_plan='||p_source_version_id;
2104: IF P_PA_DEBUG_MODE = 'Y' THEN
2105: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
2106: END IF;
2107:
2108: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
2109: p_msg_name => 'PA_FP_NO_PLAN_VERSION');
2116: --Initialise l_budget_version_id.
2117:
2118: l_budget_version_id := px_target_version_id;
2119:
2120: IF P_PA_DEBUG_MODE = 'Y' THEN
2121: pa_debug.g_err_stage := 'Source_plan='||p_source_version_id;
2122: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2123:
2124: pa_debug.g_err_stage := 'Target_plan='||l_budget_version_id;
2117:
2118: l_budget_version_id := px_target_version_id;
2119:
2120: IF P_PA_DEBUG_MODE = 'Y' THEN
2121: pa_debug.g_err_stage := 'Source_plan='||p_source_version_id;
2122: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2123:
2124: pa_debug.g_err_stage := 'Target_plan='||l_budget_version_id;
2125: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2118: l_budget_version_id := px_target_version_id;
2119:
2120: IF P_PA_DEBUG_MODE = 'Y' THEN
2121: pa_debug.g_err_stage := 'Source_plan='||p_source_version_id;
2122: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2123:
2124: pa_debug.g_err_stage := 'Target_plan='||l_budget_version_id;
2125: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2126: END IF;
2120: IF P_PA_DEBUG_MODE = 'Y' THEN
2121: pa_debug.g_err_stage := 'Source_plan='||p_source_version_id;
2122: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2123:
2124: pa_debug.g_err_stage := 'Target_plan='||l_budget_version_id;
2125: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2126: END IF;
2127:
2128: --Bug 4290043. Fire the SQLs to get the details of the source/target version ids.
2121: pa_debug.g_err_stage := 'Source_plan='||p_source_version_id;
2122: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2123:
2124: pa_debug.g_err_stage := 'Target_plan='||l_budget_version_id;
2125: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2126: END IF;
2127:
2128: --Bug 4290043. Fire the SQLs to get the details of the source/target version ids.
2129: --Fetch proj fp options id for source version
2128: --Bug 4290043. Fire the SQLs to get the details of the source/target version ids.
2129: --Fetch proj fp options id for source version
2130: --Bug 4290043. Selected source plan class code
2131:
2132: IF P_PA_DEBUG_MODE = 'Y' THEN
2133: pa_debug.g_err_stage := 'Fetching the Source version details';
2134: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2135: END IF;
2136:
2129: --Fetch proj fp options id for source version
2130: --Bug 4290043. Selected source plan class code
2131:
2132: IF P_PA_DEBUG_MODE = 'Y' THEN
2133: pa_debug.g_err_stage := 'Fetching the Source version details';
2134: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2135: END IF;
2136:
2137: SELECT pfo.proj_fp_options_id
2130: --Bug 4290043. Selected source plan class code
2131:
2132: IF P_PA_DEBUG_MODE = 'Y' THEN
2133: pa_debug.g_err_stage := 'Fetching the Source version details';
2134: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2135: END IF;
2136:
2137: SELECT pfo.proj_fp_options_id
2138: ,pfo.fin_plan_preference_code
2194: l_target_plan_class_code := l_source_plan_class_code;
2195:
2196: END IF;
2197:
2198: IF P_PA_DEBUG_MODE = 'Y' THEN
2199: pa_debug.g_err_stage := 'l_source_proj_fp_options_id ='||l_source_proj_fp_options_id;
2200: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2201:
2202: pa_debug.g_err_stage := 'l_source_fp_preference_code = '||l_source_fp_preference_code;
2195:
2196: END IF;
2197:
2198: IF P_PA_DEBUG_MODE = 'Y' THEN
2199: pa_debug.g_err_stage := 'l_source_proj_fp_options_id ='||l_source_proj_fp_options_id;
2200: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2201:
2202: pa_debug.g_err_stage := 'l_source_fp_preference_code = '||l_source_fp_preference_code;
2203: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2196: END IF;
2197:
2198: IF P_PA_DEBUG_MODE = 'Y' THEN
2199: pa_debug.g_err_stage := 'l_source_proj_fp_options_id ='||l_source_proj_fp_options_id;
2200: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2201:
2202: pa_debug.g_err_stage := 'l_source_fp_preference_code = '||l_source_fp_preference_code;
2203: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2204:
2198: IF P_PA_DEBUG_MODE = 'Y' THEN
2199: pa_debug.g_err_stage := 'l_source_proj_fp_options_id ='||l_source_proj_fp_options_id;
2200: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2201:
2202: pa_debug.g_err_stage := 'l_source_fp_preference_code = '||l_source_fp_preference_code;
2203: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2204:
2205: pa_debug.g_err_stage := 'l_source_project_id = '||l_project_id;
2206: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2199: pa_debug.g_err_stage := 'l_source_proj_fp_options_id ='||l_source_proj_fp_options_id;
2200: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2201:
2202: pa_debug.g_err_stage := 'l_source_fp_preference_code = '||l_source_fp_preference_code;
2203: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2204:
2205: pa_debug.g_err_stage := 'l_source_project_id = '||l_project_id;
2206: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2207:
2201:
2202: pa_debug.g_err_stage := 'l_source_fp_preference_code = '||l_source_fp_preference_code;
2203: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2204:
2205: pa_debug.g_err_stage := 'l_source_project_id = '||l_project_id;
2206: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2207:
2208: pa_debug.g_err_stage := 'l_source_fin_plan_type_id ='||l_source_fin_plan_type_id;
2209: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2202: pa_debug.g_err_stage := 'l_source_fp_preference_code = '||l_source_fp_preference_code;
2203: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2204:
2205: pa_debug.g_err_stage := 'l_source_project_id = '||l_project_id;
2206: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2207:
2208: pa_debug.g_err_stage := 'l_source_fin_plan_type_id ='||l_source_fin_plan_type_id;
2209: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2210:
2204:
2205: pa_debug.g_err_stage := 'l_source_project_id = '||l_project_id;
2206: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2207:
2208: pa_debug.g_err_stage := 'l_source_fin_plan_type_id ='||l_source_fin_plan_type_id;
2209: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2210:
2211: pa_debug.g_err_stage := 'l_source_element_type = '||l_source_element_type;
2212: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2205: pa_debug.g_err_stage := 'l_source_project_id = '||l_project_id;
2206: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2207:
2208: pa_debug.g_err_stage := 'l_source_fin_plan_type_id ='||l_source_fin_plan_type_id;
2209: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2210:
2211: pa_debug.g_err_stage := 'l_source_element_type = '||l_source_element_type;
2212: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2213: END IF;
2207:
2208: pa_debug.g_err_stage := 'l_source_fin_plan_type_id ='||l_source_fin_plan_type_id;
2209: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2210:
2211: pa_debug.g_err_stage := 'l_source_element_type = '||l_source_element_type;
2212: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2213: END IF;
2214:
2215:
2208: pa_debug.g_err_stage := 'l_source_fin_plan_type_id ='||l_source_fin_plan_type_id;
2209: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2210:
2211: pa_debug.g_err_stage := 'l_source_element_type = '||l_source_element_type;
2212: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2213: END IF;
2214:
2215:
2216:
2213: END IF;
2214:
2215:
2216:
2217: IF P_PA_DEBUG_MODE = 'Y' THEN
2218: pa_debug.g_err_stage := 'l_target_proj_fp_options_id ='||l_target_proj_fp_options_id;
2219: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2220:
2221: pa_debug.g_err_stage := 'l_target_fp_preference_code = '||l_target_fp_preference_code;
2214:
2215:
2216:
2217: IF P_PA_DEBUG_MODE = 'Y' THEN
2218: pa_debug.g_err_stage := 'l_target_proj_fp_options_id ='||l_target_proj_fp_options_id;
2219: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2220:
2221: pa_debug.g_err_stage := 'l_target_fp_preference_code = '||l_target_fp_preference_code;
2222: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2215:
2216:
2217: IF P_PA_DEBUG_MODE = 'Y' THEN
2218: pa_debug.g_err_stage := 'l_target_proj_fp_options_id ='||l_target_proj_fp_options_id;
2219: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2220:
2221: pa_debug.g_err_stage := 'l_target_fp_preference_code = '||l_target_fp_preference_code;
2222: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2223:
2217: IF P_PA_DEBUG_MODE = 'Y' THEN
2218: pa_debug.g_err_stage := 'l_target_proj_fp_options_id ='||l_target_proj_fp_options_id;
2219: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2220:
2221: pa_debug.g_err_stage := 'l_target_fp_preference_code = '||l_target_fp_preference_code;
2222: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2223:
2224: pa_debug.g_err_stage := 'l_target_fin_plan_type_id = '||l_target_fin_plan_type_id;
2225: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2218: pa_debug.g_err_stage := 'l_target_proj_fp_options_id ='||l_target_proj_fp_options_id;
2219: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2220:
2221: pa_debug.g_err_stage := 'l_target_fp_preference_code = '||l_target_fp_preference_code;
2222: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2223:
2224: pa_debug.g_err_stage := 'l_target_fin_plan_type_id = '||l_target_fin_plan_type_id;
2225: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2226:
2220:
2221: pa_debug.g_err_stage := 'l_target_fp_preference_code = '||l_target_fp_preference_code;
2222: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2223:
2224: pa_debug.g_err_stage := 'l_target_fin_plan_type_id = '||l_target_fin_plan_type_id;
2225: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2226:
2227: pa_debug.g_err_stage := 'l_target_element_type ='||l_target_element_type;
2228: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2221: pa_debug.g_err_stage := 'l_target_fp_preference_code = '||l_target_fp_preference_code;
2222: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2223:
2224: pa_debug.g_err_stage := 'l_target_fin_plan_type_id = '||l_target_fin_plan_type_id;
2225: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2226:
2227: pa_debug.g_err_stage := 'l_target_element_type ='||l_target_element_type;
2228: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2229: END IF;
2223:
2224: pa_debug.g_err_stage := 'l_target_fin_plan_type_id = '||l_target_fin_plan_type_id;
2225: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2226:
2227: pa_debug.g_err_stage := 'l_target_element_type ='||l_target_element_type;
2228: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2229: END IF;
2230:
2231: --Call the API to decide on whether to copy actuals/rates or not. Bug 4290043
2224: pa_debug.g_err_stage := 'l_target_fin_plan_type_id = '||l_target_fin_plan_type_id;
2225: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2226:
2227: pa_debug.g_err_stage := 'l_target_element_type ='||l_target_element_type;
2228: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2229: END IF;
2230:
2231: --Call the API to decide on whether to copy actuals/rates or not. Bug 4290043
2232: get_copy_paramters
2242:
2243: -- Calling copy_budget_version api.This api will update the budget version incase its
2244: -- already existing else it will create a new version.
2245:
2246: IF P_PA_DEBUG_MODE = 'Y' THEN
2247: pa_debug.g_err_stage := 'Copying budget version';
2248: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2249: END IF;
2250:
2243: -- Calling copy_budget_version api.This api will update the budget version incase its
2244: -- already existing else it will create a new version.
2245:
2246: IF P_PA_DEBUG_MODE = 'Y' THEN
2247: pa_debug.g_err_stage := 'Copying budget version';
2248: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2249: END IF;
2250:
2251: --Bug 4290043 .Added the parameters for copy actuals flag and copy missing amounts/rates fla
2244: -- already existing else it will create a new version.
2245:
2246: IF P_PA_DEBUG_MODE = 'Y' THEN
2247: pa_debug.g_err_stage := 'Copying budget version';
2248: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2249: END IF;
2250:
2251: --Bug 4290043 .Added the parameters for copy actuals flag and copy missing amounts/rates fla
2252: PA_FP_COPY_FROM_PKG.Copy_Budget_Version(
2287:
2288:
2289: --Calling create fp option api
2290:
2291: IF P_PA_DEBUG_MODE = 'Y' THEN
2292: pa_debug.g_err_stage := 'Calling create_fp_option api';
2293: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2294: END IF;
2295:
2288:
2289: --Calling create fp option api
2290:
2291: IF P_PA_DEBUG_MODE = 'Y' THEN
2292: pa_debug.g_err_stage := 'Calling create_fp_option api';
2293: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2294: END IF;
2295:
2296: PA_PROJ_FP_OPTIONS_PUB.create_fp_option (
2289: --Calling create fp option api
2290:
2291: IF P_PA_DEBUG_MODE = 'Y' THEN
2292: pa_debug.g_err_stage := 'Calling create_fp_option api';
2293: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2294: END IF;
2295:
2296: PA_PROJ_FP_OPTIONS_PUB.create_fp_option (
2297: px_target_proj_fp_option_id => l_target_proj_fp_options_id
2314:
2315: --Calling an api to copy transaction currencies selected in source version to target version
2316: --Fetch multi currency flag for the target/new budget.
2317:
2318: IF P_PA_DEBUG_MODE = 'Y' THEN
2319: pa_debug.g_err_stage := 'Fetching multi currency flag for the target/new budget';
2320: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2321: END IF;
2322:
2315: --Calling an api to copy transaction currencies selected in source version to target version
2316: --Fetch multi currency flag for the target/new budget.
2317:
2318: IF P_PA_DEBUG_MODE = 'Y' THEN
2319: pa_debug.g_err_stage := 'Fetching multi currency flag for the target/new budget';
2320: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2321: END IF;
2322:
2323: SELECT pfo.plan_in_multi_curr_flag
2316: --Fetch multi currency flag for the target/new budget.
2317:
2318: IF P_PA_DEBUG_MODE = 'Y' THEN
2319: pa_debug.g_err_stage := 'Fetching multi currency flag for the target/new budget';
2320: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2321: END IF;
2322:
2323: SELECT pfo.plan_in_multi_curr_flag
2324: INTO l_plan_in_multi_curr_flag
2326: WHERE pfo.fin_plan_version_id = l_budget_version_id;
2327:
2328: /* IF l_plan_in_multi_curr_flag = 'Y' THEN Commented for bug 2706430 */
2329:
2330: IF P_PA_DEBUG_MODE = 'Y' THEN
2331: pa_debug.g_err_stage := 'Calling copy_fp_txn_currencies api';
2332: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2333: END IF;
2334:
2327:
2328: /* IF l_plan_in_multi_curr_flag = 'Y' THEN Commented for bug 2706430 */
2329:
2330: IF P_PA_DEBUG_MODE = 'Y' THEN
2331: pa_debug.g_err_stage := 'Calling copy_fp_txn_currencies api';
2332: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2333: END IF;
2334:
2335: PA_FP_TXN_CURRENCIES_PUB.copy_fp_txn_currencies (
2328: /* IF l_plan_in_multi_curr_flag = 'Y' THEN Commented for bug 2706430 */
2329:
2330: IF P_PA_DEBUG_MODE = 'Y' THEN
2331: pa_debug.g_err_stage := 'Calling copy_fp_txn_currencies api';
2332: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2333: END IF;
2334:
2335: PA_FP_TXN_CURRENCIES_PUB.copy_fp_txn_currencies (
2336: p_source_fp_option_id => l_source_proj_fp_options_id
2350: --If the calling module is Financial Planning then its not required to go thru te route of
2351: --create_res_Task_maps as copy_resource_assignments would take care of the mapping logic too
2352: IF p_calling_module = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_FIN_PLAN THEN
2353:
2354: IF P_PA_DEBUG_MODE = 'Y' THEN
2355: pa_debug.g_err_stage := 'Calling copy_resource_assignment';
2356: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2357: END IF;
2358:
2351: --create_res_Task_maps as copy_resource_assignments would take care of the mapping logic too
2352: IF p_calling_module = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_FIN_PLAN THEN
2353:
2354: IF P_PA_DEBUG_MODE = 'Y' THEN
2355: pa_debug.g_err_stage := 'Calling copy_resource_assignment';
2356: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2357: END IF;
2358:
2359: PA_FP_COPY_FROM_PKG.copy_resource_assignments(
2352: IF p_calling_module = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_FIN_PLAN THEN
2353:
2354: IF P_PA_DEBUG_MODE = 'Y' THEN
2355: pa_debug.g_err_stage := 'Calling copy_resource_assignment';
2356: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2357: END IF;
2358:
2359: PA_FP_COPY_FROM_PKG.copy_resource_assignments(
2360: p_source_plan_version_id => p_source_version_id
2365: ,x_msg_data => l_msg_data );
2366:
2367: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2368:
2369: pa_debug.g_err_stage := 'PA_FP_COPY_FROM_PKG.copy_resource_assignments returned error';
2370: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2371: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2372:
2373: END IF;
2366:
2367: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2368:
2369: pa_debug.g_err_stage := 'PA_FP_COPY_FROM_PKG.copy_resource_assignments returned error';
2370: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2371: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2372:
2373: END IF;
2374:
2376: --using source budget lines depending on adjustment percentage. If adjustment
2377: --percentage is non zero,amount columns aren't copied and also roll up records
2378: --aren't entered.
2379:
2380: IF P_PA_DEBUG_MODE = 'Y' THEN
2381: pa_debug.g_err_stage := 'Calling copy_budget_lines';
2382: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2383: END IF;
2384:
2377: --percentage is non zero,amount columns aren't copied and also roll up records
2378: --aren't entered.
2379:
2380: IF P_PA_DEBUG_MODE = 'Y' THEN
2381: pa_debug.g_err_stage := 'Calling copy_budget_lines';
2382: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2383: END IF;
2384:
2385: /* 3156057: If source plan is mc enabled but not appr rev and the target is appr rev,
2378: --aren't entered.
2379:
2380: IF P_PA_DEBUG_MODE = 'Y' THEN
2381: pa_debug.g_err_stage := 'Calling copy_budget_lines';
2382: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2383: END IF;
2384:
2385: /* 3156057: If source plan is mc enabled but not appr rev and the target is appr rev,
2386: then copy copy_budget_lines_appr_rev will be called to group the source
2387: budget lines by PFC for creating target budget lines */
2388:
2389: IF l_source_appr_rev_plan_flag = 'N' and l_source_plan_in_mc_flag = 'Y' and l_target_appr_rev_plan_flag = 'Y' THEN
2390:
2391: IF P_PA_DEBUG_MODE = 'Y' THEN
2392: pa_debug.g_err_stage:='Copying a mc enabled version into a appr rev plan type version.';
2393: pa_debug.write('Copy_Plan: ' || l_module_name,pa_debug.g_err_stage,3);
2394: END IF;
2395:
2388:
2389: IF l_source_appr_rev_plan_flag = 'N' and l_source_plan_in_mc_flag = 'Y' and l_target_appr_rev_plan_flag = 'Y' THEN
2390:
2391: IF P_PA_DEBUG_MODE = 'Y' THEN
2392: pa_debug.g_err_stage:='Copying a mc enabled version into a appr rev plan type version.';
2393: pa_debug.write('Copy_Plan: ' || l_module_name,pa_debug.g_err_stage,3);
2394: END IF;
2395:
2396: --Bug 4290043. Added p_derv_rates_missing_amts_flag. Note that actuals will never be copied in this
2389: IF l_source_appr_rev_plan_flag = 'N' and l_source_plan_in_mc_flag = 'Y' and l_target_appr_rev_plan_flag = 'Y' THEN
2390:
2391: IF P_PA_DEBUG_MODE = 'Y' THEN
2392: pa_debug.g_err_stage:='Copying a mc enabled version into a appr rev plan type version.';
2393: pa_debug.write('Copy_Plan: ' || l_module_name,pa_debug.g_err_stage,3);
2394: END IF;
2395:
2396: --Bug 4290043. Added p_derv_rates_missing_amts_flag. Note that actuals will never be copied in this
2397: --case since the target is always Budget
2422: ,x_msg_data => l_msg_data );
2423:
2424: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2425:
2426: pa_debug.g_err_stage := 'PA_FP_COPY_FROM_PKG.copy_budget_lines returned error';
2427: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2428: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2429:
2430: END IF;
2423:
2424: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2425:
2426: pa_debug.g_err_stage := 'PA_FP_COPY_FROM_PKG.copy_budget_lines returned error';
2427: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2428: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2429:
2430: END IF;
2431:
2439: --Calling create_res_task_maps api to generate new resource_assignment_ids
2440: --and store them in pa_fp_ra_map_tmp table
2441:
2442:
2443: IF P_PA_DEBUG_MODE = 'Y' THEN
2444: pa_debug.g_err_stage := 'Calling create_res_task_maps';
2445: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2446: END IF;
2447:
2440: --and store them in pa_fp_ra_map_tmp table
2441:
2442:
2443: IF P_PA_DEBUG_MODE = 'Y' THEN
2444: pa_debug.g_err_stage := 'Calling create_res_task_maps';
2445: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2446: END IF;
2447:
2448: pa_fp_org_fcst_gen_pub.create_res_task_maps(
2441:
2442:
2443: IF P_PA_DEBUG_MODE = 'Y' THEN
2444: pa_debug.g_err_stage := 'Calling create_res_task_maps';
2445: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2446: END IF;
2447:
2448: pa_fp_org_fcst_gen_pub.create_res_task_maps(
2449: p_source_project_id => p_project_id
2457: ,x_msg_data => l_msg_data );
2458:
2459: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2460:
2461: pa_debug.g_err_stage := 'pa_fp_org_fcst_gen_pub.create_res_task_maps returned error';
2462: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2463: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2464:
2465: END IF;
2458:
2459: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2460:
2461: pa_debug.g_err_stage := 'pa_fp_org_fcst_gen_pub.create_res_task_maps returned error';
2462: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2463: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2464:
2465: END IF;
2466:
2464:
2465: END IF;
2466:
2467:
2468: IF P_PA_DEBUG_MODE = 'Y' THEN
2469: pa_debug.g_err_stage := 'Calling copy_resource_assignment';
2470: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2471: END IF;
2472:
2465: END IF;
2466:
2467:
2468: IF P_PA_DEBUG_MODE = 'Y' THEN
2469: pa_debug.g_err_stage := 'Calling copy_resource_assignment';
2470: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2471: END IF;
2472:
2473: pa_fp_org_fcst_gen_pub.copy_resource_assignments(
2466:
2467:
2468: IF P_PA_DEBUG_MODE = 'Y' THEN
2469: pa_debug.g_err_stage := 'Calling copy_resource_assignment';
2470: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2471: END IF;
2472:
2473: pa_fp_org_fcst_gen_pub.copy_resource_assignments(
2474: p_source_plan_version_id => p_source_version_id
2479: ,x_msg_data => l_msg_data );
2480:
2481: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2482:
2483: pa_debug.g_err_stage := 'pa_fp_org_fcst_gen_pub.copy_resource_assignments returned error';
2484: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2485: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2486:
2487: END IF;
2480:
2481: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2482:
2483: pa_debug.g_err_stage := 'pa_fp_org_fcst_gen_pub.copy_resource_assignments returned error';
2484: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2485: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2486:
2487: END IF;
2488:
2486:
2487: END IF;
2488:
2489:
2490: IF P_PA_DEBUG_MODE = 'Y' THEN
2491: pa_debug.g_err_stage := 'Calling copy_budget_lines';
2492: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2493: END IF;
2494:
2487: END IF;
2488:
2489:
2490: IF P_PA_DEBUG_MODE = 'Y' THEN
2491: pa_debug.g_err_stage := 'Calling copy_budget_lines';
2492: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2493: END IF;
2494:
2495: pa_fp_org_fcst_gen_pub.copy_budget_lines (
2488:
2489:
2490: IF P_PA_DEBUG_MODE = 'Y' THEN
2491: pa_debug.g_err_stage := 'Calling copy_budget_lines';
2492: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2493: END IF;
2494:
2495: pa_fp_org_fcst_gen_pub.copy_budget_lines (
2496: p_source_plan_version_id => p_source_version_id
2501: ,x_msg_data => l_msg_data );
2502:
2503: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2504:
2505: pa_debug.g_err_stage := 'pa_fp_org_fcst_gen_pub.copy_budget_lines returned error';
2506: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2507: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2508:
2509: END IF;
2502:
2503: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2504:
2505: pa_debug.g_err_stage := 'pa_fp_org_fcst_gen_pub.copy_budget_lines returned error';
2506: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2507: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2508:
2509: END IF;
2510:
2526: /* 3156057 */
2527:
2528: IF l_source_appr_rev_plan_flag = 'N' and l_source_plan_in_mc_flag = 'Y' and l_target_appr_rev_plan_flag = 'Y' THEN
2529:
2530: IF P_PA_DEBUG_MODE = 'Y' THEN
2531: pa_debug.g_err_stage:='Not calling convert_txn_currency since copying a mc enabled version into a appr rev plan type version.';
2532: pa_debug.write('Copy_Plan: ' || l_module_name,pa_debug.g_err_stage,3);
2533: END IF;
2534:
2527:
2528: IF l_source_appr_rev_plan_flag = 'N' and l_source_plan_in_mc_flag = 'Y' and l_target_appr_rev_plan_flag = 'Y' THEN
2529:
2530: IF P_PA_DEBUG_MODE = 'Y' THEN
2531: pa_debug.g_err_stage:='Not calling convert_txn_currency since copying a mc enabled version into a appr rev plan type version.';
2532: pa_debug.write('Copy_Plan: ' || l_module_name,pa_debug.g_err_stage,3);
2533: END IF;
2534:
2535: ELSE
2528: IF l_source_appr_rev_plan_flag = 'N' and l_source_plan_in_mc_flag = 'Y' and l_target_appr_rev_plan_flag = 'Y' THEN
2529:
2530: IF P_PA_DEBUG_MODE = 'Y' THEN
2531: pa_debug.g_err_stage:='Not calling convert_txn_currency since copying a mc enabled version into a appr rev plan type version.';
2532: pa_debug.write('Copy_Plan: ' || l_module_name,pa_debug.g_err_stage,3);
2533: END IF;
2534:
2535: ELSE
2536:
2533: END IF;
2534:
2535: ELSE
2536:
2537: IF P_PA_DEBUG_MODE = 'Y' THEN
2538: pa_debug.g_err_stage := 'Calling convert_txn_currency';
2539: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2540: END IF;
2541:
2534:
2535: ELSE
2536:
2537: IF P_PA_DEBUG_MODE = 'Y' THEN
2538: pa_debug.g_err_stage := 'Calling convert_txn_currency';
2539: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2540: END IF;
2541:
2542: PA_FP_MULTI_CURRENCY_PKG.convert_txn_currency (
2535: ELSE
2536:
2537: IF P_PA_DEBUG_MODE = 'Y' THEN
2538: pa_debug.g_err_stage := 'Calling convert_txn_currency';
2539: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2540: END IF;
2541:
2542: PA_FP_MULTI_CURRENCY_PKG.convert_txn_currency (
2543: p_budget_version_id => l_budget_version_id
2554: -- Bug Fix: 4569365. Removed MRC code.
2555: /* FPB2: MRC - Needs to done only in case of FINPLAN */
2556:
2557: /*
2558: IF P_PA_DEBUG_MODE = 'Y' THEN
2559: pa_debug.g_err_stage:='Calling mrc api ........ ';
2560: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2561: END IF;
2562:
2555: /* FPB2: MRC - Needs to done only in case of FINPLAN */
2556:
2557: /*
2558: IF P_PA_DEBUG_MODE = 'Y' THEN
2559: pa_debug.g_err_stage:='Calling mrc api ........ ';
2560: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2561: END IF;
2562:
2563: IF p_calling_module = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_FIN_PLAN THEN
2556:
2557: /*
2558: IF P_PA_DEBUG_MODE = 'Y' THEN
2559: pa_debug.g_err_stage:='Calling mrc api ........ ';
2560: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2561: END IF;
2562:
2563: IF p_calling_module = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_FIN_PLAN THEN
2564:
2565: -- Nvl is handled because we donot want to overwrite calling_module set already ,eg., COPY_PROJECTS
2566:
2567: PA_MRC_FINPLAN.G_CALLING_MODULE := Nvl(PA_MRC_FINPLAN.G_CALLING_MODULE,PA_MRC_FINPLAN.G_COPY_VERSION);
2568:
2569: IF P_PA_DEBUG_MODE = 'Y' THEN
2570: pa_debug.g_err_stage:='before mrc api ........ MRC Calling module : ' || PA_MRC_FINPLAN.G_CALLING_MODULE;
2571: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2572: END IF;
2573:
2566:
2567: PA_MRC_FINPLAN.G_CALLING_MODULE := Nvl(PA_MRC_FINPLAN.G_CALLING_MODULE,PA_MRC_FINPLAN.G_COPY_VERSION);
2568:
2569: IF P_PA_DEBUG_MODE = 'Y' THEN
2570: pa_debug.g_err_stage:='before mrc api ........ MRC Calling module : ' || PA_MRC_FINPLAN.G_CALLING_MODULE;
2571: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2572: END IF;
2573:
2574: IF PA_MRC_FINPLAN.G_MRC_ENABLED_FOR_BUDGETS IS NULL THEN
2567: PA_MRC_FINPLAN.G_CALLING_MODULE := Nvl(PA_MRC_FINPLAN.G_CALLING_MODULE,PA_MRC_FINPLAN.G_COPY_VERSION);
2568:
2569: IF P_PA_DEBUG_MODE = 'Y' THEN
2570: pa_debug.g_err_stage:='before mrc api ........ MRC Calling module : ' || PA_MRC_FINPLAN.G_CALLING_MODULE;
2571: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2572: END IF;
2573:
2574: IF PA_MRC_FINPLAN.G_MRC_ENABLED_FOR_BUDGETS IS NULL THEN
2575: PA_MRC_FINPLAN.CHECK_MRC_INSTALL
2588: PA_MRC_FINPLAN.G_FINPLAN_MRC_OPTION_CODE = 'A' AND
2589: (l_derv_rates_missing_amts_flag = 'N' OR
2590: l_source_fp_preference_code = l_target_fp_preference_code ) THEN
2591:
2592: IF P_PA_DEBUG_MODE = 'Y' THEN
2593: pa_debug.g_err_stage:='before mrc api adj % is zero ';
2594: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2595: END IF;
2596:
2589: (l_derv_rates_missing_amts_flag = 'N' OR
2590: l_source_fp_preference_code = l_target_fp_preference_code ) THEN
2591:
2592: IF P_PA_DEBUG_MODE = 'Y' THEN
2593: pa_debug.g_err_stage:='before mrc api adj % is zero ';
2594: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2595: END IF;
2596:
2597: -- 3156057: If source plan is mc enabled but not appr rev and the target is appr rev,
2590: l_source_fp_preference_code = l_target_fp_preference_code ) THEN
2591:
2592: IF P_PA_DEBUG_MODE = 'Y' THEN
2593: pa_debug.g_err_stage:='before mrc api adj % is zero ';
2594: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2595: END IF;
2596:
2597: -- 3156057: If source plan is mc enabled but not appr rev and the target is appr rev,
2598: -- then copy_mc_budget_lines_appr_rev will be called to group the source
2602: and l_source_plan_in_mc_flag = 'Y'
2603: and l_target_appr_rev_plan_flag = 'Y' THEN
2604:
2605:
2606: IF P_PA_DEBUG_MODE = 'Y' THEN
2607: pa_debug.g_err_stage:='calling copy_mc_budget_lines_appr_rev ';
2608: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2609: END IF;
2610:
2603: and l_target_appr_rev_plan_flag = 'Y' THEN
2604:
2605:
2606: IF P_PA_DEBUG_MODE = 'Y' THEN
2607: pa_debug.g_err_stage:='calling copy_mc_budget_lines_appr_rev ';
2608: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2609: END IF;
2610:
2611:
2604:
2605:
2606: IF P_PA_DEBUG_MODE = 'Y' THEN
2607: pa_debug.g_err_stage:='calling copy_mc_budget_lines_appr_rev ';
2608: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2609: END IF;
2610:
2611:
2612: PA_MRC_FINPLAN.COPY_MC_BUDGET_LINES_APPR_REV
2623: END IF;
2624:
2625: ELSE
2626:
2627: IF P_PA_DEBUG_MODE = 'Y' THEN
2628: pa_debug.g_err_stage:='calling copy_mc_budget_lines ';
2629: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2630: END IF;
2631:
2624:
2625: ELSE
2626:
2627: IF P_PA_DEBUG_MODE = 'Y' THEN
2628: pa_debug.g_err_stage:='calling copy_mc_budget_lines ';
2629: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2630: END IF;
2631:
2632: PA_MRC_FINPLAN.COPY_MC_BUDGET_LINES
2625: ELSE
2626:
2627: IF P_PA_DEBUG_MODE = 'Y' THEN
2628: pa_debug.g_err_stage:='calling copy_mc_budget_lines ';
2629: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2630: END IF;
2631:
2632: PA_MRC_FINPLAN.COPY_MC_BUDGET_LINES
2633: (p_source_fin_plan_version_id => p_source_version_id,
2639: END IF; -- 3156057
2640:
2641: ELSE
2642:
2643: IF P_PA_DEBUG_MODE = 'Y' THEN
2644: pa_debug.g_err_stage:='before mrc api adj % is NOT zero ';
2645: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2646: END IF;
2647:
2640:
2641: ELSE
2642:
2643: IF P_PA_DEBUG_MODE = 'Y' THEN
2644: pa_debug.g_err_stage:='before mrc api adj % is NOT zero ';
2645: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2646: END IF;
2647:
2648: PA_MRC_FINPLAN.MAINTAIN_ALL_MC_BUDGET_LINES
2641: ELSE
2642:
2643: IF P_PA_DEBUG_MODE = 'Y' THEN
2644: pa_debug.g_err_stage:='before mrc api adj % is NOT zero ';
2645: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2646: END IF;
2647:
2648: PA_MRC_FINPLAN.MAINTAIN_ALL_MC_BUDGET_LINES
2649: -- Bug# 2657812 - Commented - (p_fin_plan_version_id => p_source_version_id, - mrc should be done for target
2704:
2705:
2706: --copy the period denorm directly from source to target
2707:
2708: IF P_PA_DEBUG_MODE = 'Y' THEN
2709: pa_debug.g_err_stage := 'Calling copy_periods_denorm api';
2710: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2711: END IF;
2712:
2705:
2706: --copy the period denorm directly from source to target
2707:
2708: IF P_PA_DEBUG_MODE = 'Y' THEN
2709: pa_debug.g_err_stage := 'Calling copy_periods_denorm api';
2710: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2711: END IF;
2712:
2713: PA_FP_COPY_FROM_PKG.copy_periods_denorm (
2706: --copy the period denorm directly from source to target
2707:
2708: IF P_PA_DEBUG_MODE = 'Y' THEN
2709: pa_debug.g_err_stage := 'Calling copy_periods_denorm api';
2710: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2711: END IF;
2712:
2713: PA_FP_COPY_FROM_PKG.copy_periods_denorm (
2714: p_source_plan_version_id => p_source_version_id
2741: WHERE budget_version_id = l_budget_version_id;
2742:
2743: --Calling copy_periods_denorm api
2744:
2745: pa_debug.g_err_stage := 'Calling copy_periods_denorm api';
2746: IF P_PA_DEBUG_MODE = 'Y' THEN
2747: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2748: END IF;
2749:
2742:
2743: --Calling copy_periods_denorm api
2744:
2745: pa_debug.g_err_stage := 'Calling copy_periods_denorm api';
2746: IF P_PA_DEBUG_MODE = 'Y' THEN
2747: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2748: END IF;
2749:
2750: PA_FP_COPY_FROM_PKG.copy_periods_denorm (
2743: --Calling copy_periods_denorm api
2744:
2745: pa_debug.g_err_stage := 'Calling copy_periods_denorm api';
2746: IF P_PA_DEBUG_MODE = 'Y' THEN
2747: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2748: END IF;
2749:
2750: PA_FP_COPY_FROM_PKG.copy_periods_denorm (
2751: p_source_plan_version_id => p_source_version_id
2757:
2758: /*--if source and target profile ids are different then call
2759: --call_maintain_plan_matrix api
2760:
2761: pa_debug.g_err_stage := 'Calling call_maintain_plan_matrix api';
2762: IF P_PA_DEBUG_MODE = 'Y' THEN
2763: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2764: END IF;
2765:
2758: /*--if source and target profile ids are different then call
2759: --call_maintain_plan_matrix api
2760:
2761: pa_debug.g_err_stage := 'Calling call_maintain_plan_matrix api';
2762: IF P_PA_DEBUG_MODE = 'Y' THEN
2763: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2764: END IF;
2765:
2766: Call_maintain_plan_matrix(
2759: --call_maintain_plan_matrix api
2760:
2761: pa_debug.g_err_stage := 'Calling call_maintain_plan_matrix api';
2762: IF P_PA_DEBUG_MODE = 'Y' THEN
2763: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2764: END IF;
2765:
2766: Call_maintain_plan_matrix(
2767: p_budget_version_id => l_budget_version_id,
2783: X_MSG_COUNT => l_msg_count,
2784: X_MSG_DATA => l_msg_data);
2785:
2786: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2787: IF P_PA_debug_mode = 'Y' THEN
2788: pa_debug.g_err_stage:= 'Error in SRC PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
2789: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2790: END IF;
2791: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2784: X_MSG_DATA => l_msg_data);
2785:
2786: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2787: IF P_PA_debug_mode = 'Y' THEN
2788: pa_debug.g_err_stage:= 'Error in SRC PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
2789: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2790: END IF;
2791: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2792: END IF;
2785:
2786: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2787: IF P_PA_debug_mode = 'Y' THEN
2788: pa_debug.g_err_stage:= 'Error in SRC PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
2789: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2790: END IF;
2791: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2792: END IF;
2793:
2798: X_MSG_COUNT => l_msg_count,
2799: X_MSG_DATA => l_msg_data);
2800:
2801: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2802: IF P_PA_debug_mode = 'Y' THEN
2803: pa_debug.g_err_stage:= 'Error in TARGET PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
2804: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2805: END IF;
2806: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2799: X_MSG_DATA => l_msg_data);
2800:
2801: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2802: IF P_PA_debug_mode = 'Y' THEN
2803: pa_debug.g_err_stage:= 'Error in TARGET PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
2804: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2805: END IF;
2806: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2807: END IF;
2800:
2801: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2802: IF P_PA_debug_mode = 'Y' THEN
2803: pa_debug.g_err_stage:= 'Error in TARGET PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
2804: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2805: END IF;
2806: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2807: END IF;
2808:
2816: p_use_temp_table_flag => 'N',
2817: x_return_status => l_return_status);
2818:
2819: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2820: IF P_PA_debug_mode = 'Y' THEN
2821: pa_debug.g_err_stage:= 'Error in PA_BUDGET_LINES_UTILS.populate_display_qty';
2822: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2823: END IF;
2824: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2817: x_return_status => l_return_status);
2818:
2819: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2820: IF P_PA_debug_mode = 'Y' THEN
2821: pa_debug.g_err_stage:= 'Error in PA_BUDGET_LINES_UTILS.populate_display_qty';
2822: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2823: END IF;
2824: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2825: END IF;
2818:
2819: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2820: IF P_PA_debug_mode = 'Y' THEN
2821: pa_debug.g_err_stage:= 'Error in PA_BUDGET_LINES_UTILS.populate_display_qty';
2822: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2823: END IF;
2824: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2825: END IF;
2826:
2836: x_msg_count => l_msg_data);
2837:
2838:
2839: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2840: IF P_PA_debug_mode = 'Y' THEN
2841: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA';
2842: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2843: END IF;
2844: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2837:
2838:
2839: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2840: IF P_PA_debug_mode = 'Y' THEN
2841: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA';
2842: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2843: END IF;
2844: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2845: END IF;
2838:
2839: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2840: IF P_PA_debug_mode = 'Y' THEN
2841: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA';
2842: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2843: END IF;
2844: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2845: END IF;
2846:
2871: x_msg_data => l_msg_data,
2872: x_msg_count => l_msg_count);
2873:
2874: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2875: IF P_PA_debug_mode = 'Y' THEN
2876: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA - Copy Overrides';
2877: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2878: END IF;
2879: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2872: x_msg_count => l_msg_count);
2873:
2874: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2875: IF P_PA_debug_mode = 'Y' THEN
2876: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA - Copy Overrides';
2877: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2878: END IF;
2879: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2880: END IF;
2873:
2874: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2875: IF P_PA_debug_mode = 'Y' THEN
2876: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA - Copy Overrides';
2877: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2878: END IF;
2879: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2880: END IF;
2881:
2890: x_msg_data => l_msg_data,
2891: x_msg_count => l_msg_count);
2892:
2893: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2894: IF P_PA_debug_mode = 'Y' THEN
2895: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA - Rollup';
2896: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2897: END IF;
2898: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2891: x_msg_count => l_msg_count);
2892:
2893: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2894: IF P_PA_debug_mode = 'Y' THEN
2895: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA - Rollup';
2896: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2897: END IF;
2898: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2899: END IF;
2892:
2893: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2894: IF P_PA_debug_mode = 'Y' THEN
2895: pa_debug.g_err_stage:= 'Error in PA_RES_ASG_CURRENCY_PUB.MAINTAIN_DATA - Rollup';
2896: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
2897: END IF;
2898: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2899: END IF;
2900: END IF;
2907: --Calling rollup_budget_versions.This api rolls up resource assignments,
2908: --creates proj denorm at entered level, creates rollup proj denorm and
2909: --updates budget version with summed up values
2910:
2911: IF P_PA_DEBUG_MODE = 'Y' THEN
2912: pa_debug.g_err_stage := 'Calling rollup_budget_versions api - 1st rollup';
2913: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2914: END IF;
2915:
2908: --creates proj denorm at entered level, creates rollup proj denorm and
2909: --updates budget version with summed up values
2910:
2911: IF P_PA_DEBUG_MODE = 'Y' THEN
2912: pa_debug.g_err_stage := 'Calling rollup_budget_versions api - 1st rollup';
2913: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2914: END IF;
2915:
2916: PA_FP_ROLLUP_PKG.rollup_budget_version (
2909: --updates budget version with summed up values
2910:
2911: IF P_PA_DEBUG_MODE = 'Y' THEN
2912: pa_debug.g_err_stage := 'Calling rollup_budget_versions api - 1st rollup';
2913: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2914: END IF;
2915:
2916: PA_FP_ROLLUP_PKG.rollup_budget_version (
2917: p_budget_version_id => l_budget_version_id
2931: fetch chk_tgt_ver_status into l_chk_tgt_ver_status;
2932: close chk_tgt_ver_status;
2933: If l_chk_tgt_ver_status = 'Y' then
2934:
2935: IF P_PA_DEBUG_MODE = 'Y' THEN
2936: pa_debug.g_err_stage := 'Calling rollup_budget_versions api - 2nd rollup';
2937: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2938: END IF;
2939:
2932: close chk_tgt_ver_status;
2933: If l_chk_tgt_ver_status = 'Y' then
2934:
2935: IF P_PA_DEBUG_MODE = 'Y' THEN
2936: pa_debug.g_err_stage := 'Calling rollup_budget_versions api - 2nd rollup';
2937: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2938: END IF;
2939:
2940:
2933: If l_chk_tgt_ver_status = 'Y' then
2934:
2935: IF P_PA_DEBUG_MODE = 'Y' THEN
2936: pa_debug.g_err_stage := 'Calling rollup_budget_versions api - 2nd rollup';
2937: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2938: END IF;
2939:
2940:
2941: PA_FP_ROLLUP_PKG.rollup_budget_version (
2989: ,x_msg_data => l_msg_data);
2990:
2991: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2992: IF l_debug_mode = 'Y' THEN
2993: pa_debug.g_err_stage:='Called API Refresh_rbs_for_versions returned error';
2994: pa_debug.write('Refresh_Plan_Txns: ' || l_module_name,pa_debug.g_err_stage,5);
2995: END IF;
2996: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2997: END IF;
2990:
2991: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2992: IF l_debug_mode = 'Y' THEN
2993: pa_debug.g_err_stage:='Called API Refresh_rbs_for_versions returned error';
2994: pa_debug.write('Refresh_Plan_Txns: ' || l_module_name,pa_debug.g_err_stage,5);
2995: END IF;
2996: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
2997: END IF;
2998:
3014: l_source_fp_preference_code <> l_target_fp_preference_code OR --Added for bug 42344402
3015: l_adj_percentage <> 0 OR -- Bug 4085235: Added this condition to call plan_create
3016: l_derv_rates_missing_amts_flag = 'Y' THEN
3017:
3018: IF P_PA_DEBUG_MODE = 'Y' THEN
3019: pa_debug.g_err_stage := 'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_CREATE';
3020: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3021: END IF;
3022:
3015: l_adj_percentage <> 0 OR -- Bug 4085235: Added this condition to call plan_create
3016: l_derv_rates_missing_amts_flag = 'Y' THEN
3017:
3018: IF P_PA_DEBUG_MODE = 'Y' THEN
3019: pa_debug.g_err_stage := 'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_CREATE';
3020: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3021: END IF;
3022:
3023: l_dest_ver_id_tbl.extend(1);
3016: l_derv_rates_missing_amts_flag = 'Y' THEN
3017:
3018: IF P_PA_DEBUG_MODE = 'Y' THEN
3019: pa_debug.g_err_stage := 'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_CREATE';
3020: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3021: END IF;
3022:
3023: l_dest_ver_id_tbl.extend(1);
3024: l_dest_ver_id_tbl(1) := l_budget_version_id;
3029: x_return_status => l_return_status,
3030: x_msg_code => l_error_msg_code);
3031:
3032: IF l_return_status <> FND_API.G_RET_STS_SUCCESS then
3033: IF P_PA_DEBUG_MODE = 'Y' THEN
3034: pa_debug.g_err_stage := 'API PJI_FM_XBS_ACCUM_MAINT.PLAN_DELETE returned ERROR 1 '|| l_error_msg_code;
3035: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3036: END IF;
3037:
3030: x_msg_code => l_error_msg_code);
3031:
3032: IF l_return_status <> FND_API.G_RET_STS_SUCCESS then
3033: IF P_PA_DEBUG_MODE = 'Y' THEN
3034: pa_debug.g_err_stage := 'API PJI_FM_XBS_ACCUM_MAINT.PLAN_DELETE returned ERROR 1 '|| l_error_msg_code;
3035: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3036: END IF;
3037:
3038: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
3031:
3032: IF l_return_status <> FND_API.G_RET_STS_SUCCESS then
3033: IF P_PA_DEBUG_MODE = 'Y' THEN
3034: pa_debug.g_err_stage := 'API PJI_FM_XBS_ACCUM_MAINT.PLAN_DELETE returned ERROR 1 '|| l_error_msg_code;
3035: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3036: END IF;
3037:
3038: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
3039:
3083: WHEN NO_DATA_FOUND THEN
3084: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
3085: END;
3086:
3087: IF P_PA_DEBUG_MODE = 'Y' THEN
3088: pa_debug.g_err_stage := 'Calling PJI_FM_XBS_ACCUM_MAINT.FINPLAN_COPY';
3089: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3090: END IF;
3091:
3084: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
3085: END;
3086:
3087: IF P_PA_DEBUG_MODE = 'Y' THEN
3088: pa_debug.g_err_stage := 'Calling PJI_FM_XBS_ACCUM_MAINT.FINPLAN_COPY';
3089: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3090: END IF;
3091:
3092:
3085: END;
3086:
3087: IF P_PA_DEBUG_MODE = 'Y' THEN
3088: pa_debug.g_err_stage := 'Calling PJI_FM_XBS_ACCUM_MAINT.FINPLAN_COPY';
3089: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3090: END IF;
3091:
3092:
3093: PJI_FM_XBS_ACCUM_MAINT.FINPLAN_COPY(
3128: --pa_fp_adj_elements,pa_fin_plan_adj_lines,pa_org_fcst_elements,pa_org_forecast_lines.
3129:
3130: IF p_calling_module = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_ORG_FORECAST THEN
3131:
3132: IF P_PA_DEBUG_MODE = 'Y' THEN
3133: pa_debug.g_err_stage := 'Calling create_org_fcst_elements api';
3134: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3135: END IF;
3136:
3129:
3130: IF p_calling_module = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_ORG_FORECAST THEN
3131:
3132: IF P_PA_DEBUG_MODE = 'Y' THEN
3133: pa_debug.g_err_stage := 'Calling create_org_fcst_elements api';
3134: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3135: END IF;
3136:
3137: PA_FIN_PLAN_PUB.create_org_fcst_elements (
3130: IF p_calling_module = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_ORG_FORECAST THEN
3131:
3132: IF P_PA_DEBUG_MODE = 'Y' THEN
3133: pa_debug.g_err_stage := 'Calling create_org_fcst_elements api';
3134: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3135: END IF;
3136:
3137: PA_FIN_PLAN_PUB.create_org_fcst_elements (
3138: p_project_id => p_project_id,
3145:
3146: px_target_version_id := l_budget_version_id;
3147:
3148:
3149: IF P_PA_DEBUG_MODE = 'Y' THEN
3150: pa_debug.g_err_stage := 'Exiting Copy_Version';
3151: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3152: END IF;
3153:
3146: px_target_version_id := l_budget_version_id;
3147:
3148:
3149: IF P_PA_DEBUG_MODE = 'Y' THEN
3150: pa_debug.g_err_stage := 'Exiting Copy_Version';
3151: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3152: END IF;
3153:
3154: pa_debug.reset_err_stack;
3147:
3148:
3149: IF P_PA_DEBUG_MODE = 'Y' THEN
3150: pa_debug.g_err_stage := 'Exiting Copy_Version';
3151: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3152: END IF;
3153:
3154: pa_debug.reset_err_stack;
3155:
3150: pa_debug.g_err_stage := 'Exiting Copy_Version';
3151: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
3152: END IF;
3153:
3154: pa_debug.reset_err_stack;
3155:
3156: EXCEPTION
3157: WHEN PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc THEN
3158: ROLLBACK TO PA_FIN_PLAN_PUB_COPY_VERSION;
3173: ELSE
3174: x_msg_count := l_msg_count;
3175: END IF;
3176:
3177: pa_debug.g_err_stage:='Invalid Arguments Passed';
3178: IF P_PA_DEBUG_MODE = 'Y' THEN
3179: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3180: END IF;
3181:
3174: x_msg_count := l_msg_count;
3175: END IF;
3176:
3177: pa_debug.g_err_stage:='Invalid Arguments Passed';
3178: IF P_PA_DEBUG_MODE = 'Y' THEN
3179: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3180: END IF;
3181:
3182: x_return_status:= FND_API.G_RET_STS_ERROR;
3175: END IF;
3176:
3177: pa_debug.g_err_stage:='Invalid Arguments Passed';
3178: IF P_PA_DEBUG_MODE = 'Y' THEN
3179: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3180: END IF;
3181:
3182: x_return_status:= FND_API.G_RET_STS_ERROR;
3183: pa_debug.reset_err_stack;
3179: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3180: END IF;
3181:
3182: x_return_status:= FND_API.G_RET_STS_ERROR;
3183: pa_debug.reset_err_stack;
3184:
3185: WHEN Others THEN
3186: ROLLBACK TO PA_FIN_PLAN_PUB_COPY_VERSION;
3187: -- Bug Fix: 4569365. Removed MRC code.
3190: x_msg_count := 1;
3191: x_msg_data := SQLERRM;
3192: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
3193: ,p_procedure_name => 'COPY_VERSION');
3194: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
3195: IF P_PA_DEBUG_MODE = 'Y' THEN
3196: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3197: END IF;
3198: pa_debug.reset_err_stack;
3191: x_msg_data := SQLERRM;
3192: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
3193: ,p_procedure_name => 'COPY_VERSION');
3194: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
3195: IF P_PA_DEBUG_MODE = 'Y' THEN
3196: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3197: END IF;
3198: pa_debug.reset_err_stack;
3199: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3192: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
3193: ,p_procedure_name => 'COPY_VERSION');
3194: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
3195: IF P_PA_DEBUG_MODE = 'Y' THEN
3196: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3197: END IF;
3198: pa_debug.reset_err_stack;
3199: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3200: END Copy_Version;
3194: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
3195: IF P_PA_DEBUG_MODE = 'Y' THEN
3196: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,5);
3197: END IF;
3198: pa_debug.reset_err_stack;
3199: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3200: END Copy_Version;
3201:
3202: /* ------------------------------------------------------------------------- */
3239: l_temp NUMBER;
3240:
3241: begin
3242: FND_MSG_PUB.initialize;
3243: IF P_PA_DEBUG_MODE = 'Y' THEN
3244: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Baseline');
3245: END IF;
3246: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3247: l_debug_mode := NVL(l_debug_mode, 'Y');
3240:
3241: begin
3242: FND_MSG_PUB.initialize;
3243: IF P_PA_DEBUG_MODE = 'Y' THEN
3244: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Baseline');
3245: END IF;
3246: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3247: l_debug_mode := NVL(l_debug_mode, 'Y');
3248: IF P_PA_DEBUG_MODE = 'Y' THEN
3242: FND_MSG_PUB.initialize;
3243: IF P_PA_DEBUG_MODE = 'Y' THEN
3244: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Baseline');
3245: END IF;
3246: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3247: l_debug_mode := NVL(l_debug_mode, 'Y');
3248: IF P_PA_DEBUG_MODE = 'Y' THEN
3249: pa_debug.set_process('Baseline: ' || 'PLSQL','LOG',l_debug_mode);
3250: END IF;
3244: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Baseline');
3245: END IF;
3246: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3247: l_debug_mode := NVL(l_debug_mode, 'Y');
3248: IF P_PA_DEBUG_MODE = 'Y' THEN
3249: pa_debug.set_process('Baseline: ' || 'PLSQL','LOG',l_debug_mode);
3250: END IF;
3251: x_msg_count := 0;
3252: /* CHECK FOR BUSINESS RULES VIOLATIONS */
3245: END IF;
3246: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3247: l_debug_mode := NVL(l_debug_mode, 'Y');
3248: IF P_PA_DEBUG_MODE = 'Y' THEN
3249: pa_debug.set_process('Baseline: ' || 'PLSQL','LOG',l_debug_mode);
3250: END IF;
3251: x_msg_count := 0;
3252: /* CHECK FOR BUSINESS RULES VIOLATIONS */
3253: /* check for null budget_version_id */
3251: x_msg_count := 0;
3252: /* CHECK FOR BUSINESS RULES VIOLATIONS */
3253: /* check for null budget_version_id */
3254: if p_budget_version_id is NULL then
3255: IF P_PA_DEBUG_MODE = 'Y' THEN
3256: pa_debug.write_file('Baseline: ' || 'BUSINESS RULE VIOLATION: p_budget_version_id is null');
3257: END IF;
3258: x_return_status := FND_API.G_RET_STS_ERROR;
3259: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3252: /* CHECK FOR BUSINESS RULES VIOLATIONS */
3253: /* check for null budget_version_id */
3254: if p_budget_version_id is NULL then
3255: IF P_PA_DEBUG_MODE = 'Y' THEN
3256: pa_debug.write_file('Baseline: ' || 'BUSINESS RULE VIOLATION: p_budget_version_id is null');
3257: END IF;
3258: x_return_status := FND_API.G_RET_STS_ERROR;
3259: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3260: p_msg_name => 'PA_FP_NO_PLAN_VERSION');
3260: p_msg_name => 'PA_FP_NO_PLAN_VERSION');
3261: end if;
3262: /* check to see if the current user is an EMPLOYEE; ONLY EMPLOYEES CAN BASELINE */
3263: l_created_by:=FND_GLOBAL.user_id;
3264: IF P_PA_DEBUG_MODE = 'Y' THEN
3265: pa_debug.write_file('Baseline: ' || 'created by= ' || l_created_by);
3266: END IF;
3267: l_emp_id := PA_UTILS.GetEmpIdFromUser(l_created_by);
3268: IF P_PA_DEBUG_MODE = 'Y' THEN
3261: end if;
3262: /* check to see if the current user is an EMPLOYEE; ONLY EMPLOYEES CAN BASELINE */
3263: l_created_by:=FND_GLOBAL.user_id;
3264: IF P_PA_DEBUG_MODE = 'Y' THEN
3265: pa_debug.write_file('Baseline: ' || 'created by= ' || l_created_by);
3266: END IF;
3267: l_emp_id := PA_UTILS.GetEmpIdFromUser(l_created_by);
3268: IF P_PA_DEBUG_MODE = 'Y' THEN
3269: pa_debug.write_file('Baseline: ' || 'employee id= ' || l_emp_id);
3264: IF P_PA_DEBUG_MODE = 'Y' THEN
3265: pa_debug.write_file('Baseline: ' || 'created by= ' || l_created_by);
3266: END IF;
3267: l_emp_id := PA_UTILS.GetEmpIdFromUser(l_created_by);
3268: IF P_PA_DEBUG_MODE = 'Y' THEN
3269: pa_debug.write_file('Baseline: ' || 'employee id= ' || l_emp_id);
3270: END IF;
3271: if l_emp_id IS NULL then
3272: IF P_PA_DEBUG_MODE = 'Y' THEN
3265: pa_debug.write_file('Baseline: ' || 'created by= ' || l_created_by);
3266: END IF;
3267: l_emp_id := PA_UTILS.GetEmpIdFromUser(l_created_by);
3268: IF P_PA_DEBUG_MODE = 'Y' THEN
3269: pa_debug.write_file('Baseline: ' || 'employee id= ' || l_emp_id);
3270: END IF;
3271: if l_emp_id IS NULL then
3272: IF P_PA_DEBUG_MODE = 'Y' THEN
3273: pa_debug.write_file('Baseline: ' || 'BUSINESS RULE VIOLATION: l_emp_id is NULL');
3268: IF P_PA_DEBUG_MODE = 'Y' THEN
3269: pa_debug.write_file('Baseline: ' || 'employee id= ' || l_emp_id);
3270: END IF;
3271: if l_emp_id IS NULL then
3272: IF P_PA_DEBUG_MODE = 'Y' THEN
3273: pa_debug.write_file('Baseline: ' || 'BUSINESS RULE VIOLATION: l_emp_id is NULL');
3274: END IF;
3275: x_return_status := FND_API.G_RET_STS_ERROR;
3276: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3269: pa_debug.write_file('Baseline: ' || 'employee id= ' || l_emp_id);
3270: END IF;
3271: if l_emp_id IS NULL then
3272: IF P_PA_DEBUG_MODE = 'Y' THEN
3273: pa_debug.write_file('Baseline: ' || 'BUSINESS RULE VIOLATION: l_emp_id is NULL');
3274: END IF;
3275: x_return_status := FND_API.G_RET_STS_ERROR;
3276: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3277: p_msg_name => 'PA_ALL_WARN_NO_EMPL_REC');
3296: x_valid_flag => l_valid2_flag,
3297: x_return_status => l_return_status,
3298: x_error_msg_code => l_error_msg_code);
3299: if not((l_valid1_flag='Y') and (l_valid2_flag='Y')) then
3300: IF P_PA_DEBUG_MODE = 'Y' THEN
3301: pa_debug.write_file('Baseline: ' || 'BUSINESS RULE VIOLATION: Check_Record_Version_Number failed');
3302: END IF;
3303: x_return_status := FND_API.G_RET_STS_ERROR;
3304: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3297: x_return_status => l_return_status,
3298: x_error_msg_code => l_error_msg_code);
3299: if not((l_valid1_flag='Y') and (l_valid2_flag='Y')) then
3300: IF P_PA_DEBUG_MODE = 'Y' THEN
3301: pa_debug.write_file('Baseline: ' || 'BUSINESS RULE VIOLATION: Check_Record_Version_Number failed');
3302: END IF;
3303: x_return_status := FND_API.G_RET_STS_ERROR;
3304: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3305: p_msg_name => l_error_msg_code);
3320: x_msg_count := l_msg_count;
3321: else
3322: x_msg_count := l_msg_count;
3323: end if;
3324: pa_debug.reset_err_stack;
3325: return;
3326: end if;
3327:
3328: /* If There are NO Business Rules Violations , Then proceed with Baseline */
3325: return;
3326: end if;
3327:
3328: /* If There are NO Business Rules Violations , Then proceed with Baseline */
3329: IF P_PA_DEBUG_MODE = 'Y' THEN
3330: pa_debug.write_file('no business rules violations; proceeding with baseline');
3331: END IF;
3332: SAVEPOINT PA_FIN_PLAN_PUB_BASELINE;
3333:
3326: end if;
3327:
3328: /* If There are NO Business Rules Violations , Then proceed with Baseline */
3329: IF P_PA_DEBUG_MODE = 'Y' THEN
3330: pa_debug.write_file('no business rules violations; proceeding with baseline');
3331: END IF;
3332: SAVEPOINT PA_FIN_PLAN_PUB_BASELINE;
3333:
3334: /* FINPLANNING PATCHSET K: If the plan type is not ORG_FORECAST, then call
3370: current_flag = 'N',
3371: record_version_number = record_version_number+1
3372: where
3373: budget_version_id=p_orig_budget_version_id;
3374: IF P_PA_DEBUG_MODE = 'Y' THEN
3375: pa_debug.write_file('the old baselined version is no longer the current baselined version');
3376: END IF;
3377: /* create a copy, labeled as 'BASELINED' */
3378: PA_FIN_PLAN_PUB.Copy_Version
3371: record_version_number = record_version_number+1
3372: where
3373: budget_version_id=p_orig_budget_version_id;
3374: IF P_PA_DEBUG_MODE = 'Y' THEN
3375: pa_debug.write_file('the old baselined version is no longer the current baselined version');
3376: END IF;
3377: /* create a copy, labeled as 'BASELINED' */
3378: PA_FIN_PLAN_PUB.Copy_Version
3379: (p_project_id => p_project_id,
3436: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
3437:
3438: WHEN OTHERS THEN
3439:
3440: IF P_PA_DEBUG_MODE = 'Y' THEN
3441: pa_debug.g_err_stage := 'Unexpected error while deriving l_orig_budget_version_id '||sqlerrm;
3442: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3443: END IF;
3444: RAISE;
3437:
3438: WHEN OTHERS THEN
3439:
3440: IF P_PA_DEBUG_MODE = 'Y' THEN
3441: pa_debug.g_err_stage := 'Unexpected error while deriving l_orig_budget_version_id '||sqlerrm;
3442: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3443: END IF;
3444: RAISE;
3445: END;
3438: WHEN OTHERS THEN
3439:
3440: IF P_PA_DEBUG_MODE = 'Y' THEN
3441: pa_debug.g_err_stage := 'Unexpected error while deriving l_orig_budget_version_id '||sqlerrm;
3442: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3443: END IF;
3444: RAISE;
3445: END;
3446:
3445: END;
3446:
3447: IF NVL(l_orig_budget_version_id,-99) <> NVL(p_orig_budget_version_id,NVL(l_orig_budget_version_id,-99)) THEN
3448:
3449: IF P_PA_DEBUG_MODE = 'Y' THEN
3450: pa_debug.g_err_stage := 'l_orig_budget_version_id IS NOT SAME AS p_orig_budget_version_id' ;
3451: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3452:
3453: pa_debug.g_err_stage := 'l_orig_budget_version_id '||l_orig_budget_version_id ;
3446:
3447: IF NVL(l_orig_budget_version_id,-99) <> NVL(p_orig_budget_version_id,NVL(l_orig_budget_version_id,-99)) THEN
3448:
3449: IF P_PA_DEBUG_MODE = 'Y' THEN
3450: pa_debug.g_err_stage := 'l_orig_budget_version_id IS NOT SAME AS p_orig_budget_version_id' ;
3451: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3452:
3453: pa_debug.g_err_stage := 'l_orig_budget_version_id '||l_orig_budget_version_id ;
3454: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3447: IF NVL(l_orig_budget_version_id,-99) <> NVL(p_orig_budget_version_id,NVL(l_orig_budget_version_id,-99)) THEN
3448:
3449: IF P_PA_DEBUG_MODE = 'Y' THEN
3450: pa_debug.g_err_stage := 'l_orig_budget_version_id IS NOT SAME AS p_orig_budget_version_id' ;
3451: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3452:
3453: pa_debug.g_err_stage := 'l_orig_budget_version_id '||l_orig_budget_version_id ;
3454: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3455:
3449: IF P_PA_DEBUG_MODE = 'Y' THEN
3450: pa_debug.g_err_stage := 'l_orig_budget_version_id IS NOT SAME AS p_orig_budget_version_id' ;
3451: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3452:
3453: pa_debug.g_err_stage := 'l_orig_budget_version_id '||l_orig_budget_version_id ;
3454: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3455:
3456: pa_debug.g_err_stage := 'p_orig_budget_version_id '||p_orig_budget_version_id ;
3457: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3450: pa_debug.g_err_stage := 'l_orig_budget_version_id IS NOT SAME AS p_orig_budget_version_id' ;
3451: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3452:
3453: pa_debug.g_err_stage := 'l_orig_budget_version_id '||l_orig_budget_version_id ;
3454: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3455:
3456: pa_debug.g_err_stage := 'p_orig_budget_version_id '||p_orig_budget_version_id ;
3457: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3458:
3452:
3453: pa_debug.g_err_stage := 'l_orig_budget_version_id '||l_orig_budget_version_id ;
3454: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3455:
3456: pa_debug.g_err_stage := 'p_orig_budget_version_id '||p_orig_budget_version_id ;
3457: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3458:
3459: END IF;
3460: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3453: pa_debug.g_err_stage := 'l_orig_budget_version_id '||l_orig_budget_version_id ;
3454: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3455:
3456: pa_debug.g_err_stage := 'p_orig_budget_version_id '||p_orig_budget_version_id ;
3457: pa_debug.write('PAFPPUBB.Baseline',pa_debug.g_err_stage,5);
3458:
3459: END IF;
3460: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3461: p_msg_name => 'PA_FP_INV_PARAM_PASSED',
3513: x_msg_count := l_msg_count;
3514: else
3515: x_msg_count := l_msg_count;
3516: end if;
3517: pa_debug.reset_err_stack;
3518: return;
3519: end if;
3520: --Bug 4145705
3521: SELECT COUNT(*)
3540:
3541: end if; -- l_fin_plan_type_code = ORG_FORECAST
3542:
3543: x_return_status := FND_API.G_RET_STS_SUCCESS;
3544: pa_debug.reset_err_stack;
3545:
3546: exception
3547: WHEN PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc THEN
3548: l_msg_count := FND_MSG_PUB.count_msg;
3560: x_msg_count := l_msg_count;
3561: END IF;
3562: ROLLBACK TO PA_FIN_PLAN_PUB_BASELINE;
3563: x_return_status := FND_API.G_RET_STS_ERROR;
3564: pa_debug.reset_curr_function;
3565: when pa_fin_plan_pub.rollback_on_error then
3566: IF P_PA_DEBUG_MODE = 'Y' THEN
3567: pa_debug.write_file('Procedure Baseline: rollback_on_error exception');
3568: END IF;
3562: ROLLBACK TO PA_FIN_PLAN_PUB_BASELINE;
3563: x_return_status := FND_API.G_RET_STS_ERROR;
3564: pa_debug.reset_curr_function;
3565: when pa_fin_plan_pub.rollback_on_error then
3566: IF P_PA_DEBUG_MODE = 'Y' THEN
3567: pa_debug.write_file('Procedure Baseline: rollback_on_error exception');
3568: END IF;
3569: rollback to PA_FIN_PLAN_PUB_BASELINE;
3570: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3563: x_return_status := FND_API.G_RET_STS_ERROR;
3564: pa_debug.reset_curr_function;
3565: when pa_fin_plan_pub.rollback_on_error then
3566: IF P_PA_DEBUG_MODE = 'Y' THEN
3567: pa_debug.write_file('Procedure Baseline: rollback_on_error exception');
3568: END IF;
3569: rollback to PA_FIN_PLAN_PUB_BASELINE;
3570: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3571:
3575: x_msg_count := 1;
3576: x_msg_data := SQLERRM;
3577: FND_MSG_PUB.add_exc_msg(p_pkg_name => 'PA_FIN_PLAN_PUB',
3578: p_procedure_name => 'Baseline');
3579: pa_debug.reset_err_stack;
3580: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3581: end Baseline;
3582: /* ------------------------------------------------------------------------- */
3583:
3652: plan_options_rec plan_options_csr%ROWTYPE;
3653:
3654: begin
3655: FND_MSG_PUB.initialize;
3656: IF P_PA_DEBUG_MODE = 'Y' THEN
3657: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Create_Version_OrgFcst');
3658: END IF;
3659: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3660: l_debug_mode := NVL(l_debug_mode, 'Y');
3653:
3654: begin
3655: FND_MSG_PUB.initialize;
3656: IF P_PA_DEBUG_MODE = 'Y' THEN
3657: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Create_Version_OrgFcst');
3658: END IF;
3659: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3660: l_debug_mode := NVL(l_debug_mode, 'Y');
3661: IF P_PA_DEBUG_MODE = 'Y' THEN
3655: FND_MSG_PUB.initialize;
3656: IF P_PA_DEBUG_MODE = 'Y' THEN
3657: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Create_Version_OrgFcst');
3658: END IF;
3659: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3660: l_debug_mode := NVL(l_debug_mode, 'Y');
3661: IF P_PA_DEBUG_MODE = 'Y' THEN
3662: pa_debug.set_process('Create_Version_OrgFcst: ' || 'PLSQL','LOG',l_debug_mode);
3663: END IF;
3657: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Create_Version_OrgFcst');
3658: END IF;
3659: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3660: l_debug_mode := NVL(l_debug_mode, 'Y');
3661: IF P_PA_DEBUG_MODE = 'Y' THEN
3662: pa_debug.set_process('Create_Version_OrgFcst: ' || 'PLSQL','LOG',l_debug_mode);
3663: END IF;
3664: x_msg_count := 0;
3665: /* CHECK FOR BUSINESS RULES VIOLATIONS */
3658: END IF;
3659: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3660: l_debug_mode := NVL(l_debug_mode, 'Y');
3661: IF P_PA_DEBUG_MODE = 'Y' THEN
3662: pa_debug.set_process('Create_Version_OrgFcst: ' || 'PLSQL','LOG',l_debug_mode);
3663: END IF;
3664: x_msg_count := 0;
3665: /* CHECK FOR BUSINESS RULES VIOLATIONS */
3666: /* check for null version_name */
3663: END IF;
3664: x_msg_count := 0;
3665: /* CHECK FOR BUSINESS RULES VIOLATIONS */
3666: /* check for null version_name */
3667: IF P_PA_DEBUG_MODE = 'Y' THEN
3668: pa_debug.write_file('Create_Version_OrgFcst: ' || 'starting procedure: initial message count= ' || FND_MSG_PUB.count_msg);
3669: END IF;
3670: if p_version_name is NULL then
3671: x_return_status := FND_API.G_RET_STS_ERROR;
3664: x_msg_count := 0;
3665: /* CHECK FOR BUSINESS RULES VIOLATIONS */
3666: /* check for null version_name */
3667: IF P_PA_DEBUG_MODE = 'Y' THEN
3668: pa_debug.write_file('Create_Version_OrgFcst: ' || 'starting procedure: initial message count= ' || FND_MSG_PUB.count_msg);
3669: END IF;
3670: if p_version_name is NULL then
3671: x_return_status := FND_API.G_RET_STS_ERROR;
3672: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3688: x_msg_count := l_msg_count;
3689: else
3690: x_msg_count := l_msg_count;
3691: end if;
3692: pa_debug.reset_err_stack;
3693: return;
3694: end if;
3695:
3696: /* If There are NO Business Rules Violations , Then proceed with Create Version Apply */
3694: end if;
3695:
3696: /* If There are NO Business Rules Violations , Then proceed with Create Version Apply */
3697: if l_msg_count = 0 then
3698: IF P_PA_DEBUG_MODE = 'Y' THEN
3699: pa_debug.write_file('Create_Version_OrgFcst: ' || 'no business rules violations');
3700: END IF;
3701: SAVEPOINT PA_FP_PUB_CREATE_VER_ORGFCST;
3702: /* Get the version_type by querying pa_fin_plan_types_b using fin_plan_type_id */
3695:
3696: /* If There are NO Business Rules Violations , Then proceed with Create Version Apply */
3697: if l_msg_count = 0 then
3698: IF P_PA_DEBUG_MODE = 'Y' THEN
3699: pa_debug.write_file('Create_Version_OrgFcst: ' || 'no business rules violations');
3700: END IF;
3701: SAVEPOINT PA_FP_PUB_CREATE_VER_ORGFCST;
3702: /* Get the version_type by querying pa_fin_plan_types_b using fin_plan_type_id */
3703: select
3712: fin_plan_type_id=p_fin_plan_type_id;
3713: if (l_version_type is null) then
3714: raise NO_DATA_FOUND;
3715: end if;
3716: IF P_PA_DEBUG_MODE = 'Y' THEN
3717: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type selected with no problems');
3718: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type code is ' || l_version_type_code);
3719: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type name is ' || l_version_type);
3720: END IF;
3713: if (l_version_type is null) then
3714: raise NO_DATA_FOUND;
3715: end if;
3716: IF P_PA_DEBUG_MODE = 'Y' THEN
3717: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type selected with no problems');
3718: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type code is ' || l_version_type_code);
3719: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type name is ' || l_version_type);
3720: END IF;
3721: /* Get the max version_number for working versions of this plan type */
3714: raise NO_DATA_FOUND;
3715: end if;
3716: IF P_PA_DEBUG_MODE = 'Y' THEN
3717: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type selected with no problems');
3718: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type code is ' || l_version_type_code);
3719: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type name is ' || l_version_type);
3720: END IF;
3721: /* Get the max version_number for working versions of this plan type */
3722: select
3715: end if;
3716: IF P_PA_DEBUG_MODE = 'Y' THEN
3717: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type selected with no problems');
3718: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type code is ' || l_version_type_code);
3719: pa_debug.write_file('Create_Version_OrgFcst: ' || 'version type name is ' || l_version_type);
3720: END IF;
3721: /* Get the max version_number for working versions of this plan type */
3722: select
3723: nvl(max(version_number), 0)
3728: where
3729: project_id = p_project_id and
3730: fin_plan_type_id = p_fin_plan_type_id and
3731: budget_status_code in ('W', 'S');
3732: IF P_PA_DEBUG_MODE = 'Y' THEN
3733: pa_debug.write_file('Create_Version_OrgFcst: ' || 'max version number is ' || l_max_version);
3734: END IF;
3735: /* Get the resource_list_id to be used; if it was not passed to this procedure, */
3736: /* we can retrieve it from FND_PROFILE if the version_type is ORG_FORECAST */
3729: project_id = p_project_id and
3730: fin_plan_type_id = p_fin_plan_type_id and
3731: budget_status_code in ('W', 'S');
3732: IF P_PA_DEBUG_MODE = 'Y' THEN
3733: pa_debug.write_file('Create_Version_OrgFcst: ' || 'max version number is ' || l_max_version);
3734: END IF;
3735: /* Get the resource_list_id to be used; if it was not passed to this procedure, */
3736: /* we can retrieve it from FND_PROFILE if the version_type is ORG_FORECAST */
3737: if p_resource_list_id is NULL then
3734: END IF;
3735: /* Get the resource_list_id to be used; if it was not passed to this procedure, */
3736: /* we can retrieve it from FND_PROFILE if the version_type is ORG_FORECAST */
3737: if p_resource_list_id is NULL then
3738: IF P_PA_DEBUG_MODE = 'Y' THEN
3739: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_resource_list_id is null');
3740: END IF;
3741: if l_version_type_code = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_ORG_FORECAST then
3742: l_resource_list_id := FND_PROFILE.value('PA_FORECAST_RESOURCE_LIST');
3735: /* Get the resource_list_id to be used; if it was not passed to this procedure, */
3736: /* we can retrieve it from FND_PROFILE if the version_type is ORG_FORECAST */
3737: if p_resource_list_id is NULL then
3738: IF P_PA_DEBUG_MODE = 'Y' THEN
3739: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_resource_list_id is null');
3740: END IF;
3741: if l_version_type_code = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_ORG_FORECAST then
3742: l_resource_list_id := FND_PROFILE.value('PA_FORECAST_RESOURCE_LIST');
3743: else
3759: end if;
3760: else
3761: l_resource_list_id := p_resource_list_id;
3762: end if;
3763: IF P_PA_DEBUG_MODE = 'Y' THEN
3764: pa_debug.write_file('Create_Version_OrgFcst: ' || 'resource list is ' || l_resource_list_id);
3765: END IF;
3766: /* retrieve the period type, start date, and end date from pa_forecasting_options */
3767: pa_fp_org_fcst_utils.get_forecast_option_details
3760: else
3761: l_resource_list_id := p_resource_list_id;
3762: end if;
3763: IF P_PA_DEBUG_MODE = 'Y' THEN
3764: pa_debug.write_file('Create_Version_OrgFcst: ' || 'resource list is ' || l_resource_list_id);
3765: END IF;
3766: /* retrieve the period type, start date, and end date from pa_forecasting_options */
3767: pa_fp_org_fcst_utils.get_forecast_option_details
3768: (x_fcst_period_type => l_org_fcst_period_type,
3778: x_org_id => l_org_id,
3779: x_return_status => l_return_status,
3780: x_err_code => l_error_msg_code);
3781: /*
3782: IF P_PA_DEBUG_MODE = 'Y' THEN
3783: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_fcst_period_type is ' || l_org_fcst_period_type);
3784: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_set_name is ' || l_period_set_name);
3785: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_act_period_type is ' || l_act_period_type);
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3779: x_return_status => l_return_status,
3780: x_err_code => l_error_msg_code);
3781: /*
3782: IF P_PA_DEBUG_MODE = 'Y' THEN
3783: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_fcst_period_type is ' || l_org_fcst_period_type);
3784: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_set_name is ' || l_period_set_name);
3785: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_act_period_type is ' || l_act_period_type);
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3780: x_err_code => l_error_msg_code);
3781: /*
3782: IF P_PA_DEBUG_MODE = 'Y' THEN
3783: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_fcst_period_type is ' || l_org_fcst_period_type);
3784: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_set_name is ' || l_period_set_name);
3785: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_act_period_type is ' || l_act_period_type);
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3788: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_project_template_id is ' || l_org_project_template_id);
3781: /*
3782: IF P_PA_DEBUG_MODE = 'Y' THEN
3783: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_fcst_period_type is ' || l_org_fcst_period_type);
3784: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_set_name is ' || l_period_set_name);
3785: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_act_period_type is ' || l_act_period_type);
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3788: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_project_template_id is ' || l_org_project_template_id);
3789: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_structure_version_id is ' || l_org_structure_version_id);
3782: IF P_PA_DEBUG_MODE = 'Y' THEN
3783: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_fcst_period_type is ' || l_org_fcst_period_type);
3784: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_set_name is ' || l_period_set_name);
3785: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_act_period_type is ' || l_act_period_type);
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3788: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_project_template_id is ' || l_org_project_template_id);
3789: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_structure_version_id is ' || l_org_structure_version_id);
3790: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_id is ' || l_org_id);
3783: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_fcst_period_type is ' || l_org_fcst_period_type);
3784: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_set_name is ' || l_period_set_name);
3785: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_act_period_type is ' || l_act_period_type);
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3788: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_project_template_id is ' || l_org_project_template_id);
3789: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_structure_version_id is ' || l_org_structure_version_id);
3790: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_id is ' || l_org_id);
3791: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_return_status is ' || l_return_status);
3784: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_set_name is ' || l_period_set_name);
3785: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_act_period_type is ' || l_act_period_type);
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3788: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_project_template_id is ' || l_org_project_template_id);
3789: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_structure_version_id is ' || l_org_structure_version_id);
3790: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_id is ' || l_org_id);
3791: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_return_status is ' || l_return_status);
3792: END IF;
3785: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_act_period_type is ' || l_act_period_type);
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3788: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_project_template_id is ' || l_org_project_template_id);
3789: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_structure_version_id is ' || l_org_structure_version_id);
3790: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_id is ' || l_org_id);
3791: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_return_status is ' || l_return_status);
3792: END IF;
3793: */
3786: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_projfunc_currency_code is ' || l_org_projfunc_currency_code);
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3788: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_project_template_id is ' || l_org_project_template_id);
3789: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_structure_version_id is ' || l_org_structure_version_id);
3790: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_id is ' || l_org_id);
3791: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_return_status is ' || l_return_status);
3792: END IF;
3793: */
3794: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
3787: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_number_of_periods is ' || l_number_of_periods);
3788: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_project_template_id is ' || l_org_project_template_id);
3789: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_structure_version_id is ' || l_org_structure_version_id);
3790: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_org_id is ' || l_org_id);
3791: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_return_status is ' || l_return_status);
3792: END IF;
3793: */
3794: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
3795: IF P_PA_DEBUG_MODE = 'Y' THEN
3791: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_return_status is ' || l_return_status);
3792: END IF;
3793: */
3794: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
3795: IF P_PA_DEBUG_MODE = 'Y' THEN
3796: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_fp_org_fcst_utils.get_forecast_option_details');
3797: END IF;
3798: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3799: p_msg_name => l_error_msg_code);
3792: END IF;
3793: */
3794: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
3795: IF P_PA_DEBUG_MODE = 'Y' THEN
3796: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_fp_org_fcst_utils.get_forecast_option_details');
3797: END IF;
3798: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3799: p_msg_name => l_error_msg_code);
3800: raise pa_fin_plan_pub.rollback_on_error;
3820: x_return_status => l_return_status,
3821: x_err_code => l_error_msg_code);
3822: /* create a new PERIOD PROFILE ID if one does not exist */
3823: if l_period_profile_id < 0 then
3824: IF P_PA_DEBUG_MODE = 'Y' THEN
3825: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_profile_id < 0');
3826: END IF;
3827: l_period_profile_id := NULL;
3828: if l_org_fcst_period_type = PA_FP_CONSTANTS_PKG.G_PERIOD_TYPE_PA then
3821: x_err_code => l_error_msg_code);
3822: /* create a new PERIOD PROFILE ID if one does not exist */
3823: if l_period_profile_id < 0 then
3824: IF P_PA_DEBUG_MODE = 'Y' THEN
3825: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_period_profile_id < 0');
3826: END IF;
3827: l_period_profile_id := NULL;
3828: if l_org_fcst_period_type = PA_FP_CONSTANTS_PKG.G_PERIOD_TYPE_PA then
3829: l_pa_period_type := l_act_period_type;
3830: else
3831: l_pa_period_type := NULL;
3832: end if;
3833: /*
3834: IF P_PA_DEBUG_MODE = 'Y' THEN
3835: pa_debug.write_file('Create_Version_OrgFcst: ' || 'entering pa_prj_period_profile_utils.maintain_prj_period_profile');
3836: pa_debug.write_file('Create_Version_OrgFcst: ' || 'project id is ' || p_project_id);
3837: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_plan_period_type is ' || l_org_fcst_period_type);
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3831: l_pa_period_type := NULL;
3832: end if;
3833: /*
3834: IF P_PA_DEBUG_MODE = 'Y' THEN
3835: pa_debug.write_file('Create_Version_OrgFcst: ' || 'entering pa_prj_period_profile_utils.maintain_prj_period_profile');
3836: pa_debug.write_file('Create_Version_OrgFcst: ' || 'project id is ' || p_project_id);
3837: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_plan_period_type is ' || l_org_fcst_period_type);
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3832: end if;
3833: /*
3834: IF P_PA_DEBUG_MODE = 'Y' THEN
3835: pa_debug.write_file('Create_Version_OrgFcst: ' || 'entering pa_prj_period_profile_utils.maintain_prj_period_profile');
3836: pa_debug.write_file('Create_Version_OrgFcst: ' || 'project id is ' || p_project_id);
3837: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_plan_period_type is ' || l_org_fcst_period_type);
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3833: /*
3834: IF P_PA_DEBUG_MODE = 'Y' THEN
3835: pa_debug.write_file('Create_Version_OrgFcst: ' || 'entering pa_prj_period_profile_utils.maintain_prj_period_profile');
3836: pa_debug.write_file('Create_Version_OrgFcst: ' || 'project id is ' || p_project_id);
3837: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_plan_period_type is ' || l_org_fcst_period_type);
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3841: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_start_date is ' || l_fcst_start_date);
3834: IF P_PA_DEBUG_MODE = 'Y' THEN
3835: pa_debug.write_file('Create_Version_OrgFcst: ' || 'entering pa_prj_period_profile_utils.maintain_prj_period_profile');
3836: pa_debug.write_file('Create_Version_OrgFcst: ' || 'project id is ' || p_project_id);
3837: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_plan_period_type is ' || l_org_fcst_period_type);
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3841: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_start_date is ' || l_fcst_start_date);
3842: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_end_date is ' || l_fcst_end_date);
3835: pa_debug.write_file('Create_Version_OrgFcst: ' || 'entering pa_prj_period_profile_utils.maintain_prj_period_profile');
3836: pa_debug.write_file('Create_Version_OrgFcst: ' || 'project id is ' || p_project_id);
3837: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_plan_period_type is ' || l_org_fcst_period_type);
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3841: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_start_date is ' || l_fcst_start_date);
3842: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_end_date is ' || l_fcst_end_date);
3843: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_period_profile_id is ' || l_period_profile_id);
3836: pa_debug.write_file('Create_Version_OrgFcst: ' || 'project id is ' || p_project_id);
3837: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_plan_period_type is ' || l_org_fcst_period_type);
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3841: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_start_date is ' || l_fcst_start_date);
3842: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_end_date is ' || l_fcst_end_date);
3843: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_period_profile_id is ' || l_period_profile_id);
3844: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_number_of_periods is ' || l_number_of_periods);
3837: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_plan_period_type is ' || l_org_fcst_period_type);
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3841: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_start_date is ' || l_fcst_start_date);
3842: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_end_date is ' || l_fcst_end_date);
3843: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_period_profile_id is ' || l_period_profile_id);
3844: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_number_of_periods is ' || l_number_of_periods);
3845: END IF;
3838: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_period_set_name is ' || l_period_set_name);
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3841: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_start_date is ' || l_fcst_start_date);
3842: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_end_date is ' || l_fcst_end_date);
3843: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_period_profile_id is ' || l_period_profile_id);
3844: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_number_of_periods is ' || l_number_of_periods);
3845: END IF;
3846: */
3839: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_gl_period_type is ' || l_act_period_type);
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3841: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_start_date is ' || l_fcst_start_date);
3842: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_end_date is ' || l_fcst_end_date);
3843: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_period_profile_id is ' || l_period_profile_id);
3844: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_number_of_periods is ' || l_number_of_periods);
3845: END IF;
3846: */
3847: pa_prj_period_profile_utils.maintain_prj_period_profile
3840: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_pa_period_type is ' || l_pa_period_type);
3841: pa_debug.write_file('Create_Version_OrgFcst: ' || 'p_start_date is ' || l_fcst_start_date);
3842: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_end_date is ' || l_fcst_end_date);
3843: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_period_profile_id is ' || l_period_profile_id);
3844: pa_debug.write_file('Create_Version_OrgFcst: ' || 'px_number_of_periods is ' || l_number_of_periods);
3845: END IF;
3846: */
3847: pa_prj_period_profile_utils.maintain_prj_period_profile
3848: (p_project_id => p_project_id,
3862: x_msg_count => l_msg_count,
3863: x_msg_data => l_msg_data);
3864: end if;
3865: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
3866: IF P_PA_DEBUG_MODE = 'Y' THEN
3867: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_prj_period_profile_utils.maintain_prj_period_profile');
3868: END IF;
3869: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3870: p_msg_name => l_msg_data);
3863: x_msg_data => l_msg_data);
3864: end if;
3865: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
3866: IF P_PA_DEBUG_MODE = 'Y' THEN
3867: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_prj_period_profile_utils.maintain_prj_period_profile');
3868: END IF;
3869: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3870: p_msg_name => l_msg_data);
3871: raise pa_fin_plan_pub.rollback_on_error;
3869: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
3870: p_msg_name => l_msg_data);
3871: raise pa_fin_plan_pub.rollback_on_error;
3872: end if;
3873: IF P_PA_DEBUG_MODE = 'Y' THEN
3874: pa_debug.write_file('Create_Version_OrgFcst: ' || ' the new period profile id is ' || l_period_profile_id);
3875: END IF;
3876: /* create the plan version */
3877: IF P_PA_DEBUG_MODE = 'Y' THEN
3870: p_msg_name => l_msg_data);
3871: raise pa_fin_plan_pub.rollback_on_error;
3872: end if;
3873: IF P_PA_DEBUG_MODE = 'Y' THEN
3874: pa_debug.write_file('Create_Version_OrgFcst: ' || ' the new period profile id is ' || l_period_profile_id);
3875: END IF;
3876: /* create the plan version */
3877: IF P_PA_DEBUG_MODE = 'Y' THEN
3878: pa_debug.write_file('Create_Version_OrgFcst: ' || 'calling pa_fp_budget_versions_pkg.Insert_Row to create a budget version');
3873: IF P_PA_DEBUG_MODE = 'Y' THEN
3874: pa_debug.write_file('Create_Version_OrgFcst: ' || ' the new period profile id is ' || l_period_profile_id);
3875: END IF;
3876: /* create the plan version */
3877: IF P_PA_DEBUG_MODE = 'Y' THEN
3878: pa_debug.write_file('Create_Version_OrgFcst: ' || 'calling pa_fp_budget_versions_pkg.Insert_Row to create a budget version');
3879: END IF;
3880: select pa_budget_versions_s.nextVal into l_budget_version_id from dual;
3881: /* the new version is the current working only if it's the ONLY working version */
3874: pa_debug.write_file('Create_Version_OrgFcst: ' || ' the new period profile id is ' || l_period_profile_id);
3875: END IF;
3876: /* create the plan version */
3877: IF P_PA_DEBUG_MODE = 'Y' THEN
3878: pa_debug.write_file('Create_Version_OrgFcst: ' || 'calling pa_fp_budget_versions_pkg.Insert_Row to create a budget version');
3879: END IF;
3880: select pa_budget_versions_s.nextVal into l_budget_version_id from dual;
3881: /* the new version is the current working only if it's the ONLY working version */
3882: if (l_max_version = 0) then
3954: p_request_id => NULL, /* will be changed later in the script */
3955: x_row_id => l_row_id,
3956: x_return_status => l_return_status);
3957: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
3958: IF P_PA_DEBUG_MODE = 'Y' THEN
3959: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_prj_period_profile_utils.maintain_prj_period_profile');
3960: END IF;
3961: /* error message added to the stack in the table handler; we don't need to do it here */
3962: raise pa_fin_plan_pub.rollback_on_error;
3955: x_row_id => l_row_id,
3956: x_return_status => l_return_status);
3957: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
3958: IF P_PA_DEBUG_MODE = 'Y' THEN
3959: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_prj_period_profile_utils.maintain_prj_period_profile');
3960: END IF;
3961: /* error message added to the stack in the table handler; we don't need to do it here */
3962: raise pa_fin_plan_pub.rollback_on_error;
3963: end if;
3960: END IF;
3961: /* error message added to the stack in the table handler; we don't need to do it here */
3962: raise pa_fin_plan_pub.rollback_on_error;
3963: end if;
3964: IF P_PA_DEBUG_MODE = 'Y' THEN
3965: pa_debug.write_file('Create_Version_OrgFcst: ' || 'new budget version id is ' || l_budget_version_id);
3966: END IF;
3967: x_budget_version_id := l_budget_version_id;
3968:
3961: /* error message added to the stack in the table handler; we don't need to do it here */
3962: raise pa_fin_plan_pub.rollback_on_error;
3963: end if;
3964: IF P_PA_DEBUG_MODE = 'Y' THEN
3965: pa_debug.write_file('Create_Version_OrgFcst: ' || 'new budget version id is ' || l_budget_version_id);
3966: END IF;
3967: x_budget_version_id := l_budget_version_id;
3968:
3969:
3972: open amount_set_csr;
3973: fetch amount_set_csr into amount_set_rec;
3974: if amount_set_csr%NOTFOUND then
3975: close amount_set_csr;
3976: IF P_PA_DEBUG_MODE = 'Y' THEN
3977: pa_debug.write_file('Create_Version_OrgFcst: ' || 'no data found in amount_sets');
3978: END IF;
3979: raise pa_fin_plan_pub.rollback_on_error;
3980: else
3973: fetch amount_set_csr into amount_set_rec;
3974: if amount_set_csr%NOTFOUND then
3975: close amount_set_csr;
3976: IF P_PA_DEBUG_MODE = 'Y' THEN
3977: pa_debug.write_file('Create_Version_OrgFcst: ' || 'no data found in amount_sets');
3978: END IF;
3979: raise pa_fin_plan_pub.rollback_on_error;
3980: else
3981: l_org_amount_set_id := amount_set_rec.fin_plan_amount_set_id;
3993: close plan_options_csr;
3994: end if;
3995:
3996: if l_proj_fin_plan_options_id is NULL then
3997: IF P_PA_DEBUG_MODE = 'Y' THEN
3998: pa_debug.write_file('Create_Version_OrgFcst: ' || 'no planning options for plan_type level: creating one now');
3999: END IF;
4000: /* call table handler to create planning options for plan_type */
4001: select pa_proj_fp_options_s.nextVal into l_proj_fin_plan_options_id from dual;
3994: end if;
3995:
3996: if l_proj_fin_plan_options_id is NULL then
3997: IF P_PA_DEBUG_MODE = 'Y' THEN
3998: pa_debug.write_file('Create_Version_OrgFcst: ' || 'no planning options for plan_type level: creating one now');
3999: END IF;
4000: /* call table handler to create planning options for plan_type */
4001: select pa_proj_fp_options_s.nextVal into l_proj_fin_plan_options_id from dual;
4002: pa_proj_fp_options_pkg.Insert_Row
4023: p_fin_plan_version_id => NULL, /* use l_budget_version_id only at the VERSION_TYPE level */
4024: x_row_id => l_row_id,
4025: x_return_status => l_return_status);
4026: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
4027: IF P_PA_DEBUG_MODE = 'Y' THEN
4028: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_fp_proj_fplan_options_pkg.Insert_Row: plan_type level');
4029: END IF;
4030: /* error message added to the stack in the table handler; we don't need to do it here */
4031: raise pa_fin_plan_pub.rollback_on_error;
4024: x_row_id => l_row_id,
4025: x_return_status => l_return_status);
4026: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
4027: IF P_PA_DEBUG_MODE = 'Y' THEN
4028: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_fp_proj_fplan_options_pkg.Insert_Row: plan_type level');
4029: END IF;
4030: /* error message added to the stack in the table handler; we don't need to do it here */
4031: raise pa_fin_plan_pub.rollback_on_error;
4032: end if;
4031: raise pa_fin_plan_pub.rollback_on_error;
4032: end if;
4033: end if;
4034: /* create planning option for plan VERSION */
4035: IF P_PA_DEBUG_MODE = 'Y' THEN
4036: pa_debug.write_file('Create_Version_OrgFcst: ' || 'creating planning options for PLAN_VERSION level');
4037: END IF;
4038: select pa_proj_fp_options_s.nextVal into l_proj_fin_plan_options_id from dual;
4039: pa_proj_fp_options_pkg.Insert_Row
4032: end if;
4033: end if;
4034: /* create planning option for plan VERSION */
4035: IF P_PA_DEBUG_MODE = 'Y' THEN
4036: pa_debug.write_file('Create_Version_OrgFcst: ' || 'creating planning options for PLAN_VERSION level');
4037: END IF;
4038: select pa_proj_fp_options_s.nextVal into l_proj_fin_plan_options_id from dual;
4039: pa_proj_fp_options_pkg.Insert_Row
4040: (px_proj_fp_options_id => l_proj_fin_plan_options_id,
4060: p_fin_plan_version_id => l_budget_version_id,
4061: x_row_id => l_row_id,
4062: x_return_status => l_return_status);
4063: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
4064: IF P_PA_DEBUG_MODE = 'Y' THEN
4065: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_fp_proj_fplan_options_pkg.Insert_Row: plan_version level');
4066: END IF;
4067: /* error message added to the stack in the table handler; we don't need to do it here */
4068: raise pa_fin_plan_pub.rollback_on_error;
4061: x_row_id => l_row_id,
4062: x_return_status => l_return_status);
4063: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
4064: IF P_PA_DEBUG_MODE = 'Y' THEN
4065: pa_debug.write_file('Create_Version_OrgFcst: ' || 'error with pa_fp_proj_fplan_options_pkg.Insert_Row: plan_version level');
4066: END IF;
4067: /* error message added to the stack in the table handler; we don't need to do it here */
4068: raise pa_fin_plan_pub.rollback_on_error;
4069: end if;
4069: end if;
4070: l_msg_count := FND_MSG_PUB.count_msg;
4071: if l_msg_count = 0 then
4072: x_return_status := FND_API.G_RET_STS_SUCCESS;
4073: pa_debug.reset_err_stack;
4074: else
4075: IF P_PA_DEBUG_MODE = 'Y' THEN
4076: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_msg_count is ' || l_msg_count);
4077: END IF;
4071: if l_msg_count = 0 then
4072: x_return_status := FND_API.G_RET_STS_SUCCESS;
4073: pa_debug.reset_err_stack;
4074: else
4075: IF P_PA_DEBUG_MODE = 'Y' THEN
4076: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_msg_count is ' || l_msg_count);
4077: END IF;
4078: x_return_status := FND_API.G_RET_STS_ERROR;
4079: if l_msg_count > 0 then
4072: x_return_status := FND_API.G_RET_STS_SUCCESS;
4073: pa_debug.reset_err_stack;
4074: else
4075: IF P_PA_DEBUG_MODE = 'Y' THEN
4076: pa_debug.write_file('Create_Version_OrgFcst: ' || 'l_msg_count is ' || l_msg_count);
4077: END IF;
4078: x_return_status := FND_API.G_RET_STS_ERROR;
4079: if l_msg_count > 0 then
4080: if l_msg_count = 1 then
4096: end if;
4097:
4098: exception
4099: when pa_fin_plan_pub.rollback_on_error then
4100: IF P_PA_DEBUG_MODE = 'Y' THEN
4101: pa_debug.write_file('Create_Version_OrgFcst: rollback_on_error exception');
4102: END IF;
4103: rollback to PA_FP_PUB_CREATE_VER_ORGFCST;
4104: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4097:
4098: exception
4099: when pa_fin_plan_pub.rollback_on_error then
4100: IF P_PA_DEBUG_MODE = 'Y' THEN
4101: pa_debug.write_file('Create_Version_OrgFcst: rollback_on_error exception');
4102: END IF;
4103: rollback to PA_FP_PUB_CREATE_VER_ORGFCST;
4104: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4105:
4109: x_msg_count := 1;
4110: x_msg_data := SQLERRM;
4111: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
4112: p_procedure_name => 'Create_Version_OrgFcst');
4113: pa_debug.reset_err_stack;
4114: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4115: end Create_Version_OrgFcst;
4116: /* ------------------------------------------------------------------------- */
4117:
4137: l_org_id NUMBER;
4138:
4139: begin
4140: FND_MSG_PUB.initialize;
4141: IF P_PA_DEBUG_MODE = 'Y' THEN
4142: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Regenerate');
4143: END IF;
4144: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4145: l_debug_mode := NVL(l_debug_mode, 'Y');
4138:
4139: begin
4140: FND_MSG_PUB.initialize;
4141: IF P_PA_DEBUG_MODE = 'Y' THEN
4142: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Regenerate');
4143: END IF;
4144: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4145: l_debug_mode := NVL(l_debug_mode, 'Y');
4146: IF P_PA_DEBUG_MODE = 'Y' THEN
4140: FND_MSG_PUB.initialize;
4141: IF P_PA_DEBUG_MODE = 'Y' THEN
4142: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Regenerate');
4143: END IF;
4144: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4145: l_debug_mode := NVL(l_debug_mode, 'Y');
4146: IF P_PA_DEBUG_MODE = 'Y' THEN
4147: pa_debug.set_process('Regenerate: ' || 'PLSQL','LOG',l_debug_mode);
4148: END IF;
4142: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Regenerate');
4143: END IF;
4144: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4145: l_debug_mode := NVL(l_debug_mode, 'Y');
4146: IF P_PA_DEBUG_MODE = 'Y' THEN
4147: pa_debug.set_process('Regenerate: ' || 'PLSQL','LOG',l_debug_mode);
4148: END IF;
4149: x_msg_count := 0;
4150: /* CHECK FOR BUSINESS RULES VIOLATIONS */
4143: END IF;
4144: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4145: l_debug_mode := NVL(l_debug_mode, 'Y');
4146: IF P_PA_DEBUG_MODE = 'Y' THEN
4147: pa_debug.set_process('Regenerate: ' || 'PLSQL','LOG',l_debug_mode);
4148: END IF;
4149: x_msg_count := 0;
4150: /* CHECK FOR BUSINESS RULES VIOLATIONS */
4151: /* check for null budget_version_id */
4212: x_msg_count := l_msg_count;
4213: else
4214: x_msg_count := l_msg_count;
4215: end if;
4216: pa_debug.reset_err_stack;
4217: return;
4218: end if;
4219:
4220: /* If There are NO Business Rules Violations , Then proceed with Regenerate */
4219:
4220: /* If There are NO Business Rules Violations , Then proceed with Regenerate */
4221: if l_msg_count = 0 then
4222: SAVEPOINT PA_FIN_PLAN_PUB_REGENERATE;
4223: IF P_PA_DEBUG_MODE = 'Y' THEN
4224: pa_debug.write_file('no business logic errors; proceeding with regenerate');
4225: END IF;
4226: /* submit the concurrent request to generate the forecast */
4227: /* will need to FND_REQUEST.set_mode if submit_request is called from database trigger */
4220: /* If There are NO Business Rules Violations , Then proceed with Regenerate */
4221: if l_msg_count = 0 then
4222: SAVEPOINT PA_FIN_PLAN_PUB_REGENERATE;
4223: IF P_PA_DEBUG_MODE = 'Y' THEN
4224: pa_debug.write_file('no business logic errors; proceeding with regenerate');
4225: END IF;
4226: /* submit the concurrent request to generate the forecast */
4227: /* will need to FND_REQUEST.set_mode if submit_request is called from database trigger */
4228:
4228:
4229: /* SUBMIT THE REQUEST ONLY WHEN version_type = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_ORG_FORECAST */
4230: /* Moac changes:4510784 initialize org id before submitting the request for single org context */
4231: MO_GLOBAL.INIT('PA');
4232: If P_PA_DEBUG_MODE = 'Y' THEN
4233: PA_DEBUG.Log_Message(p_message => 'Calling MO_GLOBAL.SET_POLICY_CONTEXT for OrgId:'||l_org_id);
4234: End If;
4235: MO_GLOBAL.SET_POLICY_CONTEXT('S',l_org_id);
4236: FND_REQUEST.SET_ORG_ID(l_org_id);
4229: /* SUBMIT THE REQUEST ONLY WHEN version_type = PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_ORG_FORECAST */
4230: /* Moac changes:4510784 initialize org id before submitting the request for single org context */
4231: MO_GLOBAL.INIT('PA');
4232: If P_PA_DEBUG_MODE = 'Y' THEN
4233: PA_DEBUG.Log_Message(p_message => 'Calling MO_GLOBAL.SET_POLICY_CONTEXT for OrgId:'||l_org_id);
4234: End If;
4235: MO_GLOBAL.SET_POLICY_CONTEXT('S',l_org_id);
4236: FND_REQUEST.SET_ORG_ID(l_org_id);
4237: l_request_id := FND_REQUEST.submit_request
4247: argument5 => NULL,
4248: argument6 => p_budget_version_id);
4249: if l_request_id = 0 then
4250: x_return_status := FND_API.G_RET_STS_ERROR;
4251: IF P_PA_DEBUG_MODE = 'Y' THEN
4252: pa_debug.write_file('Regenerate: ' || 'l_request_id=0; ERROR');
4253: END IF;
4254: /* FND_MESSAGE.RETRIEVE; */
4255: l_msg_data := FND_MESSAGE.GET;
4248: argument6 => p_budget_version_id);
4249: if l_request_id = 0 then
4250: x_return_status := FND_API.G_RET_STS_ERROR;
4251: IF P_PA_DEBUG_MODE = 'Y' THEN
4252: pa_debug.write_file('Regenerate: ' || 'l_request_id=0; ERROR');
4253: END IF;
4254: /* FND_MESSAGE.RETRIEVE; */
4255: l_msg_data := FND_MESSAGE.GET;
4256: IF P_PA_DEBUG_MODE = 'Y' THEN
4252: pa_debug.write_file('Regenerate: ' || 'l_request_id=0; ERROR');
4253: END IF;
4254: /* FND_MESSAGE.RETRIEVE; */
4255: l_msg_data := FND_MESSAGE.GET;
4256: IF P_PA_DEBUG_MODE = 'Y' THEN
4257: pa_debug.write_file('Regenerate: ' || 'the error message is ' || l_msg_data);
4258: END IF;
4259: /* PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
4260: p_msg_name => FND_MESSAGE.GET); */
4253: END IF;
4254: /* FND_MESSAGE.RETRIEVE; */
4255: l_msg_data := FND_MESSAGE.GET;
4256: IF P_PA_DEBUG_MODE = 'Y' THEN
4257: pa_debug.write_file('Regenerate: ' || 'the error message is ' || l_msg_data);
4258: END IF;
4259: /* PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
4260: p_msg_name => FND_MESSAGE.GET); */
4261: l_msg_count := 1;
4272: x_msg_count := l_msg_count;
4273: else
4274: x_msg_count := l_msg_count;
4275: end if;
4276: pa_debug.reset_err_stack;
4277: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4278: else
4279: IF P_PA_DEBUG_MODE = 'Y' THEN
4280: pa_debug.write_file('Regenerate: ' || 'concurrent process submitted successfully; stamping request_id');
4275: end if;
4276: pa_debug.reset_err_stack;
4277: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4278: else
4279: IF P_PA_DEBUG_MODE = 'Y' THEN
4280: pa_debug.write_file('Regenerate: ' || 'concurrent process submitted successfully; stamping request_id');
4281: END IF;
4282: update
4283: pa_budget_versions
4276: pa_debug.reset_err_stack;
4277: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4278: else
4279: IF P_PA_DEBUG_MODE = 'Y' THEN
4280: pa_debug.write_file('Regenerate: ' || 'concurrent process submitted successfully; stamping request_id');
4281: END IF;
4282: update
4283: pa_budget_versions
4284: set
4288: where
4289: budget_version_id = p_budget_version_id;
4290: end if;
4291: x_return_status := FND_API.G_RET_STS_SUCCESS;
4292: pa_debug.reset_err_stack;
4293: end if;
4294:
4295: exception
4296: when pa_fin_plan_pub.rollback_on_error then
4293: end if;
4294:
4295: exception
4296: when pa_fin_plan_pub.rollback_on_error then
4297: IF P_PA_DEBUG_MODE = 'Y' THEN
4298: pa_debug.write_file('Regenerate: rollback_on_error exception');
4299: END IF;
4300: rollback to PA_FIN_PLAN_PUB_REGENERATE;
4301: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4294:
4295: exception
4296: when pa_fin_plan_pub.rollback_on_error then
4297: IF P_PA_DEBUG_MODE = 'Y' THEN
4298: pa_debug.write_file('Regenerate: rollback_on_error exception');
4299: END IF;
4300: rollback to PA_FIN_PLAN_PUB_REGENERATE;
4301: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4302:
4306: x_msg_count := 1;
4307: x_msg_data := SQLERRM;
4308: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
4309: p_procedure_name => 'Regenerate');
4310: pa_debug.reset_err_stack;
4311: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4312: end Regenerate;
4313:
4314: /* ------------------------------------------------------------------------- */
4355: l_return_status VARCHAR2(2000);
4356:
4357: begin
4358: FND_MSG_PUB.initialize;
4359: IF P_PA_DEBUG_MODE = 'Y' THEN
4360: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Update_Version');
4361: END IF;
4362: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4363: l_debug_mode := NVL(l_debug_mode, 'Y');
4356:
4357: begin
4358: FND_MSG_PUB.initialize;
4359: IF P_PA_DEBUG_MODE = 'Y' THEN
4360: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Update_Version');
4361: END IF;
4362: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4363: l_debug_mode := NVL(l_debug_mode, 'Y');
4364: IF P_PA_DEBUG_MODE = 'Y' THEN
4358: FND_MSG_PUB.initialize;
4359: IF P_PA_DEBUG_MODE = 'Y' THEN
4360: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Update_Version');
4361: END IF;
4362: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4363: l_debug_mode := NVL(l_debug_mode, 'Y');
4364: IF P_PA_DEBUG_MODE = 'Y' THEN
4365: pa_debug.set_process('Update_Version: ' || 'PLSQL','LOG',l_debug_mode);
4366: END IF;
4360: pa_debug.init_err_stack('PA_FIN_PLAN_PUB.Update_Version');
4361: END IF;
4362: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4363: l_debug_mode := NVL(l_debug_mode, 'Y');
4364: IF P_PA_DEBUG_MODE = 'Y' THEN
4365: pa_debug.set_process('Update_Version: ' || 'PLSQL','LOG',l_debug_mode);
4366: END IF;
4367: x_msg_count := 0;
4368: /* CHECK FOR BUSINESS RULES VIOLATIONS */
4361: END IF;
4362: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4363: l_debug_mode := NVL(l_debug_mode, 'Y');
4364: IF P_PA_DEBUG_MODE = 'Y' THEN
4365: pa_debug.set_process('Update_Version: ' || 'PLSQL','LOG',l_debug_mode);
4366: END IF;
4367: x_msg_count := 0;
4368: /* CHECK FOR BUSINESS RULES VIOLATIONS */
4369: /* check for null budget_version_id */
4400: x_msg_count := l_msg_count;
4401: else
4402: x_msg_count := l_msg_count;
4403: end if;
4404: pa_debug.reset_err_stack;
4405: return;
4406: end if;
4407:
4408: /* If There are NO Business Rules Violations , Then proceed with Update Version */
4441: WHERE
4442: budget_version_id = p_budget_version_id;
4443: end if;
4444: x_return_status := FND_API.G_RET_STS_SUCCESS;
4445: pa_debug.reset_err_stack;
4446:
4447: exception
4448: when others then
4449: rollback to PA_FIN_PLAN_PUB_UPDATE_VERSION;
4451: x_msg_count := 1;
4452: x_msg_data := SQLERRM;
4453: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
4454: p_procedure_name => 'Update_Version');
4455: pa_debug.reset_err_stack;
4456: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4457: end Update_Version;
4458: /*========================================================================
4459: Bug no.:- 2331201
4524: l_ae_rec l_ae_csr%ROWTYPE;
4525:
4526: begin
4527:
4528: pa_debug.set_err_stack ('PA_FIN_PLAN_PUB.Create_Org_Fcst_Elements');
4529: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4530: l_debug_mode := NVL(l_debug_mode, 'Y');
4531: IF P_PA_DEBUG_MODE = 'Y' THEN
4532: pa_debug.set_process('Create_Org_Fcst_Elements: ' || 'PLSQL','LOG',l_debug_mode);
4525:
4526: begin
4527:
4528: pa_debug.set_err_stack ('PA_FIN_PLAN_PUB.Create_Org_Fcst_Elements');
4529: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4530: l_debug_mode := NVL(l_debug_mode, 'Y');
4531: IF P_PA_DEBUG_MODE = 'Y' THEN
4532: pa_debug.set_process('Create_Org_Fcst_Elements: ' || 'PLSQL','LOG',l_debug_mode);
4533: END IF;
4527:
4528: pa_debug.set_err_stack ('PA_FIN_PLAN_PUB.Create_Org_Fcst_Elements');
4529: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4530: l_debug_mode := NVL(l_debug_mode, 'Y');
4531: IF P_PA_DEBUG_MODE = 'Y' THEN
4532: pa_debug.set_process('Create_Org_Fcst_Elements: ' || 'PLSQL','LOG',l_debug_mode);
4533: END IF;
4534: x_msg_count := 0;
4535:
4528: pa_debug.set_err_stack ('PA_FIN_PLAN_PUB.Create_Org_Fcst_Elements');
4529: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
4530: l_debug_mode := NVL(l_debug_mode, 'Y');
4531: IF P_PA_DEBUG_MODE = 'Y' THEN
4532: pa_debug.set_process('Create_Org_Fcst_Elements: ' || 'PLSQL','LOG',l_debug_mode);
4533: END IF;
4534: x_msg_count := 0;
4535:
4536: /* CHECK FOR BUSINESS RULES VIOLATIONS */
4556: x_msg_count := l_msg_count;
4557: else
4558: x_msg_count := l_msg_count;
4559: end if;
4560: pa_debug.reset_err_stack;
4561: return;
4562: end if;
4563:
4564: /* If there are no Business Rules violations, then continue with Create_Org_Fcst_Elements */
4562: end if;
4563:
4564: /* If there are no Business Rules violations, then continue with Create_Org_Fcst_Elements */
4565: if l_msg_count = 0 then
4566: IF P_PA_DEBUG_MODE = 'Y' THEN
4567: pa_debug.write_file('Create_Org_Fcst_Elements: ' || 'no business violations; continuing with create org fcst elements');
4568: END IF;
4569:
4570: x_return_status := FND_API.G_RET_STS_SUCCESS;
4563:
4564: /* If there are no Business Rules violations, then continue with Create_Org_Fcst_Elements */
4565: if l_msg_count = 0 then
4566: IF P_PA_DEBUG_MODE = 'Y' THEN
4567: pa_debug.write_file('Create_Org_Fcst_Elements: ' || 'no business violations; continuing with create org fcst elements');
4568: END IF;
4569:
4570: x_return_status := FND_API.G_RET_STS_SUCCESS;
4571:
4667:
4668: /* PA_PROJECT_PERIODS_DENORM: Insert a new row for every record whose budget_version_id and
4669: resource_assignment_id match our old ones */
4670: /* key on OBJECT_ID = adj_element_id of the original version */
4671: IF P_PA_DEBUG_MODE = 'Y' THEN
4672: pa_debug.write_file('Create_Org_Fcst_Elements: ' || 'inserting into pa_project_periods_denorm');
4673: END IF;
4674: insert into pa_proj_periods_denorm (
4675: creation_date,
4668: /* PA_PROJECT_PERIODS_DENORM: Insert a new row for every record whose budget_version_id and
4669: resource_assignment_id match our old ones */
4670: /* key on OBJECT_ID = adj_element_id of the original version */
4671: IF P_PA_DEBUG_MODE = 'Y' THEN
4672: pa_debug.write_file('Create_Org_Fcst_Elements: ' || 'inserting into pa_project_periods_denorm');
4673: END IF;
4674: insert into pa_proj_periods_denorm (
4675: creation_date,
4676: created_by,
4833:
4834:
4835:
4836: /* PA_ORG_FCST_ELEMENTS: Insert a new row for each row that contained the old budget version */
4837: IF P_PA_DEBUG_MODE = 'Y' THEN
4838: pa_debug.write_file('Create_Org_Fcst_Elements: ' || 'insert into pa_org_forecast_elements');
4839: END IF;
4840: open l_fe_csr;
4841: loop
4834:
4835:
4836: /* PA_ORG_FCST_ELEMENTS: Insert a new row for each row that contained the old budget version */
4837: IF P_PA_DEBUG_MODE = 'Y' THEN
4838: pa_debug.write_file('Create_Org_Fcst_Elements: ' || 'insert into pa_org_forecast_elements');
4839: END IF;
4840: open l_fe_csr;
4841: loop
4842: /* generate next forecast_element_id into local variable */
4950: end loop; /* PA_ORG_FORECAST_LINES */
4951: close l_fl_csr;
4952: /* PA_PROJECT_PERIODS_DENORM: Insert a new row for every record whose budget_version_id and resource_assignment_id match our old ones */
4953: /* key on OBJECT_ID = forecast_element_id of the original version */
4954: IF P_PA_DEBUG_MODE = 'Y' THEN
4955: pa_debug.write_file('Create_Org_Fcst_Elements: ' || 'inserting into pa_project_periods_denorm');
4956: END IF;
4957: insert into pa_proj_periods_denorm (
4958: creation_date,
4951: close l_fl_csr;
4952: /* PA_PROJECT_PERIODS_DENORM: Insert a new row for every record whose budget_version_id and resource_assignment_id match our old ones */
4953: /* key on OBJECT_ID = forecast_element_id of the original version */
4954: IF P_PA_DEBUG_MODE = 'Y' THEN
4955: pa_debug.write_file('Create_Org_Fcst_Elements: ' || 'inserting into pa_project_periods_denorm');
4956: END IF;
4957: insert into pa_proj_periods_denorm (
4958: creation_date,
4959: created_by,
5110:
5111: end loop; /* l_fe_csr*/
5112: close l_fe_csr;
5113:
5114: pa_debug.reset_err_stack;
5115: end if;
5116:
5117: exception
5118:
5121: x_msg_count := 1;
5122: x_msg_data := SQLERRM;
5123: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
5124: p_procedure_name => 'Create_Org_Fcst_Elements');
5125: pa_debug.reset_err_stack;
5126: raise FND_API.G_EXC_UNEXPECTED_ERROR;
5127:
5128: end create_org_fcst_elements;
5129:
5443:
5444: BEGIN
5445:
5446: FND_MSG_PUB.initialize;
5447: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
5448: l_debug_mode := NVL(l_debug_mode, 'Y');
5449: pa_debug.set_curr_function( p_function => 'Create_Version',
5450: p_debug_mode => l_debug_mode );
5451: x_msg_count := 0;
5445:
5446: FND_MSG_PUB.initialize;
5447: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
5448: l_debug_mode := NVL(l_debug_mode, 'Y');
5449: pa_debug.set_curr_function( p_function => 'Create_Version',
5450: p_debug_mode => l_debug_mode );
5451: x_msg_count := 0;
5452: x_return_status := FND_API.G_RET_STS_SUCCESS;
5453: -- Check for business rules violations
5459: l_pji_rollup_required := 'N';
5460: END IF;
5461:
5462:
5463: IF P_PA_DEBUG_MODE = 'Y' THEN
5464: pa_debug.g_err_stage:='Validating input parameters';
5465: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5466: END IF;
5467:
5460: END IF;
5461:
5462:
5463: IF P_PA_DEBUG_MODE = 'Y' THEN
5464: pa_debug.g_err_stage:='Validating input parameters';
5465: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5466: END IF;
5467:
5468: -- Check if source and target fp option ids are null
5461:
5462:
5463: IF P_PA_DEBUG_MODE = 'Y' THEN
5464: pa_debug.g_err_stage:='Validating input parameters';
5465: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5466: END IF;
5467:
5468: -- Check if source and target fp option ids are null
5469:
5471: (p_fin_plan_type_id IS NULL) OR
5472: (p_version_name IS NULL)
5473: THEN
5474:
5475: IF P_PA_DEBUG_MODE = 'Y' THEN
5476: pa_debug.g_err_stage:='Project_id = '||p_project_id;
5477: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5478: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5472: (p_version_name IS NULL)
5473: THEN
5474:
5475: IF P_PA_DEBUG_MODE = 'Y' THEN
5476: pa_debug.g_err_stage:='Project_id = '||p_project_id;
5477: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5478: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5480: pa_debug.g_err_stage:='Version_name = '||p_version_name;
5473: THEN
5474:
5475: IF P_PA_DEBUG_MODE = 'Y' THEN
5476: pa_debug.g_err_stage:='Project_id = '||p_project_id;
5477: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5478: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5480: pa_debug.g_err_stage:='Version_name = '||p_version_name;
5481: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5474:
5475: IF P_PA_DEBUG_MODE = 'Y' THEN
5476: pa_debug.g_err_stage:='Project_id = '||p_project_id;
5477: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5478: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5480: pa_debug.g_err_stage:='Version_name = '||p_version_name;
5481: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5482: pa_debug.g_err_stage:='Description = '||p_description;
5475: IF P_PA_DEBUG_MODE = 'Y' THEN
5476: pa_debug.g_err_stage:='Project_id = '||p_project_id;
5477: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5478: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5480: pa_debug.g_err_stage:='Version_name = '||p_version_name;
5481: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5482: pa_debug.g_err_stage:='Description = '||p_description;
5483: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5476: pa_debug.g_err_stage:='Project_id = '||p_project_id;
5477: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5478: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5480: pa_debug.g_err_stage:='Version_name = '||p_version_name;
5481: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5482: pa_debug.g_err_stage:='Description = '||p_description;
5483: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5484: END IF;
5477: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5478: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5480: pa_debug.g_err_stage:='Version_name = '||p_version_name;
5481: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5482: pa_debug.g_err_stage:='Description = '||p_description;
5483: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5484: END IF;
5485:
5478: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5480: pa_debug.g_err_stage:='Version_name = '||p_version_name;
5481: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5482: pa_debug.g_err_stage:='Description = '||p_description;
5483: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5484: END IF;
5485:
5486: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
5479: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5480: pa_debug.g_err_stage:='Version_name = '||p_version_name;
5481: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5482: pa_debug.g_err_stage:='Description = '||p_description;
5483: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5484: END IF;
5485:
5486: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
5487: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
5486: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
5487: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
5488:
5489:
5490: IF P_PA_DEBUG_MODE = 'Y' THEN
5491: pa_debug.g_err_stage:='Invalid Arguments Passed';
5492: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5493: END IF;
5494: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
5487: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
5488:
5489:
5490: IF P_PA_DEBUG_MODE = 'Y' THEN
5491: pa_debug.g_err_stage:='Invalid Arguments Passed';
5492: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5493: END IF;
5494: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
5495:
5488:
5489:
5490: IF P_PA_DEBUG_MODE = 'Y' THEN
5491: pa_debug.g_err_stage:='Invalid Arguments Passed';
5492: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5493: END IF;
5494: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
5495:
5496: END IF;
5499: --Throw error
5500: IF (p_calling_context =PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN AND
5501: p_struct_elem_version_id IS NULL) THEN
5502:
5503: IF P_PA_DEBUG_MODE = 'Y' THEN
5504: pa_debug.g_err_stage:='p_struct_elem_version_id in workplan context is'||p_struct_elem_version_id;
5505: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5506: END IF;
5507: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
5500: IF (p_calling_context =PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN AND
5501: p_struct_elem_version_id IS NULL) THEN
5502:
5503: IF P_PA_DEBUG_MODE = 'Y' THEN
5504: pa_debug.g_err_stage:='p_struct_elem_version_id in workplan context is'||p_struct_elem_version_id;
5505: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5506: END IF;
5507: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
5508: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
5501: p_struct_elem_version_id IS NULL) THEN
5502:
5503: IF P_PA_DEBUG_MODE = 'Y' THEN
5504: pa_debug.g_err_stage:='p_struct_elem_version_id in workplan context is'||p_struct_elem_version_id;
5505: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5506: END IF;
5507: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
5508: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
5509: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
5511: END IF;
5512:
5513: --Fetch plan type values
5514:
5515: IF P_PA_DEBUG_MODE = 'Y' THEN
5516: pa_debug.g_err_stage:='Fetching plan type properties';
5517: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5518: END IF;
5519:
5512:
5513: --Fetch plan type values
5514:
5515: IF P_PA_DEBUG_MODE = 'Y' THEN
5516: pa_debug.g_err_stage:='Fetching plan type properties';
5517: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5518: END IF;
5519:
5520: OPEN plan_type_info_cur(p_project_id,p_fin_plan_type_id);
5513: --Fetch plan type values
5514:
5515: IF P_PA_DEBUG_MODE = 'Y' THEN
5516: pa_debug.g_err_stage:='Fetching plan type properties';
5517: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5518: END IF;
5519:
5520: OPEN plan_type_info_cur(p_project_id,p_fin_plan_type_id);
5521: FETCH plan_type_info_cur INTO plan_type_info_rec;
5526: IF ( plan_type_info_rec.fin_plan_preference_code = PA_FP_CONSTANTS_PKG.G_PREF_COST_AND_REV_SEP) AND
5527: (p_element_type IS NULL )
5528: THEN
5529:
5530: IF P_PA_DEBUG_MODE = 'Y' THEN
5531: pa_debug.g_err_stage:='Element_type input can not be null for this plan type';
5532: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5533: END IF;
5534:
5527: (p_element_type IS NULL )
5528: THEN
5529:
5530: IF P_PA_DEBUG_MODE = 'Y' THEN
5531: pa_debug.g_err_stage:='Element_type input can not be null for this plan type';
5532: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5533: END IF;
5534:
5535: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
5528: THEN
5529:
5530: IF P_PA_DEBUG_MODE = 'Y' THEN
5531: pa_debug.g_err_stage:='Element_type input can not be null for this plan type';
5532: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
5533: END IF;
5534:
5535: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
5536: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
5556: ELSE
5557: new_version_info_rec.version_type := p_element_type;
5558: END IF;
5559:
5560: IF P_PA_DEBUG_MODE = 'Y' THEN
5561: pa_debug.g_err_stage:='Element_type = '||new_version_info_rec.version_type;
5562: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5563: END IF;
5564:
5557: new_version_info_rec.version_type := p_element_type;
5558: END IF;
5559:
5560: IF P_PA_DEBUG_MODE = 'Y' THEN
5561: pa_debug.g_err_stage:='Element_type = '||new_version_info_rec.version_type;
5562: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5563: END IF;
5564:
5565: IF ( p_ci_id IS NOT NULL )
5558: END IF;
5559:
5560: IF P_PA_DEBUG_MODE = 'Y' THEN
5561: pa_debug.g_err_stage:='Element_type = '||new_version_info_rec.version_type;
5562: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5563: END IF;
5564:
5565: IF ( p_ci_id IS NOT NULL )
5566: THEN
5610: l_curr_work_ver_exists_flag := 'N';
5611: END IF;
5612: END IF;
5613:
5614: IF P_PA_DEBUG_MODE = 'Y' THEN
5615: pa_debug.g_err_stage:='Parameter validation complete';
5616: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5617: END IF;
5618:
5611: END IF;
5612: END IF;
5613:
5614: IF P_PA_DEBUG_MODE = 'Y' THEN
5615: pa_debug.g_err_stage:='Parameter validation complete';
5616: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5617: END IF;
5618:
5619: -- Derive fin_plan_level_code, resource list id plan version based on element type
5612: END IF;
5613:
5614: IF P_PA_DEBUG_MODE = 'Y' THEN
5615: pa_debug.g_err_stage:='Parameter validation complete';
5616: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5617: END IF;
5618:
5619: -- Derive fin_plan_level_code, resource list id plan version based on element type
5620: IF ( new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_COST )
5633: -- Bug 3658080 copy options info from current working version only for ci versions
5634: IF (p_ci_id is not null) AND
5635: (NVL(p_calling_context,'-99') <> PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN)
5636: THEN
5637: IF P_PA_DEBUG_MODE = 'Y' THEN
5638: pa_debug.g_err_stage:='Assigning values to new_version_info_rec' ;
5639: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5640: END IF;
5641:
5634: IF (p_ci_id is not null) AND
5635: (NVL(p_calling_context,'-99') <> PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN)
5636: THEN
5637: IF P_PA_DEBUG_MODE = 'Y' THEN
5638: pa_debug.g_err_stage:='Assigning values to new_version_info_rec' ;
5639: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5640: END IF;
5641:
5642: -- bug 3658080 l_copy_res_assmt_from_cwv_flag := 'Y';
5635: (NVL(p_calling_context,'-99') <> PA_FP_CONSTANTS_PKG.G_CALLING_MODULE_WORKPLAN)
5636: THEN
5637: IF P_PA_DEBUG_MODE = 'Y' THEN
5638: pa_debug.g_err_stage:='Assigning values to new_version_info_rec' ;
5639: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5640: END IF;
5641:
5642: -- bug 3658080 l_copy_res_assmt_from_cwv_flag := 'Y';
5643:
5653:
5654: IF ( new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_COST )
5655: THEN
5656:
5657: IF P_PA_DEBUG_MODE = 'Y' THEN
5658: pa_debug.g_err_stage:='Element type is COST'||new_version_info_rec.version_type ;
5659: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5660: END IF;
5661:
5654: IF ( new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_COST )
5655: THEN
5656:
5657: IF P_PA_DEBUG_MODE = 'Y' THEN
5658: pa_debug.g_err_stage:='Element type is COST'||new_version_info_rec.version_type ;
5659: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5660: END IF;
5661:
5662: new_version_info_rec.fin_plan_level_code := plan_version_info_rec.cost_fin_plan_level_code;
5655: THEN
5656:
5657: IF P_PA_DEBUG_MODE = 'Y' THEN
5658: pa_debug.g_err_stage:='Element type is COST'||new_version_info_rec.version_type ;
5659: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5660: END IF;
5661:
5662: new_version_info_rec.fin_plan_level_code := plan_version_info_rec.cost_fin_plan_level_code;
5663: new_version_info_rec.time_phased_code := plan_version_info_rec.cost_time_phased_code;
5668: new_version_info_rec.PERIOD_MASK_ID := plan_version_info_rec.cost_PERIOD_MASK_ID;
5669:
5670: ELSIF ( new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_REVENUE ) THEN
5671:
5672: IF P_PA_DEBUG_MODE = 'Y' THEN
5673: pa_debug.g_err_stage:='Element type is REVENUE'||new_version_info_rec.version_type ;
5674: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5675: END IF;
5676:
5669:
5670: ELSIF ( new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_REVENUE ) THEN
5671:
5672: IF P_PA_DEBUG_MODE = 'Y' THEN
5673: pa_debug.g_err_stage:='Element type is REVENUE'||new_version_info_rec.version_type ;
5674: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5675: END IF;
5676:
5677: new_version_info_rec.fin_plan_level_code := plan_version_info_rec.revenue_fin_plan_level_code;
5670: ELSIF ( new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_REVENUE ) THEN
5671:
5672: IF P_PA_DEBUG_MODE = 'Y' THEN
5673: pa_debug.g_err_stage:='Element type is REVENUE'||new_version_info_rec.version_type ;
5674: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5675: END IF;
5676:
5677: new_version_info_rec.fin_plan_level_code := plan_version_info_rec.revenue_fin_plan_level_code;
5678: new_version_info_rec.time_phased_code := plan_version_info_rec.revenue_time_phased_code;
5683: new_version_info_rec.PERIOD_MASK_ID := plan_version_info_rec.rev_PERIOD_MASK_ID;
5684:
5685: ELSE
5686:
5687: IF P_PA_DEBUG_MODE = 'Y' THEN
5688: pa_debug.g_err_stage:='Element type is ALL'||new_version_info_rec.version_type ;
5689: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5690: END IF;
5691:
5684:
5685: ELSE
5686:
5687: IF P_PA_DEBUG_MODE = 'Y' THEN
5688: pa_debug.g_err_stage:='Element type is ALL'||new_version_info_rec.version_type ;
5689: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5690: END IF;
5691:
5692: new_version_info_rec.fin_plan_level_code := plan_version_info_rec.all_fin_plan_level_code;
5685: ELSE
5686:
5687: IF P_PA_DEBUG_MODE = 'Y' THEN
5688: pa_debug.g_err_stage:='Element type is ALL'||new_version_info_rec.version_type ;
5689: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5690: END IF;
5691:
5692: new_version_info_rec.fin_plan_level_code := plan_version_info_rec.all_fin_plan_level_code;
5693: new_version_info_rec.time_phased_code := plan_version_info_rec.all_time_phased_code;
5783: THEN
5784:
5785: new_version_info_rec.resource_list_id := p_resource_list_id;
5786:
5787: IF P_PA_DEBUG_MODE = 'Y' THEN
5788: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
5789: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5790:
5791: pa_debug.g_err_stage:='fetching control flag and uncategorized flag for res list: '|| p_resource_list_id;
5784:
5785: new_version_info_rec.resource_list_id := p_resource_list_id;
5786:
5787: IF P_PA_DEBUG_MODE = 'Y' THEN
5788: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
5789: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5790:
5791: pa_debug.g_err_stage:='fetching control flag and uncategorized flag for res list: '|| p_resource_list_id;
5792: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5785: new_version_info_rec.resource_list_id := p_resource_list_id;
5786:
5787: IF P_PA_DEBUG_MODE = 'Y' THEN
5788: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
5789: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5790:
5791: pa_debug.g_err_stage:='fetching control flag and uncategorized flag for res list: '|| p_resource_list_id;
5792: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5793: END IF;
5787: IF P_PA_DEBUG_MODE = 'Y' THEN
5788: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
5789: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5790:
5791: pa_debug.g_err_stage:='fetching control flag and uncategorized flag for res list: '|| p_resource_list_id;
5792: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5793: END IF;
5794:
5795: -- Add resources automatically flag should be y only for project specific res lists
5788: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
5789: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5790:
5791: pa_debug.g_err_stage:='fetching control flag and uncategorized flag for res list: '|| p_resource_list_id;
5792: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5793: END IF;
5794:
5795: -- Add resources automatically flag should be y only for project specific res lists
5796: SELECT nvl(control_flag,'Y'),
5805:
5806: new_version_info_rec.select_res_auto_flag := 'N';
5807:
5808: ELSE
5809: IF P_PA_DEBUG_MODE = 'Y' THEN
5810: pa_debug.g_err_stage:='Calling PA_CREATE_RESOURCE.CREATE_PROJ_RESOURCE_LIST for res list: '|| p_resource_list_id;
5811: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5812: END IF;
5813: -- Call create_proj_resource_list api for this resource list
5806: new_version_info_rec.select_res_auto_flag := 'N';
5807:
5808: ELSE
5809: IF P_PA_DEBUG_MODE = 'Y' THEN
5810: pa_debug.g_err_stage:='Calling PA_CREATE_RESOURCE.CREATE_PROJ_RESOURCE_LIST for res list: '|| p_resource_list_id;
5811: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5812: END IF;
5813: -- Call create_proj_resource_list api for this resource list
5814:
5807:
5808: ELSE
5809: IF P_PA_DEBUG_MODE = 'Y' THEN
5810: pa_debug.g_err_stage:='Calling PA_CREATE_RESOURCE.CREATE_PROJ_RESOURCE_LIST for res list: '|| p_resource_list_id;
5811: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5812: END IF;
5813: -- Call create_proj_resource_list api for this resource list
5814:
5815: PA_CREATE_RESOURCE.CREATE_PROJ_RESOURCE_LIST (
5826: ELSE -- added for bug 4724017
5827: -- this code block would be executed for all the flows other than the AMG flow.
5828: -- the uncategorized info is required to call pa_fp_planning_transaction_pub.create_default_task_plan_txns
5829: -- conditionally only for uncategorized resource lists only.
5830: IF P_PA_DEBUG_MODE = 'Y' THEN
5831: pa_debug.g_err_stage:='Fetching uncategorized flag when resource list id is not passed';
5832: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5833: END IF;
5834:
5827: -- this code block would be executed for all the flows other than the AMG flow.
5828: -- the uncategorized info is required to call pa_fp_planning_transaction_pub.create_default_task_plan_txns
5829: -- conditionally only for uncategorized resource lists only.
5830: IF P_PA_DEBUG_MODE = 'Y' THEN
5831: pa_debug.g_err_stage:='Fetching uncategorized flag when resource list id is not passed';
5832: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5833: END IF;
5834:
5835: BEGIN
5828: -- the uncategorized info is required to call pa_fp_planning_transaction_pub.create_default_task_plan_txns
5829: -- conditionally only for uncategorized resource lists only.
5830: IF P_PA_DEBUG_MODE = 'Y' THEN
5831: pa_debug.g_err_stage:='Fetching uncategorized flag when resource list id is not passed';
5832: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5833: END IF;
5834:
5835: BEGIN
5836: SELECT nvl(uncategorized_flag,'N')
5837: INTO l_res_list_uncategorized_flag
5838: FROM pa_resource_lists_all_bg
5839: WHERE resource_list_id = new_version_info_rec.resource_list_id;
5840:
5841: IF P_PA_DEBUG_MODE = 'Y' THEN
5842: pa_debug.g_err_stage:='l_res_list_uncategorized_flag: ' || l_res_list_uncategorized_flag;
5843: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5844: END IF;
5845: EXCEPTION
5838: FROM pa_resource_lists_all_bg
5839: WHERE resource_list_id = new_version_info_rec.resource_list_id;
5840:
5841: IF P_PA_DEBUG_MODE = 'Y' THEN
5842: pa_debug.g_err_stage:='l_res_list_uncategorized_flag: ' || l_res_list_uncategorized_flag;
5843: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5844: END IF;
5845: EXCEPTION
5846: WHEN NO_DATA_FOUND THEN
5839: WHERE resource_list_id = new_version_info_rec.resource_list_id;
5840:
5841: IF P_PA_DEBUG_MODE = 'Y' THEN
5842: pa_debug.g_err_stage:='l_res_list_uncategorized_flag: ' || l_res_list_uncategorized_flag;
5843: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5844: END IF;
5845: EXCEPTION
5846: WHEN NO_DATA_FOUND THEN
5847: IF P_PA_DEBUG_MODE = 'Y' THEN
5843: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5844: END IF;
5845: EXCEPTION
5846: WHEN NO_DATA_FOUND THEN
5847: IF P_PA_DEBUG_MODE = 'Y' THEN
5848: pa_debug.g_err_stage:='No uncategorized flag found for the resource list id passed';
5849: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5850: END IF;
5851: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
5844: END IF;
5845: EXCEPTION
5846: WHEN NO_DATA_FOUND THEN
5847: IF P_PA_DEBUG_MODE = 'Y' THEN
5848: pa_debug.g_err_stage:='No uncategorized flag found for the resource list id passed';
5849: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5850: END IF;
5851: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
5852: END; -- bug 4724017 ends.
5845: EXCEPTION
5846: WHEN NO_DATA_FOUND THEN
5847: IF P_PA_DEBUG_MODE = 'Y' THEN
5848: pa_debug.g_err_stage:='No uncategorized flag found for the resource list id passed';
5849: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5850: END IF;
5851: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
5852: END; -- bug 4724017 ends.
5853: END IF;
5895: END IF;
5896: END IF;
5897: END IF; -- p_time_phased_code is not null
5898:
5899: IF P_PA_DEBUG_MODE = 'Y' THEN
5900: pa_debug.g_err_stage:='new_version_info_rec.resource_list_id = '|| new_version_info_rec.resource_list_id || 'new_version_info_rec.time_phased_code = ' || new_version_info_rec.time_phased_code;
5901: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5902: END IF;
5903:
5896: END IF;
5897: END IF; -- p_time_phased_code is not null
5898:
5899: IF P_PA_DEBUG_MODE = 'Y' THEN
5900: pa_debug.g_err_stage:='new_version_info_rec.resource_list_id = '|| new_version_info_rec.resource_list_id || 'new_version_info_rec.time_phased_code = ' || new_version_info_rec.time_phased_code;
5901: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5902: END IF;
5903:
5904: --Start of changes for Bug :- 2570250
5897: END IF; -- p_time_phased_code is not null
5898:
5899: IF P_PA_DEBUG_MODE = 'Y' THEN
5900: pa_debug.g_err_stage:='new_version_info_rec.resource_list_id = '|| new_version_info_rec.resource_list_id || 'new_version_info_rec.time_phased_code = ' || new_version_info_rec.time_phased_code;
5901: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5902: END IF;
5903:
5904: --Start of changes for Bug :- 2570250
5905:
5904: --Start of changes for Bug :- 2570250
5905:
5906: --Fetch the MAX working version for this plan type
5907:
5908: IF P_PA_DEBUG_MODE = 'Y' THEN
5909: pa_debug.g_err_stage:='Fetching max working version number for this plan type';
5910: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5911: END IF;
5912:
5905:
5906: --Fetch the MAX working version for this plan type
5907:
5908: IF P_PA_DEBUG_MODE = 'Y' THEN
5909: pa_debug.g_err_stage:='Fetching max working version number for this plan type';
5910: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5911: END IF;
5912:
5913: PA_FIN_PLAN_UTILS.Get_Max_Budget_Version_Number
5906: --Fetch the MAX working version for this plan type
5907:
5908: IF P_PA_DEBUG_MODE = 'Y' THEN
5909: pa_debug.g_err_stage:='Fetching max working version number for this plan type';
5910: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5911: END IF;
5912:
5913: PA_FIN_PLAN_UTILS.Get_Max_Budget_Version_Number
5914: (p_project_id => p_project_id
5927: END IF;
5928:
5929: --End of changes for Bug :- 2570250
5930:
5931: IF P_PA_DEBUG_MODE = 'Y' THEN
5932: pa_debug.g_err_stage:='l_max_version_number = '|| l_max_version_number ;
5933: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5934: END IF;
5935:
5928:
5929: --End of changes for Bug :- 2570250
5930:
5931: IF P_PA_DEBUG_MODE = 'Y' THEN
5932: pa_debug.g_err_stage:='l_max_version_number = '|| l_max_version_number ;
5933: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5934: END IF;
5935:
5936: -- Start of changes for Bug :- 2650427
5929: --End of changes for Bug :- 2570250
5930:
5931: IF P_PA_DEBUG_MODE = 'Y' THEN
5932: pa_debug.g_err_stage:='l_max_version_number = '|| l_max_version_number ;
5933: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5934: END IF;
5935:
5936: -- Start of changes for Bug :- 2650427
5937:
5974: -- current_version as current_working_version
5975: l_current_working_flag := 'Y';
5976: WHEN OTHERS THEN
5977:
5978: IF P_PA_DEBUG_MODE = 'Y' THEN
5979: pa_debug.g_err_stage:='Error while fetching current_working budget_version_id';
5980: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5981: END IF;
5982: RAISE;
5975: l_current_working_flag := 'Y';
5976: WHEN OTHERS THEN
5977:
5978: IF P_PA_DEBUG_MODE = 'Y' THEN
5979: pa_debug.g_err_stage:='Error while fetching current_working budget_version_id';
5980: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5981: END IF;
5982: RAISE;
5983: END;
5976: WHEN OTHERS THEN
5977:
5978: IF P_PA_DEBUG_MODE = 'Y' THEN
5979: pa_debug.g_err_stage:='Error while fetching current_working budget_version_id';
5980: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5981: END IF;
5982: RAISE;
5983: END;
5984: END IF;
5989: --Fetch new budget version id if budget version id isn't passed
5990:
5991: IF (px_budget_version_id IS NULL) THEN
5992:
5993: IF P_PA_DEBUG_MODE = 'Y' THEN
5994: pa_debug.g_err_stage:='Fetching new budget_version_id';
5995: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5996: END IF;
5997:
5990:
5991: IF (px_budget_version_id IS NULL) THEN
5992:
5993: IF P_PA_DEBUG_MODE = 'Y' THEN
5994: pa_debug.g_err_stage:='Fetching new budget_version_id';
5995: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5996: END IF;
5997:
5998: SELECT pa_budget_versions_s.NEXTVAL
5991: IF (px_budget_version_id IS NULL) THEN
5992:
5993: IF P_PA_DEBUG_MODE = 'Y' THEN
5994: pa_debug.g_err_stage:='Fetching new budget_version_id';
5995: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
5996: END IF;
5997:
5998: SELECT pa_budget_versions_s.NEXTVAL
5999: INTO l_new_budget_version_id
6004:
6005:
6006: --Create a new record in pa_budget_versions using plan type properties
6007:
6008: IF P_PA_DEBUG_MODE = 'Y' THEN
6009: pa_debug.g_err_stage:='Calling budget_versions table handler to insert new row ';
6010: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6011: END IF;
6012:
6005:
6006: --Create a new record in pa_budget_versions using plan type properties
6007:
6008: IF P_PA_DEBUG_MODE = 'Y' THEN
6009: pa_debug.g_err_stage:='Calling budget_versions table handler to insert new row ';
6010: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6011: END IF;
6012:
6013: -- Getting the Use for workplan flag to populate WP_VERSION_FLAG in pa_budget_versions
6006: --Create a new record in pa_budget_versions using plan type properties
6007:
6008: IF P_PA_DEBUG_MODE = 'Y' THEN
6009: pa_debug.g_err_stage:='Calling budget_versions table handler to insert new row ';
6010: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6011: END IF;
6012:
6013: -- Getting the Use for workplan flag to populate WP_VERSION_FLAG in pa_budget_versions
6014: SELECT use_for_workplan_flag
6034: where b.budget_version_id =
6035: nvl(l_ci_apprv_cw_bv_id,l_fin_plan_version_id)
6036: and b.wp_version_flag = 'Y') ;
6037:
6038: IF P_PA_DEBUG_MODE = 'Y' THEN
6039: pa_debug.g_err_stage:='Project_id = '||p_project_id;
6040: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6041: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6035: nvl(l_ci_apprv_cw_bv_id,l_fin_plan_version_id)
6036: and b.wp_version_flag = 'Y') ;
6037:
6038: IF P_PA_DEBUG_MODE = 'Y' THEN
6039: pa_debug.g_err_stage:='Project_id = '||p_project_id;
6040: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6041: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6036: and b.wp_version_flag = 'Y') ;
6037:
6038: IF P_PA_DEBUG_MODE = 'Y' THEN
6039: pa_debug.g_err_stage:='Project_id = '||p_project_id;
6040: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6041: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6037:
6038: IF P_PA_DEBUG_MODE = 'Y' THEN
6039: pa_debug.g_err_stage:='Project_id = '||p_project_id;
6040: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6041: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6045: pa_debug.g_err_stage:='Description = '||p_description;
6038: IF P_PA_DEBUG_MODE = 'Y' THEN
6039: pa_debug.g_err_stage:='Project_id = '||p_project_id;
6040: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6041: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6045: pa_debug.g_err_stage:='Description = '||p_description;
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6039: pa_debug.g_err_stage:='Project_id = '||p_project_id;
6040: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6041: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6045: pa_debug.g_err_stage:='Description = '||p_description;
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6047: pa_debug.g_err_stage:='proj sv id = ' || nvl(p_struct_elem_version_id,new_version_info_rec.project_structure_version_id);
6040: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6041: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6045: pa_debug.g_err_stage:='Description = '||p_description;
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6047: pa_debug.g_err_stage:='proj sv id = ' || nvl(p_struct_elem_version_id,new_version_info_rec.project_structure_version_id);
6048: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6041: pa_debug.g_err_stage:='Fin_plan_type_id = '||p_fin_plan_type_id;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6045: pa_debug.g_err_stage:='Description = '||p_description;
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6047: pa_debug.g_err_stage:='proj sv id = ' || nvl(p_struct_elem_version_id,new_version_info_rec.project_structure_version_id);
6048: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6049: pa_debug.g_err_stage:='calling context = ' || p_calling_context;
6042: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6045: pa_debug.g_err_stage:='Description = '||p_description;
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6047: pa_debug.g_err_stage:='proj sv id = ' || nvl(p_struct_elem_version_id,new_version_info_rec.project_structure_version_id);
6048: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6049: pa_debug.g_err_stage:='calling context = ' || p_calling_context;
6050: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6043: pa_debug.g_err_stage:='Version_name = '||p_version_name;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6045: pa_debug.g_err_stage:='Description = '||p_description;
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6047: pa_debug.g_err_stage:='proj sv id = ' || nvl(p_struct_elem_version_id,new_version_info_rec.project_structure_version_id);
6048: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6049: pa_debug.g_err_stage:='calling context = ' || p_calling_context;
6050: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6051: END IF;
6044: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6045: pa_debug.g_err_stage:='Description = '||p_description;
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6047: pa_debug.g_err_stage:='proj sv id = ' || nvl(p_struct_elem_version_id,new_version_info_rec.project_structure_version_id);
6048: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6049: pa_debug.g_err_stage:='calling context = ' || p_calling_context;
6050: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6051: END IF;
6052:
6045: pa_debug.g_err_stage:='Description = '||p_description;
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6047: pa_debug.g_err_stage:='proj sv id = ' || nvl(p_struct_elem_version_id,new_version_info_rec.project_structure_version_id);
6048: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6049: pa_debug.g_err_stage:='calling context = ' || p_calling_context;
6050: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6051: END IF;
6052:
6053: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
6046: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6047: pa_debug.g_err_stage:='proj sv id = ' || nvl(p_struct_elem_version_id,new_version_info_rec.project_structure_version_id);
6048: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6049: pa_debug.g_err_stage:='calling context = ' || p_calling_context;
6050: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6051: END IF;
6052:
6053: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
6054: p_msg_name => 'DUPLICATE_WP_BEING_CREATED');
6052:
6053: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
6054: p_msg_name => 'DUPLICATE_WP_BEING_CREATED');
6055:
6056: IF P_PA_DEBUG_MODE = 'Y' THEN
6057: pa_debug.g_err_stage:='Invalid Arguments Passed';
6058: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6059: END IF;
6060: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6053: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
6054: p_msg_name => 'DUPLICATE_WP_BEING_CREATED');
6055:
6056: IF P_PA_DEBUG_MODE = 'Y' THEN
6057: pa_debug.g_err_stage:='Invalid Arguments Passed';
6058: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6059: END IF;
6060: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6061: Exception
6054: p_msg_name => 'DUPLICATE_WP_BEING_CREATED');
6055:
6056: IF P_PA_DEBUG_MODE = 'Y' THEN
6057: pa_debug.g_err_stage:='Invalid Arguments Passed';
6058: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6059: END IF;
6060: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6061: Exception
6062: When No_Data_Found Then
6184: );
6185:
6186: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6187:
6188: IF P_PA_DEBUG_MODE = 'Y' THEN
6189: pa_debug.g_err_stage:= 'Could not obtain currency info for the project';
6190: pa_debug.write('Create_Version: ' || l_module_name,
6191: pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
6192: END IF;
6185:
6186: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6187:
6188: IF P_PA_DEBUG_MODE = 'Y' THEN
6189: pa_debug.g_err_stage:= 'Could not obtain currency info for the project';
6190: pa_debug.write('Create_Version: ' || l_module_name,
6191: pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
6192: END IF;
6193: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6186: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6187:
6188: IF P_PA_DEBUG_MODE = 'Y' THEN
6189: pa_debug.g_err_stage:= 'Could not obtain currency info for the project';
6190: pa_debug.write('Create_Version: ' || l_module_name,
6191: pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
6192: END IF;
6193: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6194: END IF;
6187:
6188: IF P_PA_DEBUG_MODE = 'Y' THEN
6189: pa_debug.g_err_stage:= 'Could not obtain currency info for the project';
6190: pa_debug.write('Create_Version: ' || l_module_name,
6191: pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
6192: END IF;
6193: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6194: END IF;
6195:
6212:
6213: IF (l_agreement_currency_code IS NULL) OR
6214: (x_return_status <> FND_API.G_RET_STS_SUCCESS)
6215: THEN
6216: IF P_PA_DEBUG_MODE = 'Y' THEN
6217: pa_debug.g_err_stage:='Agreement_currency_code is null';
6218: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
6219: END IF;
6220: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6213: IF (l_agreement_currency_code IS NULL) OR
6214: (x_return_status <> FND_API.G_RET_STS_SUCCESS)
6215: THEN
6216: IF P_PA_DEBUG_MODE = 'Y' THEN
6217: pa_debug.g_err_stage:='Agreement_currency_code is null';
6218: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
6219: END IF;
6220: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6221: END IF;
6214: (x_return_status <> FND_API.G_RET_STS_SUCCESS)
6215: THEN
6216: IF P_PA_DEBUG_MODE = 'Y' THEN
6217: pa_debug.g_err_stage:='Agreement_currency_code is null';
6218: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
6219: END IF;
6220: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
6221: END IF;
6222:
6229: -- Create record in PA_PROJ_FP_OPTIONS
6230: -- Calling create_fp_options api to create new record for the created plan version
6231:
6232:
6233: IF P_PA_DEBUG_MODE = 'Y' THEN
6234: pa_debug.g_err_stage:='Calling create_fp_option api';
6235: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6236: END IF;
6237:
6230: -- Calling create_fp_options api to create new record for the created plan version
6231:
6232:
6233: IF P_PA_DEBUG_MODE = 'Y' THEN
6234: pa_debug.g_err_stage:='Calling create_fp_option api';
6235: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6236: END IF;
6237:
6238: PA_PROJ_FP_OPTIONS_PUB.create_fp_option (
6231:
6232:
6233: IF P_PA_DEBUG_MODE = 'Y' THEN
6234: pa_debug.g_err_stage:='Calling create_fp_option api';
6235: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6236: END IF;
6237:
6238: PA_PROJ_FP_OPTIONS_PUB.create_fp_option (
6239: px_target_proj_fp_option_id => l_new_proj_fp_options_id
6316: END IF;
6317:
6318: ELSE
6319:
6320: IF P_PA_DEBUG_MODE = 'Y' THEN
6321: pa_debug.g_err_stage:='Calling COPY_FP_TXN_CURRENCIES api';
6322: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6323: END IF;
6324:
6317:
6318: ELSE
6319:
6320: IF P_PA_DEBUG_MODE = 'Y' THEN
6321: pa_debug.g_err_stage:='Calling COPY_FP_TXN_CURRENCIES api';
6322: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6323: END IF;
6324:
6325: PA_FP_TXN_CURRENCIES_PUB.COPY_FP_TXN_CURRENCIES (
6318: ELSE
6319:
6320: IF P_PA_DEBUG_MODE = 'Y' THEN
6321: pa_debug.g_err_stage:='Calling COPY_FP_TXN_CURRENCIES api';
6322: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6323: END IF;
6324:
6325: PA_FP_TXN_CURRENCIES_PUB.COPY_FP_TXN_CURRENCIES (
6326: p_source_fp_option_id => new_version_info_rec.source_fp_options_id
6343: /* FP M - Reporting lines integration */
6344: l_budget_version_ids.delete;
6345: l_budget_version_ids := SYSTEM.pa_num_tbl_type(l_new_budget_version_id);
6346:
6347: IF P_PA_DEBUG_MODE = 'Y' THEN
6348: pa_debug.write('Create_Version: ' || l_module_name,'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_CREATE ' ,5);
6349: pa_debug.write('Create_Version: ' || l_module_name,'p_fp_version_ids count '|| l_budget_version_ids.count(),5);
6350: END IF;
6351:
6344: l_budget_version_ids.delete;
6345: l_budget_version_ids := SYSTEM.pa_num_tbl_type(l_new_budget_version_id);
6346:
6347: IF P_PA_DEBUG_MODE = 'Y' THEN
6348: pa_debug.write('Create_Version: ' || l_module_name,'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_CREATE ' ,5);
6349: pa_debug.write('Create_Version: ' || l_module_name,'p_fp_version_ids count '|| l_budget_version_ids.count(),5);
6350: END IF;
6351:
6352: /* We are sure that there is only one record. But just looping the std way */
6345: l_budget_version_ids := SYSTEM.pa_num_tbl_type(l_new_budget_version_id);
6346:
6347: IF P_PA_DEBUG_MODE = 'Y' THEN
6348: pa_debug.write('Create_Version: ' || l_module_name,'Calling PJI_FM_XBS_ACCUM_MAINT.PLAN_CREATE ' ,5);
6349: pa_debug.write('Create_Version: ' || l_module_name,'p_fp_version_ids count '|| l_budget_version_ids.count(),5);
6350: END IF;
6351:
6352: /* We are sure that there is only one record. But just looping the std way */
6353: FOR I in l_budget_version_ids.first..l_budget_version_ids.last LOOP
6350: END IF;
6351:
6352: /* We are sure that there is only one record. But just looping the std way */
6353: FOR I in l_budget_version_ids.first..l_budget_version_ids.last LOOP
6354: pa_debug.write('Create_Version: ' || l_module_name,''|| l_budget_version_ids(i),5);
6355: END LOOP;
6356:
6357: PJI_FM_XBS_ACCUM_MAINT.PLAN_CREATE (
6358: p_fp_version_ids => l_budget_version_ids,
6546: -- added for bug 4724017:
6547: -- Creation of default planning transaction is not done for versions
6548: -- being created with categorized resource list.
6549: IF l_res_list_uncategorized_flag = 'Y' THEN
6550: IF P_PA_DEBUG_MODE = 'Y' THEN
6551: pa_debug.g_err_stage:='Calling create_default_task_plan_txns api';
6552: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6553: END IF;
6554:
6547: -- Creation of default planning transaction is not done for versions
6548: -- being created with categorized resource list.
6549: IF l_res_list_uncategorized_flag = 'Y' THEN
6550: IF P_PA_DEBUG_MODE = 'Y' THEN
6551: pa_debug.g_err_stage:='Calling create_default_task_plan_txns api';
6552: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6553: END IF;
6554:
6555: pa_fp_planning_transaction_pub.create_default_task_plan_txns
6548: -- being created with categorized resource list.
6549: IF l_res_list_uncategorized_flag = 'Y' THEN
6550: IF P_PA_DEBUG_MODE = 'Y' THEN
6551: pa_debug.g_err_stage:='Calling create_default_task_plan_txns api';
6552: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6553: END IF;
6554:
6555: pa_fp_planning_transaction_pub.create_default_task_plan_txns
6556: ( p_budget_version_id => l_new_budget_version_id
6572: ELSE
6573: l_src_bv_id_for_copying_ra := l_ci_apprv_cw_bv_id ;
6574: END IF;
6575:
6576: IF P_PA_DEBUG_MODE = 'Y' THEN
6577: pa_debug.g_err_stage:='Calling copy_resource_assignments api';
6578: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6579: END IF;
6580:
6573: l_src_bv_id_for_copying_ra := l_ci_apprv_cw_bv_id ;
6574: END IF;
6575:
6576: IF P_PA_DEBUG_MODE = 'Y' THEN
6577: pa_debug.g_err_stage:='Calling copy_resource_assignments api';
6578: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6579: END IF;
6580:
6581: pa_fp_copy_from_pkg.copy_resource_assignments
6574: END IF;
6575:
6576: IF P_PA_DEBUG_MODE = 'Y' THEN
6577: pa_debug.g_err_stage:='Calling copy_resource_assignments api';
6578: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6579: END IF;
6580:
6581: pa_fp_copy_from_pkg.copy_resource_assignments
6582: ( p_source_plan_version_id => l_src_bv_id_for_copying_ra
6657:
6658: ELSE
6659: -- Create resource assignments for the budget version and the impacted task id
6660:
6661: IF P_PA_DEBUG_MODE = 'Y' THEN
6662: pa_debug.g_err_stage:='Calling Create_CI_Resource_Assignments';
6663: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6664: END IF;
6665:
6658: ELSE
6659: -- Create resource assignments for the budget version and the impacted task id
6660:
6661: IF P_PA_DEBUG_MODE = 'Y' THEN
6662: pa_debug.g_err_stage:='Calling Create_CI_Resource_Assignments';
6663: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6664: END IF;
6665:
6666: PA_FP_ELEMENTS_PUB.Create_CI_Resource_Assignments
6659: -- Create resource assignments for the budget version and the impacted task id
6660:
6661: IF P_PA_DEBUG_MODE = 'Y' THEN
6662: pa_debug.g_err_stage:='Calling Create_CI_Resource_Assignments';
6663: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6664: END IF;
6665:
6666: PA_FP_ELEMENTS_PUB.Create_CI_Resource_Assignments
6667: ( p_project_id => p_project_id
6694: x_msg_data => l_msg_data);
6695:
6696: IF l_return_status <> FND_API.G_RET_STS_SUCCESS
6697: THEN
6698: IF p_pa_debug_mode = 'Y' THEN
6699: pa_debug.write_file('Failed due to error in PA_FIN_PLAN_PUB.create_default_plan_txn_rec',5);
6700: END IF;
6701: raise PA_FP_CONSTANTS_PKG.INVALID_ARG_EXC;
6702: END IF;
6695:
6696: IF l_return_status <> FND_API.G_RET_STS_SUCCESS
6697: THEN
6698: IF p_pa_debug_mode = 'Y' THEN
6699: pa_debug.write_file('Failed due to error in PA_FIN_PLAN_PUB.create_default_plan_txn_rec',5);
6700: END IF;
6701: raise PA_FP_CONSTANTS_PKG.INVALID_ARG_EXC;
6702: END IF;
6703: -- End of changes for Bug :- 2649474
6702: END IF;
6703: -- End of changes for Bug :- 2649474
6704:
6705:
6706: IF P_PA_DEBUG_MODE = 'Y' THEN
6707: pa_debug.g_err_stage:='Exiting Create_Version';
6708: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6709: END IF;
6710:
6703: -- End of changes for Bug :- 2649474
6704:
6705:
6706: IF P_PA_DEBUG_MODE = 'Y' THEN
6707: pa_debug.g_err_stage:='Exiting Create_Version';
6708: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6709: END IF;
6710:
6711: --Return the out parameters
6704:
6705:
6706: IF P_PA_DEBUG_MODE = 'Y' THEN
6707: pa_debug.g_err_stage:='Exiting Create_Version';
6708: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6709: END IF;
6710:
6711: --Return the out parameters
6712:
6715: x_proj_fp_option_id := l_new_proj_fp_options_id;
6716:
6717: --Reset the error stack
6718:
6719: pa_debug.reset_curr_function;
6720:
6721: EXCEPTION
6722:
6723: WHEN PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc THEN
6735: ELSE
6736: x_msg_count := l_msg_count;
6737: END IF;
6738: x_return_status := FND_API.G_RET_STS_ERROR;
6739: -- pa_debug.g_err_stage:='Invalid Arguments Passed';
6740: -- pa_debug.write(l_module_name,pa_debug.g_err_stage,5);
6741: pa_debug.reset_curr_function;
6742: RETURN;
6743:
6736: x_msg_count := l_msg_count;
6737: END IF;
6738: x_return_status := FND_API.G_RET_STS_ERROR;
6739: -- pa_debug.g_err_stage:='Invalid Arguments Passed';
6740: -- pa_debug.write(l_module_name,pa_debug.g_err_stage,5);
6741: pa_debug.reset_curr_function;
6742: RETURN;
6743:
6744: WHEN Others THEN
6737: END IF;
6738: x_return_status := FND_API.G_RET_STS_ERROR;
6739: -- pa_debug.g_err_stage:='Invalid Arguments Passed';
6740: -- pa_debug.write(l_module_name,pa_debug.g_err_stage,5);
6741: pa_debug.reset_curr_function;
6742: RETURN;
6743:
6744: WHEN Others THEN
6745: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6746: x_msg_count := 1;
6747: x_msg_data := SQLERRM;
6748: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
6749: ,p_procedure_name => 'CREATE_VERSION');
6750: IF P_PA_DEBUG_MODE = 'Y' THEN
6751: pa_debug.g_err_stage:='Unexpected Error ' || SQLERRM;
6752: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6753: END IF;
6754: pa_debug.reset_curr_function;
6747: x_msg_data := SQLERRM;
6748: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
6749: ,p_procedure_name => 'CREATE_VERSION');
6750: IF P_PA_DEBUG_MODE = 'Y' THEN
6751: pa_debug.g_err_stage:='Unexpected Error ' || SQLERRM;
6752: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6753: END IF;
6754: pa_debug.reset_curr_function;
6755: RAISE;
6748: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
6749: ,p_procedure_name => 'CREATE_VERSION');
6750: IF P_PA_DEBUG_MODE = 'Y' THEN
6751: pa_debug.g_err_stage:='Unexpected Error ' || SQLERRM;
6752: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6753: END IF;
6754: pa_debug.reset_curr_function;
6755: RAISE;
6756:
6750: IF P_PA_DEBUG_MODE = 'Y' THEN
6751: pa_debug.g_err_stage:='Unexpected Error ' || SQLERRM;
6752: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,5);
6753: END IF;
6754: pa_debug.reset_curr_function;
6755: RAISE;
6756:
6757: END Create_Version;
6758:
6858: -- l_end_period_start_date pa_periods.end_date%TYPE;
6859:
6860: BEGIN
6861: /*
6862: pa_debug.g_err_stage := 'Entered get_profile_start_date';
6863: IF P_PA_DEBUG_MODE = 'Y' THEN
6864: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6865: END IF;
6866: pa_debug.g_err_stage := 'p_profile_end_date = ' || p_profile_end_date;
6859:
6860: BEGIN
6861: /*
6862: pa_debug.g_err_stage := 'Entered get_profile_start_date';
6863: IF P_PA_DEBUG_MODE = 'Y' THEN
6864: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6865: END IF;
6866: pa_debug.g_err_stage := 'p_profile_end_date = ' || p_profile_end_date;
6867: IF P_PA_DEBUG_MODE = 'Y' THEN
6860: BEGIN
6861: /*
6862: pa_debug.g_err_stage := 'Entered get_profile_start_date';
6863: IF P_PA_DEBUG_MODE = 'Y' THEN
6864: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6865: END IF;
6866: pa_debug.g_err_stage := 'p_profile_end_date = ' || p_profile_end_date;
6867: IF P_PA_DEBUG_MODE = 'Y' THEN
6868: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6862: pa_debug.g_err_stage := 'Entered get_profile_start_date';
6863: IF P_PA_DEBUG_MODE = 'Y' THEN
6864: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6865: END IF;
6866: pa_debug.g_err_stage := 'p_profile_end_date = ' || p_profile_end_date;
6867: IF P_PA_DEBUG_MODE = 'Y' THEN
6868: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6869: END IF;
6870: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6863: IF P_PA_DEBUG_MODE = 'Y' THEN
6864: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6865: END IF;
6866: pa_debug.g_err_stage := 'p_profile_end_date = ' || p_profile_end_date;
6867: IF P_PA_DEBUG_MODE = 'Y' THEN
6868: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6869: END IF;
6870: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6871: IF P_PA_DEBUG_MODE = 'Y' THEN
6864: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6865: END IF;
6866: pa_debug.g_err_stage := 'p_profile_end_date = ' || p_profile_end_date;
6867: IF P_PA_DEBUG_MODE = 'Y' THEN
6868: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6869: END IF;
6870: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6871: IF P_PA_DEBUG_MODE = 'Y' THEN
6872: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6866: pa_debug.g_err_stage := 'p_profile_end_date = ' || p_profile_end_date;
6867: IF P_PA_DEBUG_MODE = 'Y' THEN
6868: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6869: END IF;
6870: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6871: IF P_PA_DEBUG_MODE = 'Y' THEN
6872: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6873: END IF;
6874: */
6867: IF P_PA_DEBUG_MODE = 'Y' THEN
6868: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6869: END IF;
6870: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6871: IF P_PA_DEBUG_MODE = 'Y' THEN
6872: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6873: END IF;
6874: */
6875: IF p_period_type = PA_FP_CONSTANTS_PKG.G_PERIOD_TYPE_PA THEN
6868: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6869: END IF;
6870: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6871: IF P_PA_DEBUG_MODE = 'Y' THEN
6872: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6873: END IF;
6874: */
6875: IF p_period_type = PA_FP_CONSTANTS_PKG.G_PERIOD_TYPE_PA THEN
6876:
6885: EXCEPTION
6886: WHEN NO_DATA_FOUND THEN
6887: --IF no such period existing select the first available period
6888: /*
6889: pa_debug.g_err_stage := 'Fetching MIN of start date as profile start date';
6890: IF P_PA_DEBUG_MODE = 'Y' THEN
6891: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6892: END IF;
6893: */
6886: WHEN NO_DATA_FOUND THEN
6887: --IF no such period existing select the first available period
6888: /*
6889: pa_debug.g_err_stage := 'Fetching MIN of start date as profile start date';
6890: IF P_PA_DEBUG_MODE = 'Y' THEN
6891: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6892: END IF;
6893: */
6894: SELECT MIN(start_date)
6887: --IF no such period existing select the first available period
6888: /*
6889: pa_debug.g_err_stage := 'Fetching MIN of start date as profile start date';
6890: IF P_PA_DEBUG_MODE = 'Y' THEN
6891: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6892: END IF;
6893: */
6894: SELECT MIN(start_date)
6895: INTO l_profile_start_date
6919: EXCEPTION
6920: WHEN NO_DATA_FOUND THEN
6921: --IF no such period existing select the first available period
6922: /*
6923: pa_debug.g_err_stage := 'Fetching the first available period';
6924: IF P_PA_DEBUG_MODE = 'Y' THEN
6925: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6926: END IF;
6927: */
6920: WHEN NO_DATA_FOUND THEN
6921: --IF no such period existing select the first available period
6922: /*
6923: pa_debug.g_err_stage := 'Fetching the first available period';
6924: IF P_PA_DEBUG_MODE = 'Y' THEN
6925: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6926: END IF;
6927: */
6928: SELECT MIN(start_date)
6921: --IF no such period existing select the first available period
6922: /*
6923: pa_debug.g_err_stage := 'Fetching the first available period';
6924: IF P_PA_DEBUG_MODE = 'Y' THEN
6925: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6926: END IF;
6927: */
6928: SELECT MIN(start_date)
6929: INTO l_profile_start_date
6936: END IF;
6937:
6938: x_profile_start_date := l_profile_start_date;
6939:
6940: pa_debug.g_err_stage := 'Exiting Get_Profile_Start_Date';
6941: IF P_PA_DEBUG_MODE = 'Y' THEN
6942: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6943: END IF;
6944:
6937:
6938: x_profile_start_date := l_profile_start_date;
6939:
6940: pa_debug.g_err_stage := 'Exiting Get_Profile_Start_Date';
6941: IF P_PA_DEBUG_MODE = 'Y' THEN
6942: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6943: END IF;
6944:
6945: EXCEPTION
6938: x_profile_start_date := l_profile_start_date;
6939:
6940: pa_debug.g_err_stage := 'Exiting Get_Profile_Start_Date';
6941: IF P_PA_DEBUG_MODE = 'Y' THEN
6942: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6943: END IF;
6944:
6945: EXCEPTION
6946:
6949: x_msg_count := 1;
6950: x_msg_data := SQLERRM;
6951: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
6952: ,p_procedure_name => 'Get_Profile_Start_Date');
6953: pa_debug.g_err_stage:='Unexpected Error' || SQLERRM;
6954: IF P_PA_DEBUG_MODE = 'Y' THEN
6955: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,5);
6956: END IF;
6957: RAISE;
6950: x_msg_data := SQLERRM;
6951: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
6952: ,p_procedure_name => 'Get_Profile_Start_Date');
6953: pa_debug.g_err_stage:='Unexpected Error' || SQLERRM;
6954: IF P_PA_DEBUG_MODE = 'Y' THEN
6955: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,5);
6956: END IF;
6957: RAISE;
6958:
6951: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
6952: ,p_procedure_name => 'Get_Profile_Start_Date');
6953: pa_debug.g_err_stage:='Unexpected Error' || SQLERRM;
6954: IF P_PA_DEBUG_MODE = 'Y' THEN
6955: pa_debug.write('Get_Profile_Start_Date: ' || l_module_name,pa_debug.g_err_stage,5);
6956: END IF;
6957: RAISE;
6958:
6959: END Get_Profile_Start_Date;
6971: AS
6972: l_profile_end_date pa_periods.end_date%TYPE;
6973: BEGIN
6974: /*
6975: pa_debug.g_err_stage := 'Entered get_profile_end_date';
6976: IF P_PA_DEBUG_MODE = 'Y' THEN
6977: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6978: END IF;
6979: pa_debug.g_err_stage := 'p_profile_start_date = ' || p_profile_start_date;
6972: l_profile_end_date pa_periods.end_date%TYPE;
6973: BEGIN
6974: /*
6975: pa_debug.g_err_stage := 'Entered get_profile_end_date';
6976: IF P_PA_DEBUG_MODE = 'Y' THEN
6977: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6978: END IF;
6979: pa_debug.g_err_stage := 'p_profile_start_date = ' || p_profile_start_date;
6980: IF P_PA_DEBUG_MODE = 'Y' THEN
6973: BEGIN
6974: /*
6975: pa_debug.g_err_stage := 'Entered get_profile_end_date';
6976: IF P_PA_DEBUG_MODE = 'Y' THEN
6977: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6978: END IF;
6979: pa_debug.g_err_stage := 'p_profile_start_date = ' || p_profile_start_date;
6980: IF P_PA_DEBUG_MODE = 'Y' THEN
6981: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6975: pa_debug.g_err_stage := 'Entered get_profile_end_date';
6976: IF P_PA_DEBUG_MODE = 'Y' THEN
6977: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6978: END IF;
6979: pa_debug.g_err_stage := 'p_profile_start_date = ' || p_profile_start_date;
6980: IF P_PA_DEBUG_MODE = 'Y' THEN
6981: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6982: END IF;
6983: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6976: IF P_PA_DEBUG_MODE = 'Y' THEN
6977: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6978: END IF;
6979: pa_debug.g_err_stage := 'p_profile_start_date = ' || p_profile_start_date;
6980: IF P_PA_DEBUG_MODE = 'Y' THEN
6981: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6982: END IF;
6983: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6984: IF P_PA_DEBUG_MODE = 'Y' THEN
6977: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6978: END IF;
6979: pa_debug.g_err_stage := 'p_profile_start_date = ' || p_profile_start_date;
6980: IF P_PA_DEBUG_MODE = 'Y' THEN
6981: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6982: END IF;
6983: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6984: IF P_PA_DEBUG_MODE = 'Y' THEN
6985: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6979: pa_debug.g_err_stage := 'p_profile_start_date = ' || p_profile_start_date;
6980: IF P_PA_DEBUG_MODE = 'Y' THEN
6981: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6982: END IF;
6983: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6984: IF P_PA_DEBUG_MODE = 'Y' THEN
6985: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6986: END IF;
6987: */
6980: IF P_PA_DEBUG_MODE = 'Y' THEN
6981: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6982: END IF;
6983: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6984: IF P_PA_DEBUG_MODE = 'Y' THEN
6985: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6986: END IF;
6987: */
6988: IF p_period_type = PA_FP_CONSTANTS_PKG.G_PERIOD_TYPE_GL THEN
6981: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6982: END IF;
6983: pa_debug.g_err_stage := 'p_period_type = ' || p_period_type;
6984: IF P_PA_DEBUG_MODE = 'Y' THEN
6985: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
6986: END IF;
6987: */
6988: IF p_period_type = PA_FP_CONSTANTS_PKG.G_PERIOD_TYPE_GL THEN
6989:
7008: EXCEPTION
7009: WHEN NO_DATA_FOUND THEN
7010: --IF no such period existing select the last available period
7011: /*
7012: pa_debug.g_err_stage := 'Fetching last period available';
7013: IF P_PA_DEBUG_MODE = 'Y' THEN
7014: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7015: END IF;
7016: */
7009: WHEN NO_DATA_FOUND THEN
7010: --IF no such period existing select the last available period
7011: /*
7012: pa_debug.g_err_stage := 'Fetching last period available';
7013: IF P_PA_DEBUG_MODE = 'Y' THEN
7014: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7015: END IF;
7016: */
7017: SELECT MAX(end_date)
7010: --IF no such period existing select the last available period
7011: /*
7012: pa_debug.g_err_stage := 'Fetching last period available';
7013: IF P_PA_DEBUG_MODE = 'Y' THEN
7014: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7015: END IF;
7016: */
7017: SELECT MAX(end_date)
7018: INTO l_profile_end_date
7028: BEGIN
7029: --Fetch the start date of the period in to which p_profile_start_date falls
7030: --Select the 51st period's start date from start period as profile end date
7031:
7032: pa_debug.g_err_stage := 'Fetching profile end date';
7033: IF P_PA_DEBUG_MODE = 'Y' THEN
7034: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7035: END IF;
7036:
7029: --Fetch the start date of the period in to which p_profile_start_date falls
7030: --Select the 51st period's start date from start period as profile end date
7031:
7032: pa_debug.g_err_stage := 'Fetching profile end date';
7033: IF P_PA_DEBUG_MODE = 'Y' THEN
7034: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7035: END IF;
7036:
7037: SELECT end_date
7030: --Select the 51st period's start date from start period as profile end date
7031:
7032: pa_debug.g_err_stage := 'Fetching profile end date';
7033: IF P_PA_DEBUG_MODE = 'Y' THEN
7034: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7035: END IF;
7036:
7037: SELECT end_date
7038: INTO l_profile_end_date
7045: WHEN NO_DATA_FOUND THEN
7046:
7047: --IF no such period existing select the last available period
7048: /*
7049: pa_debug.g_err_stage := 'Fetching last available period';
7050: IF P_PA_DEBUG_MODE = 'Y' THEN
7051: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7052: END IF;
7053: */
7046:
7047: --IF no such period existing select the last available period
7048: /*
7049: pa_debug.g_err_stage := 'Fetching last available period';
7050: IF P_PA_DEBUG_MODE = 'Y' THEN
7051: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7052: END IF;
7053: */
7054: SELECT MAX(end_date)
7047: --IF no such period existing select the last available period
7048: /*
7049: pa_debug.g_err_stage := 'Fetching last available period';
7050: IF P_PA_DEBUG_MODE = 'Y' THEN
7051: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7052: END IF;
7053: */
7054: SELECT MAX(end_date)
7055: INTO l_profile_end_date
7058: END IF;
7059:
7060: x_profile_end_date := l_profile_end_date;
7061:
7062: pa_debug.g_err_stage := 'Exiting Get_Profile_End_Date';
7063: IF P_PA_DEBUG_MODE = 'Y' THEN
7064: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7065: END IF;
7066:
7059:
7060: x_profile_end_date := l_profile_end_date;
7061:
7062: pa_debug.g_err_stage := 'Exiting Get_Profile_End_Date';
7063: IF P_PA_DEBUG_MODE = 'Y' THEN
7064: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7065: END IF;
7066:
7067: EXCEPTION
7060: x_profile_end_date := l_profile_end_date;
7061:
7062: pa_debug.g_err_stage := 'Exiting Get_Profile_End_Date';
7063: IF P_PA_DEBUG_MODE = 'Y' THEN
7064: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,3);
7065: END IF;
7066:
7067: EXCEPTION
7068:
7071: x_msg_count := 1;
7072: x_msg_data := SQLERRM;
7073: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
7074: ,p_procedure_name => 'Get_Profile_End_Date');
7075: pa_debug.g_err_stage:='Unexpected Error' ||SQLERRM;
7076: IF P_PA_DEBUG_MODE = 'Y' THEN
7077: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,5);
7078: END IF;
7079: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7072: x_msg_data := SQLERRM;
7073: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
7074: ,p_procedure_name => 'Get_Profile_End_Date');
7075: pa_debug.g_err_stage:='Unexpected Error' ||SQLERRM;
7076: IF P_PA_DEBUG_MODE = 'Y' THEN
7077: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,5);
7078: END IF;
7079: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7080:
7073: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
7074: ,p_procedure_name => 'Get_Profile_End_Date');
7075: pa_debug.g_err_stage:='Unexpected Error' ||SQLERRM;
7076: IF P_PA_DEBUG_MODE = 'Y' THEN
7077: pa_debug.write('Get_Profile_End_Date: ' || l_module_name,pa_debug.g_err_stage,5);
7078: END IF;
7079: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7080:
7081: END Get_Profile_End_Date;
7127:
7128: x_msg_count := 0;
7129: x_return_status := FND_API.G_RET_STS_SUCCESS;
7130:
7131: pa_debug.set_err_stack('Create_Fresh_Period_Profile');
7132: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
7133: l_debug_mode := NVL(l_debug_mode, 'Y');
7134: IF P_PA_DEBUG_MODE = 'Y' THEN
7135: pa_debug.set_process('Create_Fresh_Period_Profile: ' || 'PLSQL','LOG',l_debug_mode);
7128: x_msg_count := 0;
7129: x_return_status := FND_API.G_RET_STS_SUCCESS;
7130:
7131: pa_debug.set_err_stack('Create_Fresh_Period_Profile');
7132: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
7133: l_debug_mode := NVL(l_debug_mode, 'Y');
7134: IF P_PA_DEBUG_MODE = 'Y' THEN
7135: pa_debug.set_process('Create_Fresh_Period_Profile: ' || 'PLSQL','LOG',l_debug_mode);
7136: END IF;
7130:
7131: pa_debug.set_err_stack('Create_Fresh_Period_Profile');
7132: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
7133: l_debug_mode := NVL(l_debug_mode, 'Y');
7134: IF P_PA_DEBUG_MODE = 'Y' THEN
7135: pa_debug.set_process('Create_Fresh_Period_Profile: ' || 'PLSQL','LOG',l_debug_mode);
7136: END IF;
7137:
7138: -- Check if source project id is NULL,if so throw an error message
7131: pa_debug.set_err_stack('Create_Fresh_Period_Profile');
7132: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
7133: l_debug_mode := NVL(l_debug_mode, 'Y');
7134: IF P_PA_DEBUG_MODE = 'Y' THEN
7135: pa_debug.set_process('Create_Fresh_Period_Profile: ' || 'PLSQL','LOG',l_debug_mode);
7136: END IF;
7137:
7138: -- Check if source project id is NULL,if so throw an error message
7139:
7136: END IF;
7137:
7138: -- Check if source project id is NULL,if so throw an error message
7139:
7140: pa_debug.g_err_stage := 'Checking for valid parameters:';
7141: IF P_PA_DEBUG_MODE = 'Y' THEN
7142: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7143: END IF;
7144:
7137:
7138: -- Check if source project id is NULL,if so throw an error message
7139:
7140: pa_debug.g_err_stage := 'Checking for valid parameters:';
7141: IF P_PA_DEBUG_MODE = 'Y' THEN
7142: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7143: END IF;
7144:
7145: IF (p_project_id IS NULL) OR (p_period_type IS NULL) THEN
7138: -- Check if source project id is NULL,if so throw an error message
7139:
7140: pa_debug.g_err_stage := 'Checking for valid parameters:';
7141: IF P_PA_DEBUG_MODE = 'Y' THEN
7142: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7143: END IF;
7144:
7145: IF (p_project_id IS NULL) OR (p_period_type IS NULL) THEN
7146:
7143: END IF;
7144:
7145: IF (p_project_id IS NULL) OR (p_period_type IS NULL) THEN
7146:
7147: pa_debug.g_err_stage := 'Project='||p_project_id;
7148: IF P_PA_DEBUG_MODE = 'Y' THEN
7149: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7150: END IF;
7151: pa_debug.g_err_stage := 'Period_type = '||p_period_type;
7144:
7145: IF (p_project_id IS NULL) OR (p_period_type IS NULL) THEN
7146:
7147: pa_debug.g_err_stage := 'Project='||p_project_id;
7148: IF P_PA_DEBUG_MODE = 'Y' THEN
7149: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7150: END IF;
7151: pa_debug.g_err_stage := 'Period_type = '||p_period_type;
7152: IF P_PA_DEBUG_MODE = 'Y' THEN
7145: IF (p_project_id IS NULL) OR (p_period_type IS NULL) THEN
7146:
7147: pa_debug.g_err_stage := 'Project='||p_project_id;
7148: IF P_PA_DEBUG_MODE = 'Y' THEN
7149: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7150: END IF;
7151: pa_debug.g_err_stage := 'Period_type = '||p_period_type;
7152: IF P_PA_DEBUG_MODE = 'Y' THEN
7153: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7147: pa_debug.g_err_stage := 'Project='||p_project_id;
7148: IF P_PA_DEBUG_MODE = 'Y' THEN
7149: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7150: END IF;
7151: pa_debug.g_err_stage := 'Period_type = '||p_period_type;
7152: IF P_PA_DEBUG_MODE = 'Y' THEN
7153: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7154: END IF;
7155: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
7148: IF P_PA_DEBUG_MODE = 'Y' THEN
7149: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7150: END IF;
7151: pa_debug.g_err_stage := 'Period_type = '||p_period_type;
7152: IF P_PA_DEBUG_MODE = 'Y' THEN
7153: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7154: END IF;
7155: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
7156: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
7149: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7150: END IF;
7151: pa_debug.g_err_stage := 'Period_type = '||p_period_type;
7152: IF P_PA_DEBUG_MODE = 'Y' THEN
7153: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7154: END IF;
7155: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
7156: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
7157: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
7156: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
7157: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
7158: END IF;
7159:
7160: pa_debug.g_err_stage := 'Parameter validation complete';
7161: IF P_PA_DEBUG_MODE = 'Y' THEN
7162: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7163: END IF;
7164:
7157: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
7158: END IF;
7159:
7160: pa_debug.g_err_stage := 'Parameter validation complete';
7161: IF P_PA_DEBUG_MODE = 'Y' THEN
7162: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7163: END IF;
7164:
7165: --Fetch project start and completion dates
7158: END IF;
7159:
7160: pa_debug.g_err_stage := 'Parameter validation complete';
7161: IF P_PA_DEBUG_MODE = 'Y' THEN
7162: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7163: END IF;
7164:
7165: --Fetch project start and completion dates
7166:
7176:
7177: IF (l_project_start_date IS NOT NULL) AND
7178: (l_project_completion_date IS NOT NULL)
7179: THEN
7180: pa_debug.g_err_stage := 'Calling get_start_and_end_dates procedure';
7181: IF P_PA_DEBUG_MODE = 'Y' THEN
7182: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7183: END IF;
7184:
7177: IF (l_project_start_date IS NOT NULL) AND
7178: (l_project_completion_date IS NOT NULL)
7179: THEN
7180: pa_debug.g_err_stage := 'Calling get_start_and_end_dates procedure';
7181: IF P_PA_DEBUG_MODE = 'Y' THEN
7182: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7183: END IF;
7184:
7185: Get_start_and_end_dates( p_period_type => p_period_type
7178: (l_project_completion_date IS NOT NULL)
7179: THEN
7180: pa_debug.g_err_stage := 'Calling get_start_and_end_dates procedure';
7181: IF P_PA_DEBUG_MODE = 'Y' THEN
7182: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7183: END IF;
7184:
7185: Get_start_and_end_dates( p_period_type => p_period_type
7186: ,p_profile_start_date => l_project_start_date
7190:
7191: ELSE
7192: --Fetch MIN and MAX of start dates of pa_budget_lines
7193:
7194: pa_debug.g_err_stage := 'Selecting start and end dates from pa_budget_lines of the project';
7195: IF P_PA_DEBUG_MODE = 'Y' THEN
7196: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7197: END IF;
7198:
7191: ELSE
7192: --Fetch MIN and MAX of start dates of pa_budget_lines
7193:
7194: pa_debug.g_err_stage := 'Selecting start and end dates from pa_budget_lines of the project';
7195: IF P_PA_DEBUG_MODE = 'Y' THEN
7196: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7197: END IF;
7198:
7199: SELECT MIN (pbl.start_date)
7192: --Fetch MIN and MAX of start dates of pa_budget_lines
7193:
7194: pa_debug.g_err_stage := 'Selecting start and end dates from pa_budget_lines of the project';
7195: IF P_PA_DEBUG_MODE = 'Y' THEN
7196: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7197: END IF;
7198:
7199: SELECT MIN (pbl.start_date)
7200: ,MAX(pbl.end_date)
7215: -- the calling program as there is no way we can create period profile for this project.
7216:
7217: IF l_start_date IS NULL OR l_end_date IS NULL THEN
7218:
7219: pa_debug.g_err_stage := 'Profile id cant be created';
7220: IF P_PA_DEBUG_MODE = 'Y' THEN
7221: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7222: END IF;
7223: x_period_profile_id := NULL;
7216:
7217: IF l_start_date IS NULL OR l_end_date IS NULL THEN
7218:
7219: pa_debug.g_err_stage := 'Profile id cant be created';
7220: IF P_PA_DEBUG_MODE = 'Y' THEN
7221: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7222: END IF;
7223: x_period_profile_id := NULL;
7224: pa_debug.reset_err_stack;
7217: IF l_start_date IS NULL OR l_end_date IS NULL THEN
7218:
7219: pa_debug.g_err_stage := 'Profile id cant be created';
7220: IF P_PA_DEBUG_MODE = 'Y' THEN
7221: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7222: END IF;
7223: x_period_profile_id := NULL;
7224: pa_debug.reset_err_stack;
7225: RETURN;
7220: IF P_PA_DEBUG_MODE = 'Y' THEN
7221: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7222: END IF;
7223: x_period_profile_id := NULL;
7224: pa_debug.reset_err_stack;
7225: RETURN;
7226: END IF;
7227:
7228: -- Fetch period_set_name, accounted_period_type and pa_period_type
7227:
7228: -- Fetch period_set_name, accounted_period_type and pa_period_type
7229: -- required for creation of period profiles as follows
7230:
7231: pa_debug.g_err_stage := 'Fetching accounted_period_type, pa_period_type';
7232: IF P_PA_DEBUG_MODE = 'Y' THEN
7233: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7234: END IF;
7235:
7228: -- Fetch period_set_name, accounted_period_type and pa_period_type
7229: -- required for creation of period profiles as follows
7230:
7231: pa_debug.g_err_stage := 'Fetching accounted_period_type, pa_period_type';
7232: IF P_PA_DEBUG_MODE = 'Y' THEN
7233: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7234: END IF;
7235:
7236: SELECT b.period_set_name
7229: -- required for creation of period profiles as follows
7230:
7231: pa_debug.g_err_stage := 'Fetching accounted_period_type, pa_period_type';
7232: IF P_PA_DEBUG_MODE = 'Y' THEN
7233: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7234: END IF;
7235:
7236: SELECT b.period_set_name
7237: ,DECODE(p_period_type,
7250: IF TRUNC(SYSDATE) BETWEEN l_start_date AND l_end_date THEN /*2690087*/
7251:
7252: --Select the number of periods between start and end date
7253: /*
7254: pa_debug.g_err_stage := 'Fetching number of periods';
7255: IF P_PA_DEBUG_MODE = 'Y' THEN
7256: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7257: END IF;
7258: */
7251:
7252: --Select the number of periods between start and end date
7253: /*
7254: pa_debug.g_err_stage := 'Fetching number of periods';
7255: IF P_PA_DEBUG_MODE = 'Y' THEN
7256: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7257: END IF;
7258: */
7259: IF p_period_type = PA_FP_CONSTANTS_PKG.G_PERIOD_TYPE_PA THEN
7252: --Select the number of periods between start and end date
7253: /*
7254: pa_debug.g_err_stage := 'Fetching number of periods';
7255: IF P_PA_DEBUG_MODE = 'Y' THEN
7256: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7257: END IF;
7258: */
7259: IF p_period_type = PA_FP_CONSTANTS_PKG.G_PERIOD_TYPE_PA THEN
7260:
7282: --Select end date as start date of end period
7283:
7284: l_profile_end_date := l_end_date;
7285:
7286: pa_debug.g_err_stage := 'Calling get_profile_start_date';
7287: IF P_PA_DEBUG_MODE = 'Y' THEN
7288: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7289: END IF;
7290:
7283:
7284: l_profile_end_date := l_end_date;
7285:
7286: pa_debug.g_err_stage := 'Calling get_profile_start_date';
7287: IF P_PA_DEBUG_MODE = 'Y' THEN
7288: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7289: END IF;
7290:
7291: Get_Profile_Start_Date (
7284: l_profile_end_date := l_end_date;
7285:
7286: pa_debug.g_err_stage := 'Calling get_profile_start_date';
7287: IF P_PA_DEBUG_MODE = 'Y' THEN
7288: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7289: END IF;
7290:
7291: Get_Profile_Start_Date (
7292: p_profile_end_date => l_profile_end_date
7335: END IF;
7336:
7337: EXCEPTION
7338: WHEN Others THEN
7339: pa_debug.g_err_stage:='Fetching start date of the period into which sysdate falls'||SQLERRM;
7340: IF P_PA_DEBUG_MODE = 'Y' THEN
7341: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7342: END IF;
7343: RAISE;
7336:
7337: EXCEPTION
7338: WHEN Others THEN
7339: pa_debug.g_err_stage:='Fetching start date of the period into which sysdate falls'||SQLERRM;
7340: IF P_PA_DEBUG_MODE = 'Y' THEN
7341: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7342: END IF;
7343: RAISE;
7344: END;
7337: EXCEPTION
7338: WHEN Others THEN
7339: pa_debug.g_err_stage:='Fetching start date of the period into which sysdate falls'||SQLERRM;
7340: IF P_PA_DEBUG_MODE = 'Y' THEN
7341: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7342: END IF;
7343: RAISE;
7344: END;
7345:
7344: END;
7345:
7346: /* End of changes for the bug :- 2623941 */
7347:
7348: pa_debug.g_err_stage := 'Calling get_profile_end_date';
7349: IF P_PA_DEBUG_MODE = 'Y' THEN
7350: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7351: END IF;
7352:
7345:
7346: /* End of changes for the bug :- 2623941 */
7347:
7348: pa_debug.g_err_stage := 'Calling get_profile_end_date';
7349: IF P_PA_DEBUG_MODE = 'Y' THEN
7350: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7351: END IF;
7352:
7353: Get_Profile_End_Date (
7346: /* End of changes for the bug :- 2623941 */
7347:
7348: pa_debug.g_err_stage := 'Calling get_profile_end_date';
7349: IF P_PA_DEBUG_MODE = 'Y' THEN
7350: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7351: END IF;
7352:
7353: Get_Profile_End_Date (
7354: p_profile_start_date => l_profile_start_date
7374: --Select start_date as start date of start period
7375:
7376: l_profile_start_date := l_start_date;
7377:
7378: pa_debug.g_err_stage := 'Calling get_profile_end_date';
7379: IF P_PA_DEBUG_MODE = 'Y' THEN
7380: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7381: END IF;
7382:
7375:
7376: l_profile_start_date := l_start_date;
7377:
7378: pa_debug.g_err_stage := 'Calling get_profile_end_date';
7379: IF P_PA_DEBUG_MODE = 'Y' THEN
7380: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7381: END IF;
7382:
7383: Get_Profile_End_Date (
7376: l_profile_start_date := l_start_date;
7377:
7378: pa_debug.g_err_stage := 'Calling get_profile_end_date';
7379: IF P_PA_DEBUG_MODE = 'Y' THEN
7380: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7381: END IF;
7382:
7383: Get_Profile_End_Date (
7384: p_profile_start_date => l_profile_start_date
7403: --Select end date as profile periods last period start date
7404:
7405: l_profile_end_date := l_end_date;
7406:
7407: pa_debug.g_err_stage := 'Calling get_profile_start_date';
7408: IF P_PA_DEBUG_MODE = 'Y' THEN
7409: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7410: END IF;
7411:
7404:
7405: l_profile_end_date := l_end_date;
7406:
7407: pa_debug.g_err_stage := 'Calling get_profile_start_date';
7408: IF P_PA_DEBUG_MODE = 'Y' THEN
7409: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7410: END IF;
7411:
7412: Get_Profile_Start_Date (
7405: l_profile_end_date := l_end_date;
7406:
7407: pa_debug.g_err_stage := 'Calling get_profile_start_date';
7408: IF P_PA_DEBUG_MODE = 'Y' THEN
7409: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7410: END IF;
7411:
7412: Get_Profile_Start_Date (
7413: p_profile_end_date => l_profile_end_date
7434: --Null out number of periods
7435:
7436: l_number_of_periods:= NULL;
7437:
7438: pa_debug.g_err_stage := 'Calling Maintain_Prj_Period_Profile api';
7439: IF P_PA_DEBUG_MODE = 'Y' THEN
7440: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7441: END IF;
7442:
7435:
7436: l_number_of_periods:= NULL;
7437:
7438: pa_debug.g_err_stage := 'Calling Maintain_Prj_Period_Profile api';
7439: IF P_PA_DEBUG_MODE = 'Y' THEN
7440: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7441: END IF;
7442:
7443: Pa_Prj_Period_Profile_Utils.Maintain_Prj_Period_Profile(
7436: l_number_of_periods:= NULL;
7437:
7438: pa_debug.g_err_stage := 'Calling Maintain_Prj_Period_Profile api';
7439: IF P_PA_DEBUG_MODE = 'Y' THEN
7440: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7441: END IF;
7442:
7443: Pa_Prj_Period_Profile_Utils.Maintain_Prj_Period_Profile(
7444: p_project_id => p_project_id
7460:
7461: --Return the newly fetched profile id
7462:
7463: x_period_profile_id := l_period_profile_id;
7464: pa_debug.g_err_stage := ' exiting Create_Fresh_Period_Profile';
7465: IF P_PA_DEBUG_MODE = 'Y' THEN
7466: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7467: END IF;
7468: pa_debug.reset_err_stack;
7461: --Return the newly fetched profile id
7462:
7463: x_period_profile_id := l_period_profile_id;
7464: pa_debug.g_err_stage := ' exiting Create_Fresh_Period_Profile';
7465: IF P_PA_DEBUG_MODE = 'Y' THEN
7466: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7467: END IF;
7468: pa_debug.reset_err_stack;
7469:
7462:
7463: x_period_profile_id := l_period_profile_id;
7464: pa_debug.g_err_stage := ' exiting Create_Fresh_Period_Profile';
7465: IF P_PA_DEBUG_MODE = 'Y' THEN
7466: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7467: END IF;
7468: pa_debug.reset_err_stack;
7469:
7470: EXCEPTION
7464: pa_debug.g_err_stage := ' exiting Create_Fresh_Period_Profile';
7465: IF P_PA_DEBUG_MODE = 'Y' THEN
7466: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,3);
7467: END IF;
7468: pa_debug.reset_err_stack;
7469:
7470: EXCEPTION
7471:
7472: WHEN PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc THEN
7483: x_msg_count := l_msg_count;
7484: ELSE
7485: x_msg_count := l_msg_count;
7486: END IF;
7487: pa_debug.g_err_stage:='Invalid Arguments Passed';
7488: IF P_PA_DEBUG_MODE = 'Y' THEN
7489: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7490: END IF;
7491: x_return_status:= FND_API.G_RET_STS_ERROR;
7484: ELSE
7485: x_msg_count := l_msg_count;
7486: END IF;
7487: pa_debug.g_err_stage:='Invalid Arguments Passed';
7488: IF P_PA_DEBUG_MODE = 'Y' THEN
7489: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7490: END IF;
7491: x_return_status:= FND_API.G_RET_STS_ERROR;
7492: pa_debug.reset_err_stack;
7485: x_msg_count := l_msg_count;
7486: END IF;
7487: pa_debug.g_err_stage:='Invalid Arguments Passed';
7488: IF P_PA_DEBUG_MODE = 'Y' THEN
7489: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7490: END IF;
7491: x_return_status:= FND_API.G_RET_STS_ERROR;
7492: pa_debug.reset_err_stack;
7493: RAISE;
7488: IF P_PA_DEBUG_MODE = 'Y' THEN
7489: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7490: END IF;
7491: x_return_status:= FND_API.G_RET_STS_ERROR;
7492: pa_debug.reset_err_stack;
7493: RAISE;
7494:
7495: WHEN Others THEN
7496: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
7497: x_msg_count := 1;
7498: x_msg_data := SQLERRM;
7499: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
7500: ,p_procedure_name => 'Create_Fresh_Period_Profile');
7501: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
7502: IF P_PA_DEBUG_MODE = 'Y' THEN
7503: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7504: END IF;
7505: pa_debug.reset_err_stack;
7498: x_msg_data := SQLERRM;
7499: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
7500: ,p_procedure_name => 'Create_Fresh_Period_Profile');
7501: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
7502: IF P_PA_DEBUG_MODE = 'Y' THEN
7503: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7504: END IF;
7505: pa_debug.reset_err_stack;
7506: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7499: FND_MSG_PUB.add_exc_msg( p_pkg_name=> 'PA_FIN_PLAN_PUB'
7500: ,p_procedure_name => 'Create_Fresh_Period_Profile');
7501: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
7502: IF P_PA_DEBUG_MODE = 'Y' THEN
7503: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7504: END IF;
7505: pa_debug.reset_err_stack;
7506: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7507:
7501: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
7502: IF P_PA_DEBUG_MODE = 'Y' THEN
7503: pa_debug.write('Create_Fresh_Period_Profile: ' || l_module_name,pa_debug.g_err_stage,5);
7504: END IF;
7505: pa_debug.reset_err_stack;
7506: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7507:
7508: END Create_Fresh_Period_Profile;
7509:
7541:
7542: BEGIN
7543:
7544: -- Set the error stack.
7545: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.INSERT_PLAN_LINES_TMP_BULK');
7546:
7547: -- Get the Debug mode into local variable and set it to 'Y' if its NULL
7548: fnd_profile.get('pa_debug_MODE',l_debug_mode);
7549: l_debug_mode := NVL(l_debug_mode, 'Y');
7544: -- Set the error stack.
7545: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.INSERT_PLAN_LINES_TMP_BULK');
7546:
7547: -- Get the Debug mode into local variable and set it to 'Y' if its NULL
7548: fnd_profile.get('pa_debug_MODE',l_debug_mode);
7549: l_debug_mode := NVL(l_debug_mode, 'Y');
7550:
7551: -- Initialize the return status to success
7552: x_return_status := FND_API.G_RET_STS_SUCCESS;
7550:
7551: -- Initialize the return status to success
7552: x_return_status := FND_API.G_RET_STS_SUCCESS;
7553:
7554: IF P_PA_DEBUG_MODE = 'Y' THEN
7555: pa_debug.set_process('INSERT_PLAN_LINES_TMP_BULK: ' || 'PLSQL','LOG',l_debug_mode);
7556: END IF;
7557:
7558: pa_debug.g_err_stage := TO_CHAR(l_stage)||':In PA_FIN_PLAN_PUB.INSERT_PLAN_LINES_TMP_BULK ';
7551: -- Initialize the return status to success
7552: x_return_status := FND_API.G_RET_STS_SUCCESS;
7553:
7554: IF P_PA_DEBUG_MODE = 'Y' THEN
7555: pa_debug.set_process('INSERT_PLAN_LINES_TMP_BULK: ' || 'PLSQL','LOG',l_debug_mode);
7556: END IF;
7557:
7558: pa_debug.g_err_stage := TO_CHAR(l_stage)||':In PA_FIN_PLAN_PUB.INSERT_PLAN_LINES_TMP_BULK ';
7559: IF P_PA_DEBUG_MODE = 'Y' THEN
7554: IF P_PA_DEBUG_MODE = 'Y' THEN
7555: pa_debug.set_process('INSERT_PLAN_LINES_TMP_BULK: ' || 'PLSQL','LOG',l_debug_mode);
7556: END IF;
7557:
7558: pa_debug.g_err_stage := TO_CHAR(l_stage)||':In PA_FIN_PLAN_PUB.INSERT_PLAN_LINES_TMP_BULK ';
7559: IF P_PA_DEBUG_MODE = 'Y' THEN
7560: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7561: END IF;
7562:
7555: pa_debug.set_process('INSERT_PLAN_LINES_TMP_BULK: ' || 'PLSQL','LOG',l_debug_mode);
7556: END IF;
7557:
7558: pa_debug.g_err_stage := TO_CHAR(l_stage)||':In PA_FIN_PLAN_PUB.INSERT_PLAN_LINES_TMP_BULK ';
7559: IF P_PA_DEBUG_MODE = 'Y' THEN
7560: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7561: END IF;
7562:
7563:
7556: END IF;
7557:
7558: pa_debug.g_err_stage := TO_CHAR(l_stage)||':In PA_FIN_PLAN_PUB.INSERT_PLAN_LINES_TMP_BULK ';
7559: IF P_PA_DEBUG_MODE = 'Y' THEN
7560: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7561: END IF;
7562:
7563:
7564: /*
7564: /*
7565: * Bulk Insert records into PA_FP_ELEMENTS table for the records fetched
7566: * from cursor top_task_cur.
7567: */
7568: pa_debug.g_err_stage := TO_CHAR(l_stage)||': INSERT into fin plan lines tmp';
7569: IF P_PA_DEBUG_MODE = 'Y' THEN
7570: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7571: END IF;
7572:
7565: * Bulk Insert records into PA_FP_ELEMENTS table for the records fetched
7566: * from cursor top_task_cur.
7567: */
7568: pa_debug.g_err_stage := TO_CHAR(l_stage)||': INSERT into fin plan lines tmp';
7569: IF P_PA_DEBUG_MODE = 'Y' THEN
7570: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7571: END IF;
7572:
7573:
7566: * from cursor top_task_cur.
7567: */
7568: pa_debug.g_err_stage := TO_CHAR(l_stage)||': INSERT into fin plan lines tmp';
7569: IF P_PA_DEBUG_MODE = 'Y' THEN
7570: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7571: END IF;
7572:
7573:
7574: FORALL i in p_res_assignment_tbl.first..p_res_assignment_tbl.last
7622: ,p_parent_assignment_id_tbl(i)
7623: ,p_delete_flag_tbl(i)
7624: ,p_source_txn_curr_code_tbl(i)) ;
7625:
7626: pa_debug.g_err_stage := TO_CHAR(l_stage)||': INSERTED ' || sql%rowcount || ' recs into fin plan lines tmp';
7627: IF P_PA_DEBUG_MODE = 'Y' THEN
7628: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7629: END IF;
7630:
7623: ,p_delete_flag_tbl(i)
7624: ,p_source_txn_curr_code_tbl(i)) ;
7625:
7626: pa_debug.g_err_stage := TO_CHAR(l_stage)||': INSERTED ' || sql%rowcount || ' recs into fin plan lines tmp';
7627: IF P_PA_DEBUG_MODE = 'Y' THEN
7628: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7629: END IF;
7630:
7631: pa_debug.reset_err_stack; -- bug 2815593
7624: ,p_source_txn_curr_code_tbl(i)) ;
7625:
7626: pa_debug.g_err_stage := TO_CHAR(l_stage)||': INSERTED ' || sql%rowcount || ' recs into fin plan lines tmp';
7627: IF P_PA_DEBUG_MODE = 'Y' THEN
7628: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7629: END IF;
7630:
7631: pa_debug.reset_err_stack; -- bug 2815593
7632: EXCEPTION
7627: IF P_PA_DEBUG_MODE = 'Y' THEN
7628: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.g_err_stage,2);
7629: END IF;
7630:
7631: pa_debug.reset_err_stack; -- bug 2815593
7632: EXCEPTION
7633: WHEN OTHERS THEN
7634: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
7635: x_msg_count := 1;
7635: x_msg_count := 1;
7636: x_msg_data := SQLERRM;
7637: FND_MSG_PUB.add_exc_msg
7638: ( p_pkg_name => 'PA_FP_COPY_FROM_PKG'
7639: ,p_procedure_name => pa_debug.G_Err_Stack );
7640: IF P_PA_DEBUG_MODE = 'Y' THEN
7641: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,SQLERRM,4);
7642: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.G_Err_Stack,4);
7643: END IF;
7636: x_msg_data := SQLERRM;
7637: FND_MSG_PUB.add_exc_msg
7638: ( p_pkg_name => 'PA_FP_COPY_FROM_PKG'
7639: ,p_procedure_name => pa_debug.G_Err_Stack );
7640: IF P_PA_DEBUG_MODE = 'Y' THEN
7641: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,SQLERRM,4);
7642: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.G_Err_Stack,4);
7643: END IF;
7644: pa_debug.reset_err_stack;
7637: FND_MSG_PUB.add_exc_msg
7638: ( p_pkg_name => 'PA_FP_COPY_FROM_PKG'
7639: ,p_procedure_name => pa_debug.G_Err_Stack );
7640: IF P_PA_DEBUG_MODE = 'Y' THEN
7641: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,SQLERRM,4);
7642: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.G_Err_Stack,4);
7643: END IF;
7644: pa_debug.reset_err_stack;
7645:
7638: ( p_pkg_name => 'PA_FP_COPY_FROM_PKG'
7639: ,p_procedure_name => pa_debug.G_Err_Stack );
7640: IF P_PA_DEBUG_MODE = 'Y' THEN
7641: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,SQLERRM,4);
7642: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.G_Err_Stack,4);
7643: END IF;
7644: pa_debug.reset_err_stack;
7645:
7646: raise FND_API.G_EXC_UNEXPECTED_ERROR ;
7640: IF P_PA_DEBUG_MODE = 'Y' THEN
7641: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,SQLERRM,4);
7642: pa_debug.write('INSERT_PLAN_LINES_TMP_BULK: ' || l_module_name,pa_debug.G_Err_Stack,4);
7643: END IF;
7644: pa_debug.reset_err_stack;
7645:
7646: raise FND_API.G_EXC_UNEXPECTED_ERROR ;
7647:
7648: END INSERT_PLAN_LINES_TMP_BULK ;
7859: BEGIN
7860:
7861:
7862: -- Set the error stack.
7863: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.Call_Maintain_Plan_Matrix');
7864:
7865: -- Get the Debug mode into local variable and set it to 'Y'if its NULL
7866: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
7867: l_debug_mode := NVL(l_debug_mode, 'Y');
7862: -- Set the error stack.
7863: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.Call_Maintain_Plan_Matrix');
7864:
7865: -- Get the Debug mode into local variable and set it to 'Y'if its NULL
7866: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
7867: l_debug_mode := NVL(l_debug_mode, 'Y');
7868:
7869: -- Initialize the return status to success
7870: x_return_status := FND_API.G_RET_STS_SUCCESS;
7868:
7869: -- Initialize the return status to success
7870: x_return_status := FND_API.G_RET_STS_SUCCESS;
7871:
7872: IF P_PA_DEBUG_MODE = 'Y' THEN
7873: pa_debug.set_process('Call_Maintain_Plan_Matrix: ' || 'PLSQL','LOG',l_debug_mode);
7874: END IF;
7875:
7876: pa_debug.g_err_stage := 'Getting the project and profile id';
7869: -- Initialize the return status to success
7870: x_return_status := FND_API.G_RET_STS_SUCCESS;
7871:
7872: IF P_PA_DEBUG_MODE = 'Y' THEN
7873: pa_debug.set_process('Call_Maintain_Plan_Matrix: ' || 'PLSQL','LOG',l_debug_mode);
7874: END IF;
7875:
7876: pa_debug.g_err_stage := 'Getting the project and profile id';
7877: IF P_PA_DEBUG_MODE = 'Y' THEN
7872: IF P_PA_DEBUG_MODE = 'Y' THEN
7873: pa_debug.set_process('Call_Maintain_Plan_Matrix: ' || 'PLSQL','LOG',l_debug_mode);
7874: END IF;
7875:
7876: pa_debug.g_err_stage := 'Getting the project and profile id';
7877: IF P_PA_DEBUG_MODE = 'Y' THEN
7878: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7879: END IF;
7880:
7873: pa_debug.set_process('Call_Maintain_Plan_Matrix: ' || 'PLSQL','LOG',l_debug_mode);
7874: END IF;
7875:
7876: pa_debug.g_err_stage := 'Getting the project and profile id';
7877: IF P_PA_DEBUG_MODE = 'Y' THEN
7878: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7879: END IF;
7880:
7881: /* Get the value of the Project_ID and the Period Profile ID for the
7874: END IF;
7875:
7876: pa_debug.g_err_stage := 'Getting the project and profile id';
7877: IF P_PA_DEBUG_MODE = 'Y' THEN
7878: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7879: END IF;
7880:
7881: /* Get the value of the Project_ID and the Period Profile ID for the
7882: Budget Version. */
7890:
7891: /* Get the value of the Preference code of the Budget Version. Margin and
7892: Margin % have to be populated only if the Preference code is
7893: 'COST_AND_REV_SAME'. */
7894: pa_debug.g_err_stage := 'Getting the fin plan preference code';
7895: IF P_PA_DEBUG_MODE = 'Y' THEN
7896: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7897: END IF;
7898:
7891: /* Get the value of the Preference code of the Budget Version. Margin and
7892: Margin % have to be populated only if the Preference code is
7893: 'COST_AND_REV_SAME'. */
7894: pa_debug.g_err_stage := 'Getting the fin plan preference code';
7895: IF P_PA_DEBUG_MODE = 'Y' THEN
7896: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7897: END IF;
7898:
7899:
7892: Margin % have to be populated only if the Preference code is
7893: 'COST_AND_REV_SAME'. */
7894: pa_debug.g_err_stage := 'Getting the fin plan preference code';
7895: IF P_PA_DEBUG_MODE = 'Y' THEN
7896: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7897: END IF;
7898:
7899:
7900: SELECT fin_plan_preference_code, margin_derived_from_code
7903: WHERE fin_plan_version_id = p_budget_version_id;
7904:
7905:
7906: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
7907: pa_debug.g_err_stage := 'opening budget_lines_cur';
7908: IF P_PA_DEBUG_MODE = 'Y' THEN
7909: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7910: END IF;
7911:
7904:
7905:
7906: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
7907: pa_debug.g_err_stage := 'opening budget_lines_cur';
7908: IF P_PA_DEBUG_MODE = 'Y' THEN
7909: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7910: END IF;
7911:
7912: OPEN budget_lines_cur;
7905:
7906: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
7907: pa_debug.g_err_stage := 'opening budget_lines_cur';
7908: IF P_PA_DEBUG_MODE = 'Y' THEN
7909: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7910: END IF;
7911:
7912: OPEN budget_lines_cur;
7913: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
7910: END IF;
7911:
7912: OPEN budget_lines_cur;
7913: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
7914: pa_debug.g_err_stage := 'opening rollup_tmp_cur';
7915: IF P_PA_DEBUG_MODE = 'Y' THEN
7916: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7917: END IF;
7918:
7911:
7912: OPEN budget_lines_cur;
7913: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
7914: pa_debug.g_err_stage := 'opening rollup_tmp_cur';
7915: IF P_PA_DEBUG_MODE = 'Y' THEN
7916: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7917: END IF;
7918:
7919: OPEN rollup_tmp_cur;
7912: OPEN budget_lines_cur;
7913: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
7914: pa_debug.g_err_stage := 'opening rollup_tmp_cur';
7915: IF P_PA_DEBUG_MODE = 'Y' THEN
7916: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7917: END IF;
7918:
7919: OPEN rollup_tmp_cur;
7920: END IF;
7922: delete from PA_FIN_PLAN_LINES_TMP;
7923: LOOP
7924: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
7925:
7926: pa_debug.g_err_stage := 'fetching from budget_lines_cur';
7927: IF P_PA_DEBUG_MODE = 'Y' THEN
7928: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7929: END IF;
7930:
7923: LOOP
7924: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
7925:
7926: pa_debug.g_err_stage := 'fetching from budget_lines_cur';
7927: IF P_PA_DEBUG_MODE = 'Y' THEN
7928: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7929: END IF;
7930:
7931: FETCH budget_lines_cur
7924: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
7925:
7926: pa_debug.g_err_stage := 'fetching from budget_lines_cur';
7927: IF P_PA_DEBUG_MODE = 'Y' THEN
7928: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7929: END IF;
7930:
7931: FETCH budget_lines_cur
7932: BULK COLLECT INTO
7975: LIMIT l_plsql_max_array_size;
7976:
7977: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
7978:
7979: pa_debug.g_err_stage := 'fetching from rollup_tmp_cur';
7980: IF P_PA_DEBUG_MODE = 'Y' THEN
7981: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7982: END IF;
7983:
7976:
7977: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
7978:
7979: pa_debug.g_err_stage := 'fetching from rollup_tmp_cur';
7980: IF P_PA_DEBUG_MODE = 'Y' THEN
7981: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7982: END IF;
7983:
7984: FETCH rollup_tmp_cur
7977: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
7978:
7979: pa_debug.g_err_stage := 'fetching from rollup_tmp_cur';
7980: IF P_PA_DEBUG_MODE = 'Y' THEN
7981: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
7982: END IF;
7983:
7984: FETCH rollup_tmp_cur
7985: BULK COLLECT INTO
8027: ,l_delete_flag_tbl
8028: LIMIT l_plsql_max_array_size;
8029: END IF;
8030:
8031: pa_debug.g_err_stage := 'Data Source is Budget Lines';
8032: IF P_PA_DEBUG_MODE = 'Y' THEN
8033: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8034: END IF;
8035:
8028: LIMIT l_plsql_max_array_size;
8029: END IF;
8030:
8031: pa_debug.g_err_stage := 'Data Source is Budget Lines';
8032: IF P_PA_DEBUG_MODE = 'Y' THEN
8033: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8034: END IF;
8035:
8036: /* Insert the Transaction, Project and Project Functional currency
8029: END IF;
8030:
8031: pa_debug.g_err_stage := 'Data Source is Budget Lines';
8032: IF P_PA_DEBUG_MODE = 'Y' THEN
8033: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8034: END IF;
8035:
8036: /* Insert the Transaction, Project and Project Functional currency
8037: columns as rows into the Lines Temp table one after the other selecting
8039:
8040: /* Inserting the Transaction Currency records into the Lines Temp table with
8041: the Amount Type code as 'TRANSACTION'. */
8042:
8043: pa_debug.g_err_stage := 'Inserting Transaction Currency Records';
8044: IF P_PA_DEBUG_MODE = 'Y' THEN
8045: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8046: END IF;
8047:
8040: /* Inserting the Transaction Currency records into the Lines Temp table with
8041: the Amount Type code as 'TRANSACTION'. */
8042:
8043: pa_debug.g_err_stage := 'Inserting Transaction Currency Records';
8044: IF P_PA_DEBUG_MODE = 'Y' THEN
8045: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8046: END IF;
8047:
8048: IF NVL(l_start_date_tbl.last,0) >= 1 THEN
8041: the Amount Type code as 'TRANSACTION'. */
8042:
8043: pa_debug.g_err_stage := 'Inserting Transaction Currency Records';
8044: IF P_PA_DEBUG_MODE = 'Y' THEN
8045: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8046: END IF;
8047:
8048: IF NVL(l_start_date_tbl.last,0) >= 1 THEN
8049: /* insert txn amounts */
8046: END IF;
8047:
8048: IF NVL(l_start_date_tbl.last,0) >= 1 THEN
8049: /* insert txn amounts */
8050: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for txn curr';
8051: IF P_PA_DEBUG_MODE = 'Y' THEN
8052: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8053: END IF;
8054:
8047:
8048: IF NVL(l_start_date_tbl.last,0) >= 1 THEN
8049: /* insert txn amounts */
8050: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for txn curr';
8051: IF P_PA_DEBUG_MODE = 'Y' THEN
8052: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8053: END IF;
8054:
8055: insert_plan_lines_tmp_bulk(
8048: IF NVL(l_start_date_tbl.last,0) >= 1 THEN
8049: /* insert txn amounts */
8050: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for txn curr';
8051: IF P_PA_DEBUG_MODE = 'Y' THEN
8052: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8053: END IF;
8054:
8055: insert_plan_lines_tmp_bulk(
8056: p_res_assignment_tbl => l_res_assignment_tbl
8079: ,x_msg_count => l_msg_count
8080: ,x_msg_data => l_msg_data );
8081:
8082: /* insert project amounts */
8083: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for proj curr';
8084: IF P_PA_DEBUG_MODE = 'Y' THEN
8085: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8086: END IF;
8087:
8080: ,x_msg_data => l_msg_data );
8081:
8082: /* insert project amounts */
8083: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for proj curr';
8084: IF P_PA_DEBUG_MODE = 'Y' THEN
8085: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8086: END IF;
8087:
8088: insert_plan_lines_tmp_bulk(
8081:
8082: /* insert project amounts */
8083: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for proj curr';
8084: IF P_PA_DEBUG_MODE = 'Y' THEN
8085: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8086: END IF;
8087:
8088: insert_plan_lines_tmp_bulk(
8089: p_res_assignment_tbl => l_res_assignment_tbl
8112: ,x_msg_count => l_msg_count
8113: ,x_msg_data => l_msg_data );
8114:
8115: /* insert project functional amounts */
8116: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for projfunc curr';
8117: IF P_PA_DEBUG_MODE = 'Y' THEN
8118: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8119: END IF;
8120:
8113: ,x_msg_data => l_msg_data );
8114:
8115: /* insert project functional amounts */
8116: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for projfunc curr';
8117: IF P_PA_DEBUG_MODE = 'Y' THEN
8118: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8119: END IF;
8120:
8121:
8114:
8115: /* insert project functional amounts */
8116: pa_debug.g_err_stage := 'calling insert_plan_lines_tmp_bulk for projfunc curr';
8117: IF P_PA_DEBUG_MODE = 'Y' THEN
8118: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8119: END IF;
8120:
8121:
8122: insert_plan_lines_tmp_bulk(
8152:
8153: END LOOP; -- loop for bulk insert
8154:
8155: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
8156: pa_debug.g_err_stage := 'closing budget_lines_cur';
8157: IF P_PA_DEBUG_MODE = 'Y' THEN
8158: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8159: END IF;
8160:
8153: END LOOP; -- loop for bulk insert
8154:
8155: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
8156: pa_debug.g_err_stage := 'closing budget_lines_cur';
8157: IF P_PA_DEBUG_MODE = 'Y' THEN
8158: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8159: END IF;
8160:
8161: CLOSE budget_lines_cur;
8154:
8155: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN
8156: pa_debug.g_err_stage := 'closing budget_lines_cur';
8157: IF P_PA_DEBUG_MODE = 'Y' THEN
8158: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8159: END IF;
8160:
8161: CLOSE budget_lines_cur;
8162: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
8159: END IF;
8160:
8161: CLOSE budget_lines_cur;
8162: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
8163: pa_debug.g_err_stage := 'closing rollup_tmp_cur';
8164: IF P_PA_DEBUG_MODE = 'Y' THEN
8165: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8166: END IF;
8167:
8160:
8161: CLOSE budget_lines_cur;
8162: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
8163: pa_debug.g_err_stage := 'closing rollup_tmp_cur';
8164: IF P_PA_DEBUG_MODE = 'Y' THEN
8165: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8166: END IF;
8167:
8168: CLOSE rollup_tmp_cur;
8161: CLOSE budget_lines_cur;
8162: ELSIF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_ROLLUP_TMP) THEN
8163: pa_debug.g_err_stage := 'closing rollup_tmp_cur';
8164: IF P_PA_DEBUG_MODE = 'Y' THEN
8165: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8166: END IF;
8167:
8168: CLOSE rollup_tmp_cur;
8169: END IF;
8184: /* First populate the amt_rec PL/SQL table with the Amount Type and the
8185: Amount Sub Type codes based on the Budget Version Type
8186: to pass to the Maintain Plan Matrix procedure. */
8187:
8188: pa_debug.g_err_stage := 'Populating the Amount Types and Amount Sub Types';
8189: IF P_PA_DEBUG_MODE = 'Y' THEN
8190: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8191: END IF;
8192:
8185: Amount Sub Type codes based on the Budget Version Type
8186: to pass to the Maintain Plan Matrix procedure. */
8187:
8188: pa_debug.g_err_stage := 'Populating the Amount Types and Amount Sub Types';
8189: IF P_PA_DEBUG_MODE = 'Y' THEN
8190: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8191: END IF;
8192:
8193: SELECT version_type
8186: to pass to the Maintain Plan Matrix procedure. */
8187:
8188: pa_debug.g_err_stage := 'Populating the Amount Types and Amount Sub Types';
8189: IF P_PA_DEBUG_MODE = 'Y' THEN
8190: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8191: END IF;
8192:
8193: SELECT version_type
8194: INTO l_budget_version_type
8246:
8247: /* Calling the Maintain_Plan_Matrix API to recalculate profile period amounts as well
8248: as preceding and succeeding period amounts in the Denorm Table. */
8249:
8250: pa_debug.g_err_stage := 'Calling the Maintain Plan Matrix procedure';
8251: IF P_PA_DEBUG_MODE = 'Y' THEN
8252: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8253: END IF;
8254:
8247: /* Calling the Maintain_Plan_Matrix API to recalculate profile period amounts as well
8248: as preceding and succeeding period amounts in the Denorm Table. */
8249:
8250: pa_debug.g_err_stage := 'Calling the Maintain Plan Matrix procedure';
8251: IF P_PA_DEBUG_MODE = 'Y' THEN
8252: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8253: END IF;
8254:
8255: PA_PLAN_MATRIX.Maintain_Plan_Matrix(
8248: as preceding and succeeding period amounts in the Denorm Table. */
8249:
8250: pa_debug.g_err_stage := 'Calling the Maintain Plan Matrix procedure';
8251: IF P_PA_DEBUG_MODE = 'Y' THEN
8252: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,3);
8253: END IF;
8254:
8255: PA_PLAN_MATRIX.Maintain_Plan_Matrix(
8256: p_amount_type_tab => amt_rec,
8269: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8270: Raise PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
8271: END IF;
8272:
8273: pa_debug.reset_err_stack;
8274: EXCEPTION
8275: WHEN OTHERS THEN
8276: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8277: x_msg_count := 1;
8278: x_msg_data := SQLERRM;
8279: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
8280: p_procedure_name => 'Call_Maintain_Plan_Matrix');
8281:
8282: pa_debug.g_err_stage:='Unexpected Error';
8283: IF P_PA_DEBUG_MODE = 'Y' THEN
8284: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,5);
8285: END IF;
8286: pa_debug.reset_err_stack;
8279: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB',
8280: p_procedure_name => 'Call_Maintain_Plan_Matrix');
8281:
8282: pa_debug.g_err_stage:='Unexpected Error';
8283: IF P_PA_DEBUG_MODE = 'Y' THEN
8284: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,5);
8285: END IF;
8286: pa_debug.reset_err_stack;
8287: raise FND_API.G_EXC_UNEXPECTED_ERROR;
8280: p_procedure_name => 'Call_Maintain_Plan_Matrix');
8281:
8282: pa_debug.g_err_stage:='Unexpected Error';
8283: IF P_PA_DEBUG_MODE = 'Y' THEN
8284: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,5);
8285: END IF;
8286: pa_debug.reset_err_stack;
8287: raise FND_API.G_EXC_UNEXPECTED_ERROR;
8288:
8282: pa_debug.g_err_stage:='Unexpected Error';
8283: IF P_PA_DEBUG_MODE = 'Y' THEN
8284: pa_debug.write('Call_Maintain_Plan_Matrix: ' || l_module_name,pa_debug.g_err_stage,5);
8285: END IF;
8286: pa_debug.reset_err_stack;
8287: raise FND_API.G_EXC_UNEXPECTED_ERROR;
8288:
8289: END Call_Maintain_Plan_Matrix;
8290:
8323:
8324: x_msg_count := 0;
8325: x_return_status := FND_API.G_RET_STS_SUCCESS;
8326:
8327: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
8328: l_debug_mode := NVL(l_debug_mode, 'Y');
8329:
8330: -- Set curr function
8331: pa_debug.set_curr_function(
8327: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
8328: l_debug_mode := NVL(l_debug_mode, 'Y');
8329:
8330: -- Set curr function
8331: pa_debug.set_curr_function(
8332: p_function =>'PA_FIN_PLAN_PUB.Refresh_res_list_assignment'
8333: ,p_debug_mode => l_debug_mode );
8334:
8335:
8335:
8336: -- Check for business rule violations
8337:
8338: IF l_debug_mode = 'Y' THEN
8339: pa_debug.g_err_stage:='Validating input parameters';
8340: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,3);
8341: END IF;
8342:
8343: IF (p_project_id IS NULL) OR
8336: -- Check for business rule violations
8337:
8338: IF l_debug_mode = 'Y' THEN
8339: pa_debug.g_err_stage:='Validating input parameters';
8340: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,3);
8341: END IF;
8342:
8343: IF (p_project_id IS NULL) OR
8344: (p_resource_list_id IS NULL)
8344: (p_resource_list_id IS NULL)
8345: THEN
8346:
8347: IF l_debug_mode = 'Y' THEN
8348: pa_debug.g_err_stage:='p_project_id = '|| p_project_id;
8349: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8350:
8351: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
8352: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8345: THEN
8346:
8347: IF l_debug_mode = 'Y' THEN
8348: pa_debug.g_err_stage:='p_project_id = '|| p_project_id;
8349: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8350:
8351: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
8352: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8353: END IF;
8347: IF l_debug_mode = 'Y' THEN
8348: pa_debug.g_err_stage:='p_project_id = '|| p_project_id;
8349: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8350:
8351: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
8352: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8353: END IF;
8354:
8355: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
8348: pa_debug.g_err_stage:='p_project_id = '|| p_project_id;
8349: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8350:
8351: pa_debug.g_err_stage:='p_resource_list_id = '|| p_resource_list_id;
8352: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8353: END IF;
8354:
8355: PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
8356: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
8413: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
8414: END IF;
8415:
8416: IF l_debug_mode = 'Y' THEN
8417: pa_debug.g_err_stage:='Exiting Refresh_res_list_assignment';
8418: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,3);
8419:
8420: -- reset curr function
8421: pa_debug.reset_curr_function;
8414: END IF;
8415:
8416: IF l_debug_mode = 'Y' THEN
8417: pa_debug.g_err_stage:='Exiting Refresh_res_list_assignment';
8418: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,3);
8419:
8420: -- reset curr function
8421: pa_debug.reset_curr_function;
8422: END IF;
8417: pa_debug.g_err_stage:='Exiting Refresh_res_list_assignment';
8418: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,3);
8419:
8420: -- reset curr function
8421: pa_debug.reset_curr_function;
8422: END IF;
8423:
8424: EXCEPTION
8425:
8442:
8443: x_return_status := FND_API.G_RET_STS_ERROR;
8444:
8445: IF l_debug_mode = 'Y' THEN
8446: pa_debug.g_err_stage:='Invalid Arguments Passed Or called api raised an error';
8447: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8448:
8449: -- reset curr function
8450: pa_debug.reset_curr_function;
8443: x_return_status := FND_API.G_RET_STS_ERROR;
8444:
8445: IF l_debug_mode = 'Y' THEN
8446: pa_debug.g_err_stage:='Invalid Arguments Passed Or called api raised an error';
8447: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8448:
8449: -- reset curr function
8450: pa_debug.reset_curr_function;
8451: END IF;
8446: pa_debug.g_err_stage:='Invalid Arguments Passed Or called api raised an error';
8447: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8448:
8449: -- reset curr function
8450: pa_debug.reset_curr_function;
8451: END IF;
8452: RETURN;
8453: WHEN Others THEN
8454: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8458: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
8459: ,p_procedure_name => 'Refresh_res_list_assignment');
8460:
8461: IF l_debug_mode = 'Y' THEN
8462: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
8463: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8464:
8465: -- reset curr function
8466: pa_debug.reset_curr_function;
8459: ,p_procedure_name => 'Refresh_res_list_assignment');
8460:
8461: IF l_debug_mode = 'Y' THEN
8462: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
8463: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8464:
8465: -- reset curr function
8466: pa_debug.reset_curr_function;
8467: END IF;
8462: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
8463: pa_debug.write('Refresh_res_list_assignment: ' || l_module_name,pa_debug.g_err_stage,5);
8464:
8465: -- reset curr function
8466: pa_debug.reset_curr_function;
8467: END IF;
8468: RAISE;
8469: END Refresh_res_list_assignment;
8470:
8544: x_msg_count := 0;
8545: x_msg_data := NULL;
8546: x_return_status := FND_API.G_RET_STS_SUCCESS;
8547:
8548: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
8549: l_debug_mode := NVL(l_debug_mode, 'Y');
8550:
8551: IF p_pa_debug_mode = 'Y' THEN
8552: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.create_default_plan_txn_rec');
8547:
8548: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
8549: l_debug_mode := NVL(l_debug_mode, 'Y');
8550:
8551: IF p_pa_debug_mode = 'Y' THEN
8552: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.create_default_plan_txn_rec');
8553: pa_debug.set_process('PLSQL','LOG',l_debug_mode);
8554:
8555: pa_debug.g_err_stage := 'Entered create_default_plan_txn_rec';
8548: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
8549: l_debug_mode := NVL(l_debug_mode, 'Y');
8550:
8551: IF p_pa_debug_mode = 'Y' THEN
8552: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.create_default_plan_txn_rec');
8553: pa_debug.set_process('PLSQL','LOG',l_debug_mode);
8554:
8555: pa_debug.g_err_stage := 'Entered create_default_plan_txn_rec';
8556: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8549: l_debug_mode := NVL(l_debug_mode, 'Y');
8550:
8551: IF p_pa_debug_mode = 'Y' THEN
8552: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.create_default_plan_txn_rec');
8553: pa_debug.set_process('PLSQL','LOG',l_debug_mode);
8554:
8555: pa_debug.g_err_stage := 'Entered create_default_plan_txn_rec';
8556: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8557:
8551: IF p_pa_debug_mode = 'Y' THEN
8552: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.create_default_plan_txn_rec');
8553: pa_debug.set_process('PLSQL','LOG',l_debug_mode);
8554:
8555: pa_debug.g_err_stage := 'Entered create_default_plan_txn_rec';
8556: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8557:
8558: -- Check for not null parameters
8559:
8552: pa_debug.set_err_stack('PA_FIN_PLAN_PUB.create_default_plan_txn_rec');
8553: pa_debug.set_process('PLSQL','LOG',l_debug_mode);
8554:
8555: pa_debug.g_err_stage := 'Entered create_default_plan_txn_rec';
8556: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8557:
8558: -- Check for not null parameters
8559:
8560: pa_debug.g_err_stage := 'Checking for valid parameters:';
8556: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8557:
8558: -- Check for not null parameters
8559:
8560: pa_debug.g_err_stage := 'Checking for valid parameters:';
8561: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8562: END IF;
8563:
8564: IF p_budget_version_id IS NULL OR
8557:
8558: -- Check for not null parameters
8559:
8560: pa_debug.g_err_stage := 'Checking for valid parameters:';
8561: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8562: END IF;
8563:
8564: IF p_budget_version_id IS NULL OR
8565: p_calling_module IS NULL THEN
8562: END IF;
8563:
8564: IF p_budget_version_id IS NULL OR
8565: p_calling_module IS NULL THEN
8566: IF p_pa_debug_mode = 'Y' THEN
8567: pa_debug.g_err_stage := 'p_budget_version_id = '||p_budget_version_id;
8568: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8569: pa_debug.g_err_stage := 'p_calling_module = '||p_calling_module;
8570: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8563:
8564: IF p_budget_version_id IS NULL OR
8565: p_calling_module IS NULL THEN
8566: IF p_pa_debug_mode = 'Y' THEN
8567: pa_debug.g_err_stage := 'p_budget_version_id = '||p_budget_version_id;
8568: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8569: pa_debug.g_err_stage := 'p_calling_module = '||p_calling_module;
8570: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8571: END IF;
8564: IF p_budget_version_id IS NULL OR
8565: p_calling_module IS NULL THEN
8566: IF p_pa_debug_mode = 'Y' THEN
8567: pa_debug.g_err_stage := 'p_budget_version_id = '||p_budget_version_id;
8568: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8569: pa_debug.g_err_stage := 'p_calling_module = '||p_calling_module;
8570: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8571: END IF;
8572:
8565: p_calling_module IS NULL THEN
8566: IF p_pa_debug_mode = 'Y' THEN
8567: pa_debug.g_err_stage := 'p_budget_version_id = '||p_budget_version_id;
8568: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8569: pa_debug.g_err_stage := 'p_calling_module = '||p_calling_module;
8570: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8571: END IF;
8572:
8573: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
8566: IF p_pa_debug_mode = 'Y' THEN
8567: pa_debug.g_err_stage := 'p_budget_version_id = '||p_budget_version_id;
8568: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8569: pa_debug.g_err_stage := 'p_calling_module = '||p_calling_module;
8570: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8571: END IF;
8572:
8573: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
8574: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
8575:
8576: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
8577:
8578: END IF;
8579: IF p_pa_debug_mode = 'Y' THEN
8580: pa_debug.g_err_stage := 'Parameter validation complete';
8581: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8582: END IF;
8583:
8576: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
8577:
8578: END IF;
8579: IF p_pa_debug_mode = 'Y' THEN
8580: pa_debug.g_err_stage := 'Parameter validation complete';
8581: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8582: END IF;
8583:
8584: if (p_calling_module = 'UPDATE_PLAN_TRANSACTION') then /* janani */
8577:
8578: END IF;
8579: IF p_pa_debug_mode = 'Y' THEN
8580: pa_debug.g_err_stage := 'Parameter validation complete';
8581: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8582: END IF;
8583:
8584: if (p_calling_module = 'UPDATE_PLAN_TRANSACTION') then /* janani */
8585: l_def_plan_txn_ra_id_tbl := p_ra_id_tbl;
8596: l_expenditure_type_tbl.extend(l_def_plan_txn_ra_id_tbl.COUNT); /*EnC */
8597:
8598:
8599: IF l_def_plan_txn_ra_id_tbl.COUNT = 0 THEN
8600: IF p_pa_debug_mode = 'Y' THEN
8601: pa_debug.g_err_stage := 'No resource assignment to default, returning';
8602: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8603: pa_debug.reset_err_stack;
8604: END IF;
8597:
8598:
8599: IF l_def_plan_txn_ra_id_tbl.COUNT = 0 THEN
8600: IF p_pa_debug_mode = 'Y' THEN
8601: pa_debug.g_err_stage := 'No resource assignment to default, returning';
8602: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8603: pa_debug.reset_err_stack;
8604: END IF;
8605: RETURN;
8598:
8599: IF l_def_plan_txn_ra_id_tbl.COUNT = 0 THEN
8600: IF p_pa_debug_mode = 'Y' THEN
8601: pa_debug.g_err_stage := 'No resource assignment to default, returning';
8602: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8603: pa_debug.reset_err_stack;
8604: END IF;
8605: RETURN;
8606: END IF;
8599: IF l_def_plan_txn_ra_id_tbl.COUNT = 0 THEN
8600: IF p_pa_debug_mode = 'Y' THEN
8601: pa_debug.g_err_stage := 'No resource assignment to default, returning';
8602: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8603: pa_debug.reset_err_stack;
8604: END IF;
8605: RETURN;
8606: END IF;
8607:
8605: RETURN;
8606: END IF;
8607:
8608: IF l_def_plan_txn_ra_id_tbl.COUNT > 0 THEN
8609: IF p_pa_debug_mode = 'Y' THEN
8610: pa_debug.g_err_stage := 'Getting currency information';
8611: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8612: END IF;
8613:
8606: END IF;
8607:
8608: IF l_def_plan_txn_ra_id_tbl.COUNT > 0 THEN
8609: IF p_pa_debug_mode = 'Y' THEN
8610: pa_debug.g_err_stage := 'Getting currency information';
8611: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8612: END IF;
8613:
8614: BEGIN
8607:
8608: IF l_def_plan_txn_ra_id_tbl.COUNT > 0 THEN
8609: IF p_pa_debug_mode = 'Y' THEN
8610: pa_debug.g_err_stage := 'Getting currency information';
8611: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8612: END IF;
8613:
8614: BEGIN
8615: SELECT pbv.ci_id,
8627: WHERE pbv.budget_version_id = p_budget_version_id
8628: AND ppa.project_id = pbv.project_id;
8629: EXCEPTION
8630: WHEN NO_DATA_FOUND THEN
8631: IF p_pa_debug_mode = 'Y' THEN
8632: pa_debug.g_err_stage := 'Invalid budget version id';
8633: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8634: END IF;
8635: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
8628: AND ppa.project_id = pbv.project_id;
8629: EXCEPTION
8630: WHEN NO_DATA_FOUND THEN
8631: IF p_pa_debug_mode = 'Y' THEN
8632: pa_debug.g_err_stage := 'Invalid budget version id';
8633: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8634: END IF;
8635: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
8636: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
8629: EXCEPTION
8630: WHEN NO_DATA_FOUND THEN
8631: IF p_pa_debug_mode = 'Y' THEN
8632: pa_debug.g_err_stage := 'Invalid budget version id';
8633: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8634: END IF;
8635: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
8636: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
8637:
8645: ELSE
8646: -- create version flow: proceed with the usual currency defaulting logic
8647: IF l_ci_id IS NOT NULL THEN
8648: /* ci version context */
8649: IF p_pa_debug_mode = 'Y' THEN
8650: pa_debug.g_err_stage := 'Ci_id is not null';
8651: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8652: END IF;
8653: IF l_app_rev_flag = 'Y' THEN
8646: -- create version flow: proceed with the usual currency defaulting logic
8647: IF l_ci_id IS NOT NULL THEN
8648: /* ci version context */
8649: IF p_pa_debug_mode = 'Y' THEN
8650: pa_debug.g_err_stage := 'Ci_id is not null';
8651: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8652: END IF;
8653: IF l_app_rev_flag = 'Y' THEN
8654: IF l_agreement_id IS NOT NULL THEN
8647: IF l_ci_id IS NOT NULL THEN
8648: /* ci version context */
8649: IF p_pa_debug_mode = 'Y' THEN
8650: pa_debug.g_err_stage := 'Ci_id is not null';
8651: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8652: END IF;
8653: IF l_app_rev_flag = 'Y' THEN
8654: IF l_agreement_id IS NOT NULL THEN
8655: /* txn currency should be the agreement currency */
8659: FROM pa_agreements_all
8660: WHERE agreement_id = l_agreement_id;
8661: EXCEPTION
8662: WHEN NO_DATA_FOUND THEN
8663: IF p_pa_debug_mode = 'Y' THEN
8664: pa_debug.g_err_stage := 'Invalid agreement id';
8665: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8666: END IF;
8667: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
8660: WHERE agreement_id = l_agreement_id;
8661: EXCEPTION
8662: WHEN NO_DATA_FOUND THEN
8663: IF p_pa_debug_mode = 'Y' THEN
8664: pa_debug.g_err_stage := 'Invalid agreement id';
8665: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8666: END IF;
8667: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
8668: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
8661: EXCEPTION
8662: WHEN NO_DATA_FOUND THEN
8663: IF p_pa_debug_mode = 'Y' THEN
8664: pa_debug.g_err_stage := 'Invalid agreement id';
8665: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8666: END IF;
8667: PA_UTILS.ADD_MESSAGE(p_app_short_name=> 'PA',
8668: p_msg_name => 'PA_FP_INV_PARAM_PASSED');
8669: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
8694: END IF;
8695: END IF; -- if ci_id not null
8696: END IF; -- p_calling_module
8697:
8698: IF p_pa_debug_mode = 'Y' THEN
8699: pa_debug.g_err_stage := 'l_def_txn_curr_code: ' || l_def_txn_curr_code;
8700: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8701: END IF;
8702:
8695: END IF; -- if ci_id not null
8696: END IF; -- p_calling_module
8697:
8698: IF p_pa_debug_mode = 'Y' THEN
8699: pa_debug.g_err_stage := 'l_def_txn_curr_code: ' || l_def_txn_curr_code;
8700: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8701: END IF;
8702:
8703: DELETE pa_resource_asgn_curr_tmp;
8696: END IF; -- p_calling_module
8697:
8698: IF p_pa_debug_mode = 'Y' THEN
8699: pa_debug.g_err_stage := 'l_def_txn_curr_code: ' || l_def_txn_curr_code;
8700: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
8701: END IF;
8702:
8703: DELETE pa_resource_asgn_curr_tmp;
8704: /* bulk insert the left over resource assignments into the new table with default txn currency
8747: X_MSG_COUNT => l_msg_count,
8748: X_MSG_DATA => l_msg_data);
8749:
8750: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8751: IF P_PA_debug_mode = 'Y' THEN
8752: pa_debug.g_err_stage:= 'Error in TARGET PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
8753: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
8754: END IF;
8755: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
8748: X_MSG_DATA => l_msg_data);
8749:
8750: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8751: IF P_PA_debug_mode = 'Y' THEN
8752: pa_debug.g_err_stage:= 'Error in TARGET PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
8753: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
8754: END IF;
8755: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
8756: END IF;
8749:
8750: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
8751: IF P_PA_debug_mode = 'Y' THEN
8752: pa_debug.g_err_stage:= 'Error in TARGET PA_FP_GEN_AMOUNT_UTILS.GET_PLAN_VERSION_DETAILS';
8753: pa_debug.write(l_module_name,pa_debug.g_err_stage,l_debug_level5);
8754: END IF;
8755: RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
8756: END IF;
8757:
8784: END IF; /* janani */
8785:
8786: IF l_return_status <> FND_API.G_RET_STS_SUCCESS
8787: THEN
8788: IF p_pa_debug_mode = 'Y' THEN
8789: pa_debug.write_file('Failed due to error in PA_RES_ASG_CURRENCY_PUB.maintain_data',5);
8790: END IF;
8791: raise PA_FP_CONSTANTS_PKG.INVALID_ARG_EXC;
8792: END IF;
8785:
8786: IF l_return_status <> FND_API.G_RET_STS_SUCCESS
8787: THEN
8788: IF p_pa_debug_mode = 'Y' THEN
8789: pa_debug.write_file('Failed due to error in PA_RES_ASG_CURRENCY_PUB.maintain_data',5);
8790: END IF;
8791: raise PA_FP_CONSTANTS_PKG.INVALID_ARG_EXC;
8792: END IF;
8793: --IPM Arch Enhancement Bug 4865563 End
8793: --IPM Arch Enhancement Bug 4865563 End
8794:
8795:
8796: END IF; -- if there is ra_id to be inserted
8797: IF p_pa_debug_mode = 'Y' THEN
8798: pa_debug.reset_err_stack;
8799: END IF;
8800:
8801: EXCEPTION
8794:
8795:
8796: END IF; -- if there is ra_id to be inserted
8797: IF p_pa_debug_mode = 'Y' THEN
8798: pa_debug.reset_err_stack;
8799: END IF;
8800:
8801: EXCEPTION
8802: WHEN PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc THEN
8818: ELSE
8819: x_msg_count := l_msg_count;
8820: x_msg_data := l_msg_data;
8821: END IF;
8822: IF p_pa_debug_mode = 'Y' THEN
8823: pa_debug.g_err_stage:='Invalid Arguments Passed';
8824: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8825: pa_debug.write_file('create_default_plan_txn_rec ' || x_msg_data,5);
8826: END IF;
8819: x_msg_count := l_msg_count;
8820: x_msg_data := l_msg_data;
8821: END IF;
8822: IF p_pa_debug_mode = 'Y' THEN
8823: pa_debug.g_err_stage:='Invalid Arguments Passed';
8824: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8825: pa_debug.write_file('create_default_plan_txn_rec ' || x_msg_data,5);
8826: END IF;
8827:
8820: x_msg_data := l_msg_data;
8821: END IF;
8822: IF p_pa_debug_mode = 'Y' THEN
8823: pa_debug.g_err_stage:='Invalid Arguments Passed';
8824: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8825: pa_debug.write_file('create_default_plan_txn_rec ' || x_msg_data,5);
8826: END IF;
8827:
8828: x_return_status:= FND_API.G_RET_STS_ERROR;
8821: END IF;
8822: IF p_pa_debug_mode = 'Y' THEN
8823: pa_debug.g_err_stage:='Invalid Arguments Passed';
8824: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8825: pa_debug.write_file('create_default_plan_txn_rec ' || x_msg_data,5);
8826: END IF;
8827:
8828: x_return_status:= FND_API.G_RET_STS_ERROR;
8829: IF p_pa_debug_mode = 'Y' THEN
8825: pa_debug.write_file('create_default_plan_txn_rec ' || x_msg_data,5);
8826: END IF;
8827:
8828: x_return_status:= FND_API.G_RET_STS_ERROR;
8829: IF p_pa_debug_mode = 'Y' THEN
8830: pa_debug.reset_err_stack;
8831: END IF;
8832: RAISE;
8833:
8826: END IF;
8827:
8828: x_return_status:= FND_API.G_RET_STS_ERROR;
8829: IF p_pa_debug_mode = 'Y' THEN
8830: pa_debug.reset_err_stack;
8831: END IF;
8832: RAISE;
8833:
8834: WHEN Others THEN
8840: x_msg_count := 1;
8841: x_msg_data := SQLERRM;
8842: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
8843: ,p_procedure_name => 'create_default_plan_txn_rec');
8844: IF p_pa_debug_mode = 'Y' THEN
8845: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
8846: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8847: pa_debug.write_file('create_default_plan_txn_rec ' || pa_debug.G_Err_Stack,5);
8848: END IF;
8841: x_msg_data := SQLERRM;
8842: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
8843: ,p_procedure_name => 'create_default_plan_txn_rec');
8844: IF p_pa_debug_mode = 'Y' THEN
8845: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
8846: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8847: pa_debug.write_file('create_default_plan_txn_rec ' || pa_debug.G_Err_Stack,5);
8848: END IF;
8849: IF p_pa_debug_mode = 'Y' THEN
8842: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FIN_PLAN_PUB'
8843: ,p_procedure_name => 'create_default_plan_txn_rec');
8844: IF p_pa_debug_mode = 'Y' THEN
8845: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
8846: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8847: pa_debug.write_file('create_default_plan_txn_rec ' || pa_debug.G_Err_Stack,5);
8848: END IF;
8849: IF p_pa_debug_mode = 'Y' THEN
8850: pa_debug.reset_err_stack;
8843: ,p_procedure_name => 'create_default_plan_txn_rec');
8844: IF p_pa_debug_mode = 'Y' THEN
8845: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
8846: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8847: pa_debug.write_file('create_default_plan_txn_rec ' || pa_debug.G_Err_Stack,5);
8848: END IF;
8849: IF p_pa_debug_mode = 'Y' THEN
8850: pa_debug.reset_err_stack;
8851: END IF;
8845: pa_debug.g_err_stage:='Unexpected Error'||SQLERRM;
8846: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8847: pa_debug.write_file('create_default_plan_txn_rec ' || pa_debug.G_Err_Stack,5);
8848: END IF;
8849: IF p_pa_debug_mode = 'Y' THEN
8850: pa_debug.reset_err_stack;
8851: END IF;
8852: RAISE;
8853: END create_default_plan_txn_rec;
8846: pa_debug.write(l_module_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
8847: pa_debug.write_file('create_default_plan_txn_rec ' || pa_debug.G_Err_Stack,5);
8848: END IF;
8849: IF p_pa_debug_mode = 'Y' THEN
8850: pa_debug.reset_err_stack;
8851: END IF;
8852: RAISE;
8853: END create_default_plan_txn_rec;
8854: