[Home] [Help]
PACKAGE BODY: APPS.PAY_LOADER_UTILS_PKG
Source
1 PACKAGE BODY PAY_LOADER_UTILS_PKG AS
2 /* $Header: pyldutil.pkb 120.4 2005/10/19 04:17 pgongada noship $ */
3
4 g_package varchar2(33) := ' pay_loader_utils_pkg.';
5 --
6 g_rfm_old_rec PAY_RFM_SHD.G_REC_TYPE;
7 g_rfm_effective_end_date date := hr_api.g_eot;
8 --
9 g_rfi_old_rec PAY_RFI_SHD.G_REC_TYPE;
10 g_rfi_effective_end_date date := hr_api.g_eot;
11 --
12 g_ecu_old_rec PAY_ECU_SHD.G_REC_TYPE;
13 g_ecu_effective_end_date date := hr_api.g_eot;
14
15 g_usage_id number := -1;
16 -- ----------------------------------------------------------------------------
17 -- |-------------------------< enable_startup_mode >--------------------------|
18 -- ----------------------------------------------------------------------------
19 --
20 -- Description:
21 -- This procedure is called prior to calling an API for a startup data entity,
22 -- and is used to set the mode which is to be used for the startup data entity.
23 --
24 -- ----------------------------------------------------------------------------
25 PROCEDURE enable_startup_mode
26 ( p_business_group_id in number
27 ,p_legislation_code in varchar2 ) IS
28 --
29 l_proc varchar2(72) := g_package||'enable_startup_mode';
30 l_mode varchar2(10);
31 --
32 BEGIN
33 --
34 hr_utility.set_location('Entering:'||l_proc, 5);
35
36 if p_business_group_id is not null and p_legislation_code is null then
37 l_mode := 'USER';
38 elsif p_business_group_id is null and p_legislation_code is not null then
39 l_mode := 'STARTUP';
40 elsif p_business_group_id is null and p_legislation_code is null then
41 l_mode := 'GENERIC';
42 end if;
43
44 hr_startup_data_api_support.enable_startup_mode(l_mode);
45
46 if l_mode <> 'USER' then
47 hr_startup_data_api_support.delete_owner_definitions;
48 hr_startup_data_api_support.create_owner_definition('PAY');
49 end if;
50
51 hr_utility.set_location(' Leaving:'||l_proc, 30);
52 --
53 END enable_startup_mode;
54 --
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< init_fndload >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 --
60 -- Description:
61 -- This procedure is called prior to calling an API to initialize the
62 -- global security context for a database session.
63 -- When an API is called the context will be used by the who triggers
64 -- to derive the who columns.
65 --
66 -- ----------------------------------------------------------------------------
67 PROCEDURE init_fndload
68 ( p_owner in varchar2 ) IS
69 --
70 l_proc varchar2(72) := g_package||'init_fndload';
71 --
72 BEGIN
73 --
74 hr_utility.set_location('Entering:'||l_proc, 5);
75
76 if p_owner = 'SEED' then
77 hr_general2.init_fndload
78 (p_resp_appl_id => 801
79 ,p_user_id => 1
80 );
81 else
82 hr_general2.init_fndload
83 (p_resp_appl_id => 801
84 ,p_user_id => -1
85 );
86 end if;
87
88 hr_utility.set_location(' Leaving:'||l_proc, 30);
89 --
90 END init_fndload;
91 --
92 --
93 -- ----------------------------------------------------------------------------
94 -- |-------------------------< get_business_group_id >------------------------|
95 -- ----------------------------------------------------------------------------
96 --
97 -- Description:
98 -- This procedure derives the business group id from the business group name.
99 -- It returns null if the business group does not exist.
100 --
101 -- ----------------------------------------------------------------------------
102 FUNCTION get_business_group_id
103 ( p_business_group_name in varchar2 )
104 RETURN number IS
105 --
106 cursor csr_bg_id is
107 select business_group_id
108 from per_business_groups
109 where name = p_business_group_name;
110 --
111 l_proc varchar2(72) := g_package||'get_business_group_id';
112 l_business_group_id PER_BUSINESS_GROUPS.BUSINESS_GROUP_ID%TYPE;
113 --
114 BEGIN
115 --
116
117 hr_utility.set_location('Entering:'||l_proc, 5);
118
119 if p_business_group_name is not null then
120
121 open csr_bg_id;
122 fetch csr_bg_id into l_business_group_id;
123 close csr_bg_id;
124
125 end if;
126
127 hr_utility.set_location('Entering:'||l_proc, 5);
128
129 return l_business_group_id;
130 --
131 END get_business_group_id;
132 --
133 --
134 -- ----------------------------------------------------------------------------
135 -- |--------------------------< get_event_group_id >--------------------------|
136 -- ----------------------------------------------------------------------------
137 --
138 -- Description:
139 -- This procedure derives the event group id from the event group name.
140 -- It returns null if the event group name not exist.
141 --
142 -- ----------------------------------------------------------------------------
143 FUNCTION get_event_group_id
144 ( p_event_group_name in varchar2,
145 p_legislation_code in varchar2,
146 p_business_group_id in number)
147 RETURN number IS
148 --
149 cursor csr_evg_grp_id is
150 select event_group_id
151 from pay_event_groups evg
152 where evg.event_group_name = p_event_group_name
153 and nvl(evg.legislation_code,hr_api.g_varchar2) = nvl(p_legislation_code,hr_api.g_varchar2)
154 and nvl(evg.business_group_id,hr_api.g_number) = nvl(p_business_group_id,hr_api.g_number);
155 --
156 l_proc varchar2(72) := g_package||'get_event_group_id';
157 l_event_group_id pay_event_groups.event_group_id%type;
158 --
159 BEGIN
160 --
161
162 hr_utility.set_location('Entering:'||l_proc, 5);
163
164 if p_event_group_name is not null then
165
166 open csr_evg_grp_id;
167 fetch csr_evg_grp_id into l_event_group_id;
168 close csr_evg_grp_id;
169
170 end if;
171
172 hr_utility.set_location('Entering:'||l_proc, 5);
173
174 return l_event_group_id;
175 --
176 END get_event_group_id;
177 --
178 --
179 -- ----------------------------------------------------------------------------
180 -- |--------------------------< get_element_set_id >--------------------------|
181 -- ----------------------------------------------------------------------------
182 --
183 -- Description:
184 -- This procedure derives the element set id from the element_set_name.
185 -- It returns null if the element set name does not exist.
186 --
187 -- ----------------------------------------------------------------------------
188 FUNCTION get_element_set_id
189 ( p_element_set_name in varchar2,
190 p_legislation_code in varchar2,
191 p_business_group_id in number)
192 RETURN number IS
193 --
194 cursor csr_eset_id is
195 select element_set_id
196 from pay_element_sets els
197 where els.element_set_name = p_element_set_name
198 and nvl(els.legislation_code,hr_api.g_varchar2) = nvl(p_legislation_code,hr_api.g_varchar2)
199 and nvl(els.business_group_id,hr_api.g_number) = nvl(p_business_group_id,hr_api.g_number);
200 --
201 l_proc varchar2(72) := g_package||'get_element_set_id';
202 l_element_set_id pay_element_sets.element_set_id%type;
203 --
204 BEGIN
205 --
206
207 hr_utility.set_location('Entering:'||l_proc, 5);
208
209 if p_element_set_name is not null then
210
211 open csr_eset_id;
212 fetch csr_eset_id into l_element_set_id;
213 close csr_eset_id;
214
215 end if;
216
217 hr_utility.set_location('Entering:'||l_proc, 5);
218
219 return l_element_set_id;
220 --
221 END get_element_set_id;
222 --
223 --
224 -- ----------------------------------------------------------------------------
225 -- |----------------------------< get_user_entity_id >------------------------|
226 -- ----------------------------------------------------------------------------
227 --
228 -- Description:
229 -- This procedure derives the user entity id from its
230 -- true key - user entity name , legislation code and business group.
231 -- It returns null if the user entity does not exist.
232 -- This procedure cannot be used to get the user_entity_id of user entities
233 -- belonging to any business group.
234 --
235 -- ----------------------------------------------------------------------------
236 FUNCTION get_user_entity_id
237 ( p_user_entity_name in varchar2
238 ,p_legislation_code in varchar2 )
239 RETURN number IS
240 --
241 cursor csr_user_entity_id is
242 select user_entity_id
243 from ff_user_entities
244 where user_entity_name = p_user_entity_name
245 and nvl(legislation_code,hr_api.g_varchar2) = nvl(p_legislation_code,hr_api.g_varchar2)
246 and business_group_id is null;
247 --
248 l_proc varchar2(72) := g_package||'get_user_entity_id';
249 l_user_entity_id FF_USER_ENTITIES.USER_ENTITY_ID%TYPE;
250 --
251 BEGIN
252 --
253 hr_utility.set_location('Entering:'||l_proc, 5);
254
255 if p_user_entity_name is not null then
256 open csr_user_entity_id;
257 fetch csr_user_entity_id into l_user_entity_id;
258 close csr_user_entity_id;
259 end if;
260
261 hr_utility.set_location(' Leaving:'||l_proc, 30);
262
263 return l_user_entity_id;
264 --
265 END get_user_entity_id;
266 --
267 --
268 -- ----------------------------------------------------------------------------
269 -- |------------------------------< get_formula_id >--------------------------|
270 -- ----------------------------------------------------------------------------
271 --
272 -- Description:
273 -- This procedure derives the formula id from its true key -
274 -- formula name, formula_type, legislation code and business group.
275 -- It returns null if the formula does not exist.
276 -- This procedure cannot be used to get the formula_id of formulas
277 -- belonging to any business group.
278 --
279 -- ----------------------------------------------------------------------------
280 FUNCTION get_formula_id
281 ( p_formula_type_name in varchar2
282 ,p_formula_name in varchar2
283 ,p_legislation_code in varchar2 )
284 RETURN number IS
285 --
286 cursor csr_formula_id is
287 select distinct ff.formula_id
288 from ff_formulas_f ff
289 ,ff_formula_types ft
290 where ff.formula_name = p_formula_name
291 and nvl(ff.legislation_code,hr_api.g_varchar2) = nvl(p_legislation_code,hr_api.g_varchar2)
292 and ft.formula_type_name = p_formula_type_name
293 and ft.formula_type_id = ff.formula_type_id
294 and ff.business_group_id is null;
295 --
296 l_formula_id FF_FORMULAS_F.FORMULA_ID%TYPE;
297 l_proc varchar2(72) := g_package||'get_formula_id';
298 --
299 BEGIN
300 --
301 hr_utility.set_location('Entering:'||l_proc, 5);
302
303 if p_formula_type_name is not null and p_formula_name is not null then
304
305 open csr_formula_id;
306 fetch csr_formula_id into l_formula_id;
307
308 if csr_formula_id%ROWCOUNT > 1 then
309
310 close csr_formula_id;
311
312 fnd_message.set_name( 'PAY' , 'PAY_33255_INV_SKEY' );
313 fnd_message.set_token( 'SURROGATE_ID' , 'FORMULA_ID' );
314 fnd_message.set_token( 'ENTITY' , 'FORMULA' );
315 fnd_message.raise_error ;
316
317 end if;
318 close csr_formula_id;
319 else
320 l_formula_id := -9999;
321
322 end if;
323
324 hr_utility.set_location(' Leaving:'||l_proc, 30);
325
326 return l_formula_id;
327 --
328 END get_formula_id;
329 --
330 --
331 -- ----------------------------------------------------------------------------
332 -- |------------------------------< load_rfm_row >----------------------------|
333 -- ----------------------------------------------------------------------------
334 --
335 -- Description:
336 -- This procedure uploads a single row into pay_report_format_mappings_f
337 -- table. When the first row of a date tracked record is being uploaded
338 -- it checks if the record already exists in the table. If the record already
339 -- exists then all the rows of this record are deleted first and then the
340 -- first row is inserted. All the subsequent rows are uploaded by updating
341 -- the first row.
342 --
343 -- ----------------------------------------------------------------------------
344 PROCEDURE load_rfm_row
345 ( p_report_type in varchar2
346 ,p_report_qualifier in varchar2
347 ,p_report_category in varchar2
348 ,p_effective_start_date in date
349 ,p_effective_end_date in date
350 ,p_legislation_code in varchar2
351 ,p_business_group_name in varchar2
352 ,p_range_code in varchar2
353 ,p_assignment_action_code in varchar2
354 ,p_initialization_code in varchar2
355 ,p_archive_code in varchar2
356 ,p_magnetic_code in varchar2
357 ,p_report_format in varchar2
358 ,p_report_name in varchar2
359 ,p_sort_code in varchar2
360 ,p_updatable_flag in varchar2
361 ,p_deinitialization_code in varchar2
362 ,p_temporary_action_flag in varchar2
363 ,p_display_name in varchar2
364 ,p_owner in varchar2
365 ,p_eof in number ) IS
366 --
367 l_proc varchar2(72) := g_package||'load_rfm_row';
368 l_business_group_id PAY_REPORT_FORMAT_MAPPINGS_F.BUSINESS_GROUP_ID%TYPE;
369 l_rec PAY_RFM_SHD.G_REC_TYPE;
370 l_report_format_mapping_id PAY_REPORT_FORMAT_MAPPINGS_F.REPORT_FORMAT_MAPPING_ID%TYPE;
371 l_exists varchar2 (1);
372 --
373 cursor csr_exists is
374 select null
375 from pay_report_format_mappings_f
376 where report_type = p_report_type
377 and report_qualifier = p_report_qualifier
378 and report_category = p_report_category;
379 --
380 PROCEDURE set_end_date IS
381 --
382 cursor csr_rfi_exists is
383 select min(rfi.effective_start_date), max(rfi.effective_end_date)
384 from pay_report_format_items_f rfi
385 where rfi.report_type = g_rfm_old_rec.report_type
386 and rfi.report_qualifier = g_rfm_old_rec.report_qualifier
387 and rfi.report_category = g_rfm_old_rec.report_category;
388 --
389 cursor csr_rfi_ids (p_effective_date date) is
390 select rfi.report_format_item_id, rfi.object_version_number
391 from pay_report_format_items_f rfi
392 where rfi.report_type = g_rfm_old_rec.report_type
393 and rfi.report_qualifier = g_rfm_old_rec.report_qualifier
394 and rfi.report_category = g_rfm_old_rec.report_category
395 and p_effective_date between
396 rfi.effective_start_date and rfi.effective_end_date ;
397 --
398 l_proc varchar2(72) := g_package||'load_rfm_row.set_end_date';
399 l_effective_start_date date;
400 l_effective_end_date date;
401 l_rfi_esd date;
402 l_rfi_eed date;
403 --
404 BEGIN
405 --
406 hr_utility.set_location('Entering:'||l_proc, 5);
407
408 open csr_rfi_exists ;
409 fetch csr_rfi_exists into l_rfi_esd, l_rfi_eed;
410
411 if csr_rfi_exists%found then
412
413 if g_rfm_effective_end_date < l_rfi_eed then
414
415 FOR l_rfi_id in csr_rfi_ids(p_effective_date => g_rfm_effective_end_date) LOOP
416
417 pay_rfi_del.del
418 ( p_effective_date => g_rfm_effective_end_date
419 ,p_datetrack_mode => 'DELETE'
420 ,p_report_format_item_id => l_rfi_id.report_format_item_id
421 ,p_object_version_number => l_rfi_id.object_version_number
422 ,p_effective_start_date => l_effective_start_date
423 ,p_effective_end_date => l_effective_end_date );
424
425 END LOOP;
426
427 end if;
428
429 end if;
430
431 close csr_rfi_exists;
432
433 enable_startup_mode
434 ( p_business_group_id => g_rfm_old_rec.business_group_id
435 ,p_legislation_code => g_rfm_old_rec.legislation_code );
436
437 pay_rfm_del.del
438 ( p_effective_date => g_rfm_effective_end_date
439 ,p_datetrack_mode => 'DELETE'
440 ,p_report_format_mapping_id => g_rfm_old_rec.report_format_mapping_id
441 ,p_object_version_number => g_rfm_old_rec.object_version_number
442 ,p_effective_start_date => l_effective_start_date
443 ,p_effective_end_date => l_effective_end_date
444 );
445
446 hr_utility.set_location(' Leaving:'||l_proc, 10);
447 --
448 END set_end_date;
449 --
450 BEGIN
451 --
452 hr_utility.set_location('Entering:'||l_proc, 5);
453
454 -- Derive the Business Group Id from Name.
455
456 l_business_group_id := get_business_group_id
457 (p_business_group_name => p_business_group_name);
458
459 l_rec := pay_rfm_shd.convert_args
460 ( p_report_type => p_report_type
461 ,p_report_qualifier => p_report_qualifier
462 ,p_report_format => p_report_format
463 ,p_effective_start_date => null
464 ,p_effective_end_date => null
465 ,p_range_code => p_range_code
466 ,p_assignment_action_code => p_assignment_action_code
467 ,p_initialization_code => p_initialization_code
468 ,p_archive_code => p_archive_code
469 ,p_magnetic_code => p_magnetic_code
470 ,p_report_category => p_report_category
471 ,p_report_name => p_report_name
472 ,p_sort_code => p_sort_code
473 ,p_updatable_flag => p_updatable_flag
474 ,p_deinitialization_code => p_deinitialization_code
475 ,p_report_format_mapping_id => null
476 ,p_business_group_id => l_business_group_id
477 ,p_legislation_code => p_legislation_code
478 ,p_temporary_action_flag => p_temporary_action_flag
479 ,p_object_version_number => null
480 );
481
482 enable_startup_mode
483 ( p_business_group_id => l_business_group_id
484 ,p_legislation_code => p_legislation_code );
485
486 init_fndload
487 ( p_owner => p_owner );
488
489 if p_eof = 1 then
490
491 if l_rec.report_type <> nvl(g_rfm_old_rec.report_type,hr_api.g_varchar2) or
492 l_rec.report_qualifier <> nvl(g_rfm_old_rec.report_qualifier,hr_api.g_varchar2) or
493 l_rec.report_category <> nvl(g_rfm_old_rec.report_category,hr_api.g_varchar2) then
494
495 -- A new record is being uploaded.
496
497 -- End Date the previous record if necessary.
498
499 if g_rfm_effective_end_date <> hr_api.g_eot then
500
501 set_end_date;
502
503 end if;
504
505 -- Reset the startup mode again in case the startup mode was changed by set_end_date
506
507 enable_startup_mode
508 ( p_business_group_id => l_business_group_id
509 ,p_legislation_code => p_legislation_code );
510
511 g_rfm_effective_end_date := p_effective_end_date;
512
513 l_report_format_mapping_id :=
514 pay_rfm_shd.get_report_format_mapping_id
515 ( p_report_type => p_report_type
516 ,p_report_qualifier => p_report_qualifier
517 ,p_report_category => p_report_category
518 );
519
520 open csr_exists;
521 fetch csr_exists into l_exists;
522
523 if csr_exists%found then
524
525 -- Can't do an api delete as child rows may exist.
526
527 delete from pay_report_format_mappings_f
528 where report_format_mapping_id = l_report_format_mapping_id;
529
530 delete from pay_report_format_mappings_tl rfmtl
531 where rfmtl.report_format_mapping_id = l_report_format_mapping_id
532 and exists
533 ( select null
534 from fnd_languages l
535 where l.installed_flag in ('I','B')
536 and l.language_code = rfmtl.language );
537
538 pay_rfm_ins.set_base_key_value
539 ( p_report_format_mapping_id => l_report_format_mapping_id );
540
541 pay_rfm_ins.ins
542 ( p_effective_date => p_effective_start_date
543 ,p_rec => l_rec );
544
545 pay_rft_ins.ins_tl
546 ( p_language_code => userenv('LANG')
547 ,p_report_format_mapping_id => l_report_format_mapping_id
548 ,p_display_name => p_display_name );
549
550 g_rfm_old_rec := l_rec;
551 else
552
553 pay_rfm_ins.ins
554 ( p_effective_date => p_effective_start_date
555 ,p_rec => l_rec );
556
557 pay_rft_ins.ins_tl
558 ( p_language_code => userenv('LANG')
559 ,p_report_format_mapping_id => l_rec.report_format_mapping_id
560 ,p_display_name => p_display_name );
561
562 g_rfm_old_rec := l_rec;
563 end if;
564
565 close csr_exists;
566 else
567
568 -- Update the row
569 g_rfm_effective_end_date := p_effective_end_date;
570
571 l_rec.report_format_mapping_id := g_rfm_old_rec.report_format_mapping_id;
572 l_rec.object_version_number := g_rfm_old_rec.object_version_number;
573
574 pay_rfm_upd.upd
575 ( p_effective_date => p_effective_start_date
576 ,p_datetrack_mode => 'UPDATE'
577 ,p_rec => l_rec );
578
579 pay_rft_upd.upd_tl
580 ( p_language_code => userenv('LANG')
581 ,p_report_format_mapping_id => l_rec.report_format_mapping_id
582 ,p_display_name => p_display_name );
583
584
585 g_rfm_old_rec := l_rec;
586
587 end if;
588
589 elsif p_eof = 2 then
590
591 if g_rfm_effective_end_date <> hr_api.g_eot then
592
593 set_end_date;
594
595 end if;
596
597 end if;
598
599 hr_utility.set_location(' Leaving:'||l_proc, 10);
600 --
601 END load_rfm_row;
602 --
603 --
604 -- ----------------------------------------------------------------------------
605 -- |---------------------------< translate_rfm_row >--------------------------|
606 -- ----------------------------------------------------------------------------
607 --
608 -- Description:
609 -- This procedure updates the translation table pay_report_format_mappings_tl.
610 -- It only updates the translations in the TL table for the current language
611 -- (if present). This procedure does not insert or update the base table
612 -- nor updates any language other than the current one.
613 -- This procedure is usually called from the loader in 'NLS' mode to upload
614 -- translations.
615 --
616 -- ----------------------------------------------------------------------------
617 PROCEDURE translate_rfm_row
618 ( p_report_type in varchar2
619 ,p_report_qualifier in varchar2
620 ,p_report_category in varchar2
621 ,p_display_name in varchar2 ) IS
622 --
623 l_proc varchar2(72) := g_package||'translate_rfm_row';
624 l_report_format_mapping_id PAY_REPORT_FORMAT_MAPPINGS_F.REPORT_FORMAT_MAPPING_ID%TYPE;
625 --
626 BEGIN
627 --
628 hr_utility.set_location('Entering:'||l_proc, 5);
629
630 l_report_format_mapping_id :=
631 pay_rfm_shd.get_report_format_mapping_id
632 ( p_report_type => p_report_type
633 ,p_report_qualifier => p_report_qualifier
634 ,p_report_category => p_report_category );
635
636 pay_rft_upd.upd_tl
637 ( p_language_code => userenv('LANG')
638 ,p_report_format_mapping_id => l_report_format_mapping_id
639 ,p_display_name => p_display_name );
640
641 hr_utility.set_location(' Leaving:'||l_proc, 30);
642 --
643 END translate_rfm_row;
644 --
645 --
646 -- ----------------------------------------------------------------------------
647 -- |------------------------------< load_rfi_row >----------------------------|
648 -- ----------------------------------------------------------------------------
649 --
650 -- Description:
651 -- This procedure uploads a single row into pay_report_format_items_f
652 -- table. When the first row of a date tracked record is being uploaded
653 -- it checks if the record already exists in the table. If the record already
654 -- exists then all the rows of this record are deleted first and then the
655 -- first row is inserted. All the subsequent rows are uploaded by updating
656 -- the first row.
657 --
658 -- ----------------------------------------------------------------------------
659 PROCEDURE load_rfi_row
660 ( p_report_type in varchar2
661 ,p_report_qualifier in varchar2
662 ,p_report_category in varchar2
663 ,p_user_entity_name in varchar2
664 ,p_legislation_code in varchar2
665 ,p_effective_start_date in date
666 ,p_effective_end_date in date
667 ,p_archive_type in varchar2
668 ,p_updatable_flag in varchar2
669 ,p_display_sequence in number
670 ,p_owner in varchar2
671 ,p_eof in number ) IS
672 --
673 l_proc varchar2(72) := g_package||'load_rfi_row';
674 l_rec PAY_RFI_SHD.G_REC_TYPE;
675 l_exists varchar2 (1);
676 l_user_entity_id PAY_REPORT_FORMAT_ITEMS_F.USER_ENTITY_ID%TYPE;
677 l_report_format_mapping_id PAY_REPORT_FORMAT_MAPPINGS_F.REPORT_FORMAT_MAPPING_ID%TYPE;
678 l_report_format_item_id PAY_REPORT_FORMAT_ITEMS_F.REPORT_FORMAT_ITEM_ID%TYPE;
679 --
680 cursor csr_exists is
681 select null
682 from pay_report_format_items_f
683 where report_type = p_report_type
684 and report_qualifier = p_report_qualifier
685 and report_category = p_report_category
686 and user_entity_id = l_user_entity_id;
687 --
688 PROCEDURE set_end_date IS
689 --
690 l_proc varchar2(72) := g_package||'load_rfi_row.set_end_date';
691 l_effective_start_date date;
692 l_effective_end_date date;
693 --
694 BEGIN
695 --
696 hr_utility.set_location('Entering:'||l_proc, 5);
697
698 pay_rfi_del.del
699 ( p_effective_date => g_rfi_effective_end_date
700 ,p_datetrack_mode => 'DELETE'
701 ,p_report_format_item_id => g_rfi_old_rec.report_format_item_id
702 ,p_object_version_number => g_rfi_old_rec.object_version_number
703 ,p_effective_start_date => l_effective_start_date
704 ,p_effective_end_date => l_effective_end_date
705 );
706
707 hr_utility.set_location(' Leaving:'||l_proc, 30);
708 --
709 END set_end_date;
710 --
711 BEGIN
712 --
713 hr_utility.set_location('Entering:'||l_proc, 5);
714
715 l_user_entity_id := get_user_entity_id
716 ( p_user_entity_name => p_user_entity_name
717 ,p_legislation_code => p_legislation_code );
718
719 l_report_format_mapping_id :=
720 pay_rfm_shd.get_report_format_mapping_id
721 ( p_report_type => p_report_type
722 ,p_report_qualifier => p_report_qualifier
723 ,p_report_category => p_report_category );
724
725
726 l_rec := pay_rfi_shd.convert_args
727 ( p_report_type => p_report_type
728 ,p_report_qualifier => p_report_qualifier
729 ,p_report_category => p_report_category
730 ,p_user_entity_id => l_user_entity_id
731 ,p_effective_start_date => null
732 ,p_effective_end_date => null
733 ,p_archive_type => p_archive_type
734 ,p_updatable_flag => p_updatable_flag
735 ,p_display_sequence => p_display_sequence
736 ,p_object_version_number => null
737 ,p_report_format_item_id => null
738 ,p_report_format_mapping_id => l_report_format_mapping_id );
739
740 init_fndload
741 ( p_owner => p_owner );
742
743 if p_eof = 1 then
744
745 if l_rec.report_type <> nvl(g_rfi_old_rec.report_type,hr_api.g_varchar2) or
746 l_rec.report_qualifier <> nvl(g_rfi_old_rec.report_qualifier,hr_api.g_varchar2) or
747 l_rec.report_category <> nvl(g_rfi_old_rec.report_category,hr_api.g_varchar2) or
748 l_rec.user_entity_id <> nvl(g_rfi_old_rec.user_entity_id,hr_api.g_number) then
749
750 -- It is a new record that is being uploaded.
751
752 -- End Date the previous record if necessary.
753
754 if g_rfi_effective_end_date <> g_rfi_old_rec.effective_end_date then
755
756 set_end_date;
757
758 end if;
759
760 g_rfi_effective_end_date := p_effective_end_date;
761
762 l_report_format_item_id :=
763 pay_rfi_shd.get_report_format_item_id
764 ( p_report_type => p_report_type
765 ,p_report_qualifier => p_report_qualifier
766 ,p_report_category => p_report_category
767 ,p_user_entity_id => l_user_entity_id
768 );
769
770
771 open csr_exists;
772 fetch csr_exists into l_exists;
773
774 if csr_exists%found then
775
776 -- Can't do an api delete as child rows may exist.
777
778 delete from pay_report_format_items_f
779 where report_format_item_id = l_report_format_item_id;
780
781 pay_rfi_ins.set_base_key_value
782 ( p_report_format_item_id => l_report_format_item_id );
783
784 pay_rfi_ins.ins
785 ( p_effective_date => p_effective_start_date
786 ,p_rec => l_rec );
787
788 g_rfi_old_rec := l_rec;
789 else
790 pay_rfi_ins.ins
791 ( p_effective_date => p_effective_start_date
792 ,p_rec => l_rec );
793
794 g_rfi_old_rec := l_rec;
795 end if;
796
797 close csr_exists;
798 else
799
800 -- Update the row
801 g_rfi_effective_end_date := p_effective_end_date;
802
803 l_rec.report_format_item_id := g_rfi_old_rec.report_format_item_id;
804 l_rec.object_version_number := g_rfi_old_rec.object_version_number;
805
806 pay_rfi_upd.upd
807 ( p_effective_date => p_effective_start_date
808 ,p_datetrack_mode => 'UPDATE'
809 ,p_rec => l_rec );
810
811 g_rfi_old_rec := l_rec;
812
813 end if;
814
815 elsif p_eof = 2 then
816
817 if g_rfi_effective_end_date <> g_rfi_old_rec.effective_end_date then
818
819 set_end_date;
820
821 end if;
822
823 end if;
824
825 hr_utility.set_location(' Leaving:'||l_proc, 30);
826 --
827 END load_rfi_row;
828 --
829 --
830 -- ----------------------------------------------------------------------------
831 -- |------------------------------< load_rfp_row >----------------------------|
832 -- ----------------------------------------------------------------------------
833 --
834 -- Description:
835 -- This procedure uploads a single row into pay_report_format_parameters
836 -- table. If the row being uploaded already exists in the table then the
837 -- row is only updated with the new values else the row is inserted.
838 --
839 -- ----------------------------------------------------------------------------
840 PROCEDURE load_rfp_row
841 ( p_report_type in varchar2
842 ,p_report_qualifier in varchar2
843 ,p_report_category in varchar2
844 ,p_parameter_name in varchar2
845 ,p_parameter_value in varchar2
846 ,p_owner in varchar2 ) IS
847 --
848 l_proc varchar2(72) := g_package||'load_rfp_row';
849 l_rec PAY_RFP_SHD.G_REC_TYPE;
850 l_object_version_number PAY_REPORT_FORMAT_PARAMETERS.OBJECT_VERSION_NUMBER%TYPE;
851 l_report_format_mapping_id PAY_REPORT_FORMAT_PARAMETERS.REPORT_FORMAT_MAPPING_ID%TYPE;
852 --
853 cursor csr_exists is
854 select object_version_number
855 from pay_report_format_parameters
856 where report_format_mapping_id = l_report_format_mapping_id
857 and parameter_name = p_parameter_name;
858 --
859 BEGIN
860 --
861
862 hr_utility.set_location('Entering:'||l_proc, 5);
863
864 l_report_format_mapping_id :=
865 pay_rfm_shd.get_report_format_mapping_id
866 ( p_report_type => p_report_type
867 ,p_report_qualifier => p_report_qualifier
868 ,p_report_category => p_report_category
869 );
870
871 l_rec := pay_rfp_shd.convert_args
872 ( p_report_format_mapping_id => l_report_format_mapping_id
873 ,p_parameter_name => p_parameter_name
874 ,p_parameter_value => p_parameter_value
875 ,p_object_version_number => null
876 );
877
878 init_fndload
879 ( p_owner => p_owner );
880
881 open csr_exists;
882 fetch csr_exists into l_object_version_number;
883
884 if csr_exists%notfound then
885
886 pay_rfp_ins.ins
887 ( p_rec => l_rec );
888
889 else
890
891 l_rec.object_version_number := l_object_version_number;
892
893 pay_rfp_upd.upd
894 ( p_rec => l_rec );
895
896 end if;
897
898 close csr_exists;
899
900 hr_utility.set_location(' Leaving:'||l_proc, 30);
901
902 --
903 END load_rfp_row;
904 --
905 --
906 -- ----------------------------------------------------------------------------
907 -- |------------------------------< load_mgb_row >----------------------------|
908 -- ----------------------------------------------------------------------------
909 --
910 -- Description:
911 -- This procedure uploads a single row into pay_magnetic_blocks
912 -- table. If the row being uploaded already exists in the table then the
913 -- row is only updated with the new values else the row is inserted.
914 --
915 -- ----------------------------------------------------------------------------
916 PROCEDURE load_mgb_row
917 ( p_block_name in varchar2
918 ,p_report_format in varchar2
919 ,p_main_block_flag in varchar2
920 ,p_cursor_name in varchar2
921 ,p_no_column_returned in number ) IS
922 --
923 l_proc varchar2(72) := g_package||'load_mgb_row';
924 l_rec PAY_MGB_SHD.G_REC_TYPE;
925 l_exists varchar2 (1);
926 l_magnetic_block_id PAY_MAGNETIC_BLOCKS.MAGNETIC_BLOCK_ID%TYPE;
927 --
928 cursor csr_exists is
929 select null
930 from pay_magnetic_blocks
931 where magnetic_block_id = l_magnetic_block_id;
932
933 --
934 BEGIN
935 --
936 hr_utility.set_location('Entering:'||l_proc, 5);
937
938 l_magnetic_block_id :=
939 pay_mgb_shd.get_magnetic_block_id
940 ( p_block_name => p_block_name
941 ,p_report_format => p_report_format
942 );
943
944 l_rec := pay_mgb_shd.convert_args
945 ( p_magnetic_block_id => null
946 ,p_block_name => p_block_name
947 ,p_main_block_flag => p_main_block_flag
948 ,p_report_format => p_report_format
949 ,p_cursor_name => p_cursor_name
950 ,p_no_column_returned => p_no_column_returned
951 );
952
953 open csr_exists;
954 fetch csr_exists into l_exists;
955
956 if csr_exists%notfound then
957
958 pay_mgb_ins.ins
959 ( p_rec => l_rec );
960
961 else
962
963 l_rec.magnetic_block_id := l_magnetic_block_id;
964
965 pay_mgb_upd.upd
966 ( p_rec => l_rec );
967
968 end if;
969
970 close csr_exists;
971
972 hr_utility.set_location(' Leaving:'||l_proc, 30);
973
974 --
975 END load_mgb_row;
976 --
977 --
978 -- ----------------------------------------------------------------------------
979 -- |------------------------------< load_mgr_row >----------------------------|
980 -- ----------------------------------------------------------------------------
981 --
982 -- Description:
983 -- This procedure uploads a single row into pay_magnetic_records
984 -- table. If the row being uploaded already exists in the table then the
985 -- row is only updated with the new values else the row is inserted.
986 --
987 -- ----------------------------------------------------------------------------
988 PROCEDURE load_mgr_row
989 ( p_block_name in varchar2
990 ,p_report_format in varchar2
991 ,p_sequence in number
992 ,p_formula_type_name in varchar2
993 ,p_formula_name in varchar2
994 ,p_legislation_code in varchar2
995 ,p_next_block_name in varchar2
996 ,p_next_report_format in varchar2
997 ,p_overflow_mode in varchar2
998 ,p_frequency in number
999 ,p_last_run_executed_mode in varchar2
1000 ,p_action_level in varchar2 default null
1001 ,p_block_label in varchar2 default null
1002 ,p_block_row_label in varchar2 default null
1003 ,p_xml_proc_name in varchar2 default null ) IS
1004 --
1005 l_proc varchar2(72) := g_package||'load_mgr_row';
1006 l_rec PAY_MGR_SHD.G_REC_TYPE;
1007 l_exists varchar2 (1);
1008 l_magnetic_block_id PAY_MAGNETIC_RECORDS.MAGNETIC_BLOCK_ID%TYPE;
1009 l_next_block_id PAY_MAGNETIC_RECORDS.NEXT_BLOCK_ID%TYPE;
1010 l_formula_id PAY_MAGNETIC_RECORDS.FORMULA_ID%TYPE;
1011 --
1012 cursor csr_exists is
1013 select null
1014 from pay_magnetic_records
1015 where magnetic_block_id = l_magnetic_block_id
1016 and sequence = p_sequence;
1017
1018 --
1019 BEGIN
1020 --
1021
1022 hr_utility.set_location('Entering:'||l_proc, 5);
1023
1024 l_magnetic_block_id :=
1025 pay_mgb_shd.get_magnetic_block_id
1026 ( p_block_name => p_block_name
1027 ,p_report_format => p_report_format
1028 );
1029
1030 l_next_block_id :=
1031 pay_mgb_shd.get_magnetic_block_id
1032 ( p_block_name => p_next_block_name
1033 ,p_report_format => p_next_report_format
1034 );
1035
1036 l_formula_id := get_formula_id
1037 ( p_formula_type_name => p_formula_type_name
1038 ,p_formula_name => p_formula_name
1039 ,p_legislation_code => p_legislation_code
1040 );
1041
1042
1043 l_rec := pay_mgr_shd.convert_args
1044 ( p_formula_id => l_formula_id
1045 ,p_magnetic_block_id => l_magnetic_block_id
1046 ,p_next_block_id => l_next_block_id
1047 ,p_last_run_executed_mode => p_last_run_executed_mode
1048 ,p_overflow_mode => p_overflow_mode
1049 ,p_sequence => p_sequence
1050 ,p_frequency => p_frequency
1051 ,p_action_level => p_action_level
1052 ,p_block_label => p_block_label
1053 ,p_block_row_label => p_block_row_label
1054 ,p_xml_proc_name => p_xml_proc_name
1055 );
1056
1057 open csr_exists;
1058 fetch csr_exists into l_exists;
1059
1060 if csr_exists%notfound then
1061
1062 pay_mgr_ins.ins
1063 ( p_rec => l_rec );
1064
1065 else
1066
1067 pay_mgr_upd.upd
1068 ( p_rec => l_rec );
1069
1070 end if;
1071
1072 close csr_exists;
1073
1074 hr_utility.set_location(' Leaving:'||l_proc, 30);
1075
1076 --
1077 END load_mgr_row;
1078 --
1079 -- ----------------------------------------------------------------------------
1080 -- |------------------------------< load_egu_row >----------------------------|
1081 -- ----------------------------------------------------------------------------
1082 --
1083 -- Description:
1084 -- This procedure uploads a single row into pay_event_group_usages
1085 -- table if the row being uploaded is not already present in the table.
1086 --
1087 -- ----------------------------------------------------------------------------
1088 PROCEDURE load_egu_row
1089 ( p_evg_name in varchar2
1090 ,p_evg_leg_code in varchar2
1091 ,p_evg_bus_grp_name in varchar2
1092 ,p_els_name in varchar2
1093 ,p_els_leg_code in varchar2
1094 ,p_els_bus_grp_name in varchar2
1095 ,p_egu_leg_code in varchar2
1096 ,p_egu_bus_grp_name in varchar2
1097 ,p_owner in varchar2 ) IS
1098 --
1099 l_proc varchar2(72) := g_package||'load_egu_row';
1100 l_exists varchar2 (1);
1101 l_event_group_id pay_event_groups.event_group_id%type;
1102 l_element_set_id pay_element_sets.element_set_id%type;
1103 l_business_group_id pay_event_group_usages.business_group_id%type;
1104 l_legislation_code pay_event_group_usages.legislation_code%type;
1105 l_evg_bus_group_id pay_event_groups.business_group_id%type;
1106 l_els_bus_group_id pay_element_sets.business_group_id%type;
1107 l_event_group_usage_id pay_event_group_usages.event_group_usage_id%type;
1108 l_ovn pay_event_group_usages.object_version_number%type;
1109 --
1110 cursor csr_exists is
1111 select null
1112 from pay_event_group_usages egu
1113 where egu.event_group_id = l_event_group_id
1114 and egu.element_set_id = l_element_set_id
1115 and ( l_business_group_id is null
1116 or ( l_business_group_id is not null and l_business_group_id = egu.business_group_id )
1117 or ( l_business_group_id is not null and
1118 egu.legislation_code is null and egu.business_group_id is null )
1119 or ( l_business_group_id is not null and
1120 egu.legislation_code = hr_api.return_legislation_code(l_business_group_id )))
1121 and ( l_legislation_code is null
1122 or ( l_legislation_code is not null and l_legislation_code = egu.legislation_code )
1123 or ( l_legislation_code is not null and
1124 egu.legislation_code is null and egu.business_group_id is null)
1125 or ( l_legislation_code is not null and
1126 l_legislation_code = hr_api.return_legislation_code(egu.business_group_id )));
1127 --
1128 BEGIN
1129 --
1130
1131 hr_utility.set_location('Entering:'||l_proc, 5);
1132
1133 l_business_group_id := get_business_group_id
1134 (p_business_group_name => p_egu_bus_grp_name);
1135
1136 l_legislation_code := p_egu_leg_code;
1137
1138 l_evg_bus_group_id := get_business_group_id
1139 (p_business_group_name => p_evg_bus_grp_name);
1140
1141 l_els_bus_group_id := get_business_group_id
1142 (p_business_group_name => p_els_bus_grp_name);
1143
1144
1145 l_element_set_id := get_element_set_id
1146 ( p_element_set_name => p_els_name,
1147 p_legislation_code => p_els_leg_code,
1148 p_business_group_id => l_els_bus_group_id);
1149
1150 l_event_group_id := get_event_group_id
1151 ( p_event_group_name => p_evg_name,
1152 p_legislation_code => p_evg_leg_code,
1153 p_business_group_id => l_evg_bus_group_id);
1154
1155
1156 open csr_exists;
1157 fetch csr_exists into l_exists;
1158
1159 if csr_exists%notfound then
1160
1161 enable_startup_mode
1162 ( p_business_group_id => l_business_group_id
1163 ,p_legislation_code => l_legislation_code );
1164
1165 init_fndload
1166 ( p_owner => p_owner );
1167
1168 pay_egu_ins.ins
1169 (p_effective_date => sysdate
1170 ,p_event_group_id => l_event_group_id
1171 ,p_element_set_id => l_element_set_id
1172 ,p_business_group_id => l_business_group_id
1173 ,p_legislation_code => l_legislation_code
1174 ,p_event_group_usage_id => l_event_group_usage_id
1175 ,p_object_version_number => l_ovn
1176 );
1177
1178 end if;
1179
1180 close csr_exists;
1181
1182 hr_utility.set_location(' Leaving:'||l_proc, 30);
1183
1184 --
1185 END load_egu_row;
1186 --
1187 --
1188 -- ----------------------------------------------------------------------------
1189 -- |------------------------------< load_ecu_row >----------------------------|
1190 -- ----------------------------------------------------------------------------
1191 --
1192 -- Description:
1193 -- This procedure uploads a single row into pay_element_class_usages_f table.
1194 --
1195 -- ----------------------------------------------------------------------------
1196 PROCEDURE load_ecu_row(
1197 p_usage_id in number,
1198 p_rt_name in varchar2,
1199 p_rt_effective_start_date in date,
1200 p_rt_effective_end_date in date,
1201 p_rt_business_group_name in varchar2,
1202 p_rt_legislation_code in varchar2,
1203 p_rt_shortname in varchar2,
1204 p_ec_classification_name in varchar2,
1205 p_ec_business_group_name in varchar2,
1206 p_ec_legislation_code in varchar2,
1207 p_effective_start_date in date,
1208 p_effective_end_date in date,
1209 p_business_group_name in varchar2,
1210 p_legislation_code in varchar2,
1211 p_owner in varchar2,
1212 p_eof_number in number
1213 ) is
1214 --
1215 l_proc varchar2(72) := g_package||'load_ecu_row';
1216 l_business_group_id PAY_ELEMENT_CLASS_USAGES_F.BUSINESS_GROUP_ID%TYPE;
1217 l_rec PAY_ECU_SHD.G_REC_TYPE;
1218 l_element_class_usage_id PAY_ELEMENT_CLASS_USAGES_F.ELEMENT_CLASS_USAGE_ID%TYPE;
1219 l_run_type_id PAY_ELEMENT_CLASS_USAGES_F.RUN_TYPE_ID%TYPE;
1220 l_classification_id PAY_ELEMENT_CLASS_USAGES_F.CLASSIFICATION_ID%TYPE;
1221 l_object_version_number PAY_ELEMENT_CLASS_USAGES_F.OBJECT_VERSION_NUMBER%TYPE;
1222 --
1223 -- Cursor for fetching the run type id.
1224 Cursor csr_get_rt_id is
1225 select prt.run_type_id
1226 from pay_run_types_f prt
1227 where UPPER(prt.run_type_name) = UPPER(p_rt_name)
1228 and p_effective_start_date between prt.effective_start_date
1229 and prt.effective_end_date
1230 and ((p_rt_business_group_name is not null
1231 and prt.business_group_id = l_business_group_id)
1232 or (p_rt_legislation_code is not null
1233 and prt.legislation_code = p_rt_legislation_code)
1234 or (p_rt_business_group_name is null
1235 and p_rt_legislation_code is null
1236 and prt.business_group_id is null
1237 and prt.legislation_code is null));
1238
1239 -- Cursor for fetching the classification id.
1240 Cursor csr_get_ec_id is
1241 select pec.classification_id
1242 from pay_element_classifications pec
1243 where UPPER(pec.classification_name) = UPPER(p_ec_classification_name)
1244 and ((p_ec_business_group_name is not null
1245 and pec.business_group_id = l_business_group_id)
1246 or (p_ec_legislation_code is not null
1247 and pec.legislation_code = p_ec_legislation_code)
1248 or (p_ec_business_group_name is null
1249 and p_ec_legislation_code is null
1250 and pec.business_group_id is null
1251 and pec.legislation_code is null));
1252
1253 -- Cursor for cheking the rows exists or not.
1254 Cursor csr_exists is
1255 select element_class_usage_id, object_version_number
1256 from pay_element_class_usages_f
1257 where run_type_id = l_run_type_id
1258 and classification_id = l_classification_id
1259 and NVL(business_group_id, hr_api.g_number) = NVL(l_business_group_id, hr_api.g_number)
1260 and NVL(legislation_code, hr_api.g_varchar2) = NVL(p_legislation_code, hr_api.g_varchar2)
1261 and p_effective_start_date between effective_start_date and effective_end_date;
1262 --
1263 PROCEDURE set_end_date IS
1264 --
1265 l_proc varchar2(72) := g_package||'load_ecu_row.set_end_date';
1266 l_effective_start_date date;
1267 l_effective_end_date date;
1268 --
1269 BEGIN
1270 --
1271 hr_utility.set_location('Entering:'||l_proc, 5);
1272
1273 enable_startup_mode
1274 ( p_business_group_id => g_ecu_old_rec.business_group_id
1275 ,p_legislation_code => g_ecu_old_rec.legislation_code );
1276
1277 PAY_ECU_DEL.DEL
1278 (p_effective_date => g_ecu_effective_end_date
1279 ,p_datetrack_mode => 'DELETE'
1280 ,p_element_class_usage_id => g_ecu_old_rec.element_class_usage_id
1281 ,p_object_version_number => g_ecu_old_rec.object_version_number
1282 ,p_effective_start_date => l_effective_start_date
1283 ,p_effective_end_date => l_effective_end_date);
1284 hr_utility.set_location(' Leaving:'||l_proc, 10);
1285 --
1286 END set_end_date;
1287 --
1288 BEGIN
1289 --
1290 hr_utility.set_location('Entering:'||l_proc, 5);
1291
1292 -- Derive the Business Group Id from Name.
1293
1294 l_business_group_id := NULL;
1295 if (p_business_group_name is not null) then
1296 l_business_group_id := get_business_group_id
1297 (p_business_group_name => p_business_group_name);
1298 end if;
1299
1300 -- Get the run_type_id
1301 --
1302 open csr_get_rt_id;
1303 fetch csr_get_rt_id into l_run_type_id;
1304 close csr_get_rt_id;
1305 --
1306 -- Get the classification_id
1307 --
1308 open csr_get_ec_id;
1309 fetch csr_get_ec_id into l_classification_id;
1310 close csr_get_ec_id;
1311
1312 l_rec := pay_ecu_shd.convert_args
1313 (p_element_class_usage_id => null
1314 ,p_effective_start_date => null
1315 ,p_effective_end_date => null
1316 ,p_run_type_id => l_run_type_id
1317 ,p_classification_id => l_classification_id
1318 ,p_business_group_id => l_business_group_id
1319 ,p_legislation_code => p_legislation_code
1320 ,p_object_version_number => null);
1321
1322 enable_startup_mode
1323 ( p_business_group_id => l_business_group_id
1324 ,p_legislation_code => p_legislation_code );
1325
1326 init_fndload
1327 ( p_owner => p_owner );
1328 if p_eof_number = 1 then
1329
1330 if (g_usage_id <> p_usage_id) then
1331
1332 -- A new record is being uploaded.
1333
1334 -- End Date the previous record if necessary.
1335 if g_ecu_effective_end_date <> hr_api.g_eot then
1336 --
1337 set_end_date;
1338 --
1339 end if;
1340 -- Reset the startup mode again in case the startup mode was changed by set_end_date
1341 enable_startup_mode
1342 ( p_business_group_id => l_business_group_id
1343 ,p_legislation_code => p_legislation_code );
1344
1345 g_ecu_effective_end_date := p_effective_end_date;
1346
1347 open csr_exists;
1348 fetch csr_exists into l_element_class_usage_id, l_object_version_number;
1349 if csr_exists%found then
1350 --
1351 l_rec.element_class_usage_id := l_element_class_usage_id;
1352 l_rec.object_version_number := l_object_version_number;
1353
1354 PAY_ECU_DEL.DEL(
1355 p_effective_date => p_effective_start_date
1356 ,p_datetrack_mode => 'ZAP'
1357 ,p_rec => l_rec);
1358
1359 PAY_ECU_INS.INS(
1360 p_effective_date => p_effective_start_date
1361 ,p_rec => l_rec);
1362
1363 g_ecu_old_rec := l_rec;
1364 --
1365 else
1366 --
1367 PAY_ECU_INS.INS(
1368 p_effective_date => p_effective_start_date
1369 ,p_rec => l_rec);
1370
1371 g_ecu_old_rec := l_rec;
1372 --
1373 end if;
1374 close csr_exists;
1375 else
1376
1377 -- Update the row
1378 g_ecu_effective_end_date := p_effective_end_date;
1379
1380 l_rec.element_class_usage_id := g_ecu_old_rec.element_class_usage_id;
1381 l_rec.object_version_number := g_ecu_old_rec.object_version_number;
1382
1383 pay_ecu_upd.upd
1384 ( p_effective_date => p_effective_start_date
1385 ,p_datetrack_mode => 'UPDATE'
1386 ,p_rec => l_rec );
1387
1388 g_ecu_old_rec := l_rec;
1389
1390 end if;
1391 g_usage_id := p_usage_id;
1392
1393 elsif p_eof_number = 2 then
1394
1395 if g_ecu_effective_end_date <> hr_api.g_eot then
1396 --
1397 set_end_date;
1398 --
1399 end if;
1400 g_usage_id := -1;
1401 end if;
1402
1403 hr_utility.set_location(' Leaving:'||l_proc, 10);
1404 --
1405 END load_ecu_row;
1406 --
1407 END PAY_LOADER_UTILS_PKG;
1408