DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_CRD_BUS

Source


1 Package Body pqh_crd_bus as
2 /* $Header: pqcrdrhi.pkb 120.0 2005/05/29 01:45 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_crd_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_criteria_rate_defn_id       number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_criteria_rate_defn_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            pbg.legislation_code
30       from per_business_groups_perf pbg
31          , pqh_criteria_rate_defn crd
32      where crd.criteria_rate_defn_id = p_criteria_rate_defn_id
33        and pbg.business_group_id (+) = crd.business_group_id;
34   --
35   -- Declare local variables
36   --
37   l_security_group_id number;
38   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
39   l_legislation_code  varchar2(150);
40   --
41 begin
42   --
43   hr_utility.set_location('Entering:'|| l_proc, 10);
44   --
45   -- Ensure that all the mandatory parameter are not null
46   --
47   hr_api.mandatory_arg_error
48     (p_api_name           => l_proc
49     ,p_argument           => 'criteria_rate_defn_id'
50     ,p_argument_value     => p_criteria_rate_defn_id
51     );
52   --
53   open csr_sec_grp;
54   fetch csr_sec_grp into l_security_group_id
55                        , l_legislation_code;
56   --
57   if csr_sec_grp%notfound then
58      --
59      close csr_sec_grp;
60      --
61      -- The primary key is invalid therefore we must error
62      --
63      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
64      hr_multi_message.add
65        (p_associated_column1
66         => nvl(p_associated_column1,'CRITERIA_RATE_DEFN_ID')
67        );
68      --
69   else
70     close csr_sec_grp;
71     --
72     -- Set the security_group_id in CLIENT_INFO
73     --
74     hr_api.set_security_group_id
75       (p_security_group_id => l_security_group_id
76       );
77     --
78     -- Set the sessions legislation context in HR_SESSION_DATA
79     --
80     hr_api.set_legislation_context(l_legislation_code);
81   end if;
82   --
83   hr_utility.set_location(' Leaving:'|| l_proc, 20);
84   --
85 end set_security_group_id;
86 --
87 --  ---------------------------------------------------------------------------
88 --  |---------------------< return_legislation_code >-------------------------|
89 --  ---------------------------------------------------------------------------
90 --
91 Function return_legislation_code
92   (p_criteria_rate_defn_id                in     number
93   )
94   Return Varchar2 Is
95   --
96   -- Declare cursor
97   --
98   cursor csr_leg_code is
99     select pbg.legislation_code
100       from per_business_groups_perf pbg
101          , pqh_criteria_rate_defn crd
102      where crd.criteria_rate_defn_id = p_criteria_rate_defn_id
103        and pbg.business_group_id (+) = crd.business_group_id;
104   --
105   -- Declare local variables
106   --
107   l_legislation_code  varchar2(150);
108   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
109   --
110 Begin
111   --
112   hr_utility.set_location('Entering:'|| l_proc, 10);
113   --
114   -- Ensure that all the mandatory parameter are not null
115   --
116   hr_api.mandatory_arg_error
117     (p_api_name           => l_proc
118     ,p_argument           => 'criteria_rate_defn_id'
119     ,p_argument_value     => p_criteria_rate_defn_id
120     );
121   --
122   if ( nvl(pqh_crd_bus.g_criteria_rate_defn_id, hr_api.g_number)
123        = p_criteria_rate_defn_id) then
124     --
125     -- The legislation code has already been found with a previous
126     -- call to this function. Just return the value in the global
127     -- variable.
128     --
129     l_legislation_code := pqh_crd_bus.g_legislation_code;
130     hr_utility.set_location(l_proc, 20);
131   else
132     --
133     -- The ID is different to the last call to this function
134     -- or this is the first call to this function.
135     --
136     open csr_leg_code;
137     fetch csr_leg_code into l_legislation_code;
138     --
139     if csr_leg_code%notfound then
140       --
141       -- The primary key is invalid therefore we must error
142       --
143       close csr_leg_code;
144       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
145       fnd_message.raise_error;
146     end if;
147     hr_utility.set_location(l_proc,30);
148     --
149     -- Set the global variables so the values are
150     -- available for the next call to this function.
151     --
152     close csr_leg_code;
153     pqh_crd_bus.g_criteria_rate_defn_id       := p_criteria_rate_defn_id;
154     pqh_crd_bus.g_legislation_code  := l_legislation_code;
155   end if;
156   hr_utility.set_location(' Leaving:'|| l_proc, 40);
157   return l_legislation_code;
158 end return_legislation_code;
159 --
160 -- ----------------------------------------------------------------------------
161 -- |------------------------------< chk_df >----------------------------------|
162 -- ----------------------------------------------------------------------------
163 --
164 -- Description:
165 --   Validates all the Descriptive Flexfield values.
166 --
167 -- Prerequisites:
168 --   All other columns have been validated.  Must be called as the
169 --   last step from insert_validate and update_validate.
170 --
171 -- In Arguments:
172 --   p_rec
173 --
174 -- Post Success:
175 --   If the Descriptive Flexfield structure column and data values are
176 --   all valid this procedure will end normally and processing will
177 --   continue.
178 --
179 -- Post Failure:
180 --   If the Descriptive Flexfield structure column value or any of
181 --   the data values are invalid then an application error is raised as
182 --   a PL/SQL exception.
183 --
184 -- Access Status:
185 --   Internal Row Handler Use Only.
186 --
187 -- ----------------------------------------------------------------------------
188 procedure chk_df
189   (p_rec in pqh_crd_shd.g_rec_type
190   ) is
191 --
192   l_proc   varchar2(72) := g_package || 'chk_df';
193 --
194 begin
195   hr_utility.set_location('Entering:'||l_proc,10);
196   --
197   if ((p_rec.criteria_rate_defn_id is not null)  and (
198     nvl(pqh_crd_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
199     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
200     nvl(pqh_crd_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
201     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
202     nvl(pqh_crd_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
203     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
204     nvl(pqh_crd_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
205     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
206     nvl(pqh_crd_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
207     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
208     nvl(pqh_crd_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
209     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
210     nvl(pqh_crd_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
211     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
212     nvl(pqh_crd_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
213     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
214     nvl(pqh_crd_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
215     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
216     nvl(pqh_crd_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
217     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
218     nvl(pqh_crd_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
219     nvl(p_rec.attribute10, hr_api.g_varchar2)  or
220     nvl(pqh_crd_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
221     nvl(p_rec.attribute11, hr_api.g_varchar2)  or
222     nvl(pqh_crd_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
223     nvl(p_rec.attribute12, hr_api.g_varchar2)  or
224     nvl(pqh_crd_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
225     nvl(p_rec.attribute13, hr_api.g_varchar2)  or
226     nvl(pqh_crd_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
227     nvl(p_rec.attribute14, hr_api.g_varchar2)  or
228     nvl(pqh_crd_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
229     nvl(p_rec.attribute15, hr_api.g_varchar2)  or
230     nvl(pqh_crd_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
231     nvl(p_rec.attribute16, hr_api.g_varchar2)  or
232     nvl(pqh_crd_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
233     nvl(p_rec.attribute17, hr_api.g_varchar2)  or
234     nvl(pqh_crd_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
235     nvl(p_rec.attribute18, hr_api.g_varchar2)  or
236     nvl(pqh_crd_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
237     nvl(p_rec.attribute19, hr_api.g_varchar2)  or
238     nvl(pqh_crd_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
239     nvl(p_rec.attribute20, hr_api.g_varchar2)  or
240     nvl(pqh_crd_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
241     nvl(p_rec.attribute21, hr_api.g_varchar2)  or
242     nvl(pqh_crd_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
243     nvl(p_rec.attribute22, hr_api.g_varchar2)  or
244     nvl(pqh_crd_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
245     nvl(p_rec.attribute23, hr_api.g_varchar2)  or
246     nvl(pqh_crd_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
247     nvl(p_rec.attribute24, hr_api.g_varchar2)  or
248     nvl(pqh_crd_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
249     nvl(p_rec.attribute25, hr_api.g_varchar2)  or
250     nvl(pqh_crd_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
251     nvl(p_rec.attribute26, hr_api.g_varchar2)  or
252     nvl(pqh_crd_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
253     nvl(p_rec.attribute27, hr_api.g_varchar2)  or
254     nvl(pqh_crd_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
255     nvl(p_rec.attribute28, hr_api.g_varchar2)  or
256     nvl(pqh_crd_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
257     nvl(p_rec.attribute29, hr_api.g_varchar2)  or
258     nvl(pqh_crd_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
259     nvl(p_rec.attribute30, hr_api.g_varchar2) ))
260     or (p_rec.criteria_rate_defn_id is null)  then
261     --
262     -- Only execute the validation if absolutely necessary:
263     -- a) During update, the structure column value or any
264     --    of the attribute values have actually changed.
265     -- b) During insert.
266     --
267     hr_dflex_utility.ins_or_upd_descflex_attribs
268       (p_appl_short_name                 => 'PQH'
269       ,p_descflex_name                   => 'EDIT_HERE: Enter descflex name'
270       ,p_attribute_category              => p_rec.attribute_category
271       ,p_attribute1_name                 => 'ATTRIBUTE1'
272       ,p_attribute1_value                => p_rec.attribute1
273       ,p_attribute2_name                 => 'ATTRIBUTE2'
274       ,p_attribute2_value                => p_rec.attribute2
275       ,p_attribute3_name                 => 'ATTRIBUTE3'
276       ,p_attribute3_value                => p_rec.attribute3
277       ,p_attribute4_name                 => 'ATTRIBUTE4'
278       ,p_attribute4_value                => p_rec.attribute4
279       ,p_attribute5_name                 => 'ATTRIBUTE5'
280       ,p_attribute5_value                => p_rec.attribute5
281       ,p_attribute6_name                 => 'ATTRIBUTE6'
282       ,p_attribute6_value                => p_rec.attribute6
283       ,p_attribute7_name                 => 'ATTRIBUTE7'
284       ,p_attribute7_value                => p_rec.attribute7
285       ,p_attribute8_name                 => 'ATTRIBUTE8'
286       ,p_attribute8_value                => p_rec.attribute8
287       ,p_attribute9_name                 => 'ATTRIBUTE9'
288       ,p_attribute9_value                => p_rec.attribute9
289       ,p_attribute10_name                => 'ATTRIBUTE10'
290       ,p_attribute10_value               => p_rec.attribute10
291       ,p_attribute11_name                => 'ATTRIBUTE11'
292       ,p_attribute11_value               => p_rec.attribute11
293       ,p_attribute12_name                => 'ATTRIBUTE12'
294       ,p_attribute12_value               => p_rec.attribute12
295       ,p_attribute13_name                => 'ATTRIBUTE13'
296       ,p_attribute13_value               => p_rec.attribute13
297       ,p_attribute14_name                => 'ATTRIBUTE14'
298       ,p_attribute14_value               => p_rec.attribute14
299       ,p_attribute15_name                => 'ATTRIBUTE15'
300       ,p_attribute15_value               => p_rec.attribute15
301       ,p_attribute16_name                => 'ATTRIBUTE16'
302       ,p_attribute16_value               => p_rec.attribute16
303       ,p_attribute17_name                => 'ATTRIBUTE17'
304       ,p_attribute17_value               => p_rec.attribute17
305       ,p_attribute18_name                => 'ATTRIBUTE18'
306       ,p_attribute18_value               => p_rec.attribute18
307       ,p_attribute19_name                => 'ATTRIBUTE19'
308       ,p_attribute19_value               => p_rec.attribute19
309       ,p_attribute20_name                => 'ATTRIBUTE20'
310       ,p_attribute20_value               => p_rec.attribute20
311       ,p_attribute21_name                => 'ATTRIBUTE21'
312       ,p_attribute21_value               => p_rec.attribute21
313       ,p_attribute22_name                => 'ATTRIBUTE22'
314       ,p_attribute22_value               => p_rec.attribute22
315       ,p_attribute23_name                => 'ATTRIBUTE23'
316       ,p_attribute23_value               => p_rec.attribute23
317       ,p_attribute24_name                => 'ATTRIBUTE24'
318       ,p_attribute24_value               => p_rec.attribute24
319       ,p_attribute25_name                => 'ATTRIBUTE25'
320       ,p_attribute25_value               => p_rec.attribute25
321       ,p_attribute26_name                => 'ATTRIBUTE26'
322       ,p_attribute26_value               => p_rec.attribute26
323       ,p_attribute27_name                => 'ATTRIBUTE27'
324       ,p_attribute27_value               => p_rec.attribute27
325       ,p_attribute28_name                => 'ATTRIBUTE28'
326       ,p_attribute28_value               => p_rec.attribute28
327       ,p_attribute29_name                => 'ATTRIBUTE29'
328       ,p_attribute29_value               => p_rec.attribute29
329       ,p_attribute30_name                => 'ATTRIBUTE30'
330       ,p_attribute30_value               => p_rec.attribute30
331       );
332   end if;
333   --
334   hr_utility.set_location(' Leaving:'||l_proc,20);
335 end chk_df;
336 --
337 -- ----------------------------------------------------------------------------
338 -- |-----------------------< chk_non_updateable_args >------------------------|
339 -- ----------------------------------------------------------------------------
343 --   This procedure is used to ensure that non updateable attributes have
340 -- {Start Of Comments}
341 --
342 -- Description:
344 --   not been updated. If an attribute has been updated an error is generated.
345 --
346 -- Pre Conditions:
347 --   g_old_rec has been populated with details of the values currently in
348 --   the database.
349 --
350 -- In Arguments:
351 --   p_rec has been populated with the updated values the user would like the
352 --   record set to.
353 --
354 -- Post Success:
355 --   Processing continues if all the non updateable attributes have not
356 --   changed.
357 --
358 -- Post Failure:
359 --   An application error is raised if any of the non updatable attributes
360 --   have been altered.
361 --
362 -- {End Of Comments}
363 -- ----------------------------------------------------------------------------
364 Procedure chk_non_updateable_args
365   (p_effective_date               in date
366   ,p_rec in pqh_crd_shd.g_rec_type
367   ) IS
368 --
369   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
370 --
371 Begin
372   --
373   -- Only proceed with the validation if a row exists for the current
374   -- record in the HR Schema.
375   --
376   IF NOT pqh_crd_shd.api_updating
377       (p_criteria_rate_defn_id             => p_rec.criteria_rate_defn_id
378       ,p_object_version_number             => p_rec.object_version_number
379       ) THEN
380      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
381      fnd_message.set_token('PROCEDURE ', l_proc);
382      fnd_message.set_token('STEP ', '5');
383      fnd_message.raise_error;
384   END IF;
385   --
386   -- EDIT_HERE: Add checks to ensure non-updateable args have
387   --            not been updated.
388   --
389   if nvl(p_rec.business_group_id, hr_api.g_number) <>
390 	     nvl(pqh_crd_shd.g_old_rec.business_group_id
391 	        ,hr_api.g_number
392 	        ) then
393 	    hr_api.argument_changed_error
394 	      (p_api_name   => l_proc
395 	      ,p_argument   => 'BUSINESS_GROUP_ID'
396 	      ,p_base_table => pqh_crd_shd.g_tab_nam
397 	      );
398   end if;
399   --
400 End chk_non_updateable_args;
401 --
402 -- ----------------------------------------------------------------------------
403 -- |----------------------< chk_startup_action >------------------------------|
404 -- ----------------------------------------------------------------------------
405 --
406 -- Description:
407 --  This procedure will check that the current action is allowed according
408 --  to the current startup mode.
409 --
410 -- ----------------------------------------------------------------------------
411 PROCEDURE chk_startup_action
412   (p_insert               IN boolean
413   ,p_business_group_id    IN number
414   ,p_legislation_code     IN varchar2
415   ,p_legislation_subgroup IN varchar2 DEFAULT NULL) IS
416 --
417 BEGIN
418   --
419   -- Call the supporting procedure to check startup mode
420   -- EDIT_HERE: The following call should be edited if certain types of rows
421   -- are not permitted.
422   IF (p_insert) THEN
423     hr_startup_data_api_support.chk_startup_action
424       (p_generic_allowed   => TRUE
425       ,p_startup_allowed   => TRUE
426       ,p_user_allowed      => TRUE
427       ,p_business_group_id => p_business_group_id
428       ,p_legislation_code  => p_legislation_code
429       ,p_legislation_subgroup => p_legislation_subgroup
430       );
431   ELSE
432     hr_startup_data_api_support.chk_upd_del_startup_action
433       (p_generic_allowed   => TRUE
434       ,p_startup_allowed   => TRUE
435       ,p_user_allowed      => TRUE
436       ,p_business_group_id => p_business_group_id
437       ,p_legislation_code  => p_legislation_code
438       ,p_legislation_subgroup => p_legislation_subgroup
439       );
440   END IF;
441   --
442 END chk_startup_action;
443 --
444 -- ----------------------------------------------------------------------------
445 -- |-------------------< chk_reference_period_cd >----------------------------|
446 -- ----------------------------------------------------------------------------
447 Procedure chk_reference_period_cd
448                            (p_criteria_rate_defn_id       in number,
449                             p_reference_period_cd         in varchar2,
450                             p_effective_date              in date,
451                             p_object_version_number       in number) is
452   --
453   l_proc         varchar2(72) := g_package||'chk_reference_period_cd';
454   l_api_updating boolean;
455   --
456 Begin
457   --
458   hr_utility.set_location('Entering:'||l_proc, 5);
459   --
460   l_api_updating := pqh_crd_shd.api_updating
461     (p_criteria_rate_defn_id       => p_criteria_rate_defn_id,
462      p_object_version_number       => p_object_version_number);
463   --
464   if (l_api_updating
465       and p_reference_period_cd
466       <> nvl(pqh_crd_shd.g_old_rec.reference_period_cd,hr_api.g_varchar2)
467       or not l_api_updating)
468       and p_reference_period_cd is not null then
469     --
470     -- check if value of lookup falls within lookup type.
471     --
472     if hr_api.not_exists_in_hr_lookups
473           (p_lookup_type    => 'PQH_RBC_REFERENCE_PERIOD',
474            p_lookup_code    => p_reference_period_cd,
475            p_effective_date => p_effective_date) then
476       --
477       -- raise error as does not exist as lookup
478       --
479       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
480       hr_utility.raise_error;
481       --
482     end if;
483     --
484   end if;
485   --
486   hr_utility.set_location('Leaving:'||l_proc,10);
487   --
488 end chk_reference_period_cd;
489 
490 --
491 -- ----------------------------------------------------------------------------
492 -- |-------------------< chk_rate_calc_cd >----------------------------|
493 -- ----------------------------------------------------------------------------
494 Procedure chk_rate_calc_cd
495                            (p_criteria_rate_defn_id       in number,
496                             p_rate_calc_cd         in varchar2,
497                             p_effective_date              in date,
498                             p_object_version_number       in number) is
499   --
500   l_proc         varchar2(72) := g_package||'chk_rate_calc_cd';
501   l_api_updating boolean;
502   --
503 Begin
504   --
505   hr_utility.set_location('Entering:'||l_proc, 5);
506   --
510   --
507   l_api_updating := pqh_crd_shd.api_updating
508     (p_criteria_rate_defn_id       => p_criteria_rate_defn_id,
509      p_object_version_number       => p_object_version_number);
511   if (l_api_updating
512       and p_rate_calc_cd
513       <> nvl(pqh_crd_shd.g_old_rec.rate_calc_cd,hr_api.g_varchar2)
514       or not l_api_updating)
515       and p_rate_calc_cd is not null then
516     --
517     -- check if value of lookup falls within lookup type.
518     --
519     if hr_api.not_exists_in_hr_lookups
520           (p_lookup_type    => 'PQH_RBC_RATE_CALC_METHOD',
521            p_lookup_code    => p_rate_calc_cd,
522            p_effective_date => p_effective_date) then
523       --
524       -- raise error as does not exist as lookup
525       --
526       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
527       hr_utility.raise_error;
528       --
529     end if;
530     --
531   end if;
532   --
533   hr_utility.set_location('Leaving:'||l_proc,10);
534   --
535 end chk_rate_calc_cd;
536 
537 --
538 -- ----------------------------------------------------------------------------
539 -- |-------------------< chk_uom >----------------------------|
540 -- ----------------------------------------------------------------------------
541 Procedure chk_uom
542                            (p_criteria_rate_defn_id       in number,
543                             p_uom         in varchar2,
544                             p_effective_date              in date,
545                             p_object_version_number       in number) is
546   --
547   l_proc         varchar2(72) := g_package||'chk_uom';
548   l_api_updating boolean;
549   --
550 Begin
551   --
552   hr_utility.set_location('Entering:'||l_proc, 5);
553   --
554   l_api_updating := pqh_crd_shd.api_updating
555     (p_criteria_rate_defn_id       => p_criteria_rate_defn_id,
556      p_object_version_number       => p_object_version_number);
557   --
558   if (l_api_updating
559       and p_uom
560       <> nvl(pqh_crd_shd.g_old_rec.uom,hr_api.g_varchar2)
561       or not l_api_updating)
562       and p_uom is not null then
563     --
564     -- check if value of lookup falls within lookup type.
565     --
566     if hr_api.not_exists_in_hr_lookups
567           (p_lookup_type    => 'PQH_RBC_UOM',
568            p_lookup_code    => p_uom,
569            p_effective_date => p_effective_date) then
570       --
571       -- raise error as does not exist as lookup
572       --
573       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
574       hr_utility.raise_error;
575       --
576     end if;
577     --
578   end if;
579   --
580   hr_utility.set_location('Leaving:'||l_proc,10);
581   --
582 end chk_uom;
583 
584 --
585 -- ----------------------------------------------------------------------------
586 -- |-------------------< chk_preferential_rate_cd >----------------------------|
587 -- ----------------------------------------------------------------------------
588 Procedure chk_preferential_rate_cd
589                            (p_criteria_rate_defn_id       in number,
590                             p_preferential_rate_cd         in varchar2,
591                             p_effective_date              in date,
592                             p_object_version_number       in number) is
593   --
594   l_proc         varchar2(72) := g_package||'chk_preferential_rate_cd';
595   l_api_updating boolean;
596   --
597 Begin
598   --
599   hr_utility.set_location('Entering:'||l_proc, 5);
600   --
601   l_api_updating := pqh_crd_shd.api_updating
602     (p_criteria_rate_defn_id       => p_criteria_rate_defn_id,
603      p_object_version_number       => p_object_version_number);
604   --
605   if (l_api_updating
606       and p_preferential_rate_cd
607       <> nvl(pqh_crd_shd.g_old_rec.preferential_rate_cd,hr_api.g_varchar2)
608       or not l_api_updating)
609       and p_preferential_rate_cd is not null then
610     --
611     -- check if value of lookup falls within lookup type.
612     --
613     if hr_api.not_exists_in_hr_lookups
614           (p_lookup_type    => 'PQH_RBC_PEFERENTIAL_RATE',
615            p_lookup_code    => p_preferential_rate_cd,
616            p_effective_date => p_effective_date) then
617       --
618       -- raise error as does not exist as lookup
619       --
620       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
621       hr_utility.raise_error;
622       --
623     end if;
624     --
625   end if;
626   --
627   hr_utility.set_location('Leaving:'||l_proc,10);
628   --
629 end chk_preferential_rate_cd;
630 
631 --
632 -- ----------------------------------------------------------------------------
633 -- |-------------------< chk_rounding_cd >----------------------------|
634 -- ----------------------------------------------------------------------------
635 Procedure chk_rounding_cd
636                            (p_criteria_rate_defn_id       in number,
637                             p_rounding_cd         in varchar2,
638                             p_effective_date              in date,
639                             p_object_version_number       in number) is
640   --
641   l_proc         varchar2(72) := g_package||'chk_rounding_cd';
642   l_api_updating boolean;
643   --
644 Begin
645   --
646   hr_utility.set_location('Entering:'||l_proc, 5);
647   --
648   l_api_updating := pqh_crd_shd.api_updating
649     (p_criteria_rate_defn_id       => p_criteria_rate_defn_id,
650      p_object_version_number       => p_object_version_number);
651   --
652   if (l_api_updating
653       and p_rounding_cd
657     --
654       <> nvl(pqh_crd_shd.g_old_rec.rounding_cd,hr_api.g_varchar2)
655       or not l_api_updating)
656       and p_rounding_cd is not null then
658     -- check if value of lookup falls within lookup type.
659     --
660     if hr_api.not_exists_in_hr_lookups
661           (p_lookup_type    => 'PQH_RBC_ROUNDING',
662            p_lookup_code    => p_rounding_cd,
663            p_effective_date => p_effective_date) then
664       --
665       -- raise error as does not exist as lookup
666       --
667       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
668       hr_utility.raise_error;
669       --
670     end if;
671     --
672   end if;
673   --
674   hr_utility.set_location('Leaving:'||l_proc,10);
675   --
676 end chk_rounding_cd;
677 --
678 /**
679 Procedure chk_business_group
680                            (p_criteria_rate_defn_id       in number,
681                             p_business_group_id           in number,
682                             p_object_version_number       in number) is
683   --
684   l_proc         varchar2(72) := g_package||'chk_business_group';
685   l_api_updating boolean;
686   --
687 Begin
688   --
689   hr_utility.set_location('Entering:'||l_proc, 5);
690   --
691   l_api_updating := pqh_crd_shd.api_updating
692     (p_criteria_rate_defn_id       => p_criteria_rate_defn_id,
693      p_object_version_number       => p_object_version_number);
694   --
695   if p_business_group_id is null then
696     --
697     -- Business group must not be null
698     --
699     hr_api.mandatory_arg_error(p_api_name       => l_proc,
700                            p_argument       => 'business_group_id',
701                            p_argument_value => p_business_group_id);
702     --
703   end if;
704   --
705   hr_utility.set_location('Leaving:'||l_proc,10);
706   --
707 end chk_business_group;
708 **/
709 --
710 -- ----------------------------------------------------------------------------
711 -- |---------------------------< insert_validate >----------------------------|
712 -- ----------------------------------------------------------------------------
713 Procedure insert_validate
714   (p_effective_date               in date
715   ,p_rec                          in pqh_crd_shd.g_rec_type
716   ) is
717 --
718   l_proc  varchar2(72) := g_package||'insert_validate';
719 --
720 Begin
721   hr_utility.set_location('Entering:'||l_proc, 5);
722   --
723   -- Call all supporting business operations
724   --
725   --
726   chk_startup_action(true
727                     ,p_rec.business_group_id
728                     ,p_rec.legislation_code
729                     );
730   IF hr_startup_data_api_support.g_startup_mode
731                      NOT IN ('GENERIC','STARTUP') THEN
732      --
733      -- Validate Important Attributes
734      --
735      if p_rec.business_group_id is not null and p_rec.legislation_code is null then
736      hr_api.validate_bus_grp_id
737        (p_business_group_id => p_rec.business_group_id
738        ,p_associated_column1 => pqh_crd_shd.g_tab_nam
739                                 || '.BUSINESS_GROUP_ID');
740      End if;
741      --
742      -- after validating the set of important attributes,
743      -- if Multiple Message Detection is enabled and at least
744      -- one error has been found then abort further validation.
745      --
746      hr_multi_message.end_validation_set;
747   END IF;
748   --
749   chk_preferential_rate_cd (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
750                    p_preferential_rate_cd            => p_rec.preferential_rate_cd,
751                    p_effective_date         => p_effective_date,
752                    p_object_version_number  => p_rec.object_version_number);
753   --
754   chk_rate_calc_cd (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
755                    p_rate_calc_cd            => p_rec.rate_calc_cd,
756                    p_effective_date         => p_effective_date,
757                    p_object_version_number  => p_rec.object_version_number);
758   --
759   chk_reference_period_cd (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
760                    p_reference_period_cd            => p_rec.reference_period_cd,
761                    p_effective_date         => p_effective_date,
762                    p_object_version_number  => p_rec.object_version_number);
763   --
764   --
765   chk_uom (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
766                    p_uom            => p_rec.uom,
767                    p_effective_date         => p_effective_date,
768                    p_object_version_number  => p_rec.object_version_number);
769   --
770   --
771   chk_rounding_cd (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
772                    p_rounding_cd            => p_rec.rounding_cd,
773                    p_effective_date         => p_effective_date,
774                    p_object_version_number  => p_rec.object_version_number);
775   --
776   /**
777   chk_business_group (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
778                    p_business_group_id      => p_rec.business_group_id,
779                    p_object_version_number  => p_rec.object_version_number);
780   **/
781   -- Validate Dependent Attributes
782   --
783   --
784   --pqh_crd_bus.chk_df(p_rec);
785   --
786   hr_utility.set_location(' Leaving:'||l_proc, 10);
787 End insert_validate;
788 --
789 -- ----------------------------------------------------------------------------
790 -- |---------------------------< update_validate >----------------------------|
791 -- ----------------------------------------------------------------------------
792 Procedure update_validate
793   (p_effective_date               in date
794   ,p_rec                          in pqh_crd_shd.g_rec_type
795   ) is
796 --
797   l_proc  varchar2(72) := g_package||'update_validate';
798 --
799 Begin
800   hr_utility.set_location('Entering:'||l_proc, 5);
801   --
802   -- Call all supporting business operations
803   --
804   --
805   chk_startup_action(false
806                     ,p_rec.business_group_id
807                     ,p_rec.legislation_code
808                     );
809   IF hr_startup_data_api_support.g_startup_mode
810                      NOT IN ('GENERIC','STARTUP') THEN
811      --
812      -- Validate Important Attributes
813      --
814      if p_rec.business_group_id is not null and p_rec.legislation_code is null then
815      hr_api.validate_bus_grp_id
816        (p_business_group_id => p_rec.business_group_id
817        ,p_associated_column1 => pqh_crd_shd.g_tab_nam
818                                 || '.BUSINESS_GROUP_ID');
819      End if;
820      --
821      -- After validating the set of important attributes,
822      -- if Multiple Message Detection is enabled and at least
823      -- one error has been found then abort further validation.
824      --
825      hr_multi_message.end_validation_set;
826   END IF;
827   --
828   --
829   chk_preferential_rate_cd (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
830                    p_preferential_rate_cd            => p_rec.preferential_rate_cd,
831                    p_effective_date         => p_effective_date,
832                    p_object_version_number  => p_rec.object_version_number);
833   --
834   chk_rate_calc_cd (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
835                    p_rate_calc_cd            => p_rec.rate_calc_cd,
836                    p_effective_date         => p_effective_date,
837                    p_object_version_number  => p_rec.object_version_number);
838   --
839   chk_reference_period_cd (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
840                    p_reference_period_cd            => p_rec.reference_period_cd,
841                    p_effective_date         => p_effective_date,
842                    p_object_version_number  => p_rec.object_version_number);
843   --
844   --
845   chk_uom (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
846                    p_uom            => p_rec.uom,
847                    p_effective_date         => p_effective_date,
848                    p_object_version_number  => p_rec.object_version_number);
849   --
850   --
851   chk_rounding_cd (p_criteria_rate_defn_id  => p_rec.criteria_rate_defn_id,
852                    p_rounding_cd            => p_rec.rounding_cd,
853                    p_effective_date         => p_effective_date,
854                    p_object_version_number  => p_rec.object_version_number);
855   --
856   --
857   -- Validate Dependent Attributes
858   --
859   chk_non_updateable_args
860     (p_effective_date              => p_effective_date
861       ,p_rec              => p_rec
862     );
863   --
864   --
865   --pqh_crd_bus.chk_df(p_rec);
866   --
867   hr_utility.set_location(' Leaving:'||l_proc, 10);
868 End update_validate;
869 --
870 -- ----------------------------------------------------------------------------
871 -- |---------------------------< delete_validate >----------------------------|
872 -- ----------------------------------------------------------------------------
873 Procedure delete_validate
874   (p_rec                          in pqh_crd_shd.g_rec_type
875   ) is
876 --
877   l_proc  varchar2(72) := g_package||'delete_validate';
878 --
879 Begin
880   hr_utility.set_location('Entering:'||l_proc, 5);
881   --
882     --
883   chk_startup_action(false
884                     ,pqh_crd_shd.g_old_rec.business_group_id
885                     ,pqh_crd_shd.g_old_rec.legislation_code
886                     );
887   IF hr_startup_data_api_support.g_startup_mode
888                      NOT IN ('GENERIC','STARTUP') THEN
889      --
890      -- Validate Important Attributes
891      --
892      --
893      -- After validating the set of important attributes,
894      -- if Multiple Message Detection is enabled and at least
895      -- one error has been found then abort further validation.
896      --
897      hr_multi_message.end_validation_set;
898   END IF;
899   --
900   -- Call all supporting business operations
901   --
902   hr_utility.set_location(' Leaving:'||l_proc, 10);
903 End delete_validate;
904 --
905 end pqh_crd_bus;