DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PPB_BUS

Source


1 Package Body per_ppb_bus as
2 /* $Header: peppbrhi.pkb 120.0 2005/05/31 14:56:26 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ppb_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code            varchar2(150)  default null;
14 g_pay_basis_id                number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_pay_basis_id                         in number
22   ,p_associated_column1                   in varchar2 default null
23   ) is
24   --
25   -- Declare cursor
26   --
27   cursor csr_sec_grp is
28     select pbg.security_group_id
29       from per_business_groups pbg
30          , per_pay_bases ppb
31      where ppb.pay_basis_id = p_pay_basis_id
32        and pbg.business_group_id = ppb.business_group_id;
33   --
34   -- Declare local variables
35   --
36   l_security_group_id number;
37   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
38   --
39 begin
40   --
41   hr_utility.set_location('Entering:'|| l_proc, 10);
42   --
43   -- Ensure that all the mandatory parameter are not null
44   --
45   hr_api.mandatory_arg_error
46     (p_api_name           => l_proc
47     ,p_argument           => 'pay_basis_id'
48     ,p_argument_value     => p_pay_basis_id
49     );
50   --
51   open csr_sec_grp;
52   fetch csr_sec_grp into l_security_group_id;
53   --
54   if csr_sec_grp%notfound then
55      --
56      close csr_sec_grp;
57      --
58      -- The primary key is invalid therefore we must error
59      --
60      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
61      hr_multi_message.add
62        (p_associated_column1
63         => nvl(p_associated_column1,'PAY_BASIS_ID')
64        );
65      --
66   else
67     close csr_sec_grp;
68     --
69     -- Set the security_group_id in CLIENT_INFO
70     --
71     hr_api.set_security_group_id
72       (p_security_group_id => l_security_group_id
73       );
74   end if;
75   --
76   hr_utility.set_location(' Leaving:'|| l_proc, 20);
77   --
78 end set_security_group_id;
79 --
80 --  ---------------------------------------------------------------------------
81 --  |---------------------< return_legislation_code >-------------------------|
82 --  ---------------------------------------------------------------------------
83 --
84 Function return_legislation_code
85   (p_pay_basis_id                         in     number
86   )
87   Return Varchar2 Is
88   --
89   -- Declare cursor
90   --
91  cursor csr_leg_code is
92     select pbg.legislation_code
93       from per_business_groups pbg
94          , per_pay_bases ppb
95      where ppb.pay_basis_id = p_pay_basis_id
96        and pbg.business_group_id = ppb.business_group_id;
97   --
98   -- Declare local variables
99   --
100   l_legislation_code  varchar2(150);
101   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
102   --
103 Begin
104   --
105   hr_utility.set_location('Entering:'|| l_proc, 10);
106   --
107   -- Ensure that all the mandatory parameter are not null
108   --
109   hr_api.mandatory_arg_error
110     (p_api_name           => l_proc
111     ,p_argument           => 'pay_basis_id'
112     ,p_argument_value     => p_pay_basis_id
113     );
114   --
115   if ( nvl(per_ppb_bus.g_pay_basis_id, hr_api.g_number)
116        = p_pay_basis_id) then
117     --
118     -- The legislation code has already been found with a previous
119     -- call to this function. Just return the value in the global
120     -- variable.
121     --
122     l_legislation_code := per_ppb_bus.g_legislation_code;
123     hr_utility.set_location(l_proc, 20);
124   else
125     --
126     -- The ID is different to the last call to this function
127     -- or this is the first call to this function.
128     --
129     open csr_leg_code;
130     fetch csr_leg_code into l_legislation_code;
131     --
132     if csr_leg_code%notfound then
133       --
134       -- The primary key is invalid therefore we must error
135       --
136       close csr_leg_code;
137       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
138       fnd_message.raise_error;
139     end if;
140     hr_utility.set_location(l_proc,30);
141     --
142     -- Set the global variables so the values are
143     -- available for the next call to this function.
144     --
145     close csr_leg_code;
146     per_ppb_bus.g_pay_basis_id                := p_pay_basis_id;
147     per_ppb_bus.g_legislation_code  := l_legislation_code;
148   end if;
149   hr_utility.set_location(' Leaving:'|| l_proc, 40);
150   return l_legislation_code;
151 end return_legislation_code;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |-----------------------< chk_pay_basis_id >--------------------------------|
155 -- ----------------------------------------------------------------------------
156 --
157 -- Description
158 --   This procedure is used to check that the primary key for the table
159 --   is created properly. It should be null on insert and
160 --   should not be able to be updated.
161 --
162 -- Pre Conditions
163 --   None.
164 --
165 -- In Parameters
166 --   pay_basis_id PK of record being inserted or updated.
167 --   object_version_number Object version number of record being
168 --                         inserted or updated.
169 --
170 -- Post Success
171 --   Processing continues
172 --
173 -- Post Failure
174 --   Errors handled by the procedure
175 --
176 -- Access Status
177 --   Internal table handler use only.
178 --
179 --
180 -- {End Of Comments}
181 -- ----------------------------------------------------------------------------
182 Procedure chk_pay_basis_id(p_pay_basis_id                     in number,
183                            p_object_version_number            in number
184                            ) is
185   --
186   l_proc         varchar2(72) := g_package||'chk_pay_basis_id';
187   l_api_updating boolean;
188   --
189 Begin
190   --
191   hr_utility.set_location('Entering:'||l_proc, 5);
192   --
193   l_api_updating := per_ppb_shd.api_updating
194     (p_pay_basis_id                     => p_pay_basis_id,
195      p_object_version_number            => p_object_version_number
196    );
197   --
198   if (l_api_updating
199      and nvl(p_pay_basis_id,hr_api.g_number)
200      <>  per_ppb_shd.g_old_rec.pay_basis_id) then
201     --
202     -- raise error as PK has changed
203     --
204     per_ppb_shd.constraint_error('PER_PAY_BASES_PK');
205     --
206   elsif not l_api_updating then
207     --
208     -- check if PK is null
209     --
210     if p_pay_basis_id is not null then
211       --
212       -- raise error as PK is not null
213       --
214       per_ppb_shd.constraint_error('PER_PAY_BASES_PK');
215       --
216     end if;
217     --
218   end if;
219   --
220   hr_utility.set_location('Leaving:'||l_proc, 10);
221   --
222   --
223 End chk_pay_basis_id;
224 --
225 --  ---------------------------------------------------------------------------
226 --  |----------------------------<  chk_rate_id  >----------------------------|
227 --  ---------------------------------------------------------------------------
228 --
229 --  Desciption :
230 --
231 --    Validates that RATE_ID in the PER_PAY_BASES table
232 --    exists for the record specified by RATE_ID.
233 --
234 --  Pre-conditions:
235 --    None.
236 --
237 --  In Arguments :
238 --    p_rate_id
239 --    p_object_version_number
240 --
241 --  Post Success :
242 --    If the above business rules are satisfied, processing continues
243 --
244 --  Post Failure :
245 --    If the above business rules are violated, an application error
246 --    is raised and processing terminates
247 --  Access Status :
248 --    Internal Table Handler Use only.
249 --
250 -- {End of Comments}
251 --
252 -- -----------------------------------------------------------------------
253 procedure chk_rate_id
254   (p_rate_id                      in      number,
255    p_pay_basis_id		  in      number default null,
256    p_object_version_number        in      number default null
257   )     is
258 --
259    l_proc          varchar2(72)    := g_package||'chk_rate_id';
260    l_exists        varchar2(1);
261    l_api_updating  boolean;
262 --
263 cursor csr_salary_basis is
264   select 'x'
265   from pay_rates
266   where rate_id = p_rate_id;
267 --
268 begin
269   hr_utility.set_location('Entering:'||l_proc, 1);
270   --
271     --
272     hr_utility.set_location(l_proc, 3);
273     --
274     open csr_salary_basis;
275     	fetch csr_salary_basis into l_exists;
276     if p_rate_id is not null then
277  	  if csr_salary_basis%notfound then
278  	    close csr_salary_basis;
279  	 per_ppb_shd.constraint_error(p_constraint_name => 'PER_PAY_BASES_FK2');
280     	  end if;
281 
282     close csr_salary_basis;
283 end if;
284     --
285   --
286   hr_utility.set_location('Leaving '||l_proc, 4);
287   --
288 end chk_rate_id;
289 --
290 --
291 --  ---------------------------------------------------------------------------
292 --  |-----------------------------<  chk_name  >------------------------------|
293 --  ---------------------------------------------------------------------------
294 --
295 --  Desciption :
296 --
297 --    Validates that NAME in the PER_PAY_BASES table
298 --    exists for the record specified by NAME.
299 --
300 --  Pre-conditions:
301 --    None.
302 --
303 --  In Arguments :
304 --    p_name
305 --    p_object_version_number
306 --
307 --  Post Success :
308 --    If the above business rules are satisfied, processing continues
309 --
310 --  Post Failure :
311 --    If the above business rules are violated, an application error
312 --    is raised and processing terminates
313 --  Access Status :
314 --    Internal Table Handler Use only.
315 --
316 -- {End of Comments}
317 --
318 -- -----------------------------------------------------------------------
319 procedure chk_name
320  (p_name                         in      varchar2,
321   p_pay_basis_id                  in      number default null,
322    p_business_group_id            in      number default null
323   )     is
324 --
325    l_proc          varchar2(72)    := g_package||'chk_name';
326    l_exists        varchar2(2);
327    l_api_updating  boolean;
328 --
329 cursor csr_name is
330          select 'Y'
331          from  per_pay_bases ppb
332          where upper(ppb.name)     = upper(p_name)
333          and ppb.business_group_id = p_business_group_id
334 --4154786
335          and  ppb.pay_basis_id <> p_pay_basis_id
336          ;
337 --
338 BEGIN
339    --
340    hr_utility.set_location('Entering:'||l_proc, 5);
341    --
342  hr_api.mandatory_arg_error
343      (p_api_name       => l_proc,
344       p_argument       => 'name',
345       p_argument_value => p_name);
346    --
347    hr_utility.set_location(l_proc,10);
348     OPEN csr_name;
349       --
350       FETCH csr_name INTO l_exists;
351        hr_utility.set_location(l_proc,15);
352       IF csr_name%FOUND THEN
353          fnd_message.set_name('PAY' ,'HR_13017_SAL_BASIS_DUP_NAME');
354          CLOSE csr_name;
355          fnd_message.raise_error;
356       END IF;
357       CLOSE csr_name;
358       --
359       --
360       hr_utility.set_location('Leaving:'||l_proc, 20);
361       --
362    end chk_name;
363 --
364 -- ----------------------------------------------------------------------------
365 -- |-------------------------< chk_pay_basis >--------------------------------|
366 -- ----------------------------------------------------------------------------
367 --
368 -- Description
369 --   This procedure is used to check that the manadatory key for the table
370 --   is setup properly.
371 --
372 -- Pre Conditions
373 --   None.
374 --
375 -- In Parameters
376 --   pay_basis  pay_basis, which is in the hr_lookups.
377 --   object_version_number Object version number of record being
378 --                         inserted or updated.
379 --
380 -- Post Success
381 --   Processing continues
382 --
383 -- Post Failure
384 --   Errors handled by the procedure
385 --
386 -- Access Status
387 --   Internal table handler use only.
388 --
389 --
390 -- {End Of Comments}
391 -- ----------------------------------------------------------------------------
392 Procedure chk_pay_basis(p_pay_basis                           in varchar2,
393                         p_object_version_number               in number
394                            ) is
395   --
396   l_proc         varchar2(72) := g_package||'chk_pay_basis';
397   l_api_updating boolean;
398   --
399 Begin
400   --
401    --
402     hr_utility.set_location('Entering:'||l_proc, 10);
403 
404      hr_api.mandatory_arg_error
405          (p_api_name       => l_proc,
406           p_argument       => 'pay_basis',
407           p_argument_value => p_pay_basis);
408 
409     --
410     -- Only proceed with validation if :
411     -- there is a pay basis being passed
412     --
413     IF  (p_pay_basis is not null) then
414       --
415       hr_utility.set_location(l_proc, 20);
416       --
417       -- Check that the reason type exists in HR_LOOKUPS
418       --
419       IF hr_api.not_exists_in_hr_lookups
420         (p_effective_date        => sysdate
421         ,p_lookup_type           => 'PAY_BASIS'
422         ,p_lookup_code           => p_pay_basis) THEN
423         --
424         hr_utility.set_location(l_proc, 30);
425         --
426         fnd_message.set_name('PER', 'HR_PSF_INVALID_PAY_BASIS');
427         hr_utility.raise_error;
428         --
429       END IF;
430       --
431     END IF;
432     --
433     hr_utility.set_location(' Leaving:'||l_proc, 40);
434 
435 End chk_pay_basis;
436 --
437 --
438 --  ---------------------------------------------------------------------------
439 --  |--------------------< chk_pay_annualization_factor  >---------------------|
440 --  ---------------------------------------------------------------------------
441 --
442 --  Desciption :
443 --
444 --    Validates that pay_annualization_factor in the PER_PAY_BASES table
445 --    has a meanigful value
446 --
447 --  Pre-conditions:
448 --    None.
449 --
450 --  In Arguments :
451 --    p_pay_annualization_factor
452 --    p_pay_basis
453 --    p_object_version_number
454 --
455 --  Post Success :
456 --    If the above business rules are satisfied, processing continues
457 --
458 --  Post Failure :
459 --    If the above business rules are violated, an application error
460 --    is raised and processing terminates
461 --  Access Status :
462 --    Internal Table Handler Use only.
463 --
464 -- {End of Comments}
465 --
466 -- -----------------------------------------------------------------------
467 procedure chk_pay_annualization_factor
468   (p_pay_annualization_factor     in      number,
469    p_pay_basis                    in      varchar2
470    )     is
471 --
472    l_proc          varchar2(72)    := g_package||'chk_pay_annualization_factor';
473    l_exists        varchar2(1);
474    l_api_updating  boolean;
475 --
476 
477 --
478 begin
479   hr_utility.set_location('Entering:'||l_proc, 1);
480   --
481   hr_utility.set_location(l_proc, 2);
482   --
483 --4154786
484 --if p_pay_basis = 'PERIOD' then
485    	if p_pay_annualization_factor is not null then
486    	-- check to make sure the hours entered are valid
487    	  if p_pay_annualization_factor > 8766 	or
488    	     p_pay_annualization_factor < 0 then
489 
490    	      fnd_message.set_name('PAY','HR_51782_PPB_INVL_ANU_HOURS');
491 		fnd_message.raise_error;
492           end if;
493 --        end if;
494     else
495     if p_pay_basis <> 'PERIOD' then
496 -- if p_pay_annualization_factor is not null then
497 
498 --if p_pay_annualization_factor > 8766 or
499 --             p_pay_annualization_factor < 0 then
500 --
501 --             fnd_message.set_name('PAY','HR_51782_PPB_INVL_ANU_HOURS');
502 --              fnd_message.raise_error;
503 -- end if;
504 --  else
505 
506      hr_api.mandatory_arg_error
507          (p_api_name       => l_proc,
508           p_argument       => 'pay_annualization_factor',
509           p_argument_value => p_pay_annualization_factor);
510    end if;
511 end if;
512   --
513   hr_utility.set_location('Leaving '||l_proc, 3);
514   --
515 end chk_pay_annualization_factor;
516 --
517 --
518 --  ---------------------------------------------------------------------------
519 --  |------------------< chk_grade_annualization_factor  >---------------------|
520 --  ---------------------------------------------------------------------------
521 --
522 --  Desciption :
523 --
524 --    Validates that grade_annualization_factor in the PER_PAY_BASES table
525 --    has a meanigful value, if p_rate_basis is entered
526 --
527 --  Pre-conditions:
528 --    None.
529 --
530 --  In Arguments :
531 --    p_grade_annualization_factor
532 --    p_pay_basis
533 --    p_object_version_number
534 --
535 --  Post Success :
536 --    If the above business rules are satisfied, processing continues
537 --
538 --  Post Failure :
539 --    If the above business rules are violated, an application error
540 --    is raised and processing terminates
541 --  Access Status :
542 --    Internal Table Handler Use only.
543 --
544 -- {End of Comments}
545 --
546 -- -----------------------------------------------------------------------
547 procedure chk_grade_annualization_factor
548   (p_grade_annualization_factor     in      number,
549    p_rate_basis                     in      varchar2
550    )     is
551 --
552    l_proc   varchar2(72)    := g_package||'chk_grade_annualization_factor';
553 
554 --
555 
556 --
557 begin
558   hr_utility.set_location('Entering:'||l_proc, 1);
559   --
560   hr_utility.set_location(l_proc, 2);
561 
562 if p_rate_basis is not null then
563   --
564   if p_rate_basis = 'PERIOD' then
565     if p_grade_annualization_factor is not  null then
566    	-- check to make sure the hours entered are valid
567    	  if p_grade_annualization_factor > 8766 or
568    	     p_grade_annualization_factor < 0 then
569    	     fnd_message.set_name('PAY','HR_51782_PPB_INVL_ANU_HOURS');
570 	     fnd_message.raise_error;
571           end if;
572      end if;
573   else
574 if p_grade_annualization_factor is not null then
575 
576   	if p_grade_annualization_factor > 8766 or
577 	                     p_grade_annualization_factor < 0 then
578 
579 	                      fnd_message.set_name('PAY','HR_51782_PPB_INVL_ANU_HOURS');
580 	                        fnd_message.raise_error;
581         end if;
582      else
583              hr_api.mandatory_arg_error
584                  (p_api_name       => l_proc,
585                   p_argument       => 'grade_annualization_factor',
586                   p_argument_value => p_grade_annualization_factor);
587   --
588      --
589      end if;
590      --
591    end if;
592 --
593 end if;
594   --
595   hr_utility.set_location('Leaving '||l_proc, 3);
596   --
597 end chk_grade_annualization_factor;
598 --
599 --
600 -- ----------------------------------------------------------------------------
601 -- |----------------------< chk_input_value_id >------------------------------|
602 -- ----------------------------------------------------------------------------
603 --
604 -- Description
605 --   This procedure is used to check that one of the foreign keys for the table
606 --   is created properly.
607 --
608 -- Pre Conditions
609 --   None.
610 --
611 -- In Parameters
612 --   input_value_id FK of record being inserted or updated.
613 --   object_version_number Object version number of record being
614 --                         inserted or updated.
615 --
616 -- Post Success
617 --   Processing continues
618 --
619 -- Post Failure
620 --   Errors handled by the procedure
621 --
622 -- Access Status
623 --   Internal table handler use only.
624 --
625 --
626 -- {End Of Comments}
627 -- ----------------------------------------------------------------------------
628 Procedure chk_input_value_id(p_input_value_id                in number,
629 			     p_business_group_id             in number,
630                              p_object_version_number         in number,
631                              p_legislation_code     in       varchar2
632                            ) is
633 
634 cursor csr_input_value is
635 select 'x'
636 from  pay_input_values_f piv,
637       pay_element_types_f pet,
638       pay_element_classifications pec
639 where piv.input_value_id = p_input_value_id
640   and piv.element_type_id = pet.element_type_id
641   and sysdate between pet.effective_start_date
642   	          and pet.effective_end_date
643   and (pet.business_group_id = p_business_group_id
644       or  pet.business_group_id is null
645       and pet.legislation_code = p_legislation_code)
646   and pet.processing_type = 'R'
647   and pet.closed_for_entry_flag = 'N'
648   and pec.classification_id = pet.classification_id
649   and pec.costing_debit_or_credit = 'D';
650   --
651   l_proc         varchar2(72) := g_package||'chk_input_value_id';
652   l_exists       varchar2(1);
653   l_api_updating boolean;
654   --
655 Begin
656   --
657   hr_utility.set_location('Entering:'||l_proc, 5);
658   --
659 
660    hr_api.mandatory_arg_error
661        (p_api_name       => l_proc,
662         p_argument       => 'input_value_id',
663         p_argument_value => p_input_value_id);
664 
665   hr_utility.set_location(l_proc, 10);
666       --
667       open csr_input_value;
668           fetch csr_input_value into l_exists;
669 
670             if csr_input_value%notfound then
671              fnd_message.set_name('PER','HR_52939_INVALID_INPUT_ID');
672 	      close csr_input_value;
673 	          fnd_message.raise_error;
674 
675            end if;
676 
677       close csr_input_value;
678       --
679     --
680     hr_utility.set_location('Leaving '||l_proc, 15);
681 
682   --
683 
684 End chk_input_value_id;
685 --
686 -- ----------------------------------------------------------------------------
687 -- |-------------------------< chk_rate_basis >-------------------------------|
688 -- ----------------------------------------------------------------------------
689 --
690 -- Description
691 --   This procedure is used to check that the manadatory key for the table
692 --   is setup properly.
693 --
694 -- Pre Conditions
695 --   None.
696 --
697 -- In Parameters
698 --   pay_basis  pay_basis, which is in the hr_lookups.
699 --   rate_basis the value must exist in pay_basis lookup table
700 --
701 -- Post Success
702 --   Processing continues
703 --
704 -- Post Failure
705 --   Errors handled by the procedure
706 --
707 --
708 -- Access Status
709 --   Internal table handler use only.
710 --
711 --
712 -- {End Of Comments}
713 -- ----------------------------------------------------------------------------
714 procedure chk_rate_basis(p_rate_basis				in varchar2,
715                          p_pay_basis				in varchar2
716                          ) is
717   --
718   l_proc         varchar2(72) := g_package||'chk_rate_basis';
719   l_api_updating boolean;
720   --
721 Begin
722   --
723    --
724     hr_utility.set_location('Entering:'||l_proc, 10);
725 
726      hr_api.mandatory_arg_error
727          (p_api_name       => l_proc,
728           p_argument       => 'pay_basis',
729           p_argument_value => p_pay_basis);
730 
731     -- Only proceed with validation if :
732     -- there is a pay basis being passed
733     --
734     IF  (p_pay_basis is not null) then
735       --
736       hr_utility.set_location(l_proc, 20);
737       --
738       -- Check that the reason type exists in HR_LOOKUPS
739       --
740       IF hr_api.not_exists_in_hr_lookups
741         (p_effective_date        => sysdate
742         ,p_lookup_type           => 'PAY_BASIS'
743         ,p_lookup_code           => p_pay_basis) THEN
744         --
745         hr_utility.set_location(l_proc, 30);
746         --
747         fnd_message.set_name('PER', 'HR_PSF_INVALID_PAY_BASIS');
748         hr_utility.raise_error;
749         --
750       END IF;
751       --
752       ELSIF p_rate_basis is not null then
753       IF hr_api.not_exists_in_hr_lookups
754               (p_effective_date        => sysdate
755               ,p_lookup_type           => 'PAY_BASIS'
756               ,p_lookup_code           => p_rate_basis) then
757 
758           hr_utility.set_location(l_proc, 40);
759           fnd_message.set_name('PER', 'PER_289917_INVALID_RATE_BASIS');
760           hr_utility.raise_error;
761        end if;
762     END IF;
763  hr_utility.set_location(' Leaving:'||l_proc, 50);
764 
765 End chk_rate_basis;
766 --
767 --  ---------------------------------------------------------------------------
768 --  |---------------------------<  chk_delete  >------------------------------|
769 --  ---------------------------------------------------------------------------
770 --
771 PROCEDURE chk_delete(p_pay_basis_id            number
772                     ,p_object_version_number   number
773                      ) is
774 
775 l_exists  varchar2(1);
776 --
777 cursor csr_assignment is
778            select 'x'
779            FROM per_all_assignments_f
780            WHERE pay_basis_id = p_pay_basis_id;
781 --
782 cursor csr_positions is
783            select 'x'
784            FROM hr_all_positions_f
785            WHERE  pay_basis_id = p_pay_basis_id;
786 
787 cursor csr_elements is
788            select 'x'
789            FROM pay_element_links_f
790            WHERE  pay_basis_id = p_pay_basis_id;
791 --
792  --
793   l_proc         varchar2(72) := g_package||'chk_delete';
794   l_api_updating boolean;
795   --
796 Begin
797   --
798   hr_utility.set_location('Entering:'||l_proc, 5);
799   --
800   --  Check there are no values in per_all_assignments_f,hr_all_positions_f
801   --  pay_elements_links_f
802   --
803 Open csr_assignment;
804   --
805  fetch csr_assignment into l_exists;
806   --
807           If csr_assignment%found Then
808             --
809             close csr_assignment;
810             --
811               fnd_message.set_name('PAY','HR_13020_SAL_ASG_EXISTS');
812             --
813             fnd_message.raise_error;
814             --
815           End If;
816   --
817 Close csr_assignment;
818 
819 Open csr_positions;
820   --
821  fetch csr_positions into l_exists;
822   --
823           If csr_positions%found Then
824             --
825             close csr_positions;
826             --
827               fnd_message.set_name('PER','PER_289918_SAL_POS_EXISTS');
828             --
829             fnd_message.raise_error;
830             --
831           End If;
832   --
833 Close csr_positions;
834 
835 Open csr_elements;
836   --
837  fetch csr_elements into l_exists;
838   --
839           If csr_elements%found Then
840             --
841             close csr_elements;
842             --
843               fnd_message.set_name('PER','PER_289919_SAL_ELEMENT_EXISTS');
844             --
845             fnd_message.raise_error;
846             --
847           End If;
848   --
849 Close csr_elements;
850   --
851 hr_utility.set_location('Leaving:'||l_proc, 20);
852         --
853   --
854 end chk_delete;
855 --
856 -- ----------------------------------------------------------------------------
857 -- |--------------------< chk_sal_basis_asg_exists >--------------------------|
858 -- ----------------------------------------------------------------------------
859 --
860 -- Description
861 --   This procedure is used to check to see if a pay basis has been assigned to
862 --   an assignment. If this is the case, then they can only update the name of
863 --   the salary basis.
864 --
865 -- Pre Conditions
866 --   None.
867 --
868 -- In Parameters
869 --   pasy_basis_id PK of record being updated.
870 --   object_version_number Object version number of record being
871 --                         updated.
872 --
873 -- Post Success
874 --   Processing continues
875 --
876 -- Post Failure
877 --   Errors handled by the procedure
878 --
879 -- Access Status
880 --   Internal table handler use only.
881 --
882 --
883 -- {End Of Comments}
884 -- ----------------------------------------------------------------------------
885 Procedure chk_sal_basis_asg_exists(
886 				p_rec in per_ppb_shd.g_rec_type
887                                    ) is
888 
889 --
890 l_proc         varchar2(72) := g_package||'chk_sal_basis_asg_exists';
891 --
892 l_api_updating boolean;
893 l_exists        varchar2(1);
894 
895 --
896 --
897 cursor csr_sal_pay_in_asg is
898           select 'Y'
899           from  PER_ALL_ASSIGNMENTS_F paa
900          where paa.pay_basis_id  = p_rec.pay_basis_id;
901 --
902 begin
903 --
904 hr_utility.set_location('Entering:'||l_proc, 10);
905 
906 	l_api_updating := per_ppb_shd.api_updating
907 	    (p_rec.pay_basis_id
908 	    ,p_rec.object_version_number
909 	   );
910 
911 if l_api_updating then
912 
913 --
914 hr_utility.set_location('Entering:'||l_proc, 15);
915 --
916 	   OPEN csr_sal_pay_in_asg;
917 	           --
918 	           FETCH csr_sal_pay_in_asg INTO l_exists;
919 	            hr_utility.set_location(l_proc,15);
920 	           IF csr_sal_pay_in_asg%FOUND THEN
921 	               -- it belongs to an assignment
922 	               -- only name can be changed
923 	             if (p_rec.name
924 		            =  per_ppb_shd.g_old_rec.name) then
925  		      hr_utility.set_location('Entering:'||l_proc, 20);
926        	              fnd_message.set_name('PER','HR_51268_PYP_CANT_UPD_RECORD');
927 	              fnd_message.raise_error;
928 		      else
929 		      hr_utility.set_location('Entering:'||l_proc, 25);
930 		       IF (p_rec.input_value_id
931 		            <>  per_ppb_shd.g_old_rec.input_value_id)
932 		      or  (p_rec.rate_id
933 		            <>  per_ppb_shd.g_old_rec.rate_id)
934 		      or  (p_rec.pay_basis
935 		            <>  per_ppb_shd.g_old_rec.pay_basis)
936 		      or  (p_rec.rate_basis
937 		            <>  per_ppb_shd.g_old_rec.rate_basis)
938 		      or  (p_rec.pay_annualization_factor
939 		            <>  per_ppb_shd.g_old_rec.pay_annualization_factor)
940 		      or  (p_rec.grade_annualization_factor
941 		            <>  per_ppb_shd.g_old_rec.grade_annualization_factor)
942 		      or  (p_rec.attribute_category
943 		            <>  per_ppb_shd.g_old_rec.attribute_category)
944 		      or  (p_rec.attribute1
945 		            <>  per_ppb_shd.g_old_rec.attribute1)
946 		      or  (p_rec.attribute2
947 		            <>  per_ppb_shd.g_old_rec.attribute2)
948 		      or  (p_rec.attribute3
949 		            <>  per_ppb_shd.g_old_rec.attribute3)
950 		      or  (p_rec.attribute4
951 		            = per_ppb_shd.g_old_rec.attribute4)
952 		      or  (p_rec.attribute5
953 		            <>  per_ppb_shd.g_old_rec.attribute5)
954 		      or  (p_rec.attribute6
955 		            <>  per_ppb_shd.g_old_rec.attribute6)
956 		      or  (p_rec.attribute7
957 		            <>  per_ppb_shd.g_old_rec.attribute7)
958 		      or  (p_rec.attribute8
959 		            <>  per_ppb_shd.g_old_rec.attribute8)
960 		      or  (p_rec.attribute9
961 		            <>  per_ppb_shd.g_old_rec.attribute9)
962 		      or  (p_rec.attribute10
963 		            <>  per_ppb_shd.g_old_rec.attribute10)
964 		      or  (p_rec.attribute11
965 		            <>  per_ppb_shd.g_old_rec.attribute11)
966 		      or  (p_rec.attribute12
967 		            <>  per_ppb_shd.g_old_rec.attribute12)
968 		      or  (p_rec.attribute13
969 		            <>  per_ppb_shd.g_old_rec.attribute13)
970 		      or  (p_rec.attribute14
971 		            <>  per_ppb_shd.g_old_rec.attribute14)
972 		      or  (p_rec.attribute15
973 		            <>  per_ppb_shd.g_old_rec.attribute15)
974 		      or  (p_rec.attribute16
975 		            <>  per_ppb_shd.g_old_rec.attribute16)
976 		      or  (p_rec.attribute17
977 		            <>  per_ppb_shd.g_old_rec.attribute17)
978 		      or  (p_rec.attribute18
979 		            <>  per_ppb_shd.g_old_rec.attribute18)
980 		      or  (p_rec.attribute19
981 		            <>  per_ppb_shd.g_old_rec.attribute19)
982 		      or  (p_rec.attribute20
983 		            <>  per_ppb_shd.g_old_rec.attribute20)
984 		      or  (p_rec.information_category
985 		            <>  per_ppb_shd.g_old_rec.information_category)
986 		      or  (p_rec.information1
987 		            <>  per_ppb_shd.g_old_rec.information1)
988 		      or  (p_rec.information2
989 		            <>  per_ppb_shd.g_old_rec.information2)
990 		      or  (p_rec.information3
991 		            <>  per_ppb_shd.g_old_rec.information3)
992 		      or  (p_rec.information4
993 		            <>  per_ppb_shd.g_old_rec.information4)
994 		      or  (p_rec.information5
995 		            =  per_ppb_shd.g_old_rec.information5)
996 		      or  (p_rec.information6
997 		            <>  per_ppb_shd.g_old_rec.information6)
998 		      or  (p_rec.information7
999 		            =  per_ppb_shd.g_old_rec.information7)
1000 		      or  (p_rec.information8
1001 		            <>  per_ppb_shd.g_old_rec.information8)
1002 		      or  (p_rec.information9
1003 		            <>  per_ppb_shd.g_old_rec.information9)
1004 		      or  (p_rec.information10
1005 		            <>  per_ppb_shd.g_old_rec.information10)
1006 		      or  (p_rec.information11
1007 		            <>  per_ppb_shd.g_old_rec.information11)
1008 		      or  (p_rec.information12
1009 		            <>  per_ppb_shd.g_old_rec.information12)
1010 		      or  (p_rec.information13
1011 		            <>  per_ppb_shd.g_old_rec.information13)
1012 		      or  (p_rec.information14
1013 		            <>  per_ppb_shd.g_old_rec.information14)
1014 		      or  (p_rec.information15
1015 		            <>  per_ppb_shd.g_old_rec.information15)
1016 		      or  (p_rec.information16
1017 		            <>  per_ppb_shd.g_old_rec.information16)
1018 		      or  (p_rec.information17
1019 		            <>  per_ppb_shd.g_old_rec.information17)
1020 		      or  (p_rec.information18
1021 		            <>  per_ppb_shd.g_old_rec.information18)
1022 		      or  (p_rec.information19
1023 		            <>  per_ppb_shd.g_old_rec.information19)
1024 		      or  (p_rec.information20
1025 		            <>  per_ppb_shd.g_old_rec.information20) THEN
1026 		            hr_utility.set_location('Entering:'||l_proc, 30);
1027                              fnd_message.set_name('PER','HR_51268_PYP_CANT_UPD_RECORD');
1028                              fnd_message.raise_error;
1029 		     end if;
1030 			--
1031 	           end if;
1032 	    CLOSE csr_sal_pay_in_asg;
1033 --
1034 end if;
1035 end if;
1036 
1037 --
1038 -- hr_utility.set_location('Leaving:'||l_proc, 35);
1039 --
1040 End chk_sal_basis_asg_exists;
1041 -- ----------------------------------------------------------------------------
1042 -- |-----------------------------< chk_ddf >----------------------------------|
1043 -- ----------------------------------------------------------------------------
1044 --
1045 -- Description:
1046 --   Validates all the Developer Descriptive Flexfield values.
1047 --
1048 -- Prerequisites:
1049 --   All other columns have been validated.  Must be called as the
1050 --   last step from insert_validate and update_validate.
1051 --
1052 -- In Arguments:
1053 --   p_rec
1054 --
1055 -- Post Success:
1056 --   If the Developer Descriptive Flexfield structure column and data values
1057 --   are all valid this procedure will end normally and processing will
1058 --   continue.
1059 --
1060 -- Post Failure:
1061 --   If the Developer Descriptive Flexfield structure column value or any of
1062 --   the data values are invalid then an application error is raised as
1063 --   a PL/SQL exception.
1064 --
1065 -- Access Status:
1066 --   Internal Row Handler Use Only.
1067 --
1068 -- ----------------------------------------------------------------------------
1069 procedure chk_ddf
1070   (p_rec in per_ppb_shd.g_rec_type
1071   ) is
1072 --
1073   l_proc   varchar2(72) := g_package || 'chk_ddf';
1074 --
1075 begin
1076   hr_utility.set_location('Entering:'||l_proc,10);
1077   --
1078   if ((p_rec.pay_basis_id is not null)  and (
1079     nvl(per_ppb_shd.g_old_rec.information_category, hr_api.g_varchar2) <>
1080     nvl(p_rec.information_category, hr_api.g_varchar2)  or
1081     nvl(per_ppb_shd.g_old_rec.information1, hr_api.g_varchar2) <>
1082     nvl(p_rec.information1, hr_api.g_varchar2)  or
1083     nvl(per_ppb_shd.g_old_rec.information2, hr_api.g_varchar2) <>
1084     nvl(p_rec.information2, hr_api.g_varchar2)  or
1085     nvl(per_ppb_shd.g_old_rec.information3, hr_api.g_varchar2) <>
1086     nvl(p_rec.information3, hr_api.g_varchar2)  or
1087     nvl(per_ppb_shd.g_old_rec.information4, hr_api.g_varchar2) <>
1088     nvl(p_rec.information4, hr_api.g_varchar2)  or
1089     nvl(per_ppb_shd.g_old_rec.information5, hr_api.g_varchar2) <>
1090     nvl(p_rec.information5, hr_api.g_varchar2)  or
1091     nvl(per_ppb_shd.g_old_rec.information6, hr_api.g_varchar2) <>
1092     nvl(p_rec.information6, hr_api.g_varchar2)  or
1093     nvl(per_ppb_shd.g_old_rec.information7, hr_api.g_varchar2) <>
1094     nvl(p_rec.information7, hr_api.g_varchar2)  or
1095     nvl(per_ppb_shd.g_old_rec.information8, hr_api.g_varchar2) <>
1096     nvl(p_rec.information8, hr_api.g_varchar2)  or
1097     nvl(per_ppb_shd.g_old_rec.information9, hr_api.g_varchar2) <>
1098     nvl(p_rec.information9, hr_api.g_varchar2)  or
1099     nvl(per_ppb_shd.g_old_rec.information10, hr_api.g_varchar2) <>
1100     nvl(p_rec.information10, hr_api.g_varchar2)  or
1101     nvl(per_ppb_shd.g_old_rec.information11, hr_api.g_varchar2) <>
1102     nvl(p_rec.information11, hr_api.g_varchar2)  or
1103     nvl(per_ppb_shd.g_old_rec.information12, hr_api.g_varchar2) <>
1104     nvl(p_rec.information12, hr_api.g_varchar2)  or
1105     nvl(per_ppb_shd.g_old_rec.information13, hr_api.g_varchar2) <>
1106     nvl(p_rec.information13, hr_api.g_varchar2)  or
1107     nvl(per_ppb_shd.g_old_rec.information14, hr_api.g_varchar2) <>
1108     nvl(p_rec.information14, hr_api.g_varchar2)  or
1109     nvl(per_ppb_shd.g_old_rec.information15, hr_api.g_varchar2) <>
1110     nvl(p_rec.information15, hr_api.g_varchar2)  or
1111     nvl(per_ppb_shd.g_old_rec.information16, hr_api.g_varchar2) <>
1112     nvl(p_rec.information16, hr_api.g_varchar2)  or
1113     nvl(per_ppb_shd.g_old_rec.information17, hr_api.g_varchar2) <>
1114     nvl(p_rec.information17, hr_api.g_varchar2)  or
1115     nvl(per_ppb_shd.g_old_rec.information18, hr_api.g_varchar2) <>
1116     nvl(p_rec.information18, hr_api.g_varchar2)  or
1117     nvl(per_ppb_shd.g_old_rec.information19, hr_api.g_varchar2) <>
1118     nvl(p_rec.information19, hr_api.g_varchar2)  or
1119     nvl(per_ppb_shd.g_old_rec.information20, hr_api.g_varchar2) <>
1120     nvl(p_rec.information20, hr_api.g_varchar2) ))
1121     or (p_rec.pay_basis_id is null)  then
1122     --
1123     -- Only execute the validation if absolutely necessary:
1124     -- a) During update, the structure column value or any
1125     --    of the attribute values have actually changed.
1126     -- b) During insert.
1127     --
1128     hr_dflex_utility.ins_or_upd_descflex_attribs
1129       (p_appl_short_name                 => 'PER'
1130       ,p_descflex_name                   => 'Salary Basis Developer DF'
1131       ,p_attribute_category              => p_rec.INFORMATION_CATEGORY
1132       ,p_attribute1_name                 => 'INFORMATION1'
1133       ,p_attribute1_value                => p_rec.information1
1134       ,p_attribute2_name                 => 'INFORMATION2'
1135       ,p_attribute2_value                => p_rec.information2
1136       ,p_attribute3_name                 => 'INFORMATION3'
1137       ,p_attribute3_value                => p_rec.information3
1138       ,p_attribute4_name                 => 'INFORMATION4'
1139       ,p_attribute4_value                => p_rec.information4
1140       ,p_attribute5_name                 => 'INFORMATION5'
1141       ,p_attribute5_value                => p_rec.information5
1142       ,p_attribute6_name                 => 'INFORMATION6'
1143       ,p_attribute6_value                => p_rec.information6
1144       ,p_attribute7_name                 => 'INFORMATION7'
1145       ,p_attribute7_value                => p_rec.information7
1146       ,p_attribute8_name                 => 'INFORMATION8'
1147       ,p_attribute8_value                => p_rec.information8
1148       ,p_attribute9_name                 => 'INFORMATION9'
1149       ,p_attribute9_value                => p_rec.information9
1150       ,p_attribute10_name                => 'INFORMATION10'
1151       ,p_attribute10_value               => p_rec.information10
1152       ,p_attribute11_name                => 'INFORMATION11'
1153       ,p_attribute11_value               => p_rec.information11
1154       ,p_attribute12_name                => 'INFORMATION12'
1155       ,p_attribute12_value               => p_rec.information12
1156       ,p_attribute13_name                => 'INFORMATION13'
1157       ,p_attribute13_value               => p_rec.information13
1158       ,p_attribute14_name                => 'INFORMATION14'
1159       ,p_attribute14_value               => p_rec.information14
1160       ,p_attribute15_name                => 'INFORMATION15'
1161       ,p_attribute15_value               => p_rec.information15
1162       ,p_attribute16_name                => 'INFORMATION16'
1163       ,p_attribute16_value               => p_rec.information16
1164       ,p_attribute17_name                => 'INFORMATION17'
1165       ,p_attribute17_value               => p_rec.information17
1166       ,p_attribute18_name                => 'INFORMATION18'
1167       ,p_attribute18_value               => p_rec.information18
1168       ,p_attribute19_name                => 'INFORMATION19'
1169       ,p_attribute19_value               => p_rec.information19
1170       ,p_attribute20_name                => 'INFORMATION20'
1171       ,p_attribute20_value               => p_rec.information20
1172       );
1173   end if;
1174   --
1175   hr_utility.set_location(' Leaving:'||l_proc,20);
1176 end chk_ddf;
1177 --
1178 -- ----------------------------------------------------------------------------
1179 -- |------------------------------< chk_df >----------------------------------|
1180 -- ----------------------------------------------------------------------------
1181 --
1182 -- Description:
1183 --   Validates all the Descriptive Flexfield values.
1184 --
1185 -- Prerequisites:
1186 --   All other columns have been validated.  Must be called as the
1187 --   last step from insert_validate and update_validate.
1188 --
1189 -- In Arguments:
1190 --   p_rec
1191 --
1192 -- Post Success:
1193 --   If the Descriptive Flexfield structure column and data values are
1194 --   all valid this procedure will end normally and processing will
1195 --   continue.
1196 --
1197 -- Post Failure:
1198 --   If the Descriptive Flexfield structure column value or any of
1199 --   the data values are invalid then an application error is raised as
1200 --   a PL/SQL exception.
1201 --
1202 -- Access Status:
1203 --   Internal Row Handler Use Only.
1204 --
1205 -- ----------------------------------------------------------------------------
1206 procedure chk_df
1207   (p_rec in per_ppb_shd.g_rec_type
1208   ) is
1209 --
1210   l_proc   varchar2(72) := g_package || 'chk_df';
1211 --
1212 begin
1213   hr_utility.set_location('Entering:'||l_proc,10);
1214   --
1215   if ((p_rec.pay_basis_id is not null)  and (
1216     nvl(per_ppb_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
1217     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
1218     nvl(per_ppb_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
1219     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
1220     nvl(per_ppb_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
1221     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
1222     nvl(per_ppb_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
1223     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
1224     nvl(per_ppb_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
1225     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
1226     nvl(per_ppb_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
1227     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
1228     nvl(per_ppb_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
1229     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
1230     nvl(per_ppb_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
1231     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
1232     nvl(per_ppb_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
1233     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
1234     nvl(per_ppb_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
1235     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
1236     nvl(per_ppb_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
1237     nvl(p_rec.attribute10, hr_api.g_varchar2)  or
1238     nvl(per_ppb_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
1239     nvl(p_rec.attribute11, hr_api.g_varchar2)  or
1240     nvl(per_ppb_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
1241     nvl(p_rec.attribute12, hr_api.g_varchar2)  or
1242     nvl(per_ppb_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
1243     nvl(p_rec.attribute13, hr_api.g_varchar2)  or
1244     nvl(per_ppb_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
1245     nvl(p_rec.attribute14, hr_api.g_varchar2)  or
1246     nvl(per_ppb_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
1247     nvl(p_rec.attribute15, hr_api.g_varchar2)  or
1248     nvl(per_ppb_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
1249     nvl(p_rec.attribute16, hr_api.g_varchar2)  or
1250     nvl(per_ppb_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
1251     nvl(p_rec.attribute17, hr_api.g_varchar2)  or
1252     nvl(per_ppb_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
1253     nvl(p_rec.attribute18, hr_api.g_varchar2)  or
1254     nvl(per_ppb_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
1255     nvl(p_rec.attribute19, hr_api.g_varchar2)  or
1256     nvl(per_ppb_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
1257     nvl(p_rec.attribute20, hr_api.g_varchar2) ))
1258     or (p_rec.pay_basis_id is null)  then
1259     --
1260     -- Only execute the validation if absolutely necessary:
1261     -- a) During update, the structure column value or any
1262     --    of the attribute values have actually changed.
1263     -- b) During insert.
1264     --
1265     hr_dflex_utility.ins_or_upd_descflex_attribs
1266       (p_appl_short_name                 => 'PER'
1267       ,p_descflex_name                   => 'PER_PAY_BASES'
1268       ,p_attribute_category              => p_rec.ATTRIBUTE_CATEGORY
1269       ,p_attribute1_name                 => 'ATTRIBUTE1'
1270       ,p_attribute1_value                => p_rec.attribute1
1271       ,p_attribute2_name                 => 'ATTRIBUTE2'
1272       ,p_attribute2_value                => p_rec.attribute2
1273       ,p_attribute3_name                 => 'ATTRIBUTE3'
1274       ,p_attribute3_value                => p_rec.attribute3
1275       ,p_attribute4_name                 => 'ATTRIBUTE4'
1276       ,p_attribute4_value                => p_rec.attribute4
1277       ,p_attribute5_name                 => 'ATTRIBUTE5'
1278       ,p_attribute5_value                => p_rec.attribute5
1279       ,p_attribute6_name                 => 'ATTRIBUTE6'
1280       ,p_attribute6_value                => p_rec.attribute6
1281       ,p_attribute7_name                 => 'ATTRIBUTE7'
1282       ,p_attribute7_value                => p_rec.attribute7
1283       ,p_attribute8_name                 => 'ATTRIBUTE8'
1284       ,p_attribute8_value                => p_rec.attribute8
1285       ,p_attribute9_name                 => 'ATTRIBUTE9'
1286       ,p_attribute9_value                => p_rec.attribute9
1287       ,p_attribute10_name                => 'ATTRIBUTE10'
1288       ,p_attribute10_value               => p_rec.attribute10
1289       ,p_attribute11_name                => 'ATTRIBUTE11'
1290       ,p_attribute11_value               => p_rec.attribute11
1291       ,p_attribute12_name                => 'ATTRIBUTE12'
1292       ,p_attribute12_value               => p_rec.attribute12
1293       ,p_attribute13_name                => 'ATTRIBUTE13'
1294       ,p_attribute13_value               => p_rec.attribute13
1295       ,p_attribute14_name                => 'ATTRIBUTE14'
1296       ,p_attribute14_value               => p_rec.attribute14
1297       ,p_attribute15_name                => 'ATTRIBUTE15'
1298       ,p_attribute15_value               => p_rec.attribute15
1299       ,p_attribute16_name                => 'ATTRIBUTE16'
1300       ,p_attribute16_value               => p_rec.attribute16
1301       ,p_attribute17_name                => 'ATTRIBUTE17'
1302       ,p_attribute17_value               => p_rec.attribute17
1303       ,p_attribute18_name                => 'ATTRIBUTE18'
1304       ,p_attribute18_value               => p_rec.attribute18
1305       ,p_attribute19_name                => 'ATTRIBUTE19'
1306       ,p_attribute19_value               => p_rec.attribute19
1307       ,p_attribute20_name                => 'ATTRIBUTE20'
1308       ,p_attribute20_value               => p_rec.attribute20
1309       );
1310   end if;
1311   --
1312   hr_utility.set_location(' Leaving:'||l_proc,20);
1313 end chk_df;
1314 --
1315 -- ----------------------------------------------------------------------------
1316 -- |-----------------------< chk_non_updateable_args >------------------------|
1317 -- ----------------------------------------------------------------------------
1318 -- {Start Of Comments}
1319 --
1320 -- Description:
1321 --   This procedure is used to ensure that non updateable attributes have
1322 --   not been updated. If an attribute has been updated an error is generated.
1323 --
1324 -- Pre Conditions:
1325 --   g_old_rec has been populated with details of the values currently in
1326 --   the database.
1327 --
1328 -- In Arguments:
1329 --   p_rec has been populated with the updated values the user would like the
1330 --   record set to.
1331 --
1332 -- Post Success:
1333 --   Processing continues if all the non updateable attributes have not
1334 --   changed.
1335 --
1336 -- Post Failure:
1337 --   An application error is raised if any of the non updatable attributes
1338 --   have been altered.
1339 --
1340 -- {End Of Comments}
1341 -- ----------------------------------------------------------------------------
1342 Procedure chk_non_updateable_args
1343   (p_rec in per_ppb_shd.g_rec_type
1344   ) IS
1345 --
1346   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
1347 --
1348 Begin
1349   --
1350   -- Only proceed with the validation if a row exists for the current
1351   -- record in the HR Schema.
1352   --
1353   IF NOT per_ppb_shd.api_updating
1354       (p_pay_basis_id                      => p_rec.pay_basis_id
1355       ,p_object_version_number             => p_rec.object_version_number
1356       ) THEN
1357      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
1358      fnd_message.set_token('PROCEDURE ', l_proc);
1359      fnd_message.set_token('STEP ', '5');
1360      fnd_message.raise_error;
1361   END IF;
1362   --
1363   -- EDIT_HERE: Add checks to ensure non-updateable args have
1364   --            not been updated.
1365   --
1366 End chk_non_updateable_args;
1367 --
1368 -- ----------------------------------------------------------------------------
1369 -- |---------------------------< insert_validate >----------------------------|
1370 -- ----------------------------------------------------------------------------
1371 Procedure insert_validate
1372   (p_rec                          in per_ppb_shd.g_rec_type
1373   ) is
1374 --
1375   l_proc  varchar2(72) := g_package||'insert_validate';
1376   l_leg_code  varchar2(30);
1377 --
1378 Begin
1379 
1380 
1381     select pbg.legislation_code
1382       into l_leg_code
1383       from per_business_groups_perf pbg
1384        where pbg.business_group_id = p_rec.business_group_id;
1385 
1386 --
1387   hr_utility.set_location('Entering:'||l_proc, 5);
1388   --
1389   -- Call all supporting business operations
1390   --
1391   hr_api.validate_bus_grp_id
1392     (p_business_group_id => p_rec.business_group_id
1393     ,p_associated_column1 => per_ppb_shd.g_tab_nam
1394                               || '.BUSINESS_GROUP_ID');
1395   --
1396  chk_pay_basis_id(p_pay_basis_id            => p_rec.pay_basis_id,
1397                   p_object_version_number   => p_rec.object_version_number
1398                            );
1399   -- After validating the set of important attributes,
1400   -- if Multiple Message detection is enabled and at least
1401   -- one error has been found then abort further validation.
1402   --
1403   hr_multi_message.end_validation_set;
1404   --
1405   -- Validate Dependent Attributes
1406   --
1407 chk_rate_id
1408   (p_rate_id                      => p_rec.rate_id,
1409    p_pay_basis_id                 => p_rec.pay_basis_id,
1410    p_object_version_number        => p_rec.object_version_number
1411   ) ;
1412   --
1413  chk_name
1414  (p_name                          => p_rec.name,
1415   p_business_group_id            => p_rec.business_group_id
1416   )    ;
1417   --
1418  chk_pay_basis(p_pay_basis             => p_rec.pay_basis,
1419                p_object_version_number => p_rec.object_version_number
1420                );
1421   --
1422 
1423 chk_pay_annualization_factor
1424  (p_pay_annualization_factor     => p_rec.pay_annualization_factor,
1425   p_pay_basis                    => p_rec.pay_basis
1426   );
1427 --
1428 chk_grade_annualization_factor
1429   (p_grade_annualization_factor     => p_rec.grade_annualization_factor,
1430    p_rate_basis                     => p_rec.rate_basis
1431   );
1432   --
1433 chk_input_value_id(p_input_value_id        => p_rec.input_value_id,
1434                    p_business_group_id     => p_rec.business_group_id,
1435                    p_object_version_number => p_rec.object_version_number,
1436                    p_legislation_code      => l_leg_code
1437                    );
1438   --
1439 chk_rate_basis(p_rate_basis            => p_rec.rate_basis,
1440                p_pay_basis             => p_rec.pay_basis
1441                          );
1442   --
1443 --  per_ppb_bus.chk_ddf(p_rec);
1444   --
1445   per_ppb_bus.chk_df(p_rec);
1446   --
1447   hr_utility.set_location(' Leaving:'||l_proc, 10);
1448 End insert_validate;
1449 --
1450 -- ----------------------------------------------------------------------------
1451 -- |---------------------------< update_validate >----------------------------|
1452 -- ----------------------------------------------------------------------------
1453 Procedure update_validate
1454   (p_rec                          in per_ppb_shd.g_rec_type
1455   ) is
1456 --
1457   l_proc  varchar2(72) := g_package||'update_validate';
1458   l_leg_code  varchar2(30);
1459 --
1460 Begin
1461  select pbg.legislation_code
1462       into l_leg_code
1463       from per_business_groups_perf pbg
1464          , per_pay_bases ppb
1465      where ppb.pay_basis_id = p_rec.pay_basis_id
1466        and pbg.business_group_id = ppb.business_group_id;
1467 --
1468   hr_utility.set_location('Entering:'||l_proc, 5);
1469   --
1470   -- Call all supporting business operations
1471   --
1472   hr_api.validate_bus_grp_id
1473     (p_business_group_id => p_rec.business_group_id
1474     ,p_associated_column1 => per_ppb_shd.g_tab_nam
1475                               || '.BUSINESS_GROUP_ID');
1476   --
1477  chk_pay_basis_id(p_pay_basis_id            => p_rec.pay_basis_id,
1478                   p_object_version_number   => p_rec.object_version_number
1479                            );
1480 --
1481 chk_sal_basis_asg_exists(p_rec);
1482   --
1483   -- After validating the set of important attributes,
1484   -- if Multiple Message detection is enabled and at least
1485   -- one error has been found then abort further validation.
1486   --
1487   hr_multi_message.end_validation_set;
1488   --
1489   -- Validate Dependent Attributes
1490   --
1491   chk_non_updateable_args
1492     (p_rec              => p_rec
1493     );
1494   --
1495 chk_rate_id
1496   (p_rate_id                      => p_rec.rate_id,
1497    p_pay_basis_id                 => p_rec.pay_basis_id,
1498    p_object_version_number        => p_rec.object_version_number
1499   ) ;
1500   --
1501 chk_name
1502  (p_name                          => p_rec.name,
1503   p_pay_basis_id                 => p_rec.pay_basis_id,
1504   p_business_group_id            => p_rec.business_group_id
1505   )    ;
1506 --
1507 chk_pay_basis(p_pay_basis             => p_rec.pay_basis,
1508               p_object_version_number => p_rec.object_version_number
1509               );
1510 
1511 --
1512 hr_utility.set_location('pay annual'||p_rec.pay_annualization_factor||l_proc, 666);
1513 chk_pay_annualization_factor
1514   (p_pay_annualization_factor     => p_rec.pay_annualization_factor,
1515    p_pay_basis                    => p_rec.pay_basis
1516    );
1517 --
1518 chk_grade_annualization_factor
1519   (p_grade_annualization_factor     => p_rec.grade_annualization_factor,
1520    p_rate_basis                     => p_rec.rate_basis
1521   );
1522   --
1523 chk_input_value_id(p_input_value_id        => p_rec.input_value_id,
1524                    p_business_group_id     => p_rec.business_group_id,
1525                    p_object_version_number => p_rec.object_version_number,
1526                    p_legislation_code      => l_leg_code
1527                    );
1528   --
1529 chk_rate_basis(p_rate_basis            => p_rec.rate_basis,
1530                p_pay_basis             => p_rec.pay_basis
1531                );
1532   --
1533 --  per_ppb_bus.chk_ddf(p_rec);
1534   --
1535   per_ppb_bus.chk_df(p_rec);
1536   --
1537   hr_utility.set_location(' Leaving:'||l_proc, 10);
1538 End update_validate;
1539 --
1540 -- ----------------------------------------------------------------------------
1541 -- |---------------------------< delete_validate >----------------------------|
1542 -- ----------------------------------------------------------------------------
1543 Procedure delete_validate
1544   (p_rec                          in per_ppb_shd.g_rec_type
1545   ) is
1546 --
1547   l_proc  varchar2(72) := g_package||'delete_validate';
1548 --
1549 Begin
1550   hr_utility.set_location('Entering:'||l_proc, 5);
1551   --
1552   -- Call all supporting business operations
1553   --
1554 chk_delete(p_pay_basis_id           => p_rec.Pay_basis_id
1555           ,p_object_version_number  => p_rec.object_version_number
1556            );
1557   hr_utility.set_location(' Leaving:'||l_proc, 10);
1558 End delete_validate;
1559 --
1560 end per_ppb_bus;