[Home] [Help]
PACKAGE BODY: APPS.BEN_MANAGE_OPEN_ENRT_WNDW
Source
1 package body ben_manage_open_enrt_wndw as
2 /* $Header: benmnoew.pkb 120.0.12000000.1 2007/05/31 10:04:27 swjain noship $ */
3 --
4 /* ============================================================================
5 * Name
6 * MANAGE OPEN ENROLLMENT WINDOW Concurrent Manager Process
7 *
8 * Purpose
9 * This package simply houses the concurrent manager and multi-thread
10 * processes for Managing Open Enrollment Window.
11 *
12 * History
13 * Date Who Version What?
14 * --------- --------- ------- -----------------------------------------------------------
15 * 14-Jul-06 swjain 115.0 Created
16 * 26-Jul-06 swjain 115.1 Made few minor changes
17 * 28-Jul-06 swjain 115.2 Added more checks in check_business_rules and added pgm_id
18 * and pl_id check in c_person cursor in procedure process
19 * 10/30/2006 gsehgal 115.3 bug: 5611643. Log report changes
20 * 11/10/2006 gsehgal 115.5 bug 5611643 Log report changes.
21 * --------------------------------------------------------------------------------------------------
22 */
23 --
24 -- Global cursor and variables declaration
25 --
26 g_package varchar2(80) := 'ben_manage_open_enrt_wndw';
27 g_persons_processed number(9) := 0;
28 g_persons_ended number(9) := 0;
29 g_persons_passed number(9) := 0;
30 g_persons_errored number(9) := 0;
31 g_max_errors_allowed number(9) := 200;
32 g_rec ben_type.g_report_rec;
33 g_debug boolean := hr_utility.debug_enabled;
34 --
35 --
36 procedure check_business_rules
37 (p_business_group_id in number,
38 p_validate in varchar2,
39 p_new_enrt_perd_end_dt in varchar2 default null,
40 p_new_procg_end_dt in varchar2 default null,
41 p_new_dflt_enrt_dt in varchar2 default null,
42 p_no_of_days in number default null,
43 p_pgm_id in number default null,
44 p_pl_id in number default null
45 ) is
46 --
47 l_package varchar2(80) := g_package||'.check_business_rules';
48 --
49 begin
50 --
51 if g_debug then
52 hr_utility.set_location ('Entering '||l_package,10);
53 end if;
54 --
55 -- This procedure checks validity of parameters that have been passed to the
56 -- BENMNGLE process.
57 --
58 -- Check if mandatory arguments have been stipulated
59 --
60 hr_api.mandatory_arg_error(p_api_name => l_package,
61 p_argument => 'p_business_group_id',
62 p_argument_value => p_business_group_id);
63 --
64 hr_api.mandatory_arg_error(p_api_name => l_package,
65 p_argument => 'p_validate',
66 p_argument_value => p_validate);
67 --
68 -- Business Rule Checks
69 --
70 -- New Dates and no_of_days can not be both be populated
71 --
72 if (p_new_enrt_perd_end_dt is not null or p_new_procg_end_dt is not null or
73 p_new_dflt_enrt_dt is not null) and p_no_of_days is not null then
74 --
75 fnd_message.set_name('BEN','BEN_94640_NEW_DATE_OR_DAY');
76 fnd_message.raise_error;
77 --
78 end if;
79 --
80 -- Either of New Dates and no_of_days should be specified
81 --
82 if (p_new_enrt_perd_end_dt is null and p_new_procg_end_dt is null and
83 p_new_dflt_enrt_dt is null) and p_no_of_days is null then
84 --
85 fnd_message.set_name('BEN','BEN_94640_NEW_DATE_OR_DAY');
86 fnd_message.raise_error;
87 --
88 end if;
89 --
90 -- Both PGM and PL ID can't be set at the same time
91 --
92 if (p_pl_id is not null and p_pgm_id is not null) then
93 --
94 fnd_message.set_name('BEN','BEN_94641_PL_OR_PGM');
95 fnd_message.raise_error;
96 --
97 end if;
98 --
99 If (p_new_enrt_perd_end_dt is not null and p_new_procg_end_dt is not null
100 and p_new_enrt_perd_end_dt > p_new_procg_end_dt) then
101 --
102 fnd_message.set_name('BEN','BEN_94014_PROC_END_ENRT_END');
103 fnd_message.raise_error;
104 --
105 End If;
106 --
107 if g_debug then
108 hr_utility.set_location ('Leaving '||l_package,10);
109 end if;
110 --
111 exception
112 --
113 when others then
114 --
115 hr_utility.set_location('Error || sqlerrm',10);
116 ben_batch_utils.write('Error is : '||benutils.get_message_name||' - '||fnd_message.get);
117 fnd_message.raise_error;
118 --
119 end check_business_rules;
120 --
121 procedure print_parameters
122 (p_benefit_action_id in number) is
123 --
124 l_package varchar2(80);
125 --
126 Cursor c_parameter is
127 Select *
128 From ben_benefit_actions ben
129 Where ben.benefit_action_id = p_benefit_action_id;
130 --
131 l_parm c_parameter%rowtype;
132 --
133 begin
134 --
135 if g_debug then
136 l_package := g_package||'.print_parameters';
137 hr_utility.set_location ('Entering '||l_package,10);
138 end if;
139 --
140 open c_parameter;
141 --
142 fetch c_parameter into l_parm;
143 --
144 close c_parameter;
145 --
146 fnd_file.put_line(which => fnd_file.log,
147 buff => 'Runtime Parameters');
148 fnd_file.put_line(which => fnd_file.log,
149 buff => '------------------');
150 fnd_file.put_line(which => fnd_file.log,
151 buff => 'Concurrent Request ID :'||
152 fnd_global.conc_request_id);
153 fnd_file.put_line(which => fnd_file.log,
154 buff => 'Validation Mode :'||
155 hr_general.decode_lookup('YES_NO',l_parm.validate_flag));
156 fnd_file.put_line(which => fnd_file.log,
157 buff => 'Benefit Action ID :'||
158 p_benefit_action_id);
159 fnd_file.put_line(which => fnd_file.log,
160 buff => 'Effective Date :'||
161 to_char(l_parm.process_date,'DD/MM/YYYY'));
162 -- l_parm.process_date);
163 fnd_file.put_line(which => fnd_file.log,
164 buff => 'Business Group ID :'||
165 l_parm.business_group_id);
166 fnd_file.put_line(which => fnd_file.log,
167 buff => 'Program ID :'||
168 benutils.iftrue
169 (p_expression => l_parm.pgm_id is null,
170 p_true => 'All',
171 p_false => l_parm.pgm_id));
172 fnd_file.put_line(which => fnd_file.log,
173 buff => 'Plan ID :'||
174 benutils.iftrue
175 (p_expression => l_parm.pl_id is null,
176 p_true => 'All',
177 p_false => l_parm.pl_id));
178 fnd_file.put_line(which => fnd_file.log,
179 buff => 'Person ID :'||
180 benutils.iftrue
181 (p_expression => l_parm.person_id is null,
182 p_true => 'None',
183 p_false => l_parm.person_id));
184 fnd_file.put_line(which => fnd_file.log,
185 buff => 'Person Selection Rule :'||
186 benutils.iftrue
187 (p_expression => l_parm.person_selection_rl is null,
188 p_true => 'None',
189 p_false => l_parm.person_selection_rl));
190 fnd_file.put_line(which => fnd_file.log,
191 buff => 'Ler ID :'||
192 benutils.iftrue
193 (p_expression => l_parm.ler_id is null,
194 p_true => 'None',
195 p_false => l_parm.ler_id));
196 fnd_file.put_line(which => fnd_file.log,
197 buff => 'New Enrollment End Date :'||
198 benutils.iftrue
199 (p_expression => l_parm.bft_attribute3 is null,
200 p_true => 'NONE',
201 p_false => l_parm.bft_attribute3));
202 fnd_file.put_line(which => fnd_file.log,
203 buff => 'New Processing End Date :'||
204 benutils.iftrue
205 (p_expression => l_parm.bft_attribute4 is null,
206 p_true => 'NONE',
207 p_false => l_parm.bft_attribute4));
208 fnd_file.put_line(which => fnd_file.log,
209 buff => 'New Default Enrollment Date:'||
210 benutils.iftrue
211 (p_expression => l_parm.bft_attribute5 is null,
212 p_true => 'NONE',
213 p_false => l_parm.bft_attribute5));
214 fnd_file.put_line(which => fnd_file.log,
215 buff => 'Number of Days to Shift :'||
216 benutils.iftrue
217 (p_expression => l_parm.bft_attribute6 is null,
218 p_true => 'NONE',
219 p_false => l_parm.bft_attribute6));
220 -- added bug: 5611643
221 fnd_file.put_line(which => fnd_file.log,
222 buff => 'Life Event Occured Date :'||
223 benutils.iftrue
224 (p_expression => l_parm.bft_attribute7 is null,
225 p_true => 'NONE',
226 p_false => to_char(
227 fnd_date.canonical_to_date(l_parm.bft_attribute7),'DD/MM/YYYY')));
228 --
229
230 fnd_file.put_line(which => fnd_file.log,
231 buff => 'Organization ID :'||
232 benutils.iftrue
233 (p_expression => l_parm.organization_id is null,
234 p_true => 'All',
235 p_false => l_parm.organization_id));
236
237 fnd_file.put_line(which => fnd_file.log,
238 buff => 'Benefit Group ID :'||
239 benutils.iftrue
240 (p_expression => l_parm.benfts_grp_id is null,
241 p_true => 'All',
242 p_false => l_parm.benfts_grp_id));
243
244 fnd_file.put_line(which => fnd_file.log,
245 buff => 'Location ID :'||
246 benutils.iftrue
247 (p_expression => l_parm.location_id is null,
248 p_true => 'All',
249 p_false => l_parm.location_id));
250
251 fnd_file.put_line(which => fnd_file.log,
252 buff => 'Postal Zip Range ID :'||
253 benutils.iftrue
254 (p_expression => l_parm.pstl_zip_rng_id is null,
255 p_true => 'All',
256 p_false => l_parm.pstl_zip_rng_id));
257
258 fnd_file.put_line(which => fnd_file.log,
259 buff => 'Reporting Group ID :'||
260 benutils.iftrue
261 (p_expression => l_parm.rptg_grp_id is null,
262 p_true => 'All',
263 p_false => l_parm.rptg_grp_id));
264
265 fnd_file.put_line(which => fnd_file.log,
266 buff => 'Legal Entity ID :'||
267 benutils.iftrue
268 (p_expression => l_parm.legal_entity_id is null,
269 p_true => 'All',
270 p_false => l_parm.legal_entity_id));
271
272 fnd_file.put_line(which => fnd_file.log,
273 buff => 'Payroll ID :'||
274 benutils.iftrue
275 (p_expression => l_parm.payroll_id is null,
276 p_true => 'All',
277 p_false => l_parm.payroll_id));
278
279 fnd_file.put_line(which => fnd_file.log,
280 buff => 'Audit Log Flag :'||
281 l_parm.debug_messages_flag);
282
283 --
284 if g_debug then
285 hr_utility.set_location ('Leaving '||l_package,10);
286 end if;
287 --
288 end print_parameters;
289 --
290 -- ============================================================================
291 -- << Procedure: Do_Multithread >>
292 -- Description:
293 -- this procedure is called from 'process'. It calls the Update POPL.
294 -- ============================================================================
295 procedure do_multithread
296 (errbuf out nocopy varchar2
297 ,retcode out nocopy number
298 ,p_benefit_action_id in number
299 ,p_effective_date in varchar2
300 ,p_thread_id in number
301 ,p_validate in varchar2 default 'N'
302 ,p_business_group_id in number
303 ,p_pgm_id in number default null
304 ,p_pl_id in number default null
305 ,p_lf_evt_ocrd_dt in varchar2 default null
306 ,p_ler_id in number default null
307 ,p_new_enrt_perd_end_dt in varchar2 default null
308 ,p_new_procg_end_dt in varchar2 default null
309 ,p_new_dflt_enrt_dt in varchar2 default null
310 ,p_no_of_days in number default null
311 ,p_audit_log_flag in varchar2 default 'N') is
312 --
313 -- Local variable declaration
314 --
315 l_proc varchar2(80) := g_package||'.do_multithread';
316 l_person_id ben_person_actions.person_id%type;
317 l_person_action_id ben_person_actions.person_action_id%type;
318 l_object_version_number ben_person_actions.object_version_number%type;
319 l_ler_id ben_person_actions.ler_id%type;
320 l_range_id ben_batch_ranges.range_id%type;
321 l_record_number number := 0;
322 l_start_person_action_id number := 0;
323 l_end_person_action_id number := 0;
324 l_popl_cnt number(5):= 0;
325 l_chunk_size number(15);
326 l_threads number(15);
327 l_new_enrt_perd_end_dt date;
328 l_new_procg_end_dt date;
329 l_new_dflt_enrt_dt date;
330 l_effective_date date;
331 l_lf_evt_ocrd_dt date;
332 --
333 -- Cursors declaration
334 --
335 Cursor c_range_thread is
336 Select ran.range_id
337 ,ran.starting_person_action_id
338 ,ran.ending_person_action_id
339 From ben_batch_ranges ran
340 Where ran.range_status_cd = 'U'
341 And ran.BENEFIT_ACTION_ID = P_BENEFIT_ACTION_ID
342 And rownum < 2
343 For update of ran.range_status_cd;
344 --
345 cursor c_person_thread is
346 select ben.person_id,
347 ben.person_action_id
348 from ben_person_actions ben
349 where ben.benefit_action_id = p_benefit_action_id
350 and ben.action_status_cd not in ('P','E')
351 and ben.person_action_id
352 between l_start_person_action_id
353 and l_end_person_action_id
354 order by ben.person_action_id;
355 --
356 Cursor c_pel is-- (p_per_in_ler_id number) is
357 select ppf.full_name, pil.per_in_ler_id,
358 pil.person_id,
359 pil.per_in_ler_stat_cd,
360 pil.lf_evt_ocrd_dt,
361 ler.typ_cd,
362 ler.ler_id,
363 ler.name,
364 pel.pil_elctbl_chc_popl_id, pel.enrt_perd_strt_dt,
365 pel.enrt_perd_end_dt, pel.procg_end_dt, pel.dflt_enrt_dt,
366 pel.object_version_number
367 from ben_per_in_ler pil,
368 ben_ler_f ler,
369 ben_pil_elctbl_chc_popl pel,
370 per_all_people_f ppf
371 where pil.person_id = l_person_id
372 and pil.lf_evt_ocrd_dt = nvl(l_lf_evt_ocrd_dt,pil.lf_evt_ocrd_dt)
373 and pil.business_group_id+0 = p_business_group_id
374 and pil.ler_id = nvl(p_ler_id,pil.ler_id)
375 and pil.per_in_ler_stat_cd = 'STRTD'
376 and ler.typ_cd not in ('SCHEDDU','GSP','ABS','COMP')
377 and ler.ler_id = pil.ler_id
378 and nvl(l_effective_date,trunc(sysdate))
379 between ler.effective_start_date
380 and ler.effective_end_date
381 and pel.per_in_ler_id = pil.per_in_ler_id
382 and ((p_pl_id is null and pgm_id = nvl(p_pgm_id, pgm_id)) or
383 (p_pgm_id is null and pl_id = nvl(p_pl_id, pl_id)))
384 and pel.business_group_id = p_business_group_id
385 and ppf.person_id = pil.person_id
386 and nvl(l_effective_date,trunc(sysdate))
387 between ppf.effective_start_date
388 and ppf.effective_end_date
389 order by pel.pil_elctbl_chc_popl_id;
390 --
391 l_pel c_pel%rowtype;
392 --
393 l_commit number;
394 --
395 Begin
396 --
397 g_debug := hr_utility.debug_enabled;
398 if g_debug then
399 hr_utility.set_location ('Entering '||l_proc,10);
400 hr_utility.set_location ('p_benefit_action_id is :'||p_benefit_action_id,10);
401 hr_utility.set_location ('p_effective_date is :'||p_effective_date,10);
402 hr_utility.set_location ('p_thread_id is :'||p_thread_id,10);
403 hr_utility.set_location ('p_pgm_id is :'||p_pgm_id,10);
404 hr_utility.set_location ('p_pl_id is :'||p_pl_id,10);
405 end if;
406 --
407 l_effective_date:=trunc(fnd_date.canonical_to_date(p_effective_date));
408 l_lf_evt_ocrd_dt:=trunc(fnd_date.canonical_to_date(p_lf_evt_ocrd_dt));
409 --
410 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
411 fnd_message.set_token('PROC','dt_fndate.change_ses_date');
412 dt_fndate.change_ses_date
413 (p_ses_date => l_effective_date,
414 p_commit => l_commit);
415 --
416 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
417 fnd_message.set_token('PROC','benutils.get_parameter');
418 benutils.get_parameter(p_business_group_id => p_business_group_id
419 -- bug: 5611643
420 -- ,p_batch_exe_cd => 'BENMNOEM'
421 ,p_batch_exe_cd => 'BENMNOEW'
422 ,p_threads => l_threads
423 ,p_chunk_size => l_chunk_size
424 ,p_max_errors => g_max_errors_allowed);
425 --
426 fnd_message.set_name('BEN','BEN_91333_CALLING_PROC');
427 fnd_message.set_token('PROC','ben_env_object.init');
428 ben_env_object.init(p_business_group_id => p_business_group_id,
429 p_effective_date => l_effective_date,
430 p_thread_id => p_thread_id,
431 p_chunk_size => l_chunk_size,
432 p_threads => l_threads,
433 p_max_errors => g_max_errors_allowed,
434 p_benefit_action_id => p_benefit_action_id);
435 --
436 -- Copy benefit action id to global in benutils package
437 --
438 benutils.g_benefit_action_id := p_benefit_action_id;
439 benutils.g_thread_id := p_thread_id;
440 g_persons_errored := 0;
441 g_persons_processed := 0;
442 --
443 print_parameters
444 (p_benefit_action_id => p_benefit_action_id);
445 --
446 if p_audit_log_flag = 'Y' then
447 -- ben_batch_utils.write(rpad('-',140,'-'));
448 ben_batch_utils.write(rpad('-',150,'-'));
449 ben_batch_utils.write('| EMP NAME | '||'Status | '||'POPL ID | '||
450 'Old Enrt Perd | '||'New Enrt Perd | '||
451 'Old Processing | '||'New Processing | '||
452 'Old Dflt | '||'New Dflt |');
453 ben_batch_utils.write('| '||rpad(' ',30)||'| '||rpad(' ',13)||'| '||rpad(' ',10)||'| '||
454 rpad('End Date',14)||'| '||rpad('End Date',14)||'| '||
455 rpad('End Date',15)||'| '||rpad('End Date',15)||'| '||
456 rpad('End Date',10)||'| '||rpad('End Date',10)||'|');
457 -- ben_batch_utils.write(rpad('-',140,'-'));
458 ben_batch_utils.write(rpad('-',150,'-'));
459 end if;
460 --
461 -- While loop to only try and fetch records while they exist
462 -- we always try and fetch the size of the chunk, if we get less
463 -- then we know that the process is finished so we end the while loop.
464 -- The process is as follows :
465 -- 1) Lock the rows that are not processed
466 -- 2) Grab as many rows as we can upto the chunk size
467 -- 3) Put each row into the person cache.
468 -- 4) Process the person cache
469 -- 5) Go to number 1 again.
470 --
471 hr_utility.set_location('getting range',10);
472 --
473 Loop
474 --
475 open c_range_thread;
476 --
477 fetch c_range_thread into l_range_id
478 ,l_start_person_action_id
479 ,l_end_person_action_id;
480 hr_utility.set_location('doing range fetch',10);
481 --
482 if c_range_thread%notfound then
483 --
484 hr_utility.set_location('range not Found',10);
485 --
486 exit;
487 --
488 end if;
489 --
490 hr_utility.set_location('range Found',10);
491 --
492 close c_range_thread;
493 --
494 update ben_batch_ranges ran
495 set ran.range_status_cd = 'P'
496 where ran.range_id = l_range_id;
497 --
498 commit;
499 --
500 -- Get person who are in the range
501 --
502 open c_person_thread;
503 --
504 loop
505 --
506 fetch c_person_thread into l_person_id,
507 l_person_action_id;
508 hr_utility.set_location('person id'||l_person_id,10);
509 --
510 exit when c_person_thread%notfound;
511 --
512 savepoint last_place;
513 benutils.set_cache_record_position;
514 --
515 begin
516 --
517 open c_pel;
518 loop
519 fetch c_pel into l_pel;
520 exit when c_pel%NOTFOUND;
521 --
522 hr_utility.set_location('per_in_ler_id '||l_pel.per_in_ler_id,10);
523 hr_utility.set_location('typ_cd '||l_pel.typ_cd,10);
524 if (p_no_of_days is not null) then
525 hr_utility.set_location('In IF part...',10);
526 hr_utility.set_location('Adding no of days to all dates...',10);
527 l_new_enrt_perd_end_dt := l_pel.enrt_perd_end_dt + p_no_of_days;
528 l_new_procg_end_dt := l_pel.procg_end_dt + p_no_of_days;
529 l_new_dflt_enrt_dt := l_pel.dflt_enrt_dt + p_no_of_days;
530 else
531 hr_utility.set_location('In ELSE part...',10);
532 l_new_enrt_perd_end_dt := l_pel.enrt_perd_end_dt;
533 l_new_procg_end_dt := l_pel.procg_end_dt;
534 l_new_dflt_enrt_dt := l_pel.dflt_enrt_dt;
535 --
536 if p_new_enrt_perd_end_dt is not null then
537 hr_utility.set_location('Replacing enrt end date...',10);
538 l_new_enrt_perd_end_dt := trunc(fnd_date.canonical_to_date(p_new_enrt_perd_end_dt));
539 end if;
540 if p_new_procg_end_dt is not null then
541 hr_utility.set_location('Replacing procg end date...',10);
542 l_new_procg_end_dt := trunc(fnd_date.canonical_to_date(p_new_procg_end_dt));
543 end if;
544 if p_new_dflt_enrt_dt is not null then
545 hr_utility.set_location('Replacing dflt enrt date...',10);
546 l_new_dflt_enrt_dt := trunc(fnd_date.canonical_to_date(p_new_dflt_enrt_dt));
547 end if;
548 --
549 end if;
550 --
551 if g_debug then
552 hr_utility.set_location('New ...enrt_perd_end_dt'||l_new_enrt_perd_end_dt,10);
553 hr_utility.set_location('New ...procg_end_dt'||l_new_procg_end_dt,10);
554 hr_utility.set_location('New ...dflt_enrt_dt'||l_new_dflt_enrt_dt,10);
555 end if;
556 /* Now updating the POPL record */
557 hr_utility.set_location('Updating POPL record : '||l_pel.pil_elctbl_chc_popl_id,10);
558 BEN_pil_elctbl_chc_popl_API.update_pil_elctbl_chc_popl
559 (p_validate => FALSE
560 ,p_PIL_ELCTBL_CHC_POPL_ID => l_pel.pil_elctbl_chc_popl_id
561 ,p_DFLT_ENRT_DT => l_new_dflt_enrt_dt
562 ,p_ENRT_PERD_END_DT => l_new_enrt_perd_end_dt
563 ,p_PROCG_END_DT => l_new_procg_end_dt
564 ,p_OBJECT_VERSION_NUMBER => l_pel.object_version_number
565 ,p_effective_date => l_effective_date
566 );
567 hr_utility.set_location('Updation done'||l_pel.pil_elctbl_chc_popl_id,10);
568 --
569 if p_audit_log_flag = 'Y' then
570 ben_batch_utils.write('| '||rpad(l_pel.full_name,30)||'| '||'SUCCESS | '||
571 rpad(l_pel.pil_elctbl_chc_popl_id,10)||'| '||
572 rpad(l_pel.enrt_perd_end_dt,14)||'| '||rpad(l_new_enrt_perd_end_dt,14)||'| '||
573 rpad(l_pel.procg_end_dt,15)||'| '||rpad(l_new_procg_end_dt,15)||'| '||
574 rpad(l_pel.dflt_enrt_dt,10)||'| '||rpad(l_new_dflt_enrt_dt,10)||'|');
575 end if;
576 l_popl_cnt := l_popl_cnt + 1;
577 --
578 end loop;
579 --
580 close c_pel;
581 if l_popl_cnt = 0 then
582 if p_audit_log_flag = 'Y' then
583 ben_batch_utils.write('| '||rpad(l_pel.full_name,30)||'| '||'UNSUCCESSFUL | No record found for the given set of conditions.');
584 end if;
585 hr_utility.set_location('No POPL record found for '||l_pel.full_name ||' for the given set of conditions.',10);
586 end if;
587 l_popl_cnt := 0;
588 --
589 -- If we get here it was successful.
590 --
591 update ben_person_actions
592 set action_status_cd = 'P'
593 where person_id = l_person_id
594 and benefit_action_id = p_benefit_action_id;
595 --
596 g_persons_processed := g_persons_processed + 1;
597 --
598 exception
599 --
600 when others then
601 --
602 hr_utility.set_location('Super Error exception level',10);
603 hr_utility.set_location(sqlerrm,10);
604 --
605 if c_pel%isopen then
606
607 close c_pel;
608 --
609 end if;
610 --
611 rollback to last_place;
612 benutils.rollback_cache;
613 --
614 update ben_person_actions
615 set action_status_cd = 'E'
616 where person_id = l_person_id
617 and benefit_action_id = p_benefit_action_id;
618 --
619 commit;
620 --
621 g_persons_errored := g_persons_errored + 1;
622 --
623 hr_utility.set_location('Error Message '||g_rec.text,10);
624 if p_audit_log_flag = 'Y' then
625 -- changed bug: 5611643
626 /*
627 ben_batch_utils.write('| '||rpad(l_pel.full_name,18)||'| '||'UNSUCCESSFUL | Error is - '||
628 benutils.get_message_name||' - '||substr(fnd_message.get,1,80));
629 */
630 DECLARE
631 l_message_text VARCHAR2 (2100);
632 l_message_length NUMBER := 148; -- := 136;
633 BEGIN
634 l_message_text :=
635 '| '
636 || RPAD (l_pel.full_name, 30)
637 || '| '
638 || 'UNSUCCESSFUL | Error is - '
639 || benutils.get_message_name
640 || ' - '
641 || fnd_message.get;
642 ben_batch_utils.WRITE (SUBSTR (l_message_text, 1, l_message_length) || ' |');
643
644 LOOP
645 IF LENGTH (l_message_text) > l_message_length
646 THEN
647 l_message_text :=
648 RPAD ('| ', 47)
649 || '|'
650 || SUBSTR (l_message_text, l_message_length + 1);
651 ben_batch_utils.WRITE ( SUBSTR (l_message_text, 1,
652 l_message_length));
653 ELSE
654 EXIT;
655 END IF;
656 END LOOP;
657 END;
658
659 end if;
660 --
661 hr_utility.set_location('Max Errors = '||g_max_errors_allowed,10);
662 hr_utility.set_location('Num Errors = '||g_persons_errored,10);
663 -- if g_persons_errored > g_max_errors_allowed then
664 if g_persons_errored >= g_max_errors_allowed then
665 --
666 fnd_message.set_name('BEN','BEN_94642_BENMNOEW_ERROR_LIMIT');
667 ben_batch_utils.write(p_text => fnd_message.get);
668 --
669 raise;
670 --
671 end if;
672 --
673 end;
674 --
675 end loop;
676 --
677 hr_utility.set_location('Closing c_person_thread',10);
678 --
679 close c_person_thread;
680 --
681 -- Commit chunk
682 --
683 if p_validate = 'Y' then
684 --
685 hr_utility.set_location('Rolling back transaction ',10);
686 --
687 rollback;
688 --
689 end if;
690 --
691 hr_utility.set_location('Commiting transaction ',10);
692 --
693 commit;
694 --
695 end loop;
696 --
697 if p_audit_log_flag = 'Y' then
698 ben_batch_utils.write(rpad('-',140,'-'));
699 end if;
700 ben_batch_utils.write_logfile(p_num_pers_processed => g_persons_processed
701 ,p_num_pers_errored => g_persons_errored);
702 --
703 commit;
704 --
705 hr_utility.set_location ('Leaving '||l_proc,70);
706 --
707 Exception
708 --
709 When others then
710 --
711 hr_utility.set_location('Super Error',10);
712 hr_utility.set_location(sqlerrm,10);
713 hr_utility.set_location('Super Error',10);
714 rollback;
715 benutils.rollback_cache;
716 --
717 g_rec.ler_id := p_ler_id;
718 g_rec.rep_typ_cd := 'FATAL';
719 g_rec.text := fnd_message.get;
720 g_rec.person_id := l_person_id;
721 --
722 benutils.write(p_text => g_rec.text);
723 benutils.write(p_rec => g_rec);
724 --
725 ben_batch_utils.write_logfile(p_num_pers_processed => g_persons_processed
726 ,p_num_pers_errored => g_persons_errored);
727 commit;
728 --
729 fnd_message.raise_error;
730 --
731 End do_multithread;
732 -- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
733 -- << Procedure: Restart >>
734 -- *****************************************************************
735 --
736 procedure restart (errbuf out nocopy varchar2
737 ,retcode out nocopy number
738 ,p_benefit_action_id in number) is
739 --
740 -- Cursor Declaration
741 --
742 cursor c_parameters is
743 Select process_date
744 ,mode_cd
745 ,validate_flag
746 ,person_id
747 ,business_group_id
748 ,person_selection_rl
749 ,ler_id
750 ,organization_id
751 ,location_id
752 ,benfts_grp_id
753
754 ,pgm_id
755 ,pl_id
756 ,pstl_zip_rng_id
757 ,rptg_grp_id
758 ,legal_entity_id
759 ,payroll_id
760 ,debug_messages_flag
761 ,object_version_number
762 ,request_id
763 ,program_application_id
764 ,program_id
765 ,program_update_date
766 ,bft_attribute3
767 ,bft_attribute4
768 ,bft_attribute5
769 ,bft_attribute6
770 ,bft_attribute7
771 From ben_benefit_actions ben
772 Where ben.benefit_action_id = p_benefit_action_id;
773 --
774 -- Local Variable declaration.
775 --
776 l_proc varchar2(80) := g_package||'.restart';
777 l_parameters c_parameters%rowtype;
778 l_errbuf varchar2(80);
779 l_retcode number;
780 --
781 Begin
782 --
783 hr_utility.set_location ('Entering '||l_proc,10);
784 --
785 -- get the parameters for a previous run and do a restart
786 --
787 open c_parameters;
788 --
789 fetch c_parameters into l_parameters;
790 If c_parameters%notfound then
791 --
792 fnd_message.set_name('BEN','BEN_91710_RESTRT_PARMS_NOT_FND');
793 fnd_message.raise_error;
794 --
795 End if;
796 --
797 close c_parameters;
798 --
799 -- Call process procedure with parameters for restart
800 --
801 /* process(errbuf => l_errbuf
802 ,retcode => l_retcode
803 ,p_benefit_action_id => p_benefit_action_id
804 ,p_effective_date => fnd_date.date_to_canonical
805 (l_parameters.process_date)
806 ,p_validate => l_parameters.validate_flag
807 ,p_business_group_id => l_parameters.business_group_id
808 ,p_ler_id => l_parameters.ler_id
809 ,p_from_ocrd_date => fnd_date.date_to_canonical
810 (l_parameters.date_from)
811 ,p_to_ocrd_date => fnd_date.date_to_canonical
812 (l_parameters.uneai_effective_date)
813 ,p_organization_id => l_parameters.organization_id
814 ,p_location_id => l_parameters.location_id
815 ,p_benfts_grp_id => l_parameters.benfts_grp_id
816 ,p_legal_entity_id => l_parameters.legal_entity_id
817 ,p_person_selection_rule_id => l_parameters.person_selection_rl
818 ,p_debug_messages => l_parameters.debug_messages_flag);
819 */
820 --
821 hr_utility.set_location ('Leaving '||l_proc,70);
822 --
823 end restart;
824 --
825 -- *************************************************************************
826 -- * << Procedure: Process >>
827 -- *************************************************************************
828 -- This is what is called from the concurrent manager screen
829 --
830 procedure process(errbuf out nocopy varchar2
831 ,retcode out nocopy number
832 ,p_benefit_action_id in number
833 ,p_effective_date in varchar2
834 ,p_validate in varchar2 default 'N'
835 ,p_person_id in number default null
836 ,p_person_selection_rule_id in number default null
837 ,p_business_group_id in number
838 ,p_pgm_id in number default null
839 ,p_pl_id in number default null
840 ,p_lf_evt_ocrd_dt in varchar2 default null
841 ,p_ler_id in number default null
842 ,p_new_enrt_perd_end_dt in varchar2 default null
843 ,p_new_procg_end_dt in varchar2 default null
844 ,p_new_dflt_enrt_dt in varchar2 default null
845 ,p_no_of_days in number default null
846 ,p_organization_id in number default null
847 ,p_benfts_grp_id in number default null
848 ,p_location_id in number default null
849 ,p_pstl_zip_rng_id in number default null
850 ,p_rptg_grp_id in number default null
851 ,p_legal_entity_id in number default null
852 ,p_payroll_id in number default null
853 ,p_audit_log_flag in varchar2 default 'N') is
854 --
855 l_effective_date date;
856 l_lf_evt_ocrd_dt date;
857 l_to_ocrd_date date;
858 l_no_one_to_process exception;
859 l_bckt_stat varchar2(20);
860 --
861 -- Cursors declaration.
862 --
863 cursor c_person is
864 select ppf.person_id
865 from per_all_people_f ppf
866 where ppf.person_id = nvl(p_person_id, ppf.person_id)
867 and ppf.business_group_id = p_business_group_id
868 and l_effective_date
869 between ppf.effective_start_date
870 and ppf.effective_end_date
871 and exists (select null
872 from ben_per_in_ler pil
873 , ben_ler_f ler
874 where pil.lf_evt_ocrd_dt = nvl(l_lf_evt_ocrd_dt, pil.lf_evt_ocrd_dt)
875 and pil.ler_id = ler.ler_id
876 and l_effective_date between ler.effective_start_date
877 and ler.effective_end_date
878 and ler.business_group_id = p_business_group_id
879 and ler.typ_cd not in ('SCHEDDU','GSP','ABS','COMP')
880 and pil.ler_id = nvl(p_ler_id, pil.ler_id)
881 and pil.per_in_ler_stat_cd = 'STRTD'
882 and pil.business_group_id = p_business_group_id
883 and pil.person_id = ppf.person_id
884 and pil.business_group_id = ppf.business_group_id
885 and exists (select pil_elctbl_chc_popl_id
886 from ben_pil_elctbl_chc_popl
887 where per_in_ler_id = pil.per_in_ler_id
888 and ((p_pl_id is null and pgm_id = nvl(p_pgm_id, pgm_id)) or
889 (p_pgm_id is null and pl_id = nvl(p_pl_id, pl_id)))))
890 and (p_organization_id is null
891 or exists (select null
892 from per_all_assignments_f paa
893 where paa.person_id = ppf.person_id
894 and l_effective_date
895 between paa.effective_start_date
896 and paa.effective_end_date
897 and paa.business_group_id = ppf.business_group_id
898 and paa.primary_flag = 'Y'
899 and paa.organization_id = p_organization_id))
900 and (p_location_id is null
901 or exists (select null
902 from per_all_assignments_f paa
903 where paa.person_id = ppf.person_id
904 and l_effective_date
905 between paa.effective_start_date
906 and paa.effective_end_date
907 and paa.business_group_id = ppf.business_group_id
908 and paa.primary_flag = 'Y'
909 and paa.location_id = p_location_id))
910 and (p_benfts_grp_id is null
911 or exists (select null
912 from per_all_people_f pap
913 where pap.person_id = ppf.person_id
914 and pap.business_group_id = ppf.business_group_id
915 and l_effective_date
916 between pap.effective_start_date
917 and pap.effective_end_date
918 and pap.benefit_group_id = p_benfts_grp_id))
919 and (p_legal_entity_id is null
920 or exists (select null
921 from per_assignments_f paf,
922 hr_soft_coding_keyflex soft
923 where paf.person_id = ppf.person_id
924 and paf.assignment_type <> 'C'
925 and l_effective_date
926 between paf.effective_start_date
927 and paf.effective_end_date
928 and paf.business_group_id = ppf.business_group_id
929 and paf.primary_flag = 'Y'
930 and soft.soft_coding_keyflex_id = paf.soft_coding_keyflex_id
931 and soft.segment1 = to_char(p_legal_entity_id)))
932 and (p_payroll_id is null
933 or exists (select null
934 from pay_payrolls_f pay,
935 per_all_assignments_f paf
936 where paf.person_id = ppf.person_id
937 and paf.assignment_type <> 'C'
938 and paf.primary_flag = 'Y'
939 and paf.business_group_id = ppf.business_group_id
940 and l_effective_date
941 between paf.effective_start_date
942 and paf.effective_end_date
943 and pay.payroll_id = p_payroll_id
944 and pay.payroll_id = paf.payroll_id
945 and l_effective_date
946 between pay.effective_start_date
947 and pay.effective_end_date))
948 and (p_pstl_zip_rng_id is null
949 or exists (select null
950 from per_addresses pad,
951 ben_pstl_zip_rng_f rzr
952 where pad.person_id = ppf.person_id
953 and pad.primary_flag = 'Y'
954 and l_effective_date
955 between nvl(pad.date_from,l_effective_date)
956 and nvl(pad.date_to,l_effective_date)
957 and rzr.pstl_zip_rng_id = p_pstl_zip_rng_id
958 and pad.postal_code
959 between rzr.from_value
960 and rzr.to_value
961 and l_effective_date
962 between rzr.effective_start_date
963 and rzr.effective_end_date));
964 --
965 -- local variable declaration.
966 --
967 l_request_id number;
968 l_proc varchar2(80) := g_package||'.process';
969 l_benefit_action_id ben_benefit_actions.benefit_action_id%type;
970 l_object_version_number ben_benefit_actions.object_version_number%type;
971 l_person_id per_people_f.person_id%type;
972 l_person_action_id ben_person_actions.person_action_id%type;
973 l_ler_id ben_ler_f.ler_id%type;
974 l_range_id ben_batch_ranges.range_id%type;
975 l_chunk_size number := 20;
976 l_threads number := 1;
977 l_start_person_action_id number := 0;
978 l_end_person_action_id number := 0;
979 l_prev_person_id number := 0;
980 rl_ret char(1);
981 skip boolean;
982 l_person_cnt number := 0;
983 l_cnt number := 0;
984 l_num_range number := 0;
985 l_chunk_num number := 1;
986 l_num_row number := 0;
987 l_commit number;
988 --
989 l_person_ok varchar2(1) := 'Y';
990 l_err_message varchar2(2000);
991 Begin
992 --
993 g_debug := hr_utility.debug_enabled;
994 if g_debug then
995 hr_utility.set_location ('Entering '||l_proc,10);
996 hr_utility.set_location ('p_validate : '||p_validate,5);
997 end if;
998 --
999 -- Check that business rules that apply to this conc request are being adhered to.
1000 --
1001 check_business_rules
1002 (p_business_group_id => p_business_group_id,
1003 p_validate => p_validate,
1004 p_new_enrt_perd_end_dt => p_new_enrt_perd_end_dt,
1005 p_new_procg_end_dt => p_new_procg_end_dt,
1006 p_new_dflt_enrt_dt => p_new_dflt_enrt_dt,
1007 p_no_of_days => p_no_of_days,
1008 p_pgm_id => p_pgm_id,
1009 p_pl_id => p_pl_id
1010 );
1011 --
1012 l_effective_date:=trunc(fnd_date.canonical_to_date(p_effective_date));
1013 l_lf_evt_ocrd_dt:=trunc(fnd_date.canonical_to_date(p_lf_evt_ocrd_dt));
1014 --
1015 -- Put row in fnd_sessions
1016 --
1017 dt_fndate.change_ses_date
1018 (p_ses_date => nvl(l_lf_evt_ocrd_dt,l_effective_date),
1019 p_commit => l_commit);
1020 --
1021 -- Get chunk_size and Thread values for multi-thread process.
1022 --
1023 ben_batch_utils.ini;
1024 ben_batch_utils.ini(p_actn_cd => 'PROC_INFO');
1025 --
1026 benutils.get_parameter(p_business_group_id => p_business_group_id
1027 -- bug 5611643
1028 -- ,p_batch_exe_cd => 'BENMNGLE'
1029 ,p_batch_exe_cd => 'BENMNOEW'
1030 ,p_threads => l_threads
1031 ,p_chunk_size => l_chunk_size
1032 ,p_max_errors => g_max_errors_allowed);
1033 if g_debug then
1034 hr_utility.set_location (l_proc||' Done get pm ',30);
1035 hr_utility.set_location('Num Threads = '||l_threads,10);
1036 hr_utility.set_location('Chunk Size = '||l_chunk_size,10);
1037 hr_utility.set_location('Max Errors = '||g_max_errors_allowed,10);
1038 end if;
1039 --
1040 --
1041 -- Create benefit actions parameters in the benefit action table.
1042 -- Do not create if a benefit action already exists, in other words
1043 -- we are doing a restart.
1044 --
1045 if p_benefit_action_id is null then
1046 --
1047 if g_debug then
1048 hr_utility.set_location (l_proc||' Create BFT ',30);
1049 end if;
1050 --
1051 ben_benefit_actions_api.create_benefit_actions
1052 (p_validate => false
1053 ,p_benefit_action_id => l_benefit_action_id
1054 ,p_process_date => l_effective_date
1055 ,p_mode_cd => 'S'
1056 ,p_derivable_factors_flag => 'N'
1057 ,p_validate_flag => p_validate
1058 ,p_person_id => p_person_id
1059 ,p_pgm_id => p_pgm_id
1060 ,p_business_group_id => p_business_group_id
1061 ,p_pl_id => p_pl_id
1062 ,p_person_selection_rl => p_person_selection_rule_id
1063 ,p_ler_id => p_ler_id
1064 ,p_organization_id => p_organization_id
1065 ,p_benfts_grp_id => p_benfts_grp_id
1066 ,p_location_id => p_location_id
1067 ,p_pstl_zip_rng_id => p_pstl_zip_rng_id
1068 ,p_rptg_grp_id => p_rptg_grp_id
1069 ,p_legal_entity_id => p_legal_entity_id
1070 ,p_payroll_id => p_payroll_id
1071 ,p_debug_messages_flag => p_audit_log_flag
1072 ,p_no_programs_flag => 'N'
1073 ,p_no_plans_flag => 'N'
1074 ,p_object_version_number => l_object_version_number
1075 ,p_effective_date => l_effective_date
1076 ,p_request_id => fnd_global.conc_request_id
1077 ,p_program_application_id => fnd_global.prog_appl_id
1078 ,p_program_id => fnd_global.conc_program_id
1079 ,p_program_update_date => sysdate
1080 ,p_bft_attribute3 => p_new_enrt_perd_end_dt
1081 ,p_bft_attribute4 => p_new_procg_end_dt
1082 ,p_bft_attribute5 => p_new_dflt_enrt_dt
1083 ,p_bft_attribute6 => p_no_of_days
1084 -- added bug 5611643
1085 ,p_bft_attribute7 => p_lf_evt_ocrd_dt
1086 );
1087 --
1088 benutils.g_benefit_action_id := l_benefit_action_id;
1089 --
1090 if g_debug then
1091 hr_utility.set_location (' l_benefit_action_id : '||l_benefit_action_id,20);
1092 hr_utility.set_location (l_proc||' Dn Create BFT ',20);
1093 end if;
1094 --
1095 -- Delete/clear ranges from ben_batch_ranges table
1096 --
1097 Delete from ben_batch_ranges
1098 Where benefit_action_id = l_benefit_action_id;
1099 --
1100 -- Now lets create person actions for all the people we are going to process
1101 --
1102 open c_person;
1103 --
1104 l_person_cnt := 0;
1105 l_cnt := 0;
1106 --
1107 loop
1108 --
1109 fetch c_person into l_person_id;
1110 exit when c_person%notfound;
1111 --
1112 l_cnt := l_cnt + 1;
1113 --
1114 l_person_ok := 'Y';
1115 --
1116 If p_person_selection_rule_id is not NULL then
1117 --
1118 ben_batch_utils.person_selection_rule
1119 (p_person_id => l_person_id
1120 ,p_business_group_id => p_business_group_id
1121 ,p_person_selection_rule_id=> p_person_selection_rule_id
1122 ,p_effective_date => l_effective_date
1123 ,p_return => l_person_ok
1124 ,p_err_message => l_err_message );
1125
1126 if l_err_message is not null then
1127 Ben_batch_utils.write(p_text =>
1128 '<< Person id : '||to_char(l_person_id)||' failed.'||
1129 ' Reason : '|| l_err_message ||' >>' );
1130 l_err_message := NULL ;
1131 end if ;
1132 --
1133 End if;
1134 --
1135 -- Store person_id into person actions table.
1136 --
1137 If l_person_ok = 'Y' then
1138 --
1139 Ben_person_actions_api.create_person_actions
1140 (p_validate => false
1141 ,p_person_action_id => l_person_action_id
1142 ,p_person_id => l_person_id
1143 ,p_ler_id => l_ler_id
1144 ,p_benefit_action_id => l_benefit_action_id
1145 ,p_action_status_cd => 'U'
1146 ,p_chunk_number => l_chunk_num
1147 ,p_object_version_number => l_object_version_number
1148 ,p_effective_date => l_effective_date);
1149 --
1150 l_num_row := l_num_row + 1;
1151 l_person_cnt := l_person_cnt + 1;
1152 l_end_person_action_id := l_person_action_id;
1153 --
1154 If l_num_row = 1 then
1155 --
1156 l_start_person_action_id := l_person_action_id;
1157 --
1158 End if;
1159 --
1160 If l_num_row = l_chunk_size then
1161 --
1162 -- Create a range of data to be multithreaded.
1163 --
1164 Ben_batch_ranges_api.create_batch_ranges
1165 (p_validate => false
1166 ,p_benefit_action_id => l_benefit_action_id
1167 ,p_range_id => l_range_id
1168 ,p_range_status_cd => 'U'
1169 ,p_starting_person_action_id => l_start_person_action_id
1170 ,p_ending_person_action_id => l_end_person_action_id
1171 ,p_object_version_number => l_object_version_number
1172 ,p_effective_date => l_effective_date);
1173 --
1174 l_start_person_action_id := 0;
1175 l_end_person_action_id := 0;
1176 l_num_row := 0;
1177 l_num_range := l_num_range + 1;
1178 --
1179 End if;
1180 --
1181 End if;
1182 --
1183 End loop;
1184 --
1185 close c_person;
1186 --
1187 hr_utility.set_location('l_num_row='||to_char(l_num_row),18);
1188 --
1189 If l_num_row <> 0 then
1190 --
1191 Ben_batch_ranges_api.create_batch_ranges
1192 (p_validate => false
1193 ,p_benefit_action_id => l_benefit_action_id
1194 ,p_range_id => l_range_id
1195 ,p_range_status_cd => 'U'
1196 ,p_starting_person_action_id => l_start_person_action_id
1197 ,p_ending_person_action_id => l_end_person_action_id
1198 ,p_object_version_number => l_object_version_number
1199 ,p_effective_date => l_effective_date);
1200 --
1201 l_num_range := l_num_range + 1;
1202 --
1203 End if;
1204 --
1205 Else
1206 --
1207 l_benefit_action_id := p_benefit_action_id;
1208 --
1209 Ben_batch_utils.create_restart_person_actions
1210 (p_benefit_action_id => p_benefit_action_id
1211 ,p_effective_date => l_effective_date
1212 ,p_chunk_size => l_chunk_size
1213 ,p_threads => l_threads
1214 ,p_num_ranges => l_num_range
1215 ,p_num_persons => l_person_cnt);
1216 --
1217 End if;
1218 --
1219 If l_num_range > 1 then
1220 --
1221 For l_count in 1..least(l_threads,l_num_range)-1 loop
1222 --
1223 l_request_id := fnd_request.submit_request
1224 (application => 'BEN'
1225 ,program => 'BENMNOEM'
1226 ,description => NULL
1227 ,sub_request => FALSE
1228 ,argument1 => l_benefit_action_id
1229 ,argument2 => p_effective_date
1230 ,argument3 => l_count
1231 ,argument4 => p_validate
1232 ,argument5 => p_business_group_id
1233 ,argument6 => p_pgm_id
1234 ,argument7 => p_pl_id
1235 ,argument8 => p_lf_evt_ocrd_dt
1236 ,argument9 => p_ler_id
1237 ,argument10 => p_new_enrt_perd_end_dt
1238 ,argument11 => p_new_procg_end_dt
1239 ,argument12 => p_new_dflt_enrt_dt
1240 ,argument13 => p_no_of_days
1241 ,argument14 => p_audit_log_flag);
1242 --
1243 -- Store the request id of the concurrent request
1244 --
1245 ben_batch_utils.g_num_processes := ben_batch_utils.g_num_processes + 1;
1246 ben_batch_utils.g_processes_tbl(ben_batch_utils.g_num_processes)
1247 := l_request_id;
1248 --
1249 End loop;
1250 --
1251 commit;
1252 --
1253 Elsif (l_num_range = 0 ) then
1254 --
1255 print_parameters
1256 (p_benefit_action_id => l_benefit_action_id);
1257 --
1258 fnd_message.set_name('BEN','BEN_91769_NOONE_TO_PROCESS');
1259 fnd_message.set_token('PROC' , l_proc);
1260 raise l_no_one_to_process;
1261 --
1262 End if;
1263 --
1264 do_multithread(errbuf => errbuf
1265 ,retcode => retcode
1266 ,p_benefit_action_id => l_benefit_action_id
1267 ,p_effective_date => p_effective_date
1268 ,p_thread_id => l_threads+1
1269 ,p_validate => p_validate
1270 ,p_business_group_id => p_business_group_id
1271 ,p_pgm_id => p_pgm_id
1272 ,p_pl_id => p_pl_id
1273 ,p_lf_evt_ocrd_dt => p_lf_evt_ocrd_dt
1274 ,p_ler_id => p_ler_id
1275 ,p_new_enrt_perd_end_dt => p_new_enrt_perd_end_dt
1276 ,p_new_procg_end_dt => p_new_procg_end_dt
1277 ,p_new_dflt_enrt_dt => p_new_dflt_enrt_dt
1278 ,p_no_of_days => p_no_of_days
1279 ,p_audit_log_flag => p_audit_log_flag);
1280 --
1281 ben_batch_utils.check_all_slaves_finished(p_rpt_flag => TRUE);
1282 ben_batch_utils.end_process(p_benefit_action_id => l_benefit_action_id
1283 ,p_person_selected => l_person_cnt
1284 ,p_business_group_id => p_business_group_id);
1285 --
1286 -- need to write summary contents here
1287 --
1288 --
1289 hr_utility.set_location ('Leaving '||l_proc,70);
1290 --
1291 Exception
1292 --
1293 when l_no_one_to_process then
1294 ben_batch_utils.write(p_text => fnd_message.get);
1295 --
1296 when others then
1297 --
1298 hr_utility.set_location('Super Error',10);
1299 rollback;
1300 ben_batch_utils.write(p_text => fnd_message.get);
1301 ben_batch_utils.write(p_text => sqlerrm);
1302 --
1303 If (l_num_range > 0) then
1304 ben_batch_utils.check_all_slaves_finished(p_rpt_flag => TRUE);
1305 ben_batch_utils.end_process(p_benefit_action_id => l_benefit_action_id
1306 ,p_person_selected => l_person_cnt
1307 ,p_business_group_id => p_business_group_id
1308 ) ;
1309 End if;
1310 fnd_message.raise_error;
1311 End process;
1312 --
1313 end BEN_MANAGE_OPEN_ENRT_WNDW; -- End of Package.