[Home] [Help]
PACKAGE BODY: APPS.PA_REP_UTIL_GLOB
Source
1 PACKAGE BODY PA_REP_UTIL_GLOB AS
2 /* $Header: PARRGLBB.pls 120.1 2005/07/04 03:14:12 appldev ship $ */
3
4 /*
5 * Procedure to cache the Organization ID for U1 screen
6 */
7
8 l_debug varchar2(1) := NVL(FND_PROFILE.value('PA_DEBUG_MODE'), 'N');
9
10 PROCEDURE SetU1OrganizationID (
11 p_organization_id IN NUMBER
12 )
13 IS
14 BEGIN
15 G_Organization_ID:=p_organization_id;
16 END SetU1OrganizationID;
17
18 /*
19 * Procedure to return cached Organization ID
20 */
21 FUNCTION GetU1OrganizationID return NUMBER
22 IS
23 BEGIN
24 return G_Organization_ID;
25 END GetU1OrganizationID;
26
27 /*
28 * Procedure to cache the Organization ID, Period Information for U1 screen
29 */
30 PROCEDURE SetU1Params(p_organization_id IN NUMBER, p_period_type IN VARCHAR2, p_period_name IN VARCHAR2, p_period_year IN NUMBER)
31 IS
32 BEGIN
33 G_Organization_ID:=p_organization_id;
34 G_Period_Type:=p_period_type;
35 G_Period_Name:=p_period_name;
36 G_Period_Year:=p_period_year;
37 IF G_Period_Type = GetPeriodTypeGe THEN
38 G_Global_Exp_Period_End_Date:=to_date(p_period_name,'MM/DD/YYYY');
39 ELSIF G_Period_Type = GetPeriodTypeQr THEN
40 G_Period_Quarter:=p_period_name;
41 END IF;
42 END;
43
44 /*
45 * Procedure to return cached Period Type
46 */
47 FUNCTION GetU1PeriodType return VARCHAR2
48 IS
49 BEGIN
50 return G_Period_Type;
51 END GetU1PeriodType;
52
53 /*
54 * Procedure to return cached Period Name
55 */
56 FUNCTION GetU1PeriodName return VARCHAR2
57 IS
58 BEGIN
59 return G_Period_Name;
60 END GetU1PeriodName;
61
62 /*
63 * Procedure to return cached Period Year
64 */
65 FUNCTION GetU1PeriodYear return VARCHAR2
66 IS
67 BEGIN
68 return G_Period_Year;
69 END GetU1PeriodYear;
70
71 /*
72 * Procedure to return cached Period Quarter
73 */
74 FUNCTION GetU1PeriodQuarter return VARCHAR2
75 IS
76 BEGIN
77 return G_Period_Quarter;
78 END GetU1PeriodQuarter;
79
80 /*
81 * Procedure to return cached GE Date
82 */
83 FUNCTION GetU1GlobalExpPeriodEndDate return DATE
84 IS
85 BEGIN
86 return G_Global_Exp_Period_End_Date;
87 END GetU1GlobalExpPeriodEndDate;
88
89
90 /*
91 * Procedure to Call Actuals Summarization based on the PA Installation
92 */
93 PROCEDURE Get_Util_Ac_Parm(
94 errbuf OUT NOCOPY VARCHAR2
95 ,retcode OUT NOCOPY VARCHAR2
96 ,p_ac_start_date IN VARCHAR2
97 ,p_ac_end_date IN VARCHAR2
98 ,p_fc_start_date IN VARCHAR2
99 ,p_fc_end_date IN VARCHAR2
100 ,p_org_rollup_method IN VARCHAR2
101 ,p_debug_mode IN VARCHAR2
102 )
103 IS
104 l_prc_switch VARCHAR2(1) :=NULL;
105 l_errbuf VARCHAR2(2000) :=NULL;
106 l_retcode VARCHAR2(2000) :=NULL;
107 l_return_status VARCHAR2(2000) :=NULL;
108 l_effect_start_period_num NUMBER;
109 l_orghier_date_before DATE;
110 l_orghier_date_after DATE;
111 l_fnd_msg VARCHAR2(1000):=NULL;
112 BEGIN
113
114 /*
115 * To Initialize the error stack
116 */
117 PA_DEBUG.Set_Curr_Function(
118 p_function => 'Get_Util_Ac_Parm',
119 p_process => 'PLSQL',
120 p_write_file => 'LOG',
121 p_debug_mode => p_debug_mode);
122
123 PA_DEBUG.g_err_stage := 'Process : Actuals Summarization';
124 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage
125 , p_write_mode => 1
126 , p_write_file => 'OUT');
127
128
129 --Enable menu structure for Utilization
130 --This will enable the correct menu structure
131 --for Utilization based on whether PJI is installed
132 --or not
133 PA_PJI_MENU_UTIL.ENABLE_MENUS;
134
135 /*
136 * Assume Success
137 */
138 retcode := 0;
139 /*
140 * Populate Globals for Subsequent Concurrent Processes
141 * Call PA_REP_UTIL_GLOB procedure ...
142 * Depending on Products Installed, Run Actuals
143 * Concurrent Processes
144 */
145 IF l_debug ='Y'THEN -- bug 2674619
146 PA_DEBUG.g_err_stage := 'Arguments';
147 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
148 PA_DEBUG.g_err_stage := '---------';
149 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
150
151 PA_DEBUG.g_err_stage := 'p_ac_start_date : '||p_ac_start_date;
152 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
153 PA_DEBUG.g_err_stage := 'p_ac_end_date : '||p_ac_end_date;
154 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
155 PA_DEBUG.g_err_stage := 'p_fc_start_date : '||p_fc_start_date;
156 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
157 PA_DEBUG.g_err_stage := 'p_fc_end_date : '||p_fc_end_date;
158 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
159 PA_DEBUG.g_err_stage := 'p_org_rollup_method : '||p_org_rollup_method;
160 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
161 PA_DEBUG.g_err_stage := 'p_debug_mode : '||p_debug_mode;
162 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
163 END IF;
164
165 /*
166 * Write messages to the concurrent OUT file
167 */
168
169 FND_MESSAGE.Set_Name('PA','PA_UTIL_ACT_FROM_DATE');
170 l_fnd_msg := p_ac_start_date||' : '||FND_MESSAGE.Get;
171 PA_DEBUG.Log_Message(p_message => l_fnd_msg
172 , p_write_mode => 1
173 , p_write_file => 'OUT'
174 );
175 FND_MESSAGE.Set_Name('PA','PA_UTIL_ACT_THRU_DATE');
176 l_fnd_msg := p_ac_end_date||' : '||FND_MESSAGE.Get;
177 PA_DEBUG.Log_Message(p_message => l_fnd_msg
178 , p_write_mode => 1
179 , p_write_file => 'OUT'
180 );
181 FND_MESSAGE.Set_Name('PA','PA_UTIL_ORGZ_ROLLUP_METHOD');
182 l_fnd_msg := p_org_rollup_method||' : '||FND_MESSAGE.Get;
183 PA_DEBUG.Log_Message(p_message => l_fnd_msg
184 , p_write_mode => 1
185 , p_write_file => 'OUT'
186 );
187 FND_MESSAGE.Set_Name('PA','PA_UTIL_FETCH_SIZE');
188 l_fnd_msg := PA_REP_UTIL_GLOB.G_util_fetch_size||' : '||FND_MESSAGE.Get;
189 PA_DEBUG.Log_Message(p_message => l_fnd_msg
190 , p_write_mode => 1
191 , p_write_file => 'OUT'
192 );
193 FND_MESSAGE.Set_Name('PA','PA_UTIL_SUCCESSFUL_RUN');
194 l_fnd_msg := FND_MESSAGE.Get;
195 PA_DEBUG.Log_Message(p_message => l_fnd_msg
196 , p_write_mode => 1
197 , p_write_file => 'OUT'
198 );
199 IF l_debug ='Y'THEN -- bug 2674619
200 PA_DEBUG.g_err_stage := 'Messages';
201 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
202 PA_DEBUG.g_err_stage := '--------';
203 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
204
205 PA_DEBUG.g_err_stage := '50 : Inside PA_REP_UTIL_GLOB.get_util_ac_parm';
206 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
207 END IF;
208
209 IF TRUNC(TO_DATE(p_ac_start_date,'YYYY/MM/DD HH24:MI:SS')) >
210 TRUNC(TO_DATE(p_ac_end_date, 'YYYY/MM/DD HH24:MI:SS')) THEN
211 retcode := 2;
212 errbuf := 'The Given Date Range is Invalid';
213 IF l_debug ='Y'THEN -- bug 2674619
214 PA_DEBUG.g_err_stage := '100 : The Given Date Range is Invalid';
215 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
216 END IF;
217
218 FND_MESSAGE.Set_Name('PA','PA_UTIL_INVALID_DATE_RANGE');
219 l_fnd_msg := FND_MESSAGE.Get;
220 PA_DEBUG.Log_Message(p_message => l_fnd_msg
221 , p_write_mode => 1
222 , p_write_file => 'OUT');
223 PA_Debug.Reset_Curr_Function;
224 RETURN;
225 END IF;
226 IF l_debug ='Y'THEN -- bug 2674619
227 PA_DEBUG.g_err_stage := '150 : Before Calling PA_REP_UTIL_GLOB.Get_Util_Prc_Switch';
228 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
229 END IF;
230
231 Get_Util_Prc_Switch (
232 x_prc_switch => l_prc_switch
233 ,x_msg_data => l_errbuf
234 ,x_return_status => l_retcode
235 );
236
237 IF l_debug ='Y'THEN -- bug 2674619
238 PA_DEBUG.g_err_stage := '200 : After Calling PA_REP_UTIL_GLOB.Get_Util_Prc_Switch';
239 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
240 END IF;
241
242 IF ( l_prc_switch = 'A' OR l_prc_switch = 'B') THEN
243 IF l_debug ='Y'THEN -- bug 2674619
244 PA_DEBUG.g_err_stage := '250 : Before calling PA_REP_UTIL_GLOB.initialize_util_cache';
245 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
246 END IF;
247
248 PA_REP_UTIL_GLOB.initialize_util_cache(
249 p_ac_start_date => TRUNC(TO_DATE(p_ac_start_date,'YYYY/MM/DD HH24:MI:SS'))
250 ,p_ac_end_date => TRUNC(TO_DATE(p_ac_end_date,'YYYY/MM/DD HH24:MI:SS'))
251 ,p_fc_start_date => TRUNC(TO_DATE(p_fc_start_date,'YYYY/MM/DD HH24:MI:SS'))
252 ,p_fc_end_date => TRUNC(TO_DATE(p_fc_end_date,'YYYY/MM/DD HH24:MI:SS'))
253 ,p_org_rollup_method => p_org_rollup_method
254 ,p_debug_mode => p_debug_mode
255 );
256 IF l_debug ='Y'THEN -- bug 2674619
257 PA_DEBUG.g_err_stage := '300 : After calling PA_REP_UTIL_GLOB.initialize_util_cache';
258 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
259 END IF;
260 /*
261 * Bug 1810528
262 * The checking of the last_update_date of pa_org_hierarchy_denorm is
263 * to find if the the organization hierarchy changed during the run.
264 */
265 SELECT max(LAST_UPDATE_DATE)
266 INTO l_orghier_date_before
267 FROM pa_org_hierarchy_denorm
268 WHERE pa_org_use_type = 'REPORTING'
269 AND NVL(org_id, -99) = pa_rep_util_glob.G_implementation_details.G_org_id
270 AND ORG_HIERARCHY_VERSION_ID = pa_rep_util_glob.G_implementation_details.G_org_structure_version_id
271 ;
272
273 IF l_debug ='Y'THEN -- bug 2674619
274 PA_DEBUG.g_err_stage := '310 : Max Last_Update_Date of pa_org_hierarchy_denorm before the run is <'||l_orghier_date_before||'>';
275 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
276
277 PA_DEBUG.g_err_stage := '350 : Before calling PA_REP_UTIL_GLOB.Get_Effective_Start_Period_Num';
278 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
279 END IF;
280
281 IF pa_rep_util_glob.G_input_parameters.G_org_rollup_method = 'R' THEN
282 IF pa_rep_util_glob.G_util_option_details.G_pa_period_flag = 'Y' THEN
283 l_errbuf := NULL;
284 l_retcode := '0';
285 pa_rep_util_glob.Get_Effective_Start_Period_Num(
286 errbuf => l_errbuf,
287 retcode => l_retcode,
288 effective_start_period_num => l_effect_start_period_num,
289 -- p_period_set_name => pa_rep_util_glob.G_implementation_details.G_period_set_name,
290 p_period_set_name => pa_rep_util_glob.G_implementation_details.G_pa_period_set_name, -- bug 3434019
291 p_period_type => pa_rep_util_glob.G_implementation_details.G_pa_period_type,
292 p_start_date => TRUNC(TO_DATE(p_ac_start_date,'YYYY/MM/DD HH24:MI:SS'))
293 );
294 IF l_retcode = '2' THEN
295 retcode := '2';
296 IF l_debug ='Y'THEN -- bug 2674619
297 PA_DEBUG.g_err_stage := '400 : There is no matching PA period for the given Start Date';
298 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
299 END IF;
300 FND_MESSAGE.Set_Name('PA','PA_UTIL_INVALID_START_DATE_PA');
301 l_fnd_msg := FND_MESSAGE.Get;
302 PA_DEBUG.Log_Message(p_message => l_fnd_msg
303 , p_write_mode => 1
304 , p_write_file => 'OUT');
305 PA_Debug.Reset_Curr_Function;
306 RETURN;
307 ELSE
308 IF l_debug ='Y'THEN -- bug 2674619
309 PA_DEBUG.g_err_stage := '400 : Eff pd Num-PA '||to_char(l_effect_start_period_num);
310 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
311 END IF;
312 PA_REP_UTIL_GLOB.G_eff_ac_start_pa_period_num := l_effect_start_period_num;
313 END IF;
314 END IF;
315 IF pa_rep_util_glob.G_util_option_details.G_gl_period_flag = 'Y' THEN
316 l_errbuf := NULL;
317 l_retcode := '0';
318 pa_rep_util_glob.Get_Effective_Start_Period_Num(
319 errbuf => l_errbuf,
320 retcode => l_retcode,
321 effective_start_period_num => l_effect_start_period_num,
322 -- p_period_set_name => pa_rep_util_glob.G_implementation_details.G_period_set_name,
323 p_period_set_name => pa_rep_util_glob.G_implementation_details.G_gl_period_set_name, -- bug 3434019
324 p_period_type => pa_rep_util_glob.G_implementation_details.G_gl_period_type,
325 p_start_date => TRUNC(TO_DATE(p_ac_start_date,'YYYY/MM/DD HH24:MI:SS'))
326 );
327 IF l_retcode = '2' THEN
328 retcode := '2';
329 IF l_debug ='Y'THEN -- bug 2674619
330 PA_DEBUG.g_err_stage := '450 : There is no matching GL period for the given Start Date';
331 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
332 END IF;
333 FND_MESSAGE.Set_Name('PA','PA_UTIL_INVALID_START_DATE_GL');
334 l_fnd_msg := FND_MESSAGE.Get;
335 PA_DEBUG.Log_Message(p_message => l_fnd_msg
336 , p_write_mode => 1
337 , p_write_file => 'OUT');
338 PA_Debug.Reset_Curr_Function;
339 RETURN;
340 ELSE
341 IF l_debug ='Y'THEN -- bug 2674619
342 PA_DEBUG.g_err_stage := '500 : Eff pd Num-GL '||to_char(l_effect_start_period_num);
343 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
344 END IF;
345 PA_REP_UTIL_GLOB.G_eff_ac_start_gl_period_num := l_effect_start_period_num;
346 END IF;
347 END IF;
348 END IF;
349 IF l_debug ='Y'THEN -- bug 2674619
350 PA_DEBUG.g_err_stage := '550 : After calling PA_REP_UTIL_GLOB.Get_Effective_Start_Period_Num';
351 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
352
353 PA_DEBUG.g_err_stage := '600 : Before calling PA_SUMMARIZE_ACTUAL_UTIL_PVT.summarize_actual_util';
354 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
355 END IF;
356
357 PA_SUMMARIZE_ACTUAL_UTIL_PVT.summarize_actual_util;
358 IF l_debug ='Y'THEN -- bug 2674619
359 PA_DEBUG.g_err_stage := '650 : After calling PA_SUMMARIZE_ACTUAL_UTIL_PVT.summarize_actual_util';
360 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
361 END IF;
362 ELSE
363 IF l_debug ='Y'THEN -- bug 2674619
364 PA_DEBUG.g_err_stage := '700 : Oracle Projects Not Installed .. Not Running Acutals';
365 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
366 END IF;
367 FND_MESSAGE.Set_Name('PA','PA_UTIL_PA_NOT_INSTALLED');
368 l_fnd_msg := FND_MESSAGE.Get;
369 PA_DEBUG.Log_Message(p_message => l_fnd_msg
370 , p_write_mode => 1
371 , p_write_file => 'OUT');
372 PA_Debug.Reset_Curr_Function;
373 RETURN;
374 END IF;
375
376 /*
377 * Continuation of the check for Bug 1810528
378 */
379 SELECT max(LAST_UPDATE_DATE)
380 INTO l_orghier_date_after
381 FROM pa_org_hierarchy_denorm
382 WHERE pa_org_use_type = 'REPORTING'
383 AND NVL(org_id, -99) = pa_rep_util_glob.G_implementation_details.G_org_id
384 AND ORG_HIERARCHY_VERSION_ID = pa_rep_util_glob.G_implementation_details.G_org_structure_version_id
385 ;
386
387 IF ( l_orghier_date_after > l_orghier_date_before) then
388 FND_MESSAGE.Set_Name('PA','PA_UTIL_ORGZ_HIER_CHANGE');
389 l_fnd_msg := FND_MESSAGE.Get;
390 PA_DEBUG.Log_Message(p_message => l_fnd_msg);
391 PA_DEBUG.Log_Message(p_message => l_fnd_msg
392 , p_write_mode => 1
393 , p_write_file => 'OUT'
394 );
395 ELSE
396 FND_MESSAGE.Set_Name('PA','PA_UTIL_SUCCESSFUL_RUN');
397 l_fnd_msg := FND_MESSAGE.Get;
398 PA_DEBUG.Log_Message(p_message => l_fnd_msg);
399 PA_DEBUG.Log_Message(p_message => l_fnd_msg
400 , p_write_mode => 1
401 , p_write_file => 'OUT'
402 );
403 END IF;
404 IF l_debug ='Y'THEN -- bug 2674619
405 PA_DEBUG.g_err_stage := '310 : Max Last_Update_Date of pa_org_hierarchy_denorm after the run is <'||l_orghier_date_after||'>';
406 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
407
408 PA_DEBUG.g_err_stage := '750 : Exiting PA_REP_UTIL_GLOB.get_util_ac_parm';
409 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
410 END IF;
411
412 PA_Debug.Reset_Curr_Function;
413 EXCEPTION
414 WHEN OTHERS THEN
415 retcode := 2;
416 errbuf := SUBSTR(SQLERRM,1,240);
417 PA_DEBUG.Log_Message( SQLERRM);
418 PA_DEBUG.Log_Message(PA_DEBUG.g_err_stack);
419 PA_DEBUG.Log_Message(p_message => SQLERRM
420 , p_write_mode => 1
421 , p_write_file => 'OUT'
422 );
423 /*
424 * Set the excetption Message and the stack
425 */
426 FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_REP_UTIL_GLOB.get_util_ac_parm'
427 ,p_procedure_name => PA_DEBUG.G_Err_Stack );
428 RAISE;
429
430 END Get_Util_Ac_Parm;
431 /*
432 * Procedure to Call Forecasting Summarization based on the PRM Installation
433 */
434 PROCEDURE Get_Util_Fc_Parm(
435 errbuf OUT NOCOPY VARCHAR2
436 ,retcode OUT NOCOPY VARCHAR2
437 ,p_ac_start_date IN VARCHAR2
438 ,p_ac_end_date IN VARCHAR2
439 ,p_fc_start_date IN VARCHAR2
440 ,p_fc_end_date IN VARCHAR2
441 ,p_org_rollup_method IN VARCHAR2
442 ,p_debug_mode IN VARCHAR2
443 )
444 IS
445 l_prc_switch VARCHAR2(1) :=NULL;
446 l_errbuf VARCHAR2(2000) :=NULL;
447 l_retcode VARCHAR2(2000) :=NULL;
448 l_return_status VARCHAR2(2000) :=NULL;
449 l_effect_start_period_num NUMBER;
450 l_orghier_date_before DATE;
451 l_orghier_date_after DATE;
452 l_fnd_msg VARCHAR2(1000):=NULL;
453 BEGIN
454
455
456 /*
457 * Set the debug mode
458 */
459
460 PA_DEBUG.Set_Curr_Function(
461 p_function => 'Get_Util_Fc_Parm',
462 p_process => 'PLSQL',
463 p_write_file => 'LOG',
464 p_debug_mode => p_debug_mode);
465
466 PA_DEBUG.g_err_stage := 'Process : Forecast Summarization';
467 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage
468 , p_write_mode => 1
469 , p_write_file => 'OUT');
470
471
472 --Enable menu structure for Utilization
473 --This will enable the correct menu structure
474 --for Utilization based on whether PJI is installed
475 --or not
476 PA_PJI_MENU_UTIL.ENABLE_MENUS;
477
478 /*
479 * Assume Success
480 */
481 retcode := 0;
482 /* Populate Globals for Subsequent Concurrent Processes
483 * Call PA_REP_UTIL_GLOB procedure ...
484 * Depending on Products Installed, Run Forecasts
485 * Concurrent Processes
486 */
487 IF l_debug ='Y'THEN -- bug 2674619
488 PA_DEBUG.g_err_stage := 'Arguments';
489 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
490 PA_DEBUG.g_err_stage := '---------';
491 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
492
493 PA_DEBUG.g_err_stage := 'p_ac_start_date : '||p_ac_start_date;
494 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
495 PA_DEBUG.g_err_stage := 'p_ac_end_date : '||p_ac_end_date;
496 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
497 PA_DEBUG.g_err_stage := 'p_fc_start_date : '||p_fc_start_date;
498 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
499 PA_DEBUG.g_err_stage := 'p_fc_end_date : '||p_fc_end_date;
500 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
501 PA_DEBUG.g_err_stage := 'p_org_rollup_method : '||p_org_rollup_method;
502 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
503 PA_DEBUG.g_err_stage := 'p_debug_mode : '||p_debug_mode;
504 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
505 END IF;
506
507 /*
508 * Write messages to the concurrent OUT file
509 */
510
511 FND_MESSAGE.Set_Name('PA','PA_UTIL_FCT_FROM_DATE');
512 l_fnd_msg := p_fc_start_date||' : '||FND_MESSAGE.Get;
513 PA_DEBUG.Log_Message(p_message => l_fnd_msg
514 , p_write_mode => 1
515 , p_write_file => 'OUT'
516 );
517 FND_MESSAGE.Set_Name('PA','PA_UTIL_FCT_THRU_DATE');
518 l_fnd_msg := p_fc_end_date||' : '||FND_MESSAGE.Get;
519 PA_DEBUG.Log_Message(p_message => l_fnd_msg
520 , p_write_mode => 1
521 , p_write_file => 'OUT'
522 );
523 FND_MESSAGE.Set_Name('PA','PA_UTIL_ORGZ_ROLLUP_METHOD');
524 l_fnd_msg := p_org_rollup_method||' : '||FND_MESSAGE.Get;
525 PA_DEBUG.Log_Message(p_message => l_fnd_msg
526 , p_write_mode => 1
527 , p_write_file => 'OUT'
528 );
529 FND_MESSAGE.Set_Name('PA','PA_UTIL_FETCH_SIZE');
530 l_fnd_msg := PA_REP_UTIL_GLOB.G_util_fetch_size||' : '||FND_MESSAGE.Get;
531 PA_DEBUG.Log_Message(p_message => l_fnd_msg
532 , p_write_mode => 1
533 , p_write_file => 'OUT'
534 );
535 FND_MESSAGE.Set_Name('PA','PA_UTIL_SUCCESSFUL_RUN');
536 l_fnd_msg := FND_MESSAGE.Get;
537 PA_DEBUG.Log_Message(p_message => l_fnd_msg
538 , p_write_mode => 1
539 , p_write_file => 'OUT'
540 );
541
542 IF l_debug ='Y'THEN -- bug 2674619
543 PA_DEBUG.g_err_stage := 'Messages';
544 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
545 PA_DEBUG.g_err_stage := '--------';
546 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
547
548 PA_DEBUG.g_err_stage := '50 : Inside PA_REP_UTIL_GLOB.get_util_fc_parm';
549 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
550 END IF;
551
552 IF TRUNC(TO_DATE(p_fc_start_date,'YYYY/MM/DD HH24:MI:SS')) >
553 TRUNC(TO_DATE(p_fc_end_date, 'YYYY/MM/DD HH24:MI:SS')) THEN
554 retcode := 2;
555 errbuf := 'The Given Date Range is Invalid';
556 IF l_debug ='Y'THEN -- bug 2674619
557 PA_DEBUG.g_err_stage := '100 : The Given Date Range is Invalid';
558 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
559 END IF;
560 FND_MESSAGE.Set_Name('PA','PA_UTIL_INVALID_DATE_RANGE');
561 l_fnd_msg := FND_MESSAGE.Get;
562 PA_DEBUG.Log_Message(p_message => l_fnd_msg
563 , p_write_mode => 1
564 , p_write_file => 'OUT');
565 PA_Debug.Reset_Curr_Function;
566 RETURN;
567 END IF;
568 IF l_debug ='Y'THEN -- bug 2674619
569
570 PA_DEBUG.g_err_stage := '100 : Before Calling PA_REP_UTIL_GLOB.Get_Util_Prc_Switch';
571 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
572 END IF;
573 Get_Util_Prc_Switch (
574 x_prc_switch => l_prc_switch
575 ,x_msg_data => l_errbuf
576 ,x_return_status => l_retcode
577 );
578 IF l_debug ='Y'THEN -- bug 2674619
579 PA_DEBUG.g_err_stage := '150 : After Calling PA_REP_UTIL_GLOB.Get_Util_Prc_Switch';
580 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
581 END IF;
582
583 IF ( l_prc_switch = 'F' OR l_prc_switch = 'B') THEN
584 IF l_debug ='Y'THEN -- bug 2674619
585 PA_DEBUG.g_err_stage := '200 : Before calling PA_REP_UTIL_GLOB.initialize_util_cache';
586 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
587 END IF;
588
589 PA_REP_UTIL_GLOB.initialize_util_cache(
590 p_ac_start_date => TRUNC(TO_DATE(p_ac_start_date,'YYYY/MM/DD HH24:MI:SS'))
591 ,p_ac_end_date => TRUNC(TO_DATE(p_ac_end_date,'YYYY/MM/DD HH24:MI:SS'))
592 ,p_fc_start_date => TRUNC(TO_DATE(p_fc_start_date,'YYYY/MM/DD HH24:MI:SS'))
593 ,p_fc_end_date => TRUNC(TO_DATE(p_fc_end_date,'YYYY/MM/DD HH24:MI:SS'))
594 ,p_org_rollup_method => p_org_rollup_method
595 ,p_debug_mode => p_debug_mode
596 );
597 IF l_debug ='Y'THEN -- bug 2674619
598 PA_DEBUG.g_err_stage := '250 : After calling PA_REP_UTIL_GLOB.initialize_util_cache';
599 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
600 END IF;
601
602 /*
603 * Bug 1810528
604 * The checking of the last_update_date of pa_org_hierarchy_denorm is
605 * to find if the the organization hierarchy changed during the run.
606 */
607 SELECT max(LAST_UPDATE_DATE)
608 INTO l_orghier_date_before
609 FROM pa_org_hierarchy_denorm
610 WHERE pa_org_use_type = 'REPORTING'
611 AND NVL(org_id, -99) = pa_rep_util_glob.G_implementation_details.G_org_id
612 AND ORG_HIERARCHY_VERSION_ID = pa_rep_util_glob.G_implementation_details.
613 G_org_structure_version_id
614 ;
615 IF l_debug ='Y'THEN -- bug 2674619
616 PA_DEBUG.g_err_stage := '300 : Max Last_Update_Date of pa_org_hierarchy_denorm before the run is <'||l_orghier_date_before||'>';
617 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
618 PA_DEBUG.g_err_stage := '330 : Before calling PA_REP_UTIL_GLOB.Get_Effective_Start_Period_Num';
619 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
620 END IF;
621
622 IF pa_rep_util_glob.G_input_parameters.G_org_rollup_method = 'R' THEN
623 IF pa_rep_util_glob.G_util_option_details.G_pa_period_flag = 'Y' THEN
624 l_errbuf := NULL;
625 l_retcode := '0';
626 pa_rep_util_glob.Get_Effective_Start_Period_Num(
627 errbuf => l_errbuf,
628 retcode => l_retcode,
629 effective_start_period_num => l_effect_start_period_num,
630 -- p_period_set_name => pa_rep_util_glob.G_implementation_details.G_period_set_name,
631 p_period_set_name => pa_rep_util_glob.G_implementation_details.G_pa_period_set_name, -- bug 3434019
632 p_period_type => pa_rep_util_glob.G_implementation_details.G_pa_period_type,
633 p_start_date => TRUNC(TO_DATE(p_fc_start_date,'YYYY/MM/DD HH24:MI:SS'))
634 );
635 IF l_retcode = '2' THEN
636 retcode := '2';
637 IF l_debug ='Y'THEN -- bug 2674619
638 PA_DEBUG.g_err_stage := '350 : There is no matching PA period for the given Start Date';
639 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
640 END IF;
641 FND_MESSAGE.Set_Name('PA','PA_UTIL_INVALID_START_DATE_PA');
642 l_fnd_msg := FND_MESSAGE.Get;
643 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage
644 , p_write_mode => 1
645 , p_write_file => 'OUT');
646 PA_Debug.Reset_Curr_Function;
647 RETURN;
648 ELSE
649 IF l_debug ='Y'THEN -- bug 2674619
650 PA_DEBUG.g_err_stage := '350 : Eff pd Num-PA '||to_char(l_effect_start_period_num);
651 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
652 END IF;
653 PA_REP_UTIL_GLOB.G_eff_fc_start_pa_period_num := l_effect_start_period_num;
654 END IF;
655 END IF;
656 IF pa_rep_util_glob.G_util_option_details.G_gl_period_flag = 'Y' THEN
657 l_errbuf := NULL;
658 l_retcode := '0';
659 pa_rep_util_glob.Get_Effective_Start_Period_Num(
660 errbuf => l_errbuf,
661 retcode => l_retcode,
662 effective_start_period_num => l_effect_start_period_num,
663 -- p_period_set_name => pa_rep_util_glob.G_implementation_details.G_period_set_name,
664 p_period_set_name => pa_rep_util_glob.G_implementation_details.G_gl_period_set_name, -- bug 3434019
665 p_period_type => pa_rep_util_glob.G_implementation_details.G_gl_period_type,
666 p_start_date => TRUNC(TO_DATE(p_fc_start_date,'YYYY/MM/DD HH24:MI:SS'))
667 );
668 IF l_retcode = '2' THEN
669 retcode := '2';
670 IF l_debug ='Y'THEN -- bug 2674619
671 PA_DEBUG.g_err_stage := '400 : There is no matching GL period for the given Start Date';
672 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
673 END IF;
674 FND_MESSAGE.Set_Name('PA','PA_UTIL_INVALID_START_DATE_GL');
675 l_fnd_msg := FND_MESSAGE.Get;
676 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage
677 , p_write_mode => 1
678 , p_write_file => 'OUT');
679 PA_Debug.Reset_Curr_Function;
680 RETURN;
681 ELSE
682 IF l_debug ='Y'THEN -- bug 2674619
683
684 PA_DEBUG.g_err_stage := '400 : Eff pd Num-GL '||to_char(l_effect_start_period_num);
685 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
686 END IF;
687 PA_REP_UTIL_GLOB.G_eff_fc_start_gl_period_num := l_effect_start_period_num;
688 END IF;
689 END IF;
690 END IF;
691
692 IF l_debug ='Y'THEN -- bug 2674619
693 PA_DEBUG.g_err_stage := '450 : After calling PA_REP_UTIL_GLOB.Get_Effective_Start_Period_Num';
694 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
695 PA_DEBUG.g_err_stage := '500 : Before calling PA_SUMMARIZE_FORECAST_UTIL_PVT.summarize_forecast_util';
696 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
697 END IF;
698
699 PA_SUMMARIZE_FORECAST_UTIL_PVT.summarize_forecast_util;
700 IF l_debug ='Y'THEN -- bug 2674619
701 PA_DEBUG.g_err_stage := '550 : After calling PA_SUMMARIZE_FORECAST_UTIL_PVT.summarize_forecast_util';
702 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
703 END IF;
704 ELSE
705 IF l_debug ='Y'THEN -- bug 2674619
706
707 PA_DEBUG.g_err_stage := '400 : Oracle PRM Not Installed ... Not Running Forecast';
708 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
709 END IF;
710 FND_MESSAGE.Set_Name('PA','PA_UTIL_PRM_NOT_INSTALLED');
711 l_fnd_msg := FND_MESSAGE.Get;
712 PA_DEBUG.Log_Message(p_message => l_fnd_msg
713 , p_write_mode => 1
714 , p_write_file => 'OUT');
715 PA_DEBUG.Reset_Curr_Function;
716 RETURN;
717 END IF;
718
719 /*
720 * Continuation of the check for Bug 1810528
721 */
722 SELECT max(LAST_UPDATE_DATE)
723 INTO l_orghier_date_after
724 FROM pa_org_hierarchy_denorm
725 WHERE pa_org_use_type = 'REPORTING'
726 AND NVL(org_id, -99) = pa_rep_util_glob.G_implementation_details.G_org_id
727 AND ORG_HIERARCHY_VERSION_ID = pa_rep_util_glob.G_implementation_details.G_org_structure_version_id
728 ;
729
730 IF ( l_orghier_date_after > l_orghier_date_before) then
731 FND_MESSAGE.Set_Name('PA','PA_UTIL_ORGZ_HIER_CHANGE');
732 l_fnd_msg := FND_MESSAGE.Get;
733 PA_DEBUG.Log_Message(p_message => l_fnd_msg);
734 PA_DEBUG.Log_Message(p_message => l_fnd_msg
735 , p_write_mode => 1
736 , p_write_file => 'OUT'
737 );
738 ELSE
739 FND_MESSAGE.Set_Name('PA','PA_UTIL_SUCCESSFUL_RUN');
740 l_fnd_msg := FND_MESSAGE.Get;
741 PA_DEBUG.Log_Message(p_message => l_fnd_msg);
742 PA_DEBUG.Log_Message(p_message => l_fnd_msg
743 , p_write_mode => 1
744 , p_write_file => 'OUT'
745 );
746 END IF;
747 IF l_debug ='Y'THEN -- bug 2674619
748 PA_DEBUG.g_err_stage := '310 : Max Last_Update_Date of pa_org_hierarchy_denorm after the run is <'||l_orghier_date_after||'>';
749 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
750
751 PA_DEBUG.g_err_stage := '650 : Exiting PA_REP_UTIL_GLOB.get_util_fc_parm';
752 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
753 END IF;
754 PA_DEBUG.Reset_Curr_Function;
755 EXCEPTION
756 WHEN OTHERS THEN
757
758 retcode := 2;
759 errbuf := SUBSTR(SQLERRM,1,240);
760 PA_DEBUG.Log_Message( SQLERRM);
761 PA_DEBUG.Log_Message(PA_DEBUG.g_err_stack);
762 PA_DEBUG.Log_Message(p_message => SQLERRM
763 , p_write_mode => 1
764 , p_write_file => 'OUT'
765 );
766 /*
767 * Set the excetption Message and the stack
768 */
769 FND_MSG_PUB.add_exc_msg (
770 p_pkg_name => 'PA_REP_UTIL_GLOB.get_util_fc_parm'
771 ,p_procedure_name => PA_DEBUG.G_Err_Stack
772 );
773 RAISE;
774
775 END Get_Util_Fc_Parm;
776
777 PROCEDURE Get_Util_Prc_Switch (
778 x_prc_switch OUT NOCOPY VARCHAR2
779 ,x_msg_data OUT NOCOPY VARCHAR2
780 ,x_return_status OUT NOCOPY VARCHAR2
781 )
782 IS
783 l_pa_installed BOOLEAN;
784 l_prm_installed VARCHAR2(2);
785 BEGIN
786
787 PA_DEBUG.Set_Curr_Function( p_function => 'Get_Util_Prc_Switch');
788 IF l_debug ='Y'THEN -- bug 2674619
789 PA_DEBUG.g_err_stage := '50 : Entering PA_REP_UTIL_GLOB.Get_Util_Prc_Switch';
790 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
791 END IF;
792 /*
793 * assume success
794 */
795
796 x_return_status := 0;
797 x_prc_switch := NULL;
798 l_pa_installed := pa_install.is_product_installed('PA');
799 l_prm_installed := pa_install.is_prm_licensed();
800 IF ((l_pa_installed = TRUE) AND (l_prm_installed = 'Y' ) ) THEN
801 x_prc_switch := 'B';
802 ELSIF (l_pa_installed = TRUE) THEN
803 x_prc_switch := 'A';
804 ELSIF (l_prm_installed = 'Y') THEN
805 x_prc_switch := 'F';
806 ELSE
807 /*
808 * Neither PA or PRM are installed
809 */
810 x_prc_switch := 'X';
811 END IF;
812 IF l_debug ='Y'THEN -- bug 2674619
813 PA_DEBUG.g_err_stage := '100 : X_PRC_SWITCH Value : '||x_prc_switch;
814 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
815
816 -- PA_DEBUG.init_err_stack('PA_REP_UTIL_GLOB.Get_Util_Prc_Switch');
817 PA_DEBUG.g_err_stage := '150 : Exiting PA_REP_UTIL_GLOB.Get_Util_Prc_Switch';
818 END IF;
819 PA_DEBUG.Reset_Curr_Function;
820
821 EXCEPTION
822 WHEN OTHERS THEN
823 x_return_status := 2;
824 x_msg_data := SUBSTR(SQLERRM,1,240);
825 PA_DEBUG.Log_Message( SQLERRM);
826 PA_DEBUG.Log_Message(PA_DEBUG.g_err_stack);
827 RAISE;
828 END Get_Util_Prc_Switch;
829
830 PROCEDURE initialize_util_cache(
831 p_ac_start_date IN DATE
832 ,p_ac_end_date IN DATE
833 ,p_fc_start_date IN DATE
834 ,p_fc_end_date IN DATE
835 ,p_org_rollup_method IN VARCHAR2 DEFAULT 'I'
836 ,p_debug_mode IN VARCHAR2
837 )
838 IS
839 BEGIN
840 PA_DEBUG.Set_Curr_Function( p_function => 'Initialize_Util_Cache');
841 IF l_debug ='Y'THEN -- bug 2674619
842 PA_DEBUG.g_err_stage := '50 : Entering PA_REP_UTIL_GLOB.initialize_util_cache';
843 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
844 END IF;
845 /*
846 * Initialize the Global variables with the user specified
847 * input parameters.
848 */
849
850 /*
851 * The end_dates should be >= the start_dates.
852 * This check can be included in the SRS high-low edit.
853 * If that's not possible, this check has to be done here
854 * and an appropriate error message has to be displayed.
855 */
856 G_input_parameters.G_ac_start_date := NVL(p_ac_start_date,
857 TO_DATE('01-01-1950','DD-MM-YYYY'));
858 G_input_parameters.G_ac_end_date := NVL(p_ac_end_date,
859 TO_DATE('31-12-4712','DD-MM-YYYY'));
860 G_input_parameters.G_fc_start_date := NVL(p_fc_start_date,
861 TO_DATE('01-01-1950','DD-MM-YYYY'));
862 G_input_parameters.G_fc_end_date := NVL(p_fc_end_date,
863 TO_DATE('31-12-4712','DD-MM-YYYY'));
864 G_input_parameters.G_org_rollup_method := p_org_rollup_method;
865 G_input_parameters.G_debug_mode := p_debug_mode;
866 IF l_debug ='Y'THEN -- bug 2674619
867 PA_DEBUG.g_err_stage := '100 : Exiting PA_REP_UTIL_GLOB.initialize_util_cache';
868 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
869 PA_DEBUG.Reset_Curr_Function;
870 END IF;
871 EXCEPTION
872 WHEN OTHERS THEN
873 PA_DEBUG.Log_Message( SQLERRM);
874 PA_DEBUG.Log_Message(PA_DEBUG.g_err_stack);
875 RAISE;
876 END initialize_util_cache;
877
878 PROCEDURE Get_Effective_Start_Period_Num( errbuf OUT NOCOPY VARCHAR2
879 ,retcode OUT NOCOPY VARCHAR2
880 ,effective_start_period_num OUT NOCOPY NUMBER
881 ,p_period_set_name IN VARCHAR2
882 ,p_period_type IN VARCHAR2
883 ,p_start_date IN DATE
884 )
885 IS
886 BEGIN
887 retcode := 0;
888
889 PA_DEBUG.Set_Curr_Function( p_function => 'Get_Effective_Start_Period_Num');
890 IF l_debug ='Y'THEN -- bug 2674619
891
892 PA_DEBUG.g_err_stage := '50 : Entering PA_REP_UTIL_GLOB.Get_Effective_Start_Period_Num';
893 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
894 END IF;
895
896 SELECT (g.period_year*10000) + g.period_num
897 INTO effective_start_period_num
898 FROM gl_date_period_map map
899 ,gl_periods g
900 -- WHERE g.period_set_name = G_implementation_details.G_period_set_name
901 WHERE g.period_set_name = p_period_set_name --bug 3434019
902 AND g.period_name = map.period_name
903 AND map.accounting_date = p_start_date
904 AND map.period_type = p_period_type
905 -- AND map.period_set_name = G_implementation_details.G_period_set_name;
906 AND map.period_set_name = p_period_set_name; --bug 3434019
907
908 IF l_debug ='Y'THEN -- bug 2674619
909 PA_DEBUG.g_err_stage := '100 : Exiting PA_REP_UTIL_GLOB.Get_Effective_Start_Period_Num';
910 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
911 END IF;
912 EXCEPTION
913 WHEN NO_DATA_FOUND THEN
914 retcode := 2;
915 errbuf := 'The Given Start Date does not map to ';
916 WHEN OTHERS THEN
917 retcode := 2;
918 errbuf := SQLERRM;
919 RAISE;
920 END Get_Effective_Start_Period_Num;
921
922 /*
923 * This Procedure populates the Amount type ids Cache.
924 * Its called from, PA_REP_UTIL_GLOB.auto_util_cache.
925 */
926 PROCEDURE initialize_amt_type_id_cache
927 IS
928 BEGIN
929 PA_DEBUG.Set_Curr_Function( p_function => 'Initialize_Amt_Type_Id_Cache');
930 IF l_debug ='Y'THEN -- bug 2674619
931 PA_DEBUG.g_err_stage := '50 : Entering PA_REP_UTIL_GLOB.initialize_amt_type_id_cache';
932 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
933 END IF;
934 /*
935 * Initialize the amount type_id variables with their
936 * corresponding values.
937 */
938
939 G_amt_type_details.G_res_hrs_id := 1;
940 G_amt_type_details.G_res_wtdhrs_org_id := 2;
941 G_amt_type_details.G_res_wtdhrs_people_id := 3;
942 G_amt_type_details.G_res_prvhrs_id := 4;
943 G_amt_type_details.G_res_prvwtdhrs_org_id := 5;
944 G_amt_type_details.G_res_prvwtdhrs_people_id := 6;
945 G_amt_type_details.G_res_utilprctghrs_id := 7;
946 G_amt_type_details.G_res_utilprctgcap_id := 8;
947 G_amt_type_details.G_res_cap_id := 9;
948 G_amt_type_details.G_res_reducedcap_id := 10;
949
950 G_amt_type_details.G_org_sub_hrs_id := 11;
951 G_amt_type_details.G_org_sub_wtdhrs_org_id := 12;
952 G_amt_type_details.G_org_sub_prvhrs_id := 13;
953 G_amt_type_details.G_org_sub_prvwtdhrs_org_id := 14;
954 G_amt_type_details.G_org_sub_utilprctghrs_id := 15;
955 G_amt_type_details.G_org_sub_utilprctgcap_id := 16;
956 G_amt_type_details.G_org_sub_cap_id := 17;
957 G_amt_type_details.G_org_sub_reducedcap_id := 18;
958 G_amt_type_details.G_org_sub_headcount_id := 19;
959 G_amt_type_details.G_org_sub_empheadcount_id := 20;
960
961 G_amt_type_details.G_org_dir_hrs_id := 21;
962 G_amt_type_details.G_org_dir_wtdhrs_org_id := 22;
963 G_amt_type_details.G_org_dir_prvhrs_id := 23;
964 G_amt_type_details.G_org_dir_prvwtdhrs_org_id := 24;
965 G_amt_type_details.G_org_dir_utilprctghrs_id := 25;
966 G_amt_type_details.G_org_dir_utilprctgcap_id := 26;
967 G_amt_type_details.G_org_dir_cap_id := 27;
968 G_amt_type_details.G_org_dir_reducedcap_id := 28;
969 G_amt_type_details.G_org_dir_headcount_id := 29;
970 G_amt_type_details.G_org_dir_empheadcount_id := 30;
971
972 G_amt_type_details.G_org_tot_hrs_id := 31;
973 G_amt_type_details.G_org_tot_wtdhrs_org_id := 32;
974 G_amt_type_details.G_org_tot_prvhrs_id := 33;
975 G_amt_type_details.G_org_tot_prvwtdhrs_org_id := 34;
976 G_amt_type_details.G_org_tot_utilprctghrs_id := 35;
977 G_amt_type_details.G_org_tot_utilprctgcap_id := 36;
978 G_amt_type_details.G_org_tot_cap_id := 37;
979 G_amt_type_details.G_org_tot_reducedcap_id := 38;
980 G_amt_type_details.G_org_tot_headcount_id := 39;
981 G_amt_type_details.G_org_tot_empheadcount_id := 40;
982 G_amt_type_details.G_quantity_id := 41;
983 IF l_debug ='Y'THEN -- bug 2674619
984 PA_DEBUG.g_err_stage := '100 : Exiting PA_REP_UTIL_GLOB.initialize_amt_type_id_cache';
985 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
986 END IF;
987 PA_DEBUG.Reset_Curr_Function;
988
989 EXCEPTION
990 WHEN OTHERS THEN
991 PA_DEBUG.Log_Message( SQLERRM);
992 PA_DEBUG.Log_Message(PA_DEBUG.g_err_stack);
993 RAISE;
994 END initialize_amt_type_id_cache;
995
996 PROCEDURE SetU3PeriodType(p_period_type IN pa_implementations.pa_period_type%TYPE)
997 IS
998 BEGIN
999 G_u3_parameters.G_period_type := p_period_type;
1000 END SetU3PeriodType;
1001
1002 PROCEDURE SetU3PeriodName(p_period_name IN gl_periods.period_name%TYPE)
1003 IS
1004 BEGIN
1005 G_u3_parameters.G_period_name := p_period_name;
1006 END SetU3PeriodName;
1007
1008 PROCEDURE SetU3QtrOrMonNum(p_qtr_or_mon_num IN VARCHAR2)
1009 IS
1010 BEGIN
1011 G_u3_parameters.G_qtr_or_mon_num := p_qtr_or_mon_num;
1012 END SetU3QtrOrMonNum;
1013
1014 PROCEDURE SetU3YearNum(p_year_num IN VARCHAR2)
1015 IS
1016 BEGIN
1017 G_u3_parameters.G_year_num := p_year_num;
1018 END SetU3YearNum;
1019
1020 PROCEDURE SetU3PersonId(p_person_id IN VARCHAR2)
1021 IS
1022 BEGIN
1023 G_u3_parameters.G_person_id := p_person_id;
1024 END SetU3PersonId;
1025 PROCEDURE SetU3GeEndDate(p_ge_end_date IN VARCHAR2)
1026 IS
1027 BEGIN
1028 G_u3_parameters.G_ge_end_date := p_ge_end_date;
1029 END SetU3GeEndDate;
1030 PROCEDURE SetU3EffPeriodNum(p_eff_period_num IN VARCHAR2)
1031 IS
1032 BEGIN
1033 G_u3_parameters.G_eff_period_num := p_eff_period_num;
1034 END SetU3EffPeriodNum;
1035
1036 PROCEDURE SetU1ShowPrctgBy(p_showprctgby IN VARCHAR2)
1037 IS
1038 BEGIN
1039 G_u1_show_prctg_by := p_showprctgby;
1040 END SetU1ShowPrctgBy;
1041
1042 /*
1043 * This procedure initializes Global variables.
1044 */
1045 /*
1046 * This procedure initializes Global variables.
1047 */
1048 PROCEDURE auto_util_cache
1049 IS
1050 BEGIN
1051 PA_DEBUG.Set_Curr_Function( p_function => 'Auto_Util_Cache');
1052 IF l_debug ='Y'THEN -- bug 2674619
1053 PA_DEBUG.g_err_stage := '50 : Entering PA_REP_UTIL_GLOB.auto_util_cache';
1054 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1055 END IF;
1056
1057 /*
1058 * Assigning Constant values for variables supposed to
1059 * to act as constants.
1060 * The values assigned are NOT to be changed anywhere.
1061 */
1062
1063 /*
1064 * Constants - Amount Types.
1065 */
1066 G_BAL_TYPE_C.G_ACTUALS_C := 'ACTUALS';
1067 G_BAL_TYPE_C.G_FORECAST_C := 'FORECAST';
1068
1069 /*
1070 * Constants - Object Types.
1071 */
1072 G_OBJ_TYPE_C.G_ORG_C := 'ORG';
1073 G_OBJ_TYPE_C.G_ORGUC_C := 'ORGUC';
1074 G_OBJ_TYPE_C.G_ORGWT_C := 'ORGWT';
1075 G_OBJ_TYPE_C.G_RES_C := 'RES';
1076 G_OBJ_TYPE_C.G_RESUCO_C := 'RESUCO';
1077 G_OBJ_TYPE_C.G_RESUCR_C := 'RESUCR';
1078 G_OBJ_TYPE_C.G_RESWT_C := 'RESWT';
1079 G_OBJ_TYPE_C.G_UTILDET_C := 'UTILDET';
1080
1081 /*
1082 * Constants - Period Types.
1083 */
1084 G_PERIOD_TYPE_C.G_GL_C := 'GL';
1085 G_PERIOD_TYPE_C.G_PA_C := 'PA';
1086 G_PERIOD_TYPE_C.G_GE_C := 'GE';
1087
1088 /*
1089 * Populate the Global record for the WHO columns.
1090 */
1091
1092 G_who_columns.G_last_updated_by := FND_GLOBAL.USER_ID;
1093 G_who_columns.G_created_by := FND_GLOBAL.USER_ID;
1094 G_who_columns.G_creation_date := SYSDATE;
1095 G_who_columns.G_last_update_date := G_who_columns.G_creation_date;
1096 G_who_columns.G_last_update_login := FND_GLOBAL.LOGIN_ID;
1097 G_who_columns.G_program_application_id := FND_GLOBAL.PROG_APPL_ID;
1098 G_who_columns.G_request_id := FND_GLOBAL.CONC_REQUEST_ID;
1099 G_who_columns.G_program_id := FND_GLOBAL.CONC_PROGRAM_ID;
1100
1101 /*
1102 * Populate the Global variable for the Fetch Size.
1103 */
1104 IF l_debug ='Y'THEN -- bug 2674619
1105 PA_DEBUG.g_err_stage := '100 : Before Accessing FND_PROFILE values';
1106 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1107 END IF;
1108
1109 --IF (FND_PROFILE.VALUE('PA_NUM_TXN_SUMM_PER_SET')) IS NOT NULL THEN
1110 -- G_util_fetch_size := FND_PROFILE.VALUE('PA_NUM_TXN_SUMM_PER_SET');
1111 -- /*
1112 -- * If a fetch size is NOT specified, G_DEFAULT_FETCH_SIZE is used.
1113 -- */
1114 --END IF;
1115
1116 G_global_week_start_day := FND_PROFILE.VALUE('PA_GLOBAL_WEEK_START_DAY');
1117
1118 /*
1119 * To get the Global variable for Utilization Calculation Method from FND Profile
1120 */
1121
1122 G_util_option_details.G_util_calc_method := FND_PROFILE.VALUE('PA_RES_UTIL_DEF_CALC_METHOD');
1123
1124 IF l_debug ='Y'THEN -- bug 2674619
1125 PA_DEBUG.g_err_stage := '150 : After Accessing FND_PROFILE values';
1126 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1127 END IF;
1128
1129 /*
1130 * Populate the Global record for the Implementation Details.
1131 */
1132 IF l_debug ='Y'THEN -- bug 2674619
1133 PA_DEBUG.g_err_stage := '200 : Before Selecting Implementation Details';
1134 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1135 END IF;
1136
1137 SELECT NVL(imp.org_id,-99)
1138 ,imp.org_structure_version_id
1139 ,imp.start_organization_id
1140 ,imp.pa_period_type
1141 ,sob.accounted_period_type
1142 ,sob.period_set_name
1143 ,imp.period_set_name --bug 3434019
1144 INTO G_implementation_details.G_org_id
1145 ,G_implementation_details.G_org_structure_version_id
1146 ,G_implementation_details.G_start_organization_id
1147 ,G_implementation_details.G_pa_period_type
1148 ,G_implementation_details.G_gl_period_type
1149 ,G_implementation_details.G_gl_period_set_name --bug 3434019
1150 ,G_implementation_details.G_pa_period_set_name --bug 3434019
1151 FROM pa_implementations imp
1152 ,gl_sets_of_books sob
1153 WHERE sob.set_of_books_id = imp.set_of_books_id ;
1154
1155 IF l_debug ='Y'THEN -- bug 2674619
1156 PA_DEBUG.g_err_stage := '250 : After Selecting Implementation Details';
1157 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1158 END IF;
1159
1160 /*
1161 * Populate the Global record for the Utilization Options
1162 * details.
1163 * pa_utilization_options is assumed to have ONLY ONE record.
1164 */
1165 IF l_debug ='Y'THEN -- bug 2674619
1166 PA_DEBUG.g_err_stage := '300 : Before Setting the Global variables for all Period flags';
1167 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1168 END IF;
1169
1170 SELECT pa_period_flag
1171 ,gl_period_flag
1172 ,global_exp_period_flag
1173 ,forecast_thru_date
1174 ,actuals_thru_date
1175 INTO G_util_option_details.G_pa_period_flag
1176 ,G_util_option_details.G_gl_period_flag
1177 ,G_util_option_details.G_ge_period_flag
1178 ,G_util_option_details.G_forecast_thru_date
1179 ,G_util_option_details.G_actuals_thru_date
1180 FROM pa_utilization_options;
1181
1182 IF l_debug ='Y'THEN -- bug 2674619
1183 PA_DEBUG.g_err_stage := '350 : After Setting the Global variables for all Period flags';
1184 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1185 END IF;
1186
1187 /*
1188 * Populate the Global record for the last run details
1189 * pa_utilization_options is assumed to have ONLY ONE record.
1190 */
1191 IF l_debug ='Y'THEN -- bug 2674619
1192 PA_DEBUG.g_err_stage := '360 : Before Setting the Global variables for last run details';
1193 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1194 END IF;
1195
1196 SELECT actuals_last_run_date
1197 ,forecast_last_run_date
1198 INTO G_last_run_when.G_ac_last_run_date
1199 ,G_last_run_when.G_fc_last_run_date
1200 FROM pa_utilization_options;
1201 IF l_debug ='Y'THEN -- bug 2674619
1202 PA_DEBUG.g_err_stage := '370 : After Setting the Global variables for last run details';
1203 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1204 END IF;
1205
1206
1207
1208 /*
1209 * Call the Procedure to initialize amount_type_ids.
1210 */
1211 IF l_debug ='Y'THEN -- bug 2674619
1212 PA_DEBUG.g_err_stage := '400 : Before calling initialize_amt_type_id_cache';
1213 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1214 END IF;
1215
1216 PA_REP_UTIL_GLOB.initialize_amt_type_id_cache;
1217 IF l_debug ='Y'THEN -- bug 2674619
1218 PA_DEBUG.g_err_stage := '450 : After calling initialize_amt_type_id_cache';
1219 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1220
1221 PA_DEBUG.g_err_stage := '500 : Exiting PA_REP_UTIL_GLOB.auto_util_cache';
1222 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1223 END IF;
1224 PA_DEBUG.Reset_Curr_Function;
1225 EXCEPTION
1226 WHEN OTHERS THEN
1227 RAISE;
1228 END auto_util_cache;
1229
1230 /*
1231 * Functions.
1232 */
1233
1234 /*
1235 * Functions to return Period_types.
1236 */
1237
1238 FUNCTION GetPeriodTypeGl RETURN VARCHAR2
1239 IS
1240 BEGIN
1241 RETURN G_PERIOD_TYPE_C.G_GL_C;
1242 END GetPeriodTypeGl;
1243
1244 FUNCTION GetPeriodTypePa RETURN VARCHAR2
1245 IS
1246 BEGIN
1247 RETURN G_PERIOD_TYPE_C.G_PA_C;
1248 END GetPeriodTypePa;
1249
1250 FUNCTION GetPeriodTypeGe RETURN VARCHAR2
1251 IS
1252 BEGIN
1253 RETURN G_PERIOD_TYPE_C.G_GE_C;
1254 END GetPeriodTypeGe;
1255
1256 /*
1257 * Functions to return Balance_types..
1258 */
1259
1260 FUNCTION GetBalTypeActuals RETURN VARCHAR2
1261 IS
1262 BEGIN
1263 RETURN G_BAL_TYPE_C.G_ACTUALS_C;
1264 END GetBalTypeActuals;
1265
1266 FUNCTION GetBalTypeForecast RETURN VARCHAR2
1267 IS
1268 BEGIN
1269 RETURN G_BAL_TYPE_C.G_FORECAST_C;
1270 END GetBalTypeForecast;
1271
1272 /*
1273 * Functions to return Object_types
1274 */
1275
1276 FUNCTION GetObjectTypeOrg RETURN VARCHAR2
1277 IS
1278 BEGIN
1279 RETURN G_OBJ_TYPE_C.G_ORG_C;
1280 END GetObjectTypeOrg;
1281
1282 FUNCTION GetObjectTypeOrgUc RETURN VARCHAR2
1283 IS
1284 BEGIN
1285 RETURN G_OBJ_TYPE_C.G_ORGUC_C;
1286 END GetObjectTypeOrgUc ;
1287
1288 FUNCTION GetObjectTypeOrgWt RETURN VARCHAR2
1289 IS
1290 BEGIN
1291 RETURN G_OBJ_TYPE_C.G_ORGWT_C;
1292 END GetObjectTypeOrgWt ;
1293
1294 FUNCTION GetObjectTypeRes RETURN VARCHAR2
1295 IS
1296 BEGIN
1297 RETURN G_OBJ_TYPE_C.G_RES_C;
1298 END GetObjectTypeRes ;
1299
1300 FUNCTION GetObjectTypeResUco RETURN VARCHAR2
1301 IS
1302 BEGIN
1303 RETURN G_OBJ_TYPE_C.G_RESUCO_C;
1304 END GetObjectTypeResUco ;
1305
1306 FUNCTION GetObjectTypeResUcr RETURN VARCHAR2
1307 IS
1308 BEGIN
1309 RETURN G_OBJ_TYPE_C.G_RESUCR_C;
1310 END GetObjectTypeResUcr ;
1311
1312 FUNCTION GetObjectTypeResWt RETURN VARCHAR2
1313 IS
1314 BEGIN
1315 RETURN G_OBJ_TYPE_C.G_RESWT_C;
1316 END GetObjectTypeResWt ;
1317
1318 FUNCTION GetObjectTypeUtilDet RETURN VARCHAR2
1319 IS
1320 BEGIN
1321 RETURN G_OBJ_TYPE_C.G_UTILDET_C;
1322 END GetObjectTypeUtilDet ;
1323
1324 /*
1325 * Function to return Fetch Size.
1326 */
1327 FUNCTION GetFetchSize RETURN NUMBER
1328 IS
1329 BEGIN
1330 RETURN G_DEFAULT_FETCH_SIZE_C;
1331 END GetFetchSize;
1332
1333 /*
1334 * Function to return Period Set name.
1335 */
1336 FUNCTION GetPeriodSetName RETURN gl_sets_of_books.period_set_name%TYPE
1337 IS
1338 BEGIN
1339 RETURN G_implementation_details.G_gl_period_set_name;
1340 END GetPeriodSetName;
1341
1342 /*
1343 * Functions to return dummy values.
1344 */
1345 FUNCTION GetDummy RETURN VARCHAR2
1346 IS
1347 BEGIN
1348 RETURN PA_REP_UTIL_GLOB.G_DUMMY_C;
1349 END GetDummy;
1350
1351 FUNCTION GetDummyDate RETURN DATE
1352 IS
1353 BEGIN
1354 RETURN PA_REP_UTIL_GLOB.G_DUMMY_DATE_C;
1355 END GetDummyDate;
1356
1357 /*
1358 * Function to return org_id
1359 */
1360 FUNCTION GetOrgId RETURN pa_implementations.org_id%TYPE
1361 IS
1362 BEGIN
1363 RETURN G_implementation_details.G_org_id;
1364 END GetOrgId;
1365
1366 FUNCTION GetOrgStructureVersionId RETURN pa_implementations.org_structure_version_id%TYPE
1367 IS
1368 BEGIN
1369 RETURN G_implementation_details.G_org_structure_version_id;
1370 END GetOrgStructureVersionId;
1371
1372 /*
1373 * Functions to get parameters from the U3 screen
1374 */
1375
1376 FUNCTION GetU3PeriodType RETURN pa_implementations.pa_period_type%TYPE
1377 IS
1378 BEGIN
1379 RETURN G_u3_parameters.G_period_type;
1380 END GetU3PeriodType;
1381
1382 FUNCTION GetU3PeriodName RETURN gl_periods.period_name%TYPE
1383 IS
1384 BEGIN
1385 RETURN G_u3_parameters.G_period_name;
1386 END GetU3PeriodName;
1387
1388 FUNCTION GetU3QtrOrMonNum RETURN NUMBER
1389 IS
1390 BEGIN
1391 RETURN G_u3_parameters.G_qtr_or_mon_num;
1392 END GetU3QtrOrMonNum;
1393
1394 FUNCTION GetU3YearNum RETURN NUMBER
1395 IS
1396 BEGIN
1397 RETURN G_u3_parameters.G_year_num;
1398 END GetU3YearNum;
1399
1400 FUNCTION GetU3PersonId RETURN NUMBER
1401 IS
1402 BEGIN
1403 RETURN G_u3_parameters.G_person_id;
1404 END GetU3PersonId;
1405
1406 FUNCTION GetU3GeEndDate RETURN VARCHAR2
1407 IS
1408 BEGIN
1409 RETURN G_u3_parameters.G_ge_end_date;
1410 END GetU3GeEndDate;
1411 FUNCTION GetU3EffPeriodNum RETURN NUMBER
1412 IS
1413 BEGIN
1414 RETURN G_u3_parameters.G_eff_period_num;
1415 END GetU3EffPeriodNum;
1416
1417 FUNCTION GetU1ShowPrctgBy RETURN VARCHAR2
1418 IS
1419 BEGIN
1420 RETURN G_u1_show_prctg_by;
1421 END GetU1ShowPrctgBy;
1422
1423
1424
1425 FUNCTION GetPeriodTypeQr RETURN VARCHAR2
1426 IS
1427 BEGIN
1428 RETURN G_period_type_qtr_c;
1429 END GetPeriodTypeQr;
1430
1431 FUNCTION GetPeriodTypeYr RETURN VARCHAR2
1432 IS
1433 BEGIN
1434 RETURN G_period_type_year_c;
1435 END GetPeriodTypeYr;
1436
1437 FUNCTION GetUtilCalcMethod RETURN VARCHAR2
1438 IS
1439 BEGIN
1440 RETURN G_util_option_details.G_util_calc_method;
1441 END GetUtilCalcMethod;
1442
1443 /*
1444 * The following Functions are for getting the last run details
1445 */
1446
1447 FUNCTION GetActualsLastRunDate RETURN DATE
1448 IS
1449 BEGIN
1450 RETURN G_last_run_when.G_ac_last_run_date;
1451 END GetActualsLastRunDate;
1452
1453 FUNCTION GetForecastLastRunDate RETURN DATE
1454 IS
1455 BEGIN
1456 RETURN G_last_run_when.G_fc_last_run_date;
1457 END GetForecastLastRunDate;
1458
1459 /*
1460 * This procedure initializes Global variables.
1461 * This is created for Bug 2447797. Note that do
1462 * not stub out the code in auto_util_cache.
1463 */
1464 PROCEDURE update_util_cache
1465 IS
1466 l_global_week_start_day PLS_INTEGER;
1467 l_util_calc_method VARCHAR2(30);
1468 l_org_id pa_implementations.org_id%TYPE;
1469 l_org_structure_version_id pa_implementations.org_structure_version_id%TYPE;
1470 l_start_organization_id pa_implementations.start_organization_id%TYPE;
1471 l_pa_period_type pa_implementations.pa_period_type%TYPE;
1472 l_gl_period_type gl_sets_of_books.accounted_period_type%TYPE;
1473 -- l_period_set_name gl_sets_of_books.period_set_name%TYPE;
1474 l_gl_period_set_name gl_sets_of_books.period_set_name%TYPE; -- bug 3434019
1475 l_pa_period_set_name gl_sets_of_books.period_set_name%TYPE; -- bug 3434019
1476 BEGIN
1477
1478 PA_DEBUG.Set_Curr_Function( p_function => 'Update_Util_Cache');
1479 IF l_debug ='Y'THEN -- bug 2674619
1480 PA_DEBUG.g_err_stage := '50 : Entering PA_REP_UTIL_GLOB.update_util_cache';
1481 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1482
1483 PA_DEBUG.g_err_stage := '100 : Before Accessing FND_PROFILE values';
1484 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1485 END IF;
1486
1487 l_global_week_start_day := FND_PROFILE.VALUE('PA_GLOBAL_WEEK_START_DAY');
1488 l_util_calc_method := FND_PROFILE.VALUE('PA_RES_UTIL_DEF_CALC_METHOD');
1489
1490 IF l_debug ='Y'THEN -- bug 2674619
1491 PA_DEBUG.g_err_stage := '150 : After Accessing FND_PROFILE values';
1492 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1493
1494 PA_DEBUG.g_err_stage := '200 : Before Selecting Implementation Details';
1495 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1496 END IF;
1497
1498 SELECT NVL(imp.org_id,-99)
1499 ,imp.org_structure_version_id
1500 ,imp.start_organization_id
1501 ,imp.pa_period_type
1502 ,sob.accounted_period_type
1503 ,sob.period_set_name
1504 ,imp.period_set_name
1505 INTO l_org_id
1506 ,l_org_structure_version_id
1507 ,l_start_organization_id
1508 ,l_pa_period_type
1509 ,l_gl_period_type
1510 -- ,l_period_set_name
1511 ,l_gl_period_set_name -- bug 3434019
1512 ,l_pa_period_set_name -- bug 3434019
1513 FROM pa_implementations imp
1514 ,gl_sets_of_books sob
1515 WHERE sob.set_of_books_id = imp.set_of_books_id ;
1516
1517 IF l_debug ='Y'THEN -- bug 2674619
1518 PA_DEBUG.g_err_stage := '250 : After Selecting Implementation Details';
1519 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1520 END IF;
1521
1522 /* This condition is made so that unnecessary processing is avoided. As
1523 the global variables are already initialzed through the procedure
1524 auto_util_cache.
1525 */
1526 IF ( l_global_week_start_day <> G_global_week_start_day OR
1527 l_util_calc_method <> G_util_option_details.G_util_calc_method OR
1528 l_org_id <> G_implementation_details.G_org_id)
1529 THEN
1530
1531
1532 /*
1533 * Assigning Constant values for variables supposed to
1534 * to act as constants.
1535 * The values assigned are NOT to be changed anywhere.
1536 */
1537
1538 /*
1539 * Constants - Amount Types.
1540 */
1541 G_BAL_TYPE_C.G_ACTUALS_C := 'ACTUALS';
1542 G_BAL_TYPE_C.G_FORECAST_C := 'FORECAST';
1543
1544 /*
1545 * Constants - Object Types.
1546 */
1547 G_OBJ_TYPE_C.G_ORG_C := 'ORG';
1548 G_OBJ_TYPE_C.G_ORGUC_C := 'ORGUC';
1549 G_OBJ_TYPE_C.G_ORGWT_C := 'ORGWT';
1550 G_OBJ_TYPE_C.G_RES_C := 'RES';
1551 G_OBJ_TYPE_C.G_RESUCO_C := 'RESUCO';
1552 G_OBJ_TYPE_C.G_RESUCR_C := 'RESUCR';
1553 G_OBJ_TYPE_C.G_RESWT_C := 'RESWT';
1554 G_OBJ_TYPE_C.G_UTILDET_C := 'UTILDET';
1555
1556 /*
1557 * Constants - Period Types.
1558 */
1559 G_PERIOD_TYPE_C.G_GL_C := 'GL';
1560 G_PERIOD_TYPE_C.G_PA_C := 'PA';
1561 G_PERIOD_TYPE_C.G_GE_C := 'GE';
1562
1563 /*
1564 * Populate the Global record for the WHO columns.
1565 */
1566
1567 G_who_columns.G_last_updated_by := FND_GLOBAL.USER_ID;
1568 G_who_columns.G_created_by := FND_GLOBAL.USER_ID;
1569 G_who_columns.G_creation_date := SYSDATE;
1570 G_who_columns.G_last_update_date := G_who_columns.G_creation_date;
1571 G_who_columns.G_last_update_login := FND_GLOBAL.LOGIN_ID;
1572 G_who_columns.G_program_application_id := FND_GLOBAL.PROG_APPL_ID;
1573 G_who_columns.G_request_id := FND_GLOBAL.CONC_REQUEST_ID;
1574 G_who_columns.G_program_id := FND_GLOBAL.CONC_PROGRAM_ID;
1575
1576
1577 G_global_week_start_day := l_global_week_start_day;
1578
1579 /*
1580 * To get the Global variable for Utilization Calculation Method from FND Profile
1581 */
1582
1583 G_util_option_details.G_util_calc_method := l_util_calc_method ;
1584
1585
1586 /*
1587 * Populate the Global record for the Implementation Details.
1588 */
1589
1590 G_implementation_details.G_org_id := l_org_id;
1591 G_implementation_details.G_org_structure_version_id := l_org_structure_version_id;
1592 G_implementation_details.G_start_organization_id := l_start_organization_id;
1593 G_implementation_details.G_pa_period_type := l_pa_period_type;
1594 G_implementation_details.G_gl_period_type := l_gl_period_type;
1595 -- G_implementation_details.G_period_set_name := l_period_set_name;
1596 G_implementation_details.G_gl_period_set_name := l_gl_period_set_name; -- bug 3434019
1597 G_implementation_details.G_pa_period_set_name := l_pa_period_set_name; -- bug 3434019
1598
1599
1600 /*
1601 * Populate the Global record for the Utilization Options
1602 * details. Populate the Global record for the last run details
1603 * pa_utilization_options is assumed to have ONLY ONE record.
1604 */
1605 IF l_debug ='Y'THEN -- bug 2674619
1606 PA_DEBUG.g_err_stage := '300 : Before Setting the Global variables for all Period flags and for last run details';
1607 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1608 END IF;
1609
1610 SELECT pa_period_flag
1611 ,gl_period_flag
1612 ,global_exp_period_flag
1613 ,forecast_thru_date
1614 ,actuals_thru_date
1615 ,actuals_last_run_date
1616 ,forecast_last_run_date
1617 INTO G_util_option_details.G_pa_period_flag
1618 ,G_util_option_details.G_gl_period_flag
1619 ,G_util_option_details.G_ge_period_flag
1620 ,G_util_option_details.G_forecast_thru_date
1621 ,G_util_option_details.G_actuals_thru_date
1622 ,G_last_run_when.G_ac_last_run_date
1623 ,G_last_run_when.G_fc_last_run_date
1624 FROM pa_utilization_options;
1625 IF l_debug ='Y'THEN -- bug 2674619
1626 PA_DEBUG.g_err_stage := '350 : After Setting the Global variables for all Period flags and for last run details';
1627 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1628 END IF;
1629
1630
1631
1632 /*
1633 * Call the Procedure to initialize amount_type_ids.
1634 */
1635 IF l_debug ='Y'THEN -- bug 2674619
1636 PA_DEBUG.g_err_stage := '400 : Before calling initialize_amt_type_id_cache';
1637 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1638 END IF;
1639
1640 PA_REP_UTIL_GLOB.initialize_amt_type_id_cache;
1641 IF l_debug ='Y'THEN -- bug 2674619
1642 PA_DEBUG.g_err_stage := '450 : After calling initialize_amt_type_id_cache';
1643 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1644 END IF;
1645 END IF;
1646
1647 IF l_debug ='Y'THEN -- bug 2674619
1648 PA_DEBUG.g_err_stage := '500 : Exiting PA_REP_UTIL_GLOB.update_util_cache';
1649 PA_DEBUG.Log_Message(p_message => PA_DEBUG.g_err_stage);
1650 END IF;
1651 PA_DEBUG.Reset_Curr_Function;
1652
1653 EXCEPTION
1654 WHEN OTHERS THEN
1655 RAISE;
1656 END update_util_cache;
1657
1658 BEGIN
1659 /*
1660 * The following procedure gets executed the first time the
1661 * Package is loaded.
1662 */
1663 auto_util_cache;
1664
1665 END PA_REP_UTIL_GLOB;