DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PSL_BUS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body ben_psl_bus as
2 /* $Header: bepslrhi.pkb 115.14 2004/06/30 23:53:12 hmani ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ben_psl_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_per_info_chg_cs_ler_id >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 --   This procedure is used to check that the primary key for the table
16 --   is created properly. It should be null on insert and
17 --   should not be able to be updated.
18 --
19 -- Pre Conditions
20 --   None.
21 --
22 -- In Parameters
23 --   per_info_chg_cs_ler_id PK of record being inserted or updated.
24 --   effective_date Effective Date of session
25 --   object_version_number Object version number of record being
26 --                         inserted or updated.
27 --
28 -- Post Success
29 --   Processing continues
30 --
31 -- Post Failure
32 --   Errors handled by the procedure
33 --
34 -- Access Status
35 --   Internal table handler use only.
36 --
37 Procedure chk_per_info_chg_cs_ler_id(p_per_info_chg_cs_ler_id       in number,
38                            p_effective_date              in date,
39                            p_object_version_number       in number) is
40   --
41   l_proc         varchar2(72) := g_package||'chk_per_info_chg_cs_ler_id';
42   l_api_updating boolean;
43   --
44 Begin
45   --
46   hr_utility.set_location('Entering:'||l_proc, 5);
47   --
48   l_api_updating := ben_psl_shd.api_updating
49     (p_effective_date              => p_effective_date,
50      p_per_info_chg_cs_ler_id                => p_per_info_chg_cs_ler_id,
51      p_object_version_number       => p_object_version_number);
52   --
53   if (l_api_updating
54      and nvl(p_per_info_chg_cs_ler_id,hr_api.g_number)
55      <>  ben_psl_shd.g_old_rec.per_info_chg_cs_ler_id) then
56     --
57     -- raise error as PK has changed
58     --
59     ben_psl_shd.constraint_error('BEN_PER_INFO_CHG_CS_LER_F_PK');
60     --
61   elsif not l_api_updating then
62     --
63     -- check if PK is null
64     --
65     if p_per_info_chg_cs_ler_id is not null then
66       --
67       -- raise error as PK is not null
68       --
69       ben_psl_shd.constraint_error('BEN_PER_INFO_CHG_CS_LER_F_PK');
70       --
71     end if;
72     --
73   end if;
74   --
75   hr_utility.set_location('Leaving:'||l_proc, 10);
76   --
77 End chk_per_info_chg_cs_ler_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_per_info_chg_cs_ler_rl >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 --   This procedure is used to check that the Formula Rule is valid.
85 --
86 -- Pre Conditions
87 --   None.
88 --
89 -- In Parameters
90 --   per_info_chg_cs_ler_id PK of record being inserted or updated.
91 --   per_info_chg_cs_ler_rl Value of formula rule id.
92 --   effective_date effective date
93 --   object_version_number Object version number of record being
94 --                         inserted or updated.
95 --
96 -- Post Success
97 --   Processing continues
98 --
99 -- Post Failure
100 --   Error handled by procedure
101 --
102 -- Access Status
103 --   Internal table handler use only.
104 --
105 Procedure chk_per_info_chg_cs_ler_rl(p_per_info_chg_cs_ler_id      in number,
106                              p_per_info_chg_cs_ler_rl              in number,
107                              p_business_group_id           in number,
108                              p_effective_date              in date,
109                              p_object_version_number       in number) is
110   --
111   l_proc         varchar2(72) := g_package||'chk_per_info_chg_cs_ler_rl';
112   l_api_updating boolean;
113   l_dummy        varchar2(1);
114   --
115   cursor c1 is
116     select null
117     from   ff_formulas_f ff
118             ,per_business_groups pbg
119     where  ff.formula_id = p_per_info_chg_cs_ler_rl
120     and    ff.formula_type_id = -46   -- Person Information Causes Life Event
121     and    pbg.business_group_id = p_business_group_id
122     and    nvl(ff.business_group_id, p_business_group_id) = p_business_group_id
123     and    nvl(ff.legislation_code, pbg.legislation_code) = pbg.legislation_code
124     and    p_effective_date
125            between ff.effective_start_date
126            and     ff.effective_end_date;
127   --
128 Begin
129   --
130   hr_utility.set_location('Entering:'||l_proc, 5);
131   --
132   l_api_updating := ben_psl_shd.api_updating
133     (p_per_info_chg_cs_ler_id                => p_per_info_chg_cs_ler_id,
134      p_effective_date              => p_effective_date,
135      p_object_version_number       => p_object_version_number);
136   --
137   if (l_api_updating
138       and nvl(p_per_info_chg_cs_ler_rl,hr_api.g_number)
139       <> ben_psl_shd.g_old_rec.per_info_chg_cs_ler_rl
140       or not l_api_updating)
141       and p_per_info_chg_cs_ler_rl is not null then
142     --
143     -- check if value of formula rule is valid.
144     --
148       -- formula is valid otherwise its invalid
145     open c1;
146       --
147       -- fetch value from cursor if it returns a record then the
149       --
150       fetch c1 into l_dummy;
151       if c1%notfound then
152         --
153         close c1;
154         --
155         -- raise error
156         --
157         fnd_message.set_name('BEN','BEN_91007_INVALID_RULE');
158         fnd_message.raise_error;
159         --
160       end if;
161       --
162     close c1;
163     --
164   end if;
165   --
166   hr_utility.set_location('Leaving:'||l_proc,10);
167   --
168 end chk_per_info_chg_cs_ler_rl;
169 --
170 -- ----------------------------------------------------------------------------
171 -- |------< chk_table_column_val >------|
172 -- ----------------------------------------------------------------------------
173 --
174 -- Description
175 --   This procedure is used to check that the source table and source
176 --   column are entered and that the combo of table, column, new value and
177 --   old value is unique.
178 --
179 -- Pre Conditions
180 --   None.
181 --
182 -- In Parameters
183 --   per_info_chg_cs_ler_id PK of record being inserted or updated.
184 --   source_table      table name selected
185 --   source_column     column name selected
186 --   new_val           New value being entered.  When this value is detected
187 --                     in this table.column, a database trigger should fire
188 --                     that checks for life events to be created for the person
189 --                     to which the data change is happening.
190 --   old_val           Old value being entered.  When this value is detected
191 --                     in this table.column (pre-change), a database trigger
192 --                     should fire
193 --                     that checks for life events to be created for the person
194 --                     to which the data change is happening.
195 --   object_version_number Object version number of record being
196 --                         inserted or updated.
197 --   effective_date
198 --
199 -- Post Success
200 --   Processing continues
201 --
202 -- Post Failure
203 --   Errors handled by the procedure
204 --
205 -- Access Status
206 --   Internal table handler use only.
207 --
208 Procedure chk_table_column_val(p_per_info_chg_cs_ler_id  in number,
209                            p_source_table                in varchar2,
210                            p_source_column               in varchar2,
211                            p_new_val                     in varchar2,
212                            p_old_val                     in varchar2,
213                            p_business_group_id           in number,
214                            p_effective_date              in date,
215                            p_object_version_number       in number) is
216   --
217 CURSOR c1 (p_per_info_chg_cs_ler_id     number
218                  ,p_source_table        varchar2
219                  ,p_source_column       varchar2
220                  ,p_new_val           varchar2
221                  ,p_old_val           varchar2
222                 ,p_effective_date     date
223                  ,p_business_group_id   number) IS
224     SELECT  'x'
225     FROM    ben_per_info_chg_cs_ler_f
226     WHERE   per_info_chg_cs_ler_id   <> nvl(p_per_info_chg_cs_ler_id,
227                                             hr_api.g_number)
228     AND     source_table              = p_source_table
229     AND     source_column             = p_source_column
230     AND     new_val                   = nvl(p_new_val, hr_api.g_varchar2)
231     AND     old_val                   = nvl(p_old_val, hr_api.g_varchar2)
232     AND     business_group_id + 0     = p_business_group_id
233     AND     p_effective_date between effective_start_date
234     AND     effective_end_date;
235   --
236   l_proc         varchar2(72) := g_package||'chk_table_column_val';
237   l_api_updating boolean;
238   l_dummy        varchar2(1);
239   --
240 Begin
241   --
242   hr_utility.set_location('Entering:'||l_proc, 5);
243   --
244      if p_source_table is null then
245         fnd_message.set_name('BEN', 'BEN_91020_TABLE_REQUIRED');
246         fnd_message.raise_error;
247      elsif p_source_column is null then
248         fnd_message.set_name('BEN', 'BEN_91021_COLUMN_REQUIRED');
249         fnd_message.raise_error;
250      else
251           -- check if table, column, new value, old value is unique
252           --
253           open c1
254             (p_per_info_chg_cs_ler_id   => p_per_info_chg_cs_ler_id
255             ,p_source_table             => p_source_table
256             ,p_source_column            => p_source_column
257             ,p_new_val                  => p_new_val
258             ,p_old_val                  => p_old_val
259             ,p_effective_date           => p_effective_date
260             ,p_business_group_id        => p_business_group_id) ;
261         fetch c1 into l_dummy;
262         if c1%found then
263           close c1;
264           fnd_message.set_name('BEN', 'BEN_91017_PERSON_CHANGE_UNIQUE');
265           fnd_message.raise_error;
266         end if;
267         close c1;
268      end if;
269   --
270   hr_utility.set_location('Leaving:'||l_proc, 10);
271   --
272 End chk_table_column_val;
273 --
274 -- ----------------------------------------------------------------------------
275 -- |------< chk_name_unique >------|
276 -- ----------------------------------------------------------------------------
277 --
278 -- Description
279 --   This procedure is used to check that the name is unique.
280 --
281 -- Pre Conditions
282 --   None.
283 --
284 -- In Parameters
288 --                         inserted or updated.
285 --   per_info_chg_cs_ler_id PK of record being inserted or updated.
286 --   old_val           Name being entered.
287 --   object_version_number Object version number of record being
289 --   effective_date
290 --
291 -- Post Success
292 --   Processing continues
293 --
294 -- Post Failure
295 --   Errors handled by the procedure
296 --
297 -- Access Status
298 --   Internal table handler use only.
299 --
300 Procedure chk_name_unique( p_per_info_chg_cs_ler_id  in number,
301                            p_name                     in varchar2,
302                            p_business_group_id           in number,
303                            p_effective_date              in date,
304                            p_object_version_number       in number) is
305   --
306 CURSOR c1 (p_per_info_chg_cs_ler_id     number
307                  ,p_name           varchar2
308                 ,p_effective_date     date
309                  ,p_business_group_id   number) IS
310     SELECT  'x'
311     FROM    ben_per_info_chg_cs_ler_f
312     WHERE   per_info_chg_cs_ler_id   <> nvl(p_per_info_chg_cs_ler_id,
313                                             hr_api.g_number)
314     AND     name                   = nvl(p_name, hr_api.g_varchar2)
315     AND     business_group_id + 0  = p_business_group_id
316     AND     p_effective_date between effective_start_date
317     AND     effective_end_date;
318   --
319   l_proc         varchar2(72) := g_package||'chk_name_unique';
320   l_api_updating boolean;
321   l_dummy        varchar2(1);
322   --
323 Begin
324   --
325   hr_utility.set_location('Entering:'||l_proc, 5);
326   --
327           -- check name is unique
328           --
329           open c1
330             (p_per_info_chg_cs_ler_id   => p_per_info_chg_cs_ler_id
331             ,p_name                     => p_name
332             ,p_effective_date           => p_effective_date
333             ,p_business_group_id        => p_business_group_id) ;
334         fetch c1 into l_dummy;
335         if c1%found then
336           close c1;
337           fnd_message.set_name('BEN', 'BEN_91009_NAME_NOT_UNIQUE');
338           fnd_message.raise_error;
339         end if;
340         close c1;
341   --
342   hr_utility.set_location('Leaving:'||l_proc, 10);
343   --
344 End chk_name_unique;
345 --
346 -- ----------------------------------------------------------------------------
347 -- |------< chk_whatif_lbl_unique >------|
348 -- ----------------------------------------------------------------------------
349 --
350 -- Description
351 --   This procedure is used to check that the whatif label is unique.
352 --
353 -- Pre Conditions
354 --   None.
355 --
356 -- In Parameters
357 --   per_info_chg_cs_ler_id PK of record being inserted or updated.
358 --   whatif_lbl           What If Label being entered.
359 --   effective_date
360 --
361 -- Post Success
362 --   Processing continues
363 --
364 -- Post Failure
365 --   Errors handled by the procedure
366 --
367 -- Access Status
368 --   Internal table handler use only.
369 Procedure chk_whatif_lbl_unique( p_per_info_chg_cs_ler_id  in number,
370                            p_whatif_lbl_txt                     in varchar2,
371                            p_business_group_id           in number,
372                            p_effective_date              in date) is
373   --
374 CURSOR c1 (p_per_info_chg_cs_ler_id  number
375            ,p_whatif_lbl_txt      varchar2
376            ,p_effective_date     date
377            ,p_business_group_id   number) IS
378     SELECT  'x'
379     FROM    ben_per_info_chg_cs_ler_f
380     WHERE   whatif_lbl_txt         = p_whatif_lbl_txt
381     AND     per_info_chg_cs_ler_id   <> nvl(p_per_info_chg_cs_ler_id,
382                                             hr_api.g_number)
383     AND     business_group_id + 0  = p_business_group_id
384     AND     p_effective_date between effective_start_date
385     AND     effective_end_date;
386   --
387   l_proc         varchar2(72) := g_package||'chk_whatif_lbl_unique';
388   l_api_updating boolean;
389   l_dummy        varchar2(1);
390   --
391 Begin
392 	--
393 	hr_utility.set_location('Entering:'||l_proc, 5);
394 	--
395 	-- check what if label is unique
396 	--
397 	if p_whatif_lbl_txt is not null then
398 		hr_utility.set_location(' What IF Label is not null'||l_proc, 5);
399 			open c1(p_per_info_chg_cs_ler_id  =>  p_per_info_chg_cs_ler_id
400                                 ,p_whatif_lbl_txt        => p_whatif_lbl_txt
401 				,p_effective_date           => p_effective_date
402 				,p_business_group_id        => p_business_group_id) ;
403 			fetch c1 into l_dummy;
404 			  if c1%found then
405 			    close c1;
406 			    fnd_message.set_name('BEN', 'BEN_94013_WHATIF_LBL_UNIQUE');
407 			    fnd_message.raise_error;
408 			   end if;
409 			close c1;
410 		--
411 	end if;
412 	hr_utility.set_location('Leaving:'||l_proc, 10);
413   --
414 End chk_whatif_lbl_unique;
415 -- ----------------------------------------------------------------------------
416 -- |--------------------------< dt_update_validate >--------------------------|
417 -- ----------------------------------------------------------------------------
418 -- {Start Of Comments}
419 --
420 -- Description:
421 --   This procedure is used for referential integrity of datetracked
422 --   parent entities when a datetrack update operation is taking place
423 --   and where there is no cascading of update defined for this entity.
424 --
425 -- Prerequisites:
426 --   This procedure is called from the update_validate.
427 --
428 -- In Parameters:
429 --
433 -- Post Failure:
430 -- Post Success:
431 --   Processing continues.
432 --
434 --
435 -- Developer Implementation Notes:
436 --   This procedure should not need maintenance unless the HR Schema model
437 --   changes.
438 --
439 -- Access Status:
440 --   Internal Row Handler Use Only.
441 --
442 -- {End Of Comments}
443 -- ----------------------------------------------------------------------------
444 Procedure dt_update_validate
445             (
446          p_datetrack_mode            in varchar2,
447              p_validation_start_date         in date,
448          p_validation_end_date       in date) Is
449 --
450   l_proc        varchar2(72) := g_package||'dt_update_validate';
451   l_integrity_error Exception;
452   l_table_name      all_tables.table_name%TYPE;
453 --
454 Begin
455   hr_utility.set_location('Entering:'||l_proc, 5);
456   --
457   -- Ensure that the p_datetrack_mode argument is not null
458   --
459   hr_api.mandatory_arg_error
460     (p_api_name       => l_proc,
461      p_argument       => 'datetrack_mode',
462      p_argument_value => p_datetrack_mode);
463   --
464   -- Only perform the validation if the datetrack update mode is valid
465   --
466   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
467     --
468     --
469     -- Ensure the arguments are not null
470     --
471     hr_api.mandatory_arg_error
472       (p_api_name       => l_proc,
473        p_argument       => 'validation_start_date',
474        p_argument_value => p_validation_start_date);
475     --
476     hr_api.mandatory_arg_error
477       (p_api_name       => l_proc,
478        p_argument       => 'validation_end_date',
479        p_argument_value => p_validation_end_date);
480     --
481     --
482     --
483   End If;
484   --
485   hr_utility.set_location(' Leaving:'||l_proc, 10);
486 Exception
487   When l_integrity_error Then
488     --
489     -- A referential integrity check was violated therefore
490     -- we must error
491     --
492     ben_utility.parent_integrity_error(p_table_name => l_table_name);
493   When Others Then
494     --
495     -- An unhandled or unexpected error has occurred which
496     -- we must report
497     --
498     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
499     fnd_message.set_token('PROCEDURE', l_proc);
500     fnd_message.set_token('STEP','15');
501     fnd_message.raise_error;
502 End dt_update_validate;
503 --
504 -- ----------------------------------------------------------------------------
505 -- |--------------------------< dt_delete_validate >--------------------------|
506 -- ----------------------------------------------------------------------------
507 -- {Start Of Comments}
508 --
509 -- Description:
510 --   This procedure is used for referential integrity of datetracked
511 --   child entities when either a datetrack DELETE or ZAP is in operation
512 --   and where there is no cascading of delete defined for this entity.
513 --   For the datetrack mode of DELETE or ZAP we must ensure that no
514 --   datetracked child rows exist between the validation start and end
515 --   dates.
516 --
517 -- Prerequisites:
518 --   This procedure is called from the delete_validate.
519 --
520 -- In Parameters:
521 --
522 -- Post Success:
523 --   Processing continues.
524 --
525 -- Post Failure:
526 --   If a row exists by determining the returning Boolean value from the
527 --   generic dt_api.rows_exist function then we must supply an error via
528 --   the use of the local exception handler l_rows_exist.
529 --
530 -- Developer Implementation Notes:
531 --   This procedure should not need maintenance unless the HR Schema model
532 --   changes.
533 --
534 -- Access Status:
535 --   Internal Row Handler Use Only.
536 --
537 -- {End Of Comments}
538 -- ----------------------------------------------------------------------------
539 Procedure dt_delete_validate
540             (p_per_info_chg_cs_ler_id       in number,
541              p_datetrack_mode       in varchar2,
542          p_validation_start_date    in date,
543          p_validation_end_date  in date) Is
544 --
545   l_proc    varchar2(72)    := g_package||'dt_delete_validate';
546   l_rows_exist  Exception;
547   l_table_name  all_tables.table_name%TYPE;
548 --
549 Begin
550   hr_utility.set_location('Entering:'||l_proc, 5);
551   --
552   -- Ensure that the p_datetrack_mode argument is not null
553   --
554   hr_api.mandatory_arg_error
555     (p_api_name       => l_proc,
556      p_argument       => 'datetrack_mode',
557      p_argument_value => p_datetrack_mode);
558   --
559   -- Only perform the validation if the datetrack mode is either
560   -- DELETE or ZAP
561   --
562   If (p_datetrack_mode = 'DELETE' or
563       p_datetrack_mode = 'ZAP') then
564     --
565     --
566     -- Ensure the arguments are not null
567     --
568     hr_api.mandatory_arg_error
569       (p_api_name       => l_proc,
570        p_argument       => 'validation_start_date',
571        p_argument_value => p_validation_start_date);
572     --
573     hr_api.mandatory_arg_error
574       (p_api_name       => l_proc,
575        p_argument       => 'validation_end_date',
576        p_argument_value => p_validation_end_date);
577     --
578     hr_api.mandatory_arg_error
579       (p_api_name       => l_proc,
580        p_argument       => 'per_info_chg_cs_ler_id',
581        p_argument_value => p_per_info_chg_cs_ler_id);
582     --
583     If (dt_api.rows_exist
584           (p_base_table_name => 'ben_ler_per_info_cs_ler_f',
588            p_to_date         => p_validation_end_date)) Then
585            p_base_key_column => 'per_info_chg_cs_ler_id',
586            p_base_key_value  => p_per_info_chg_cs_ler_id,
587            p_from_date       => p_validation_start_date,
589       l_table_name := 'ben_ler_per_info_cs_ler_f';
590       Raise l_rows_exist;
591     End If;
592     --
593   End If;
594   --
595   hr_utility.set_location(' Leaving:'||l_proc, 10);
596 Exception
597   When l_rows_exist Then
598     --
599     -- A referential integrity check was violated therefore
600     -- we must error
601     --
602     ben_utility.child_exists_error(p_table_name => l_table_name);
603   When Others Then
604     --
605     -- An unhandled or unexpected error has occurred which
606     -- we must report
607     --
608     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
609     fnd_message.set_token('PROCEDURE', l_proc);
610     fnd_message.set_token('STEP','15');
611     fnd_message.raise_error;
612 End dt_delete_validate;
613 --
614 -- ----------------------------------------------------------------------------
615 -- |---------------------------< insert_validate >----------------------------|
616 -- ----------------------------------------------------------------------------
617 Procedure insert_validate
618     (p_rec           in ben_psl_shd.g_rec_type,
619      p_effective_date    in date,
620      p_datetrack_mode    in varchar2,
621      p_validation_start_date in date,
622      p_validation_end_date   in date) is
623 --
624   l_proc    varchar2(72) := g_package||'insert_validate';
625 --
626 Begin
627   hr_utility.set_location('Entering:'||l_proc, 5);
628   --
629   -- Call all supporting business operations
630   --
631   --
632   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
633   --
634   chk_per_info_chg_cs_ler_id
635   (p_per_info_chg_cs_ler_id          => p_rec.per_info_chg_cs_ler_id,
636    p_effective_date        => p_effective_date,
637    p_object_version_number => p_rec.object_version_number);
638   --
639   chk_per_info_chg_cs_ler_rl
640   (p_per_info_chg_cs_ler_id    => p_rec.per_info_chg_cs_ler_id,
641    p_per_info_chg_cs_ler_rl    => p_rec.per_info_chg_cs_ler_rl,
642    p_business_group_id     => p_rec.business_group_id,
643    p_effective_date            => p_effective_date,
644    p_object_version_number     => p_rec.object_version_number);
645   --
646   chk_table_column_val
647   (p_per_info_chg_cs_ler_id      => p_rec.per_info_chg_cs_ler_id,
648    p_source_table                => p_rec.source_table,
649    p_source_column               => p_rec.source_column,
650    p_new_val                     => p_rec.new_val,
651    p_old_val                     => p_rec.old_val,
652    p_business_group_id           => p_rec.business_group_id,
653    p_effective_date            => p_effective_date,
654    p_object_version_number       => p_rec.object_version_number);
655   --
656   chk_name_unique
657   (p_per_info_chg_cs_ler_id      => p_rec.per_info_chg_cs_ler_id,
658    p_name                        => p_rec.name,
659    p_business_group_id           => p_rec.business_group_id,
660    p_effective_date              => p_effective_date,
661    p_object_version_number       => p_rec.object_version_number);
662 
663    chk_whatif_lbl_unique
664      (p_per_info_chg_cs_ler_id      => p_rec.per_info_chg_cs_ler_id,
665       p_whatif_lbl_txt              => p_rec.whatif_lbl_txt,
666       p_business_group_id           => p_rec.business_group_id,
667       p_effective_date              => p_effective_date);
668 
669   --
670   hr_utility.set_location(' Leaving:'||l_proc, 10);
671 End insert_validate;
672 --
673 -- ----------------------------------------------------------------------------
674 -- |---------------------------< update_validate >----------------------------|
675 -- ----------------------------------------------------------------------------
676 Procedure update_validate
677     (p_rec           in ben_psl_shd.g_rec_type,
678      p_effective_date    in date,
679      p_datetrack_mode    in varchar2,
680      p_validation_start_date in date,
681      p_validation_end_date   in date) is
682 --
683   l_proc    varchar2(72) := g_package||'update_validate';
684 --
685 Begin
686   hr_utility.set_location('Entering:'||l_proc, 5);
687   --
688   -- Call all supporting business operations
689   --
690   --
691   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
692   --
693   chk_per_info_chg_cs_ler_id
694   (p_per_info_chg_cs_ler_id          => p_rec.per_info_chg_cs_ler_id,
695    p_effective_date        => p_effective_date,
696    p_object_version_number => p_rec.object_version_number);
697   --
698   chk_per_info_chg_cs_ler_rl
699   (p_per_info_chg_cs_ler_id    => p_rec.per_info_chg_cs_ler_id,
700    p_per_info_chg_cs_ler_rl    => p_rec.per_info_chg_cs_ler_rl,
701    p_business_group_id     => p_rec.business_group_id,
702    p_effective_date            => p_effective_date,
703    p_object_version_number     => p_rec.object_version_number);
704   --
705   chk_table_column_val
706   (p_per_info_chg_cs_ler_id      => p_rec.per_info_chg_cs_ler_id,
707    p_source_table                => p_rec.source_table,
708    p_source_column               => p_rec.source_column,
709    p_new_val                     => p_rec.new_val,
710    p_old_val                     => p_rec.old_val,
711    p_business_group_id           => p_rec.business_group_id,
712    p_effective_date            => p_effective_date,
713    p_object_version_number       => p_rec.object_version_number);
714   --
715   chk_name_unique
719    p_effective_date              => p_effective_date,
716   (p_per_info_chg_cs_ler_id      => p_rec.per_info_chg_cs_ler_id,
717    p_name                        => p_rec.name,
718    p_business_group_id           => p_rec.business_group_id,
720    p_object_version_number       => p_rec.object_version_number);
721   --
722   chk_whatif_lbl_unique
723        (p_per_info_chg_cs_ler_id      => p_rec.per_info_chg_cs_ler_id,
724         p_whatif_lbl_txt              => p_rec.whatif_lbl_txt,
725         p_business_group_id           => p_rec.business_group_id,
726         p_effective_date              => p_effective_date);
727 
728 
729   -- Call the datetrack update integrity operation
730   --
731   dt_update_validate
732     (
733      p_datetrack_mode                => p_datetrack_mode,
734      p_validation_start_date         => p_validation_start_date,
735      p_validation_end_date       => p_validation_end_date);
736   --
737   hr_utility.set_location(' Leaving:'||l_proc, 10);
738 End update_validate;
739 --
740 -- ----------------------------------------------------------------------------
741 -- |---------------------------< delete_validate >----------------------------|
742 -- ----------------------------------------------------------------------------
743 Procedure delete_validate
744     (p_rec           in ben_psl_shd.g_rec_type,
745      p_effective_date    in date,
746      p_datetrack_mode    in varchar2,
747      p_validation_start_date in date,
748      p_validation_end_date   in date) is
749 --
750   l_proc    varchar2(72) := g_package||'delete_validate';
751 --
752 Begin
753   hr_utility.set_location('Entering:'||l_proc, 5);
754   --
755   -- Call all supporting business operations
756   --
757   dt_delete_validate
758     (p_datetrack_mode       => p_datetrack_mode,
759      p_validation_start_date    => p_validation_start_date,
760      p_validation_end_date  => p_validation_end_date,
761      p_per_info_chg_cs_ler_id       => p_rec.per_info_chg_cs_ler_id);
762   --
763   hr_utility.set_location(' Leaving:'||l_proc, 10);
764 End delete_validate;
765 --
766 --
767 --  ---------------------------------------------------------------------------
768 --  |---------------------< return_legislation_code >-------------------------|
769 --  ---------------------------------------------------------------------------
770 --
771 function return_legislation_code
772   (p_per_info_chg_cs_ler_id in number) return varchar2 is
773   --
774   -- Declare cursor
775   --
776   cursor csr_leg_code is
777     select a.legislation_code
778     from   per_business_groups a,
779            ben_per_info_chg_cs_ler_f b
780     where b.per_info_chg_cs_ler_id      = p_per_info_chg_cs_ler_id
781     and   a.business_group_id = b.business_group_id;
782   --
783   -- Declare local variables
784   --
785   l_legislation_code  varchar2(150);
786   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
787   --
788 begin
789   --
790   hr_utility.set_location('Entering:'|| l_proc, 10);
791   --
792   -- Ensure that all the mandatory parameter are not null
793   --
794   hr_api.mandatory_arg_error(p_api_name       => l_proc,
795                              p_argument       => 'per_info_chg_cs_ler_id',
796                              p_argument_value => p_per_info_chg_cs_ler_id);
797   --
798   open csr_leg_code;
799     --
800     fetch csr_leg_code into l_legislation_code;
801     --
802     if csr_leg_code%notfound then
803       --
804       close csr_leg_code;
805       --
806       -- The primary key is invalid therefore we must error
807       --
808       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
809       fnd_message.raise_error;
810       --
811     end if;
812     --
813   close csr_leg_code;
814   --
815   hr_utility.set_location(' Leaving:'|| l_proc, 20);
816   --
817   return l_legislation_code;
818   --
819 end return_legislation_code;
820 --
821 end ben_psl_bus;