1 PACKAGE BODY PA_DISPLAY_PERIOD_MASKS AS
2 /*$Header: PAFPPMKB.pls 120.2 2006/02/24 00:04:20 prachand noship $*/
3
4 --g_module_name VARCHAR2(100) := 'pa.plsql.PA_DISPLAY_PERIOD_MASKS';
5
6 --P_PA_DEBUG_MODE varchar2(1) := NVL(FND_PROFILE.value('PA_DEBUG_MODE'), 'N');
7
8 g_plan_period_start_name gl_periods.period_name%TYPE := NULL;
9 g_plan_period_start_date gl_periods.end_date%TYPE := to_date(NULL);
10 g_plan_period_end_name gl_periods.period_name%TYPE := NULL;
11 g_plan_period_end_date gl_periods.end_date%TYPE := to_date(NULL);
12 g_cpp_start_date gl_periods.start_date%TYPE := to_date(NULL);
13 g_cpp_end_date gl_periods.end_date%TYPE := to_date(NULL);
14 --g_tab_deleted boolean := FALSE;
15
16 -- Bug Fix 3671424.
17 -- Removing the hard coded string proeceeding and succeding in the code
18 -- with the appropriate lookup meanings which 'll be translated.
19
20 g_preceeding pa_lookups.meaning%TYPE := NULL;
21 g_succeeding pa_lookups.meaning%TYPE := NULL;
22 g_to pa_lookups.meaning%TYPE := NULL;
23
24
25
26 /* get_current_period_start_date() will get the current periods start date
27 -- it MUST have the following parameters:
28 -- current_planning_period,
29 -- period_set_name,
30 -- time_phase_code,
31 -- and either accounterd_period_type set for 'GL'
32 -- OR pa_period_type set for 'PA'
33 -- it is called by get_periods()
34 */
35
36 FUNCTION get_current_period_start_date ( p_current_planning_period IN pa_budget_versions.current_planning_period%TYPE
37 ,p_period_set_name IN gl_sets_of_books.period_set_name%TYPE
38 ,p_time_phase_code IN pa_proj_fp_options.cost_time_phased_code%TYPE
39 ,p_accounted_period_type IN gl_sets_of_books.accounted_period_type%TYPE
40 ,p_pa_period_type IN pa_implementations_all.pa_period_type%TYPE)
41 RETURN DATE IS
42
43 l_current_period_start_date DATE; --RETURN value
44
45 /*
46 -- gl_periods_start_date_csr uses the decode function as follows :
47 -- if time phase code = 'G' then use accounted_period_type
48 -- if time phase code = 'P' then use pa_period_type
49 */
50
51
52 CURSOR gl_periods_start_date_csr IS
53 SELECT gp.start_date
54 ,gp.end_date
55 FROM gl_periods gp
56 WHERE gp.period_name = p_current_planning_period
57 AND gp.period_set_name = p_period_set_name
58 AND gp.period_type = decode(P_time_phase_code,'G',p_accounted_period_type,'P',P_pa_period_type)
59 AND gp.adjustment_period_flag = 'N';
60
61 gl_periods_start_date_rec gl_periods_start_date_csr%ROWTYPE;
62
63 BEGIN
64 OPEN gl_periods_start_date_csr;
65 FETCH gl_periods_start_date_csr INTO gl_periods_start_date_rec;
66 IF gl_periods_start_date_csr%NOTFOUND THEN
67 NULL;
68 --hr_utility.trace('get_current_period_start_date.gl_periods_start_date_csr does not contain anything! exception');
69 g_cpp_start_date := NULL;
70 g_cpp_end_date := NULL;
71 ELSE
72 l_current_period_start_date := gl_periods_start_date_rec.start_date;
73
74 g_cpp_start_date := gl_periods_start_date_rec.start_date;
75 g_cpp_end_date := gl_periods_start_date_rec.end_date;
76
77 --hr_utility.trace('g_cpp_start_date := '||to_char(g_cpp_start_date));
78 --hr_utility.trace('g_cpp_end_date := '||to_char(g_cpp_end_date));
79
80 END IF;
81 CLOSE gl_periods_start_date_csr;
82
83 RETURN l_current_period_start_date;
84
85 END get_current_period_start_date;
86
87
88
89 PROCEDURE get_plan_period_end ( p_planning_end_date IN pa_resource_assignments.planning_end_date%TYPE
90 ,p_period_set_name IN gl_sets_of_books.period_set_name%TYPE
91 ,p_time_phase_code IN pa_proj_fp_options.cost_time_phased_code%TYPE
92 ,p_accounted_period_type IN gl_sets_of_books.accounted_period_type%TYPE
93 ,p_pa_period_type IN pa_implementations_all.pa_period_type%TYPE
94 )
95 IS
96
97
98
99 CURSOR plan_period_end_csr IS
100 SELECT gp.end_date
101 ,gp.period_name
102 FROM gl_periods gp
103 WHERE p_planning_end_date BETWEEN gp.start_date AND gp.end_date
104 AND gp.period_set_name = p_period_set_name
105 AND gp.period_type = decode(P_time_phase_code,'G',p_accounted_period_type,'P',P_pa_period_type)
106 AND gp.adjustment_period_flag = 'N';
107
108 plan_period_end_rec plan_period_end_csr%ROWTYPE;
109
110 BEGIN
111 OPEN plan_period_end_csr;
112 FETCH plan_period_end_csr INTO plan_period_end_rec;
113 IF plan_period_end_csr%NOTFOUND THEN
114 NULL;
115 --hr_utility.trace('plan_period_end.plan_period_end_csr does not contain anything! exception');
116 g_plan_period_end_name := NULL;
117 g_plan_period_end_date := NULL;
118 ELSE
119 g_plan_period_end_name := plan_period_end_rec.period_name;
120 g_plan_period_end_date := plan_period_end_rec.end_date;
121 --hr_utility.trace('g_plan_period_end_name := '||g_plan_period_end_name);
122 --hr_utility.trace('g_plan_period_end_date := '||g_plan_period_end_date);
123 END IF;
124 CLOSE plan_period_end_csr;
125
126 END get_plan_period_end;
127
128
129
130 PROCEDURE get_plan_period_start ( p_planning_start_date IN pa_resource_assignments.planning_start_date%TYPE
131 ,p_period_set_name IN gl_sets_of_books.period_set_name%TYPE
132 ,p_time_phase_code IN pa_proj_fp_options.cost_time_phased_code%TYPE
133 ,p_accounted_period_type IN gl_sets_of_books.accounted_period_type%TYPE
134 ,p_pa_period_type IN pa_implementations_all.pa_period_type%TYPE
135 )
136 IS
137
138
139
140 CURSOR plan_period_start_csr IS
141 SELECT gp.start_date
142 ,gp.period_name
143 FROM gl_periods gp
144 WHERE p_planning_start_date BETWEEN gp.start_date AND gp.end_date
145 AND gp.period_set_name = p_period_set_name
146 AND gp.period_type = decode(P_time_phase_code,'G',p_accounted_period_type,'P',P_pa_period_type)
147 AND gp.adjustment_period_flag = 'N';
148
149 plan_period_start_rec plan_period_start_csr%ROWTYPE;
150
151 BEGIN
152 OPEN plan_period_start_csr;
153 FETCH plan_period_start_csr INTO plan_period_start_rec;
154 IF plan_period_start_csr%NOTFOUND THEN
155 NULL;
156 --hr_utility.trace('plan_period_start.plan_period_start_csr does not contain anything! exception');
157 g_plan_period_start_name := NULL;
158 g_plan_period_start_date := NULL;
159 ELSE
160 g_plan_period_start_name := plan_period_start_rec.period_name;
161 g_plan_period_start_date := plan_period_start_rec.start_date;
162 --hr_utility.trace('g_plan_period_start_name := '||g_plan_period_start_name);
163 --hr_utility.trace('g_plan_period_start_date := '||to_char(g_plan_period_start_date));
164 END IF;
165 CLOSE plan_period_start_csr;
166
167 END get_plan_period_start;
168
169
170 /* get_period_mask_start() returns the min from_anchor_start from pa_period_mask_details
171 -- it will not return rows that have an from_anchor_start with -99999 or 99999
172 -- these are flags for preceeding and suceeding buckets
173 -- this function is called from get_periods to populate the pl/sql table with the
174 -- before anchor date records from gl_periods
175 */
176 FUNCTION get_period_mask_start( p_period_mask_id IN pa_period_mask_details.period_mask_id%TYPE) RETURN NUMBER
177 IS
178
179 l_period_mask_start pa_period_mask_details.from_anchor_start%type; --RETURN value
180
181 CURSOR get_min_csr IS
182 SELECT min(from_anchor_start) from_anchor_start_min
183 FROM pa_period_mask_details
184 WHERE from_anchor_start NOT IN (-99999,99999)
185 AND period_mask_id = p_period_mask_id;
186
187 get_min_rec get_min_csr%ROWTYPE;
188
189 BEGIN
190
191 OPEN get_min_csr;
192 FETCH get_min_csr INTO get_min_rec;
193 IF get_min_csr%NOTFOUND
194 THEN
195 NULL;
196 --hr_utility.trace('get_period_mask_start.get_min_csr does not contain anything! exception');
197 ELSE
198 l_period_mask_start := get_min_rec.from_anchor_start_min;
199 --hr_utility.trace('l_period_mask_start := '||to_char(l_period_mask_start));
200 END IF;
201 CLOSE get_min_csr;
202
203 RETURN l_period_mask_start;
204
205 END get_period_mask_start;
206
207
208
209 /* get_period_mask_end() returns the max from_anchor_end from pa_period_mask_details
210 -- it will not return rows that have an from_anchor_start with -99999 or 99999
211 -- these are flags for preceeding and suceeding buckets
212 -- this function is called from get_periods to populate the pl/sql table with the
213 -- after anchor date records from gl_periods
214 */
215 FUNCTION get_period_mask_end ( p_period_mask_id IN pa_period_mask_details.period_mask_id%TYPE) RETURN NUMBER
216 IS
217
218 l_period_mask_end pa_period_mask_details.from_anchor_end%TYPE;
219
220 CURSOR get_max_csr IS
221 SELECT max(from_anchor_end) from_anchor_end_max
222 FROM pa_period_mask_details
223 WHERE from_anchor_end NOT IN (-99999,99999)
224 AND period_mask_id = p_period_mask_id;
225
226 get_max_rec get_max_csr%ROWTYPE;
227
228 BEGIN
229
230 OPEN get_max_csr;
231 FETCH get_max_csr INTO get_max_rec;
232 IF get_max_csr%NOTFOUND
233 THEN
234 NULL;
235 --hr_utility.trace('get_period_mask_end.get_max_csr does not contain anything! exception');
236 ELSE
237 l_period_mask_end := get_max_rec.from_anchor_end_max;
238 --hr_utility.trace('l_period_mask_end := '||to_char(l_period_mask_end));
239 END IF;
240 CLOSE get_max_csr;
241
242 RETURN l_period_mask_end;
243
244 END get_period_mask_end;
245
246
247
248
249
250
251 /*
252 -- get_periods() is the main function of this package
253 -- it populates the periods_tab pl/sql table with rows of data from gl_periods
254 -- within the masks start and end periods
255 -- it will also set the global variables g_preceeding_end and g_suceeding_start
256 -- these will be used for the proceeding buckets end period and suceeding buckets start period
257 -- get_periods will return 1 if it populates periods_tab pl/sql table successfully
258 */
259 FUNCTION get_periods ( p_budget_version_id IN pa_budget_versions.budget_version_id%TYPE,
260 p_resource_assignment_id IN pa_resource_assignments.resource_assignment_id%TYPE DEFAULT -1) RETURN NUMBER
261 IS
262 l_return NUMBER := 0; --RETURN value
263 l_current_planning_period pa_budget_versions.current_planning_period%TYPE;
264 l_period_set_name gl_sets_of_books.period_set_name%TYPE;
265 l_accounted_period_type gl_sets_of_books.accounted_period_type%TYPE;
266 l_pa_period_type pa_implementations_all.pa_period_type%TYPE;
270 l_count NUMBER := 0 ; --counter variable
267 l_time_phase_code pa_proj_fp_options.cost_time_phased_code%TYPE;
268 l_period_mask_id pa_period_mask_details.period_mask_id%TYPE;
269 l_cpp_start_date DATE;
271 l_plan_start_date pa_resource_assignments.planning_start_date%TYPE;
272 l_plan_end_date pa_resource_assignments.planning_end_date%TYPE;
273
274
275 /*
276 -- get_name_and_type_csr is used to select the parameters needed for
277 -- get_current_period_start_date(),get_gl_periods_before_csr,get_gl_periods_after_csr
278 -- get_current_period_start_date() must return a start date for get_gl_periods_before_csr
279 -- and get_gl_periods_after_csr to run
280 -- period_set_name and accounted_period_type exist in table gl_set_of_books
281 -- current_planning_period and period_mask_id exist in table pa_budget_versions
282 -- pa_period_type exists in pa_implementations_all
283 -- to find the time phase code decode is used
284 -- IF pbv.version_type = COST the time phase code = ppfo.cost_time_phased_code
285 -- IF pbv.version_type = REVENUE the time phase code = ppfo.revenue_time_phased_code
286 -- ELSE the time phase code = ppfo.all_time_phased_code
287 -- p_budget_version_id is a parameter IN
288 -- use nvl(ppa.org_id,-99) = nvl(pia.org_id,-99) to return at least one row if columns are null
289 */
290
291
292 CURSOR get_name_and_type_csr IS
293 SELECT gsb.period_set_name
294 ,gsb.accounted_period_type
295 ,pbv.current_planning_period
296 ,pbv.period_mask_id
297 ,pia.pa_period_type
298 ,decode(pbv.version_type,
299 'COST',ppfo.cost_time_phased_code,
300 'REVENUE',ppfo.revenue_time_phased_code,
301 ppfo.all_time_phased_code) time_phase_code
302 FROM gl_sets_of_books gsb
303 ,pa_implementations_all pia
304 ,pa_projects_all ppa
305 ,pa_budget_versions pbv
306 ,pa_proj_fp_options ppfo
307 WHERE ppa.project_id = pbv.project_id
308 AND pbv.budget_version_id = ppfo.fin_plan_version_id
309 AND ppa.org_id = pia.org_id
310 AND gsb.set_of_books_id = pia.set_of_books_id
311 AND pbv.budget_version_id = p_budget_version_id;
312
313
314 CURSOR get_resource_asg_dates IS
315 SELECT planning_start_date,
316 planning_end_date
317 FROM pa_resource_assignments
318 WHERE resource_assignment_id = p_resource_assignment_id;
319
320 get_name_and_type_rec get_name_and_type_csr%ROWTYPE;
321
322 /*
323 -- get_gl_periods_before_csr returns all rows from gl_periods
324 -- before or equal to current planning period start date
325 -- get_gl_periods_before_csr uses the decode function use the correct period type GL and PA periods
326 -- G = 'GL' and P = 'PA'
327 */
328
329 -- Bug Fix 3663107.
330 -- The display mask is not forming properly. This is happening because of the
331 -- where condition in this cursos.
332 -- Consider the scenario where Current Planning Period is prior to the planning
333 -- Start Date.
334 -- Current Planning Period is JAN-03 and Planning Start Date is 02-MAR-03.
335 -- Due to the where conditions in the cursor to restrict the gl periods before the
336 -- current planning period and falling between the planning dates is not
337 -- returning any values thus resulting into the wrong mask.
338 --
339 -- Need to remove the where condition which assumes that the current planning
340 -- period is always between the planning periods.
341 -- As a fix remove the planning dates restriction here and make sure that
342 -- the select which will call the functions in this package are restricting
343 -- the constructed mask between the planning dates.
344 --
345 -- Here in the cursor commenting the following two where conditions
346 --
347 -- AND gp.end_date >= nvl(l_plan_start_date, gp.end_date)
348 -- AND l_cpp_start_date between g_plan_period_start_date and g_plan_period_end_datE
349 --
350 -- Made sure that the select in the FpEditPlanLinesTableVO has the following where cond.
351 --
352 -- and exists (select 'x' from dual
353 -- where (pp.planning_start_date between pp.start_date and pp.end_date OR
354 -- pp.planning_end_date between pp.start_date and pp.end_date OR
355 -- (pp.start_date >= pp.planning_start_date and
356 -- pp.end_date <= pp.planning_end_date)))
357
358 -- End of Fix for Bug 3663107.
359
360 CURSOR get_gl_periods_before_csr IS
361 SELECT *
362 FROM gl_periods gp
363 WHERE gp.period_set_name = l_period_set_name
364 AND gp.period_type = decode(l_time_phase_code,'G',l_accounted_period_type,
365 'P',l_pa_period_type)
366 AND gp.start_date <= l_cpp_start_date
367 AND gp.adjustment_period_flag = 'N'
368 --AND nvl(l_plan_start_date,gp.start_date) between gp.start_date and gp.end_date
369 --AND gp.end_date >= nvl(l_plan_start_date, gp.end_date)
370 -- Bug Fix 3475010. Additional PP masks are getting created.
371 -- Modified the following where condition as we are trying to compare
372 -- Period's start with plan start date instead of the plan's start date's
373 -- period's start date.
374 -- Need to compare the like wise things.
375
376 -- AND l_cpp_start_date between l_plan_start_date and l_plan_end_date
377 -- AND l_cpp_start_date between g_plan_period_start_date and g_plan_period_end_datE
378 ORDER BY gp.start_date DESC;
379
380 /*
381 -- get_gl_periods_after_csr returns all rows from gl_periods
382 -- after current planning period start date
386 -- Bug Fix 3663107.
383 -- get_gl_periods_before_csr uses the decode function use the correct period type GL and PA periods
384 -- G = 'GL' and P = 'PA'
385 */
387 -- The display mask is not forming properly. This is happening because of the
388 -- where condition in this cursos.
389 -- Consider the scenario where Current Planning Period is after/between the planning
390 -- Start Date/dates.
391 -- Current Planning Period is APR-03 and Planning Dates are 02-MAR-03 to 31-DEC-03.
392 -- Due to the where conditions in the cursor to restrict the gl periods after the
393 -- current planning period and falling between the planning dates is not
394 -- returning proper values and resulting into the wrong mask.
395 --
396 -- Need to remove the where condition which assumes that the current planning
397 -- period is always between the planning periods.
398 -- As a fix remove the planning dates restriction here and make sure that
399 -- the select which will call the functions in this package are restricting
400 -- the constructed mask between the planning dates.
401 --
402 -- Here in the cursor commenting the following two where conditions
403 -- AND gp.start_date <= nvl(g_plan_period_end_date, gp.start_date)
404 --
405 -- Made sure that the select in the FpEditPlanLinesTableVO has the following where cond.
406 --
407 -- and exists (select 'x' from dual
408 -- where (pp.planning_start_date between pp.start_date and pp.end_date OR
409 -- pp.planning_end_date between pp.start_date and pp.end_date OR
410 -- (pp.start_date >= pp.planning_start_date and
411 -- pp.end_date <= pp.planning_end_date)))
412
413 -- End of Fix for Bug 3663107.
414
415 CURSOR get_gl_periods_after_csr IS
416 SELECT *
417 FROM gl_periods gp
418 WHERE gp.period_set_name = l_period_set_name
419 AND gp.period_type = decode(l_time_phase_code,'G',l_accounted_period_type,
420 'P',l_pa_period_type)
421 AND gp.start_date > l_cpp_start_date
422 AND gp.adjustment_period_flag = 'N'
423 -- Bug Fix 3475010. Additional PP masks are getting created.
424 -- Modified the following where condition as we are trying to compare
425 -- Period's start with plan end date instead of the plan's end date's
426 -- period's end date.
427 -- Need to compare the like wise things.
428 -- AND gp.start_date <= nvl(l_plan_end_date, gp.start_date)
429 -- AND gp.start_date <= nvl(g_plan_period_end_date, gp.start_date)
430 ORDER BY gp.start_date;
431
432 -- Bug Fix 3671424.
433 -- removing the hard coded strings.
434
438 l_succ PA_LOOKUPS.LOOKUP_CODE%TYPE ;
435 l_lookup_type PA_LOOKUPS.LOOKUP_TYPE%TYPE ;
436
437 l_prec PA_LOOKUPS.LOOKUP_CODE%TYPE ;
439 l_to PA_LOOKUPS.LOOKUP_CODE%TYPE ;
440
441 CURSOR get_preceeding_csr IS
442 SELECT meaning
443 FROM pa_lookups
444 WHERE lookup_type = l_lookup_type
445 AND lookup_code = l_prec ;
446
447 CURSOR get_succeeding_csr IS
448 SELECT meaning
449 FROM pa_lookups
450 WHERE lookup_type = l_lookup_type
451 AND lookup_code = l_succ ;
452
453 CURSOR get_to_csr IS
454 SELECT meaning
455 FROM pa_lookups
456 WHERE lookup_type = l_lookup_type
457 AND lookup_code = l_to ;
458
459
460
461
462 BEGIN
463 --hr_utility.trace('Entered PA_DISPLAY_PERIOD_MASKS');
464
465 --hr_utility.trace('p_budget_version_id := '||to_char(p_budget_version_id));
466 --hr_utility.trace('p_resource_assignment_id := '||to_char(p_resource_assignment_id));
467
468 -- Bug Fix 3671424
469 -- removing the hard coded strings in the code to avoid translation issues.
470
471 l_lookup_type := 'PA_PERIOD_MASK';
472 l_prec := 'PRECEEDING';
473 l_succ := 'SUCCEEDING';
474 l_to := 'TO';
475
476 OPEN get_preceeding_csr;
477 FETCH get_preceeding_csr INTO g_preceeding;
478 CLOSE get_preceeding_csr;
479
480 OPEN get_succeeding_csr;
481 FETCH get_succeeding_csr INTO g_succeeding;
482 CLOSE get_succeeding_csr;
483
484 OPEN get_to_csr;
485 FETCH get_to_csr INTO g_to;
486 CLOSE get_to_csr;
487
488
489 OPEN get_name_and_type_csr;
490 FETCH get_name_and_type_csr INTO get_name_and_type_rec;
491 IF get_name_and_type_csr%NOTFOUND THEN
492 NULL;
493 --hr_utility.trace('get_periods.get_name_and_type_csr does not contain anything! exception');
494 ELSE
498 l_accounted_period_type := get_name_and_type_rec.accounted_period_type;
495 g_period_mask_id := get_name_and_type_rec.period_mask_id;
496 l_current_planning_period := get_name_and_type_rec.current_planning_period;
497 l_period_set_name := get_name_and_type_rec.period_set_name;
499 l_pa_period_type := get_name_and_type_rec.pa_period_type;
500 l_time_phase_code := get_name_and_type_rec.time_phase_code;
501
502 -----remove below after testing ---------
503 --hr_utility.trace('g_period_mask_id '||g_period_mask_id);
504 --hr_utility.trace('l_current_planning_period '||l_current_planning_period);
505 --hr_utility.trace('l_period_set_name '||l_period_set_name);
506 --hr_utility.trace('l_accounted_period_type '||l_accounted_period_type);
507 --hr_utility.trace('l_pa_period_type '||l_pa_period_type);
508 --hr_utility.trace('l_time_phase_code '||l_time_phase_code);
509 ----remove above after testing ----------
510
511 l_return := 1; --successful RETURN
512 END IF;
513
514 -- Bug Fix 3868062.
515 -- Adding close cursor statement.
516 CLOSE get_name_and_type_csr;
517
518 OPEN get_resource_asg_dates;
519 FETCH get_resource_asg_dates INTO l_plan_start_date, l_plan_end_date;
520 IF get_resource_asg_dates%NOTFOUND THEN
521 l_plan_start_date := to_date(null);
522 l_plan_end_date := to_date(null);
523 END IF;
524
525 -- Bug Fix 3868062.
526 -- Adding close cursor statement.
527 CLOSE get_resource_asg_dates;
528
529 --hr_utility.trace('l_plan_start_date := '||to_char(l_plan_start_date));
530 --hr_utility.trace('l_plan_end_date := '||to_char(l_plan_end_date));
531
532 -- calling get_plan_period_start and get_plan_period_end
533 --hr_utility.trace('calling get_plan_period_end to populate g_plan_period_end_name and g_plan_period_end_date');
534 get_plan_period_end ( p_planning_end_date => l_plan_end_date
535 ,p_period_set_name => l_period_set_name
539 );
536 ,p_time_phase_code => l_time_phase_code
537 ,p_accounted_period_type => l_accounted_period_type
538 ,p_pa_period_type => l_pa_period_type
540 --hr_utility.trace('g_plan_period_end_name := '||g_plan_period_end_name);
541 --hr_utility.trace('g_plan_period_end_date := '||to_char(g_plan_period_end_date));
542
543
544
545 --hr_utility.trace('calling get_plan_period_start to populate g_plan_period_start_name and g_plan_period_start_date');
546 get_plan_period_start ( p_planning_start_date => l_plan_start_date
547 ,p_period_set_name => l_period_set_name
548 ,p_time_phase_code => l_time_phase_code
549 ,p_accounted_period_type => l_accounted_period_type
550 ,p_pa_period_type => l_pa_period_type
551 );
552 --hr_utility.trace('g_plan_period_start_name := '||g_plan_period_start_name);
553 --hr_utility.trace('g_plan_period_start_date := '||to_char(g_plan_period_start_date));
554
555 -- get min AND max of the current mask
556 g_get_mask_start := pa_display_period_masks.get_period_mask_start(g_period_mask_id);
557 g_get_mask_end := pa_display_period_masks.get_period_mask_end(g_period_mask_id);
558
559 -----remove below after testing ---------
560 --hr_utility.trace('g_get_mask_start '||g_get_mask_start);
561 --hr_utility.trace('g_get_mask_end '||g_get_mask_end);
562 -----remove above after testing -------------
563
564
565
566
567
568 l_cpp_start_date := get_current_period_start_date (p_current_planning_period => l_current_planning_period
569 ,p_period_set_name => l_period_set_name
570 ,p_time_phase_code => l_time_phase_code
571 ,p_accounted_period_type => l_accounted_period_type
572 ,p_pa_period_type => l_pa_period_type);
573
574 --hr_utility.trace('l_cpp_start_date :='||to_char(l_cpp_start_date));
575
576 /*
577 -- populate periods_tab pl/sql table with data
578 -- first delete tables data if the pl/sql table has session data
579 */
580
581 /* Commenting out the fix done for bug 3631320 for bug fix 3964651. */
582
583 /*
584 -- Bug Fix 3631320
585 -- blindly deleting this is causing the table population
586 -- an overhead. Need to delete this for the first time
590 -- To acheive this we use a package variable and populate this
587 -- subsequently we dont delete but rather we directly read
588 -- from it.
589
591 -- after delete and use this value before deleting again.
592 */
593 -- IF (periods_tab.first IS NOT NULL AND NOT g_tab_deleted)
594 IF periods_tab.first IS NOT NULL
595 THEN periods_tab.DELETE;
596 --g_tab_deleted := TRUE;
597 END IF;
598 -----------------BEFORE RECORDS -------------
599 l_count := 0;
600
601 FOR rec IN get_gl_periods_before_csr
602 LOOP
603 IF l_count >= g_get_mask_start THEN
604 periods_tab(l_count) := rec;
605 l_count := l_count - 1;
606 ELSE
607 NULL;
608 END IF;
609 END LOOP;
610
611 ---------------AFTER RECORDS -----------------------
612 l_count := 0;
613 FOR rec in get_gl_periods_after_csr
614 LOOP
615 l_count := l_count + 1;
616 IF l_count <= g_get_mask_end THEN
617 periods_tab(l_count) := rec;
618 ELSE
619 NULL;
620 END IF;
621 END LOOP;
622
623 ----- SHOW DATA in TABLES REMOVE after Testing ----
624 g_preceeding_end := to_date(NULL);
625 g_suceeding_start := to_date(NULL);
626
627 --hr_utility.trace('First => ' ||periods_tab.FIRST);
628 --hr_utility.trace('Last => ' ||periods_tab.LAST);
629
630 IF periods_tab.COUNT > 0 THEN
631 FOR x in periods_tab.first..periods_tab.last
632 LOOP
633
634 NULL;
635 --hr_utility.trace(x);
636 --hr_utility.trace(periods_tab(x).period_name||', '||periods_tab(x).start_date ||', '||periods_tab(x).end_date);
637 END LOOP;
638
639 /*
640 -- set global variables g_preceeding_end and g_suceeding_start
641 -- must convert periods_tab.start_date and periods_tab.end_date to char
642 -- then back to date. Otherwise incrementing/decrementing by 1
643 -- will increment/decrement by months rather than days
644 */
645 g_preceeding_end := to_date(to_char(periods_tab(periods_tab.FIRST).start_date,'DD-MM-YYYY'),
646 'DD-MM-YYYY') - 1 ;
647
648 g_suceeding_start := to_date(to_char(periods_tab(periods_tab.LAST).end_date,'DD-MM-YYYY'),
649 'DD-MM-YYYY') + 1 ;
650
651 if g_preceeding_end < g_plan_period_start_date then
652 g_preceeding_end:= NULL;
653 end if;
654
655 if g_suceeding_start > g_plan_period_end_date then
656 g_suceeding_start := NULL;
657 end if;
658
659 if g_plan_period_end_date < periods_tab(periods_tab.FIRST).start_date then
660 g_preceeding_end := g_plan_period_end_date;
661 end if;
662
663 if g_plan_period_start_date > periods_tab(periods_tab.LAST).end_date then
664 g_suceeding_start := g_plan_period_start_date;
665 end if;
666 ELSE
667 if g_plan_period_end_date < g_cpp_start_date then
668 g_preceeding_end := g_plan_period_end_date;
669 end if;
670
671 END IF;
672 ----- SHOW DATA in TABLES REMOVE ABOVE before Testing ----
673
674
675 ----- remove after testing -----
676
677 --hr_utility.trace('g_preceeding_end ' ||g_preceeding_end );
678 --hr_utility.trace('g_suceeding_start ' ||g_suceeding_start);
679 --hr_utility.trace('Leaving PA_DISPLAY_PERIOD_MASKS');
680 RETURN l_return;
681 END get_periods;
682
683
684
685 /*
686 -- get_min_start_period, get_max_end_period, get_min_start_date, get_max_end_date
687 -- are used by the start_period, end_period, start_date, and end_date functions
688 */
689 FUNCTION get_min_start_period RETURN VARCHAR2
690 IS
691 l_min_start_period gl_periods.period_name%TYPE;
692
693 BEGIN
694 l_min_start_period := periods_tab(periods_tab.FIRST).period_name;
695 --hr_utility.trace('l_min_start_period :='||l_min_start_period);
696 RETURN l_min_start_period;
697
698 END get_min_start_period;
699
700
701
702 FUNCTION get_max_end_period RETURN VARCHAR2
703 IS
704 l_max_start_period gl_periods.period_name%TYPE;
705
706 BEGIN
707 l_max_start_period := periods_tab(periods_tab.LAST).period_name;
708 --hr_utility.trace('l_max_start_period :='||l_max_start_period);
709 RETURN l_max_start_period;
710 END get_max_end_period;
711
712
713
714
715 FUNCTION get_min_start_date RETURN DATE
716 IS
717 l_min_start_date DATE;
718 BEGIN
719 l_min_start_date := periods_tab(periods_tab.FIRST).start_date;
720 --hr_utility.trace('l_min_start_date := '||to_char(l_min_start_date));
721 RETURN l_min_start_date;
722 END get_min_start_date;
723
724
725
726
727 FUNCTION get_max_end_date RETURN DATE
728 IS
729 l_max_end_date DATE;
730 BEGIN
731 l_max_end_date := periods_tab(periods_tab.last).end_date;
732 --hr_utility.trace('l_max_end_date := '||to_char(l_max_end_date));
733 RETURN l_max_end_date;
734 END get_max_end_date;
735
736
737
738 /*
739 -- start_period is the function to be used by the select statement to
740 -- return the start period that corresponds to the masks from_anchor_position
741 -- if the from_anchor_position = -99999 or 99999 then set these to Preceeding and Suceeding periods
742 */
743
747 -- Bug 3671424.
744 FUNCTION start_period ( p_from_anchor_position IN pa_period_mask_details.from_anchor_position%TYPE ) RETURN VARCHAR2
745 IS
746
748 -- THe gl periods period name is only 15 chars long where
749 -- as our local variable may need to store a string preceeding
750 -- periods or succeeding periods.
751 -- so making it longer than 15 by changing it to lookups meaning %type.
752
753 --l_start_period gl_periods.period_name%TYPE;
754 l_start_period pa_lookups.meaning%TYPE;
755
756 CURSOR get_period_mask_details_csr IS
757 SELECT from_anchor_start
758 ,from_anchor_end
759 FROM pa_period_mask_details
760 WHERE from_anchor_position = p_from_anchor_position
761 AND period_mask_id = g_period_mask_id;
762
763 get_period_mask_details_rec get_period_mask_details_csr%ROWTYPE;
764
765
766 BEGIN
767 -- Bug Fix 3671424
768 -- Changing the start and end period names
769 -- from preceeding to preceeding periods
770 -- the smae for the end period also.
771
772 IF p_from_anchor_position = -99999
773 -- Bug Fix 3671424.
774 --THEN l_start_period := 'Preceeding';
775 THEN l_start_period := g_preceeding;
776 ELSIF p_from_anchor_position = 99999
777 --THEN l_start_period := 'Suceeding';
778 THEN l_start_period := g_succeeding;
779 ELSE
780
781 OPEN get_period_mask_details_csr;
782 FETCH get_period_mask_details_csr INTO get_period_mask_details_rec;
783 IF get_period_mask_details_csr%NOTFOUND THEN
784 NULL;
785 --hr_utility.trace('start_period.get_period_mask_details_csr does not contain anything! exception');
786 ELSIF
787 pa_display_period_masks.periods_tab.EXISTS(get_period_mask_details_rec.from_anchor_start)
788 THEN l_start_period :=
789 pa_display_period_masks.periods_tab(get_period_mask_details_rec.from_anchor_start).period_name;
790
791 /*
792 -- if from_anchor_start does not exist check if from_anchor_end exists
793 -- set start period = periods_tab.first period name
794 */
795 ELSIF
796 (pa_display_period_masks.periods_tab.EXISTS(get_period_mask_details_rec.from_anchor_end))
800 -- set start period = NULL
797 THEN l_start_period := get_min_start_period;
798 /*
799 -- if from_anchor_start and from_anchor_end do not exist then
801 */
802
803 ELSE l_start_period := NULL;
804 END IF;
805 CLOSE get_period_mask_details_csr;
806
807 END IF;
808 --hr_utility.trace('l_start_period := '||l_start_period);
809 RETURN l_start_period;
810
811 END start_period;
812
813 /*
814 -- end_period is the function to be used by the select statement to
815 -- return the end period that corresponds to the masks from_anchor_position
816 -- if the from_anchor_position = -99999 or 99999 then set these to Preceeding and Suceeding periods
817 */
818
819 FUNCTION end_period ( p_from_anchor_position IN pa_period_mask_details.from_anchor_position%TYPE ) RETURN VARCHAR2
820 IS
821
822 -- Bug 3671424.
823 -- THe gl periods period name is only 15 chars long where
824 -- as our local variable may need to store a string preceeding
825 -- periods or succeeding periods.
826 -- so making it longer than 15 by changing it to lookups meaning %type.
827
828
829 --l_end_period gl_periods.period_name%TYPE;
830 l_end_period pa_lookups.meaning%TYPE;
831
832 CURSOR get_period_mask_details_csr IS
833 SELECT from_anchor_start
834 ,from_anchor_end
835 FROM pa_period_mask_details
836 WHERE from_anchor_position = p_from_anchor_position
837 AND period_mask_id = g_period_mask_id;
838
839 get_period_mask_details_rec get_period_mask_details_csr%ROWTYPE;
840
841
842 BEGIN
843 -- Bug Fix 3671424
844 -- Changing the start and end period names
845 -- from preceeding to preceeding periods
846 -- the smae for the end period also.
847
848 IF p_from_anchor_position = -99999
849 -- Bug Fix 367142
850 --THEN l_end_period := 'Preceeding';
851 THEN l_end_period := g_preceeding;
852 ELSIF p_from_anchor_position = 99999
853 --THEN l_end_period := 'Suceeding';
854 THEN l_end_period := g_succeeding;
855 ELSE
856
857 OPEN get_period_mask_details_csr;
858 FETCH get_period_mask_details_csr INTO get_period_mask_details_rec;
859 IF get_period_mask_details_csr%NOTFOUND
860 THEN NULL;
861 --hr_utility.trace('end_period.get_period_mask_details_csr does not contain anything! exception');
862 ELSIF
863 pa_display_period_masks.periods_tab.EXISTS(get_period_mask_details_rec.from_anchor_end)
864 THEN l_end_period :=
865 pa_display_period_masks.periods_tab(get_period_mask_details_rec.from_anchor_end).period_name;
866
867
868 /*
869 -- if from_anchor_end does not exist check if from_anchor_start exists
870 -- set end period = periods_tab.last period name
871 */
872 ELSIF
873 (pa_display_period_masks.periods_tab.EXISTS(get_period_mask_details_rec.from_anchor_start))
874 THEN
875 l_end_period := get_max_end_period;
876
877 /*
878 -- if from_anchor_start and from_anchor_end do not exist then
879 -- set end period = NULL
880 */
881 ELSE l_end_period := NULL;
882 END IF;
883 CLOSE get_period_mask_details_csr;
884
885 END IF;
886
887 --hr_utility.trace('l_end_period := '||l_end_period);
888
889 RETURN l_end_period;
890
891 END end_period;
892
893
894 /*
895 -- display_name() is used to display the name of start period and end period together
896 -- if start period = end period then display only start period
897 -- if start period or end period is null then display null
898 -- else display start period - end period
899 */
900 FUNCTION display_name ( p_from_anchor_position IN pa_period_mask_details.from_anchor_position%TYPE ) RETURN VARCHAR2
901 IS
902 l_display_name varchar2(2000);
903 BEGIN
904 IF p_from_anchor_position = -99999 THEN
905 IF g_preceeding_end IS NULL THEN
906 l_display_name := NULL;
907 ELSE
908 -- Bug Fix 3671424
909 -- l_display_name := 'Preceeding';
910 l_display_name := g_preceeding;
911 END IF;
912 ELSIF p_from_anchor_position = 99999 THEN
913 IF g_suceeding_start IS NULL THEN
914 l_display_name := NULL;
915 ELSE
916 -- Bug Fix 3671424
917 -- l_display_name := 'Suceeding';
918 l_display_name := g_succeeding;
919 END IF;
920 ELSIF
921 pa_display_period_masks.start_period(p_from_anchor_position) = pa_display_period_masks.end_period(p_from_anchor_position)
922 THEN
923 l_display_name := pa_display_period_masks.start_period(p_from_anchor_position);
924 ELSIF
925 pa_display_period_masks.start_period(p_from_anchor_position) IS NULL OR
926 pa_display_period_masks.end_period(p_from_anchor_position) IS NULL
927 THEN l_display_name := NULL;
928 ELSE
929 -- Bug Fix 3671424
930 -- l_display_name := pa_display_period_masks.start_period(p_from_anchor_position) || ' - '
931 l_display_name := pa_display_period_masks.start_period(p_from_anchor_position) || ' '||g_to||' '
932 || pa_display_period_masks.end_period(p_from_anchor_position);
933 END IF;
934
935 --hr_utility.trace('l_display_name := '||l_display_name);
936 RETURN l_display_name;
937
941 -- start_date is the function to be used by the select statement to
938 END display_name;
939
940 /*
942 -- return the start date that corresponds to the masks from_anchor_position
943 -- if the from_anchor_position = -99999 set start date = 01-JAN-0001
944 -- if the from_anchor_position = 99999 set start date = g_suceeding start
945 */
946
947 FUNCTION start_date ( p_from_anchor_position IN pa_period_mask_details.from_anchor_position%TYPE ) RETURN DATE
948 IS
949 l_start_date date;
950
951 CURSOR get_period_mask_details_csr IS
952 SELECT from_anchor_start
953 ,from_anchor_end
954 FROM pa_period_mask_details
955 WHERE from_anchor_position = p_from_anchor_position
956 AND period_mask_id = g_period_mask_id;
957
958 get_period_mask_details_rec get_period_mask_details_csr%ROWTYPE;
959
960 BEGIN
961
962 IF p_from_anchor_position = -99999
963 THEN l_start_date:= to_date('01/01/0001','DD/MM/YYYY');
964 ELSIF p_from_anchor_position = 99999
965 THEN l_start_date:= pa_display_period_masks.g_suceeding_start;
966 ELSE
967
968 OPEN get_period_mask_details_csr;
969 FETCH get_period_mask_details_csr INTO get_period_mask_details_rec;
970 IF get_period_mask_details_csr%NOTFOUND THEN
971 NULL;
972 --hr_utility.trace('start_date.get_period_mask_details_csr does not contain anything! exception');
973 ELSIF
974 pa_display_period_masks.periods_tab.EXISTS(get_period_mask_details_rec.from_anchor_start)
975 THEN l_start_date :=
976 pa_display_period_masks.periods_tab(get_period_mask_details_rec.from_anchor_start).start_date;
977
978 /*
979 -- if from_anchor_start does not exist check if from_anchor_end exists
980 -- set start date = periods_tab.first start_date
981 */
982 ELSIF
983 (pa_display_period_masks.periods_tab.EXISTS(get_period_mask_details_rec.from_anchor_end))
984 THEN l_start_date := get_min_start_date;
985
986 /*
987 -- if from_anchor_start and from_anchor_end do not exist then
988 -- set start date = NULL
989 */
990 ELSE l_start_date := NULL;
991 END IF;
992 CLOSE get_period_mask_details_csr;
993
994 END IF;
995
996 --hr_utility.trace('l_start_date := '||to_char(l_start_date));
997 RETURN l_start_date;
998
999 END start_date;
1000
1001 /*
1002 -- end_date is the function to be used by the select statement to
1003 -- return the start date that corresponds to the masks from_anchor_position
1004 -- if the from_anchor_position = -99999 set start date = g_preceeding_end
1005 -- if the from_anchor_position = 99999 set start date = '31-DEC-4712'
1006 */
1007 FUNCTION end_date ( p_from_anchor_position IN pa_period_mask_details.from_anchor_position%TYPE ) RETURN DATE
1008 IS
1009 l_end_date DATE;
1010
1011 CURSOR get_period_mask_details_csr IS
1012 SELECT from_anchor_start
1013 ,from_anchor_end
1014 FROM pa_period_mask_details
1015 WHERE from_anchor_position = p_from_anchor_position
1016 AND period_mask_id = g_period_mask_id;
1017
1018 get_period_mask_details_rec get_period_mask_details_csr%ROWTYPE;
1019
1020 BEGIN
1021
1022 IF p_from_anchor_position = -99999
1023 THEN l_end_date:= pa_display_period_masks.g_preceeding_end;
1024 ELSIF p_from_anchor_position = 99999
1025 THEN l_end_date:= to_date('31/12/4712','DD/MM/YYYY'); --xin
1026 ELSE
1027
1028 OPEN get_period_mask_details_csr;
1029 FETCH get_period_mask_details_csr INTO get_period_mask_details_rec;
1030 IF get_period_mask_details_csr%NOTFOUND
1031 THEN
1032 NULL;
1033 --hr_utility.trace('end_date.get_period_mask_details_csr does not contain anything! exception');
1034 ELSIF
1035 pa_display_period_masks.periods_tab.EXISTS(get_period_mask_details_rec.from_anchor_end)
1036 THEN l_end_date :=
1037 pa_display_period_masks.periods_tab(get_period_mask_details_rec.from_anchor_end).end_date;
1038
1039 /*
1040 -- if from_anchor_end does not exist check if from_anchor_start exists
1041 -- set end date= periods_tab.last end_date
1042 */
1043 ELSIF
1044 (pa_display_period_masks.periods_tab.EXISTS(get_period_mask_details_rec.from_anchor_start))
1045 THEN l_end_date := get_max_end_date;
1046
1047 /*
1048 -- if from_anchor_start and from_anchor_end do not exist then
1049 -- set end date = NULL
1050 */
1051 ELSE l_end_date := NULL;
1052 END IF;
1053 CLOSE get_period_mask_details_csr;
1054 END IF;
1055
1056 --hr_utility.trace('l_end_date := '||to_char(l_end_date));
1057 RETURN l_end_date;
1058
1059 END end_date;
1060
1061 /* The update_current_pp is called from the Edit Plan Lines Page to update
1062 the current planning period in the pa_budget_versions table and pa_proj_fp_options
1063 table.
1064 */
1065 -- Bug Fix 3975683
1066 -- Added record version numbers which will be used
1067 -- to see if the record is already is updates or not
1068 -- and update the version number as well.
1069
1070 PROCEDURE update_current_pp (p_budget_version_id IN pa_budget_versions.budget_version_id%TYPE,
1071 p_current_planning_period IN pa_budget_versions.current_planning_period%TYPE,
1072 p_commit IN VARCHAR2 := FND_API.G_FALSE,
1073 p_bud_rec_ver_num IN pa_budget_versions.record_version_number%TYPE,
1077 X_Msg_Data OUT NOCOPY Varchar2) IS
1074 p_fp_rec_ver_num IN pa_proj_fp_options.record_version_number%TYPE,
1075 X_Return_Status OUT NOCOPY Varchar2,
1076 X_Msg_Count OUT NOCOPY Number,
1078
1079 CURSOR get_version_type_csr(p_budget_version_id NUMBER) IS
1080 SELECT version_type
1081 FROM pa_budget_versions
1082 WHERE budget_version_id = p_budget_version_id;
1083
1084 l_version_type PA_BUDGET_VERSIONS.version_type%TYPE;
1085 l_curr_plan_period PA_BUDGET_VERSIONS.current_planning_period%type;
1086 BEGIN
1087 -- Initialize values
1088 X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
1089 X_Msg_Count := 0;
1090 X_Msg_Data := Null;
1091 -- Make sure that the parameter is not null.
1092 if p_current_planning_period is null then
1093 X_Return_Status := Fnd_Api.G_Ret_Sts_Error;
1094 X_Msg_Count := 1;
1095 X_Msg_Data := 'PA_NULL_CURR_PLAN_PERIOD';
1096 Pa_Utils.Add_Message
1097 (P_App_Short_Name => 'PA',
1098 P_Msg_Name => 'PA_NULL_CURR_PLAN_PERIOD');
1099 RAISE FND_API.G_EXC_ERROR;
1100 end if;
1101 -- Fix for Bug 4898791
1102 BEGIN
1103 l_curr_plan_period := null;
1104 SELECT DISTINCT(period_name) into l_curr_plan_period FROM gl_periods where period_name=p_current_planning_period;
1105 exception
1106 when no_data_found
1107 then
1108 X_Return_Status := Fnd_Api.G_Ret_Sts_Error;
1109 X_Msg_Count := 1;
1110 X_Msg_Data := 'PA_INVALID_CURR_PLAN_PERIOD';
1111 Pa_Utils.Add_Message
1112 (P_App_Short_Name => 'PA',
1113 P_Msg_Name => 'PA_INVALID_CURR_PLAN_PERIOD');
1114 RAISE FND_API.G_EXC_ERROR;
1115
1116 END; -- End of Fix for Bug 4898791
1117
1118 OPEN get_version_type_csr(p_budget_version_id);
1119 FETCH get_version_type_csr INTO l_version_type;
1120 CLOSE get_version_type_csr;
1121
1122 -- Bug Fix 3975683
1123 -- Started updating the record_version_number
1124
1125 UPDATE pa_budget_versions
1126 SET current_planning_period = p_current_planning_period,
1127 record_version_number = record_version_number + 1
1128 WHERE budget_version_id = p_budget_version_id
1129 AND record_version_number = p_bud_rec_ver_num;
1130
1131 IF sql%rowcount = 0 THEN
1132 X_Return_Status := Fnd_Api.G_Ret_Sts_Error;
1133 X_Msg_Count := 1;
1134 X_Msg_Data := 'PA_RECORD_ALREADY_UPDATED';
1135 Pa_Utils.Add_Message
1136 (P_App_Short_Name => 'PA',
1137 P_Msg_Name => 'PA_RECORD_ALREADY_UPDATED');
1138 RAISE FND_API.G_EXC_ERROR;
1139 END if;
1140
1141 IF l_version_type = 'COST' THEN
1142 UPDATE pa_proj_fp_options
1143 SET COST_CURRENT_PLANNING_PERIOD = p_current_planning_period,
1144 record_version_number = record_version_number + 1
1145 WHERE FIN_PLAN_VERSION_ID = p_budget_version_id
1146 AND record_version_number = p_fp_rec_ver_num;
1147 ELSIF l_version_type = 'REVENUE' THEN
1148 UPDATE pa_proj_fp_options
1149 SET REV_CURRENT_PLANNING_PERIOD = p_current_planning_period,
1150 record_version_number = record_version_number + 1
1151 WHERE FIN_PLAN_VERSION_ID = p_budget_version_id
1152 AND record_version_number = p_fp_rec_ver_num;
1153 ELSIF l_version_type = 'ALL' THEN
1154 UPDATE pa_proj_fp_options
1155 SET ALL_CURRENT_PLANNING_PERIOD = p_current_planning_period,
1156 record_version_number = record_version_number + 1
1157 WHERE FIN_PLAN_VERSION_ID = p_budget_version_id
1158 AND record_version_number = p_fp_rec_ver_num;
1159 END IF;
1160
1161 IF sql%rowcount = 0 THEN
1162 X_Return_Status := Fnd_Api.G_Ret_Sts_Error;
1163 X_Msg_Count := 1;
1164 X_Msg_Data := 'PA_RECORD_ALREADY_UPDATED';
1165 Pa_Utils.Add_Message
1166 (P_App_Short_Name => 'PA',
1167 P_Msg_Name => 'PA_RECORD_ALREADY_UPDATED');
1168 RAISE FND_API.G_EXC_ERROR;
1169 END if;
1170
1171 X_Msg_Data := Null;
1172 X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
1173
1174 IF FND_API.to_boolean( p_commit )
1175 THEN
1176 COMMIT;
1177 END IF;
1178
1179 EXCEPTION
1180 WHEN FND_API.G_EXC_ERROR
1181 THEN
1182 X_return_status := FND_API.G_RET_STS_ERROR;
1183
1184 When Others Then
1185 Raise;
1186
1187 END update_current_pp;
1188
1189 END pa_display_period_masks;