DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BLT_BUS

Source


1 Package Body pay_blt_bus as
2 /* $Header: pybltrhi.pkb 120.4 2012/03/01 05:23:29 vvijayku ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_blt_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_balance_type_id             number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_balance_type_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          , pay_balance_types blt
32      where blt.balance_type_id = p_balance_type_id
33        and pbg.business_group_id (+) = blt.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           => 'balance_type_id'
50     ,p_argument_value     => p_balance_type_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,'BALANCE_TYPE_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_balance_type_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          , pay_balance_types blt
102      where blt.balance_type_id = p_balance_type_id
103        and pbg.business_group_id (+) = blt.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           => 'balance_type_id'
119     ,p_argument_value     => p_balance_type_id
120     );
121   --
122   if ( nvl(pay_blt_bus.g_balance_type_id, hr_api.g_number)
123        = p_balance_type_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 := pay_blt_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     pay_blt_bus.g_balance_type_id             := p_balance_type_id;
154     pay_blt_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 pay_blt_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.balance_type_id is not null)  and (
198     nvl(pay_blt_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
199     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
200     nvl(pay_blt_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
201     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
202     nvl(pay_blt_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
203     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
204     nvl(pay_blt_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
205     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
206     nvl(pay_blt_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
207     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
208     nvl(pay_blt_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
209     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
210     nvl(pay_blt_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
211     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
212     nvl(pay_blt_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
213     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
214     nvl(pay_blt_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
215     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
216     nvl(pay_blt_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
217     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
218     nvl(pay_blt_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
219     nvl(p_rec.attribute10, hr_api.g_varchar2)  or
220     nvl(pay_blt_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
221     nvl(p_rec.attribute11, hr_api.g_varchar2)  or
222     nvl(pay_blt_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
223     nvl(p_rec.attribute12, hr_api.g_varchar2)  or
224     nvl(pay_blt_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
225     nvl(p_rec.attribute13, hr_api.g_varchar2)  or
226     nvl(pay_blt_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
227     nvl(p_rec.attribute14, hr_api.g_varchar2)  or
228     nvl(pay_blt_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
229     nvl(p_rec.attribute15, hr_api.g_varchar2)  or
230     nvl(pay_blt_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
231     nvl(p_rec.attribute16, hr_api.g_varchar2)  or
232     nvl(pay_blt_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
233     nvl(p_rec.attribute17, hr_api.g_varchar2)  or
234     nvl(pay_blt_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
235     nvl(p_rec.attribute18, hr_api.g_varchar2)  or
236     nvl(pay_blt_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
237     nvl(p_rec.attribute19, hr_api.g_varchar2)  or
238     nvl(pay_blt_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
239     nvl(p_rec.attribute20, hr_api.g_varchar2) ))
240     or (p_rec.balance_type_id is null)  then
241     --
242     -- Only execute the validation if absolutely necessary:
243     -- a) During update, the structure column value or any
244     --    of the attribute values have actually changed.
245     -- b) During insert.
246     --
247     hr_dflex_utility.ins_or_upd_descflex_attribs
248       (p_appl_short_name                 => 'PAY'
249       ,p_descflex_name                   => 'PAY_BALANCE_TYPES'
250       ,p_attribute_category              =>  p_rec.ATTRIBUTE_CATEGORY
251       ,p_attribute1_name                 => 'ATTRIBUTE1'
252       ,p_attribute1_value                => p_rec.attribute1
253       ,p_attribute2_name                 => 'ATTRIBUTE2'
254       ,p_attribute2_value                => p_rec.attribute2
255       ,p_attribute3_name                 => 'ATTRIBUTE3'
256       ,p_attribute3_value                => p_rec.attribute3
257       ,p_attribute4_name                 => 'ATTRIBUTE4'
258       ,p_attribute4_value                => p_rec.attribute4
259       ,p_attribute5_name                 => 'ATTRIBUTE5'
260       ,p_attribute5_value                => p_rec.attribute5
261       ,p_attribute6_name                 => 'ATTRIBUTE6'
262       ,p_attribute6_value                => p_rec.attribute6
263       ,p_attribute7_name                 => 'ATTRIBUTE7'
264       ,p_attribute7_value                => p_rec.attribute7
265       ,p_attribute8_name                 => 'ATTRIBUTE8'
266       ,p_attribute8_value                => p_rec.attribute8
267       ,p_attribute9_name                 => 'ATTRIBUTE9'
268       ,p_attribute9_value                => p_rec.attribute9
269       ,p_attribute10_name                => 'ATTRIBUTE10'
270       ,p_attribute10_value               => p_rec.attribute10
271       ,p_attribute11_name                => 'ATTRIBUTE11'
272       ,p_attribute11_value               => p_rec.attribute11
273       ,p_attribute12_name                => 'ATTRIBUTE12'
274       ,p_attribute12_value               => p_rec.attribute12
275       ,p_attribute13_name                => 'ATTRIBUTE13'
276       ,p_attribute13_value               => p_rec.attribute13
277       ,p_attribute14_name                => 'ATTRIBUTE14'
278       ,p_attribute14_value               => p_rec.attribute14
279       ,p_attribute15_name                => 'ATTRIBUTE15'
280       ,p_attribute15_value               => p_rec.attribute15
281       ,p_attribute16_name                => 'ATTRIBUTE16'
282       ,p_attribute16_value               => p_rec.attribute16
283       ,p_attribute17_name                => 'ATTRIBUTE17'
284       ,p_attribute17_value               => p_rec.attribute17
285       ,p_attribute18_name                => 'ATTRIBUTE18'
286       ,p_attribute18_value               => p_rec.attribute18
287       ,p_attribute19_name                => 'ATTRIBUTE19'
288       ,p_attribute19_value               => p_rec.attribute19
289       ,p_attribute20_name                => 'ATTRIBUTE20'
290       ,p_attribute20_value               => p_rec.attribute20
291       );
292   end if;
293   --
294   hr_utility.set_location(' Leaving:'||l_proc,20);
295 end chk_df;
296 --
297 --
298 -- ----------------------------------------------------------------------------
299 -- |------------------------< chk_assignment_remuneration_fg >----------------|
300 -- ----------------------------------------------------------------------------
301 --
302 Procedure chk_assignment_remuneration_fg
303   (p_assignment_remuneration_flag   in varchar2
304   ,p_business_group_id              in number
305   ,p_legislation_code               in varchar2
306   )  is
307 --
308   l_proc        varchar2(72) := g_package||'chk_assignment_remuneration_fg';
309 
310 --
311 Begin
312   hr_utility.set_location('Entering:'||l_proc, 5);
313   --
314 
315   if p_assignment_remuneration_flag = 'Y' then
316      pay_balance_types_pkg.chk_balance_type
317          ( p_row_id            => null,
318            p_business_group_id => p_business_group_id,
319            p_legislation_code  => nvl(p_legislation_code,
320                       hr_api.return_legislation_code(p_business_group_id)),
321            p_balance_name      => null,
322            p_reporting_name    => null,
323            p_assignment_remuneration_flag =>p_assignment_remuneration_flag
324 	 );
325   end if;
326 	    --
327   hr_utility.set_location('Leaving:'||l_proc, 10);
328 End;
329 --
330 --
331 -- ----------------------------------------------------------------------------
332 -- |--------------------------< chk_currency_code >--------------------------|
333 -- ----------------------------------------------------------------------------
334 --
335 Procedure chk_currency_code
336   (p_effective_date  	   in date
337   ,p_business_group_id     in number
338   ,p_legislation_code      in varchar2
339   ,p_balance_uom           in varchar2
340   ,p_currency_code         in varchar2
341   ) is
342 --
343   l_proc                  varchar2(72) := g_package||'chk_currency_code';
344   l_exists	          varchar2(1);
345 
346   Cursor c_chk_currency
347   is
348   -- bug 7462502 in startup mode remove restriction on enabled currencies
349     select '1'
350       from fnd_currencies
351      where currency_code = p_currency_code
352        and ( ( enabled_flag = 'Y') or
353              ( hr_startup_data_api_support.g_startup_mode IN ('STARTUP') ))
354        and currency_flag = 'Y'
355        and p_effective_date between nvl(start_date_active,p_effective_date)
356        and nvl(end_date_active,p_effective_date);
357 
358   Cursor c_chk_currency_1
359   is
360   -- bug 11901831: Removing effective date check in startup mode
361     select '1'
362       from fnd_currencies
363      where currency_code = p_currency_code
364        and ( ( enabled_flag = 'Y') or
365              ( hr_startup_data_api_support.g_startup_mode IN ('STARTUP') ))
366        and currency_flag = 'Y';
367 --
368 Begin
369   hr_utility.set_location('Entering:'||l_proc, 5);
370   --
371   If (p_balance_uom <> 'M' and p_currency_code is not null) then
372       fnd_message.set_name('PAY','PAY_34193_UOM_NOT_MONEY');
373       fnd_message.raise_error;
374   elsIf p_currency_code is not null then
375     --
376   IF hr_startup_data_api_support.g_startup_mode IN ('STARTUP') THEN	-- bug 11901831
377     Open c_chk_currency_1;
378     Fetch c_chk_currency_1 into l_exists;
379     If c_chk_currency_1%notfound Then
380     --
381       Close c_chk_currency_1;
382       fnd_message.set_name('PAY','HR_51855_QUA_CCY_INV');
383       fnd_message.raise_error;
384     End if;
385     --
386     Close c_chk_currency_1;
387     --
388   else
389 
390     Open c_chk_currency;
391     Fetch c_chk_currency into l_exists;
392     If c_chk_currency%notfound Then
393     --
394       Close c_chk_currency;
395       fnd_message.set_name('PAY','HR_51855_QUA_CCY_INV');
396       fnd_message.raise_error;
397     End if;
398     --
399     Close c_chk_currency;
400 
401   end if;
402 
403   end if;
404   --
405   hr_utility.set_location('Leaving:'||l_proc, 10);
406 End;
407 --
408 -- ----------------------------------------------------------------------------
409 -- |--------------------------< chk_balance_name >----------------------------|
410 -- ----------------------------------------------------------------------------
411 --
412 Procedure chk_balance_name
413   (p_business_group_id         in number
414   ,p_legislation_code          in varchar2
415   ,p_balance_type_id           in number
416   ,p_balance_name              in varchar2
417   ,p_balance_name_warning      out nocopy number
418   ) is
419 --
420   l_proc         varchar2(72) := g_package||'chk_balance_name';
421   l_exists       varchar2(1);
422   l_dbi_exists   varchar2(1);
423 --
424   cursor chk_source_lang is
425     select '1'
426       from pay_balance_types_tl
427      where balance_type_id = p_balance_type_id
428        and source_lang <> userenv('LANG');
429 
430   cursor chk_db_items is
431     select '1'
432       from ff_user_entities uet,
433            pay_defined_balances dfb
434      where uet.creator_id = dfb.defined_balance_id
435        and uet.creator_type = 'B'
436        and dfb.balance_type_id = p_balance_type_id;
437 --
438 Begin
439   hr_utility.set_location('Entering:'||l_proc, 5);
440   --
441   pay_balance_types_pkg.chk_balance_type
442        (null,
443         p_business_group_id,
444         p_legislation_code,
445         p_balance_name,
446         null,
447         null);
448   --
449   hr_utility.set_location('Entering:'||l_proc, 10);
450   --
451   if( p_balance_name <> nvl(pay_blt_shd.g_old_rec.balance_name,p_balance_name)) then
452      --
453      -- Check db items exist for this balance
454      --
455      open chk_db_items;
456      fetch chk_db_items into l_dbi_exists;
457      close chk_db_items;
458      --
459        hr_utility.set_location('Entering:'||l_proc, 15);
460      --
461      if l_dbi_exists is null then
462          -- if database item does not exist
463           p_balance_name_warning := 1;
464      else
465      --
466      -- Check between source and env languages for update operations
467      -- against the base table
468      --
469         open chk_source_lang;
470         fetch chk_source_lang into l_exists;
471         close chk_source_lang;
472      --
473         if l_exists is null then
474           -- fnd_message.set_name ('PAY', 'PAY_34172_BAL_DBI_UPD');
475    	  p_balance_name_warning := 2;
476         else
477           -- fnd_message.set_name('PAY','PAY_34173_BASE_TBL_UPD');
478           p_balance_name_warning := 3;
479         end if;
480      --
481      end if;
482   end if;
483   --
484   hr_utility.set_location('Leaving:'||l_proc, 20);
485 End;
486 --
487 --
488 -- ----------------------------------------------------------------------------
489 -- |--------------------------< chk_balance_uom >--------------------------|
490 -- ----------------------------------------------------------------------------
491 --
492 Procedure chk_balance_uom
493   (p_effective_date  	   in date
494   ,p_balance_uom           in varchar2
495   ,p_assignment_remuneration_flag in varchar2
496   ,p_balance_type_id       in number
497   ,p_object_version_number in number
498   ) is
499 --
500   l_proc              varchar2(72) := g_package||'chk_balance_uom';
501   l_exists	      varchar2(1);
502   l_class_exists      varchar2(1);
503 
504   Cursor c_chk_balance_uom
505   is
506     select '1'
507       from hr_lookups hl
508      where hl.lookup_type = 'UNITS' and
509        (hl.lookup_code in ('M','I','N','ND') or hl.lookup_code like 'H%') and
510         hl.enabled_flag = 'Y' and
511         hl.lookup_code = p_balance_uom and
512         p_effective_date between nvl(hl.start_date_active,p_effective_date) and
513         nvl(hl.end_date_active,p_effective_date);
514 
515   Cursor c_chk_balance_uom_class(p_balance_uom_old varchar2)
516   is
517     select '1'
518       from hr_lookups hl
519      where hl.lookup_type = 'UNITS' and
520            hl.lookup_code = p_balance_uom and
521            substr(hl.lookup_code,1,1) = substr(p_balance_uom_old,1,1) and
522            hl.enabled_flag = 'Y' and
523            p_effective_date between nvl(hl.start_date_active,p_effective_date) and
524            nvl(hl.end_date_active,p_effective_date);
525 
526 --
527 Begin
528   hr_utility.set_location('Entering:'||l_proc, 5);
529   --
530   If (p_assignment_remuneration_flag = 'Y' and p_balance_uom <> 'M') then
531       fnd_message.set_name('PAY','PAY_34194_UOM_MUST_BE_MONEY');
532       fnd_message.raise_error;
533   elsif((pay_blt_shd.api_updating
534             (p_balance_type_id => p_balance_type_id
535             ,p_object_version_number  => p_object_version_number)) and
536     nvl(p_balance_uom,hr_api.g_varchar2) <>
537     nvl(pay_blt_shd.g_old_rec.balance_uom,hr_api.g_varchar2)) then
538     --
539     hr_utility.set_location('Entering:'||l_proc|| ' new :'||p_balance_uom||' old '||pay_blt_shd.g_old_rec.balance_uom, 10);
540     --
541     Open c_chk_balance_uom_class(pay_blt_shd.g_old_rec.balance_uom);
542     Fetch c_chk_balance_uom_class into l_class_exists;
543     If c_chk_balance_uom_class%notfound Then
544     --
545       Close c_chk_balance_uom_class;
546       fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
547       fnd_message.set_token('COLUMN_NAME', 'BALANCE_UOM');
548       fnd_message.raise_error;
549     --
550     End If;
551     Close c_chk_balance_uom_class;
552     --
553   else
554     --
555     hr_utility.set_location('Entering:'||l_proc, 15);
556     --
557     Open c_chk_balance_uom;
558     Fetch c_chk_balance_uom into l_exists;
559     If c_chk_balance_uom%notfound Then
560     --
561       Close c_chk_balance_uom;
562       fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
563       fnd_message.set_token('COLUMN_NAME', 'BALANCE_UOM');
564       fnd_message.raise_error;
565     --
566      End If;
567     Close c_chk_balance_uom;
568   End If;
569   --
570   hr_utility.set_location('Leaving:'||l_proc, 20);
571 End;
572 --
573 -- ----------------------------------------------------------------------------
574 -- |--------------------------< chk_reporting_name >----------------------------|
575 -- ----------------------------------------------------------------------------
576 --
577 Procedure chk_reporting_name
578   (p_business_group_id         in number
579   ,p_legislation_code          in varchar2
580   ,p_reporting_name            in varchar2
581   ) is
582 --
583   l_proc         varchar2(72) := g_package||'chk_reporting_name';
584   l_exists       varchar2(1);
585 --
586 Begin
587   hr_utility.set_location('Entering:'||l_proc, 5);
588   --
589   pay_balance_types_pkg.chk_balance_type
590        (null,
591         p_business_group_id,
592         p_legislation_code,
593         null,
594         p_reporting_name,
595         null);
596   --
597   hr_utility.set_location('Leaving:'||l_proc, 10);
598 End;
599 --
600 --
601 -- ----------------------------------------------------------------------------
602 -- |--------------------------< chk_balance_category_id >---------------------|
603 -- ----------------------------------------------------------------------------
604 --
605 Procedure chk_balance_category_id
606   (p_effective_date  	          in date
607   ,p_business_group_id            in number
608   ,p_legislation_code             in varchar2
609   ,p_balance_category_id          in number
610   ) is
611 --
612   l_proc              varchar2(72) := g_package||'chk_balance_category_id';
613   l_exists	      varchar2(1);
614 
615   Cursor c_chk_balance_category
616   is
617    select '1'
618      from pay_balance_categories_f
619     where balance_category_id = p_balance_category_id
620        and  nvl(legislation_code,
621          nvl(HR_API.RETURN_LEGISLATION_CODE(p_business_group_id),'~~nvl~~')) =
622        nvl(p_legislation_code,nvl(HR_API.RETURN_LEGISLATION_CODE(p_business_group_id),'~~nvl~~'))
623       and p_effective_date between effective_start_date
624                                      and effective_end_date;
625 --
626 Begin
627   hr_utility.set_location('Entering:'||l_proc, 5);
628   --
629   if (p_balance_category_id is null and
630      pay_balance_types_pkg.chk_balance_category_rule(
631         nvl(p_legislation_code,hr_api.return_legislation_code(p_business_group_id)))) then
632      hr_api.mandatory_arg_error
633      (p_api_name                     => l_proc
634      ,p_argument                     => 'balance_category_id'
635      ,p_argument_value               => p_balance_category_id
636     );
637   end if;
638    --
639    hr_utility.set_location('Entering:'||l_proc, 10);
640    --
641    Open c_chk_balance_category;
642    Fetch c_chk_balance_category into l_exists;
643    If c_chk_balance_category%notfound Then
644     --
645       Close c_chk_balance_category;
646       fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
647       fnd_message.set_token('COLUMN_NAME', 'BALANCE_CATEGORY_ID');
648       fnd_message.raise_error;
649     --
650    End If;
651     Close c_chk_balance_category;
652   --
653   hr_utility.set_location('Leaving:'||l_proc, 15);
654 End;
655 --
656 --
657 -- ----------------------------------------------------------------------------
658 -- |--------------------------< chk_base_balance_type_id >---------------------|
659 -- ----------------------------------------------------------------------------
660 --
661 Procedure chk_base_balance_type_id
662   (p_effective_date  	          in date
663   ,p_business_group_id            in number
664   ,p_legislation_code             in varchar2
665   ,p_base_balance_type_id         in number
666   ) is
667 --
668   l_proc              varchar2(72) := g_package||'chk_base_balance_type_id';
669   l_exists	      varchar2(1);
670 
671   Cursor c_chk_base_balance
672   is
673    select '1'
674      from  pay_balance_types
675     where  base_balance_type_id is null
676       and  balance_type_id = p_base_balance_type_id
677       and    ((p_business_group_id is not null
678       and    nvl(business_group_id,-1) = p_business_group_id
679        or     nvl(legislation_code,nvl(HR_API.RETURN_LEGISLATION_CODE(p_business_group_id),'~~nvl~~')) =
680                     nvl(p_legislation_code,nvl(hr_api.return_legislation_code(p_business_group_id),'~~nvl~~')))
681        or     (p_legislation_code is not null
682       and    nvl(legislation_code,' ') = p_legislation_code
683        or     business_group_id is not null
684       and    legislation_code = p_legislation_code)
685        or     business_group_id is null
686       and    legislation_code is null)	;
687 --
688 Begin
689   hr_utility.set_location('Entering:'||l_proc, 5);
690   --
691    Open c_chk_base_balance;
692    Fetch c_chk_base_balance into l_exists;
693    If c_chk_base_balance%notfound Then
694     --
695       Close c_chk_base_balance;
696       fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
697       fnd_message.set_token('COLUMN_NAME', 'BASE_BALANCE_TYPE_ID'||p_base_balance_type_id||'value unknown');
698       fnd_message.raise_error;
699     --
700      End If;
701     Close c_chk_base_balance;
702   --
703   hr_utility.set_location('Leaving:'||l_proc, 10);
704 End;
705 --
706 --
707 -- ----------------------------------------------------------------------------
708 -- |--------------------------< chk_input_value_id >--------------------------|
709 -- ----------------------------------------------------------------------------
710 --
711 Procedure chk_input_value_id
712   (p_effective_date  	    in date
713   ,p_input_value_id         in number
714   ,p_balance_uom            in varchar2
715   ,p_balance_type_id        in number
716   ) is
717 --
718   l_proc              varchar2(72) := g_package||'chk_input_value_id';
719   l_exists	      varchar2(1);
720 
721   Cursor c_chk_input_value
722   is
723     select '1'
724       from pay_input_values_f
725      where input_value_id = p_input_value_id
726        and uom = p_balance_uom
727        and p_effective_date between effective_start_date and effective_end_date;
728 --
729 Begin
730   hr_utility.set_location('Entering:'||l_proc, 5);
731   --
732    Open c_chk_input_value;
733    Fetch c_chk_input_value into l_exists;
734    If c_chk_input_value%notfound Then
735     --
736       Close c_chk_input_value;
737       fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
738       fnd_message.set_token('COLUMN_NAME', 'INPUT_VALUE_ID');
739       fnd_message.raise_error;
740     --
741    End If;
742    Close c_chk_input_value;
743   --
744   --
745   hr_utility.set_location('Entering:'||l_proc, 10);
746   --
747   --
748   -- INPUT_VALUE_ID can be updated only if its value is null and there is
749   -- no balance feed exist except initial feed or there is no balance
750   -- classification exists.
751   --
752   If(p_input_value_id is not null and
753     nvl(p_input_value_id,hr_api.g_number) <>
754      nvl(pay_blt_shd.g_old_rec.input_value_id,hr_api.g_number)) then
755      --
756 
757      if (hr_balance_feeds.manual_bal_feeds_exist(p_balance_type_id) or
758         hr_balance_feeds.bal_classifications_exist(p_balance_type_id)) then
759      --
760         fnd_message.set_name('PAY','PAY_34195_FEED_OR_CLASS_EXIST');
761         fnd_message.raise_error;
762      end if;
763     --
764   End if;
765 
766 
767   hr_utility.set_location('Leaving:'||l_proc, 10);
768 End;
769 --
770 --
771 -- ----------------------------------------------------------------------------
772 -- |--------------------------< recreate_db_items >---------------------------|
773 -- ----------------------------------------------------------------------------
774 --
775 PROCEDURE recreate_db_items(p_balance_type_id in number) is
776   cursor get_defined_balances is
777     select defined_balance_id,
778            balance_dimension_id,
779            business_group_id,
780            legislation_code
781       from pay_defined_balances dfb
782      where dfb.balance_type_id = p_balance_type_id;
783   --
784   l_exists varchar2(1);
785   --
786   BEGIN
787     --
788       for l_dfb in get_defined_balances loop
789         hrdyndbi.recreate_defined_balance
790           (p_defined_balance_id   => l_dfb.defined_balance_id,
791            p_balance_dimension_id => l_dfb.balance_dimension_id,
792            p_balance_type_id      => p_balance_type_id,
793            p_business_group_id    => l_dfb.business_group_id,
794            p_legislation_code     => l_dfb.legislation_code);
795        end loop;
796     --
797   END recreate_db_items;
798 --
799 -- ----------------------------------------------------------------------------
800 -- |--------------------------< insert_primary_balance_feed >-----------------|
801 -- ----------------------------------------------------------------------------
802 --
803 procedure insert_primary_balance_feed
804    ( p_effective_date       in date
805     ,p_business_group_id    in number
806     ,p_balance_type_id      in number
807     ,p_input_value_id       in number
808    ) is
809   --
810   l_proc   varchar2(72) := g_package||'insert_primary_balance_feed';
811   l_exists number;
812 
813   cursor feed_exists
814   is
815   select null
816   from   pay_balance_feeds_f pbf
817   where  pbf.balance_type_id = p_balance_type_id
818   and    pbf.input_value_id  = p_input_value_id
819   and    nvl(pbf.business_group_id, -1) = nvl(p_business_group_id, -1)
820   and    nvl(pbf.legislation_code, 'NULL') =
821          nvl(hr_api.return_legislation_code(p_business_group_id), 'NULL')
822   and    p_effective_date between pbf.effective_start_date
823                                        and pbf.effective_end_date;
824 
825 
826   BEGIN
827     hr_utility.set_location('Entering:'||l_proc, 5);
828     --
829     open  feed_exists;
830     fetch feed_exists into l_exists;
831     if feed_exists%notfound then
832       close feed_exists;
833       --
834       hr_utility.set_location('Entering:'||l_proc, 10);
835       --
836       hr_balances.ins_balance_feed
837         (p_option                     => 'INS_PRIMARY_BALANCE_FEED'
838         ,p_input_value_id             => p_input_value_id
839         ,p_element_type_id            => null
840         ,p_primary_classification_id  => ''
841         ,p_sub_classification_id      => ''
842         ,p_sub_classification_rule_id => ''
843         ,p_balance_type_id            => p_balance_type_id
844         ,p_scale                      => 1
845         ,p_session_date               => p_effective_date
846         ,p_business_group             => p_business_group_id
847         ,p_legislation_code
848 	             => hr_api.return_legislation_code(p_business_group_id)
849         ,p_mode
850 	             => hr_startup_data_api_support.g_startup_mode
851         );
852     else
853       close feed_exists;
854     end if;
855     --
856     hr_utility.set_location('Leaving:'||l_proc, 15);
857     --
858   END Insert_primary_balance_feed;
859 --
860 -- ----------------------------------------------------------------------------
861 -- |------------------------< chk_legislation_code >--------------------------|
862 -- ----------------------------------------------------------------------------
863 --
864 -- Description:
865 --   This procedure is used to validate the legislation code against the
866 --   parent table
867 --
868 -- ----------------------------------------------------------------------------
869 Procedure chk_legislation_code
870   (p_legislation_code  in varchar2)
871   is
872 --
873   l_proc        varchar2(72) := g_package||'chk_legislation_code';
874   l_exists varchar2(1);
875 
876   Cursor c_chk_leg_code
877   is
878     select null
879       from fnd_territories
880      where territory_code = p_legislation_code;
881 --
882 Begin
883   hr_utility.set_location('Entering:'||l_proc, 5);
884   --
885   If p_legislation_code is not null then
886 
887     Open c_chk_leg_code;
888     Fetch c_chk_leg_code into l_exists;
889     If c_chk_leg_code%notfound Then
890       --
891       Close c_chk_leg_code;
892       fnd_message.set_name('PAY','PAY_33085_INVALID_FK');
893       fnd_message.set_token('COLUMN','LEGISLATION_CODE');
894       fnd_message.set_token('TABLE','FND_TERRITORIES');
895       fnd_message.raise_error;
896       --
897     End If;
898     Close c_chk_leg_code;
899 
900   End If;
901   --
902   hr_utility.set_location('Leaving:'||l_proc, 10);
903 End;
904 
905 --
906 -- ----------------------------------------------------------------------------
907 -- |-----------------------< chk_non_updateable_args >------------------------|
908 -- ----------------------------------------------------------------------------
909 -- {Start Of Comments}
910 --
911 -- Description:
912 --   This procedure is used to ensure that non updateable attributes have
913 --   not been updated. If an attribute has been updated an error is generated.
914 --
915 -- Pre Conditions:
916 --   g_old_rec has been populated with details of the values currently in
917 --   the database.
918 --
919 -- In Arguments:
920 --   p_rec has been populated with the updated values the user would like the
921 --   record set to.
922 --
923 -- Post Success:
924 --   Processing continues if all the non updateable attributes have not
925 --   changed.
926 --
927 -- Post Failure:
928 --   An application error is raised if any of the non updatable attributes
929 --   have been altered.
930 --
931 -- {End Of Comments}
932 -- ----------------------------------------------------------------------------
933 Procedure chk_non_updateable_args
934   (p_effective_date               in date
935   ,p_rec in pay_blt_shd.g_rec_type
936   ) IS
937 --
938   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
939   l_argument varchar2(80);
940   l_error    exception;
941 --
942 Begin
943   --
944   -- Only proceed with the validation if a row exists for the current
945   -- record in the HR Schema.
946   --
947   IF NOT pay_blt_shd.api_updating
948       (p_balance_type_id                   => p_rec.balance_type_id
949       ,p_object_version_number             => p_rec.object_version_number
950       ) THEN
951      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
952      fnd_message.set_token('PROCEDURE ', l_proc);
953      fnd_message.set_token('STEP ', '5');
954      fnd_message.raise_error;
955   END IF;
956   --
957    hr_utility.set_location('Entering:'||l_proc, 10);
958   --
959   -- Ensure that the following attributes are not updated.
960   --
961   If nvl(p_rec.business_group_id,hr_api.g_number) <>
962      nvl(pay_blt_shd.g_old_rec.business_group_id,hr_api.g_number) then
963     --
964     l_argument := 'business_group_id';
965     raise l_error;
966     --
967   End if;
968   --
969   hr_utility.set_location('Entering:'||l_proc, 15);
970   --
971   If nvl(p_rec.legislation_code,hr_api.g_varchar2) <>
972      nvl(pay_blt_shd.g_old_rec.legislation_code,hr_api.g_varchar2) then
973     --
974     l_argument := 'legislation_code';
975     raise l_error;
976     --
977   End if;
978   --
979   hr_utility.set_location('Entering:'||l_proc, 20);
980   --
981   If nvl(p_rec.balance_type_id,hr_api.g_number) <>
982      nvl(pay_blt_shd.g_old_rec.balance_type_id,hr_api.g_number) then
983     --
984     l_argument := 'balance_type_id';
985     raise l_error;
986     --
987   End if;
988   --
989   hr_utility.set_location('Entering:'||l_proc, 25);
990   -- balance category can be updated only if it is null
991   --
992   If(pay_blt_shd.g_old_rec.balance_category_id is not null and
993     nvl(p_rec.balance_category_id,hr_api.g_number) <>
994      nvl(pay_blt_shd.g_old_rec.balance_category_id,hr_api.g_number)) then
995     --
996     l_argument := 'balance_category_id';
997     raise l_error;
998     --
999   End if;
1000   --
1001    hr_utility.set_location('Entering:'||l_proc, 30);
1002   -- jurisdiction_level can not be updated
1003   --
1004   If nvl(p_rec.jurisdiction_level,hr_api.g_number) <>
1005      nvl(pay_blt_shd.g_old_rec.jurisdiction_level,hr_api.g_number) then
1006     --
1007     l_argument := 'jurisdiction_level';
1008     raise l_error;
1009     --
1010   End if;
1011   --
1012      hr_utility.set_location('Entering:'||l_proc, 35);
1013   -- Tax_Type can not be updated
1014   --
1015   If nvl(p_rec.tax_type,hr_api.g_varchar2) <>
1016      nvl(pay_blt_shd.g_old_rec.tax_type,hr_api.g_varchar2) then
1017     --
1018     l_argument := 'tax_type';
1019     raise l_error;
1020     --
1021   End if;
1022   --
1023    --
1024   hr_utility.set_location('Entering:'||l_proc, 45);
1025   --
1026   If nvl(p_rec.legislation_subgroup,hr_api.g_varchar2) <>
1027      nvl(pay_blt_shd.g_old_rec.legislation_subgroup,hr_api.g_varchar2) then
1028     --
1029     l_argument := 'legislation_subgroup';
1030     raise l_error;
1031     --
1032   End if;
1033   --
1034   hr_utility.set_location('Leaving :'||l_proc, 50);
1035 EXCEPTION
1036   WHEN l_error THEN
1037       hr_api.argument_changed_error
1038          (p_api_name => l_proc
1039          ,p_argument => l_argument);
1040   WHEN OTHERS THEN
1041       RAISE;
1042   --
1043 End chk_non_updateable_args;
1044 --
1045 --
1046 -- ----------------------------------------------------------------------------
1047 -- |----------------------< chk_startup_action >------------------------------|
1048 -- ----------------------------------------------------------------------------
1049 --
1050 -- Description:
1051 --  This procedure will check that the current action is allowed according
1052 --  to the current startup mode.
1053 --
1054 -- ----------------------------------------------------------------------------
1055 PROCEDURE chk_startup_action
1056   (p_insert               IN boolean
1057   ,p_business_group_id    IN number
1058   ,p_legislation_code     IN varchar2
1059   ,p_legislation_subgroup IN varchar2 DEFAULT NULL) IS
1060 --
1061 BEGIN
1062   --
1063   -- Call the supporting procedure to check startup mode
1064   -- EDIT_HERE: The following call should be edited if certain types of rows
1065   -- are not permitted.
1066   IF (p_insert) THEN
1067     hr_startup_data_api_support.chk_startup_action
1068       (p_generic_allowed   => FALSE
1069       ,p_startup_allowed   => TRUE
1070       ,p_user_allowed      => TRUE
1071       ,p_business_group_id => p_business_group_id
1072       ,p_legislation_code  => p_legislation_code
1073       ,p_legislation_subgroup => p_legislation_subgroup
1074       );
1075   ELSE
1076     hr_startup_data_api_support.chk_upd_del_startup_action
1077       (p_generic_allowed   => FALSE
1078       ,p_startup_allowed   => TRUE
1079       ,p_user_allowed      => TRUE
1080       ,p_business_group_id => p_business_group_id
1081       ,p_legislation_code  => p_legislation_code
1082       ,p_legislation_subgroup => p_legislation_subgroup
1083       );
1084   END IF;
1085   --
1086 END chk_startup_action;
1087 --
1088 -- ----------------------------------------------------------------------------
1089 -- |---------------------------< insert_validate >----------------------------|
1090 -- ----------------------------------------------------------------------------
1091 Procedure insert_validate
1092   (p_effective_date               in date
1093   ,p_rec                          in pay_blt_shd.g_rec_type
1094   ) is
1095 --
1096   l_proc                    varchar2(72) := g_package||'insert_validate';
1097   l_balance_name_warning    number;
1098 --
1099 Begin
1100   hr_utility.set_location('Entering:'||l_proc, 5);
1101   --
1102   -- Call all supporting business operations
1103   --
1104   --
1105   chk_startup_action(true
1106                     ,p_rec.business_group_id
1107                     ,p_rec.legislation_code
1108                     );
1109   IF hr_startup_data_api_support.g_startup_mode
1110                      NOT IN ('GENERIC','STARTUP') THEN
1111      --
1112      -- Validate Important Attributes
1113      --
1114      hr_api.validate_bus_grp_id
1115        (p_business_group_id => p_rec.business_group_id
1116        ,p_associated_column1 => pay_blt_shd.g_tab_nam
1117                                 || '.BUSINESS_GROUP_ID');
1118      --
1119      -- after validating the set of important attributes,
1120      -- if Multiple Message Detection is enabled and at least
1121      -- one error has been found then abort further validation.
1122      --
1123      hr_multi_message.end_validation_set;
1124   END IF;
1125   --
1126   --
1127   -- Validate Dependent Attributes
1128   --
1129   -- ----------------------------------------------------------------------------
1130   IF hr_startup_data_api_support.g_startup_mode
1131                      IN ('STARTUP') and p_rec.legislation_code <> 'ZZ' THEN
1132 
1133    chk_legislation_code
1134        (p_legislation_code    => p_rec.legislation_code);
1135   End if;
1136   --
1137   -- ----------------------------------------------------------------------------
1138   --
1139   chk_assignment_remuneration_fg
1140   (p_assignment_remuneration_flag   => p_rec.assignment_remuneration_flag
1141   ,p_business_group_id              => p_rec.business_group_id
1142   ,p_legislation_code               => p_rec.legislation_code
1143   );
1144   -- ----------------------------------------------------------------------------
1145   --
1146   chk_currency_code
1147   (p_effective_date  	   => p_effective_date
1148   ,p_business_group_id     => p_rec.business_group_id
1149   ,p_legislation_code      => p_rec.legislation_code
1150   ,p_balance_uom           => p_rec.balance_uom
1151   ,p_currency_code         => p_rec.currency_code
1152   );
1153 
1154   -- ----------------------------------------------------------------------------
1155 
1156  chk_balance_name
1157   (p_business_group_id     => p_rec.business_group_id
1158   ,p_legislation_code      => p_rec.legislation_code
1159   ,p_balance_type_id       => p_rec.balance_type_id
1160   ,p_balance_name          => p_rec.balance_name
1161   ,p_balance_name_warning  => l_balance_name_warning
1162   );
1163 
1164   -- ----------------------------------------------------------------------------
1165 
1166  chk_balance_uom
1167   (p_effective_date  	           => p_effective_date
1168   ,p_balance_uom                   => p_rec.balance_uom
1169   ,p_assignment_remuneration_flag  => p_rec.assignment_remuneration_flag
1170   ,p_balance_type_id               => p_rec.balance_type_id
1171   ,p_object_version_number         => p_rec.object_version_number
1172   );
1173   -- ----------------------------------------------------------------------------
1174   if p_rec.reporting_name is not null then
1175      chk_reporting_name
1176      (p_business_group_id     => p_rec.business_group_id
1177      ,p_legislation_code      => p_rec.legislation_code
1178      ,p_reporting_name        => p_rec.reporting_name
1179      );
1180   end if;
1181   -- ----------------------------------------------------------------------------
1182   if p_rec.balance_category_id is not null then
1183      chk_balance_category_id
1184      (p_effective_date        => p_effective_date
1185      ,p_business_group_id     => p_rec.business_group_id
1186      ,p_legislation_code      => p_rec.legislation_code
1187      ,p_balance_category_id   => p_rec.balance_category_id
1188      );
1189   end if;
1190   -- ----------------------------------------------------------------------------
1191   if p_rec.base_balance_type_id is not null then
1192      chk_base_balance_type_id
1193      (p_effective_date        => p_effective_date
1194      ,p_business_group_id     => p_rec.business_group_id
1195      ,p_legislation_code      => p_rec.legislation_code
1196      ,p_base_balance_type_id  => p_rec.base_balance_type_id
1197      ) ;
1198   end if;
1199   -- ----------------------------------------------------------------------------
1200   if p_rec.input_value_id is not null then
1201      chk_input_value_id
1202      (p_effective_date         => p_effective_date
1203      ,p_input_value_id         => p_rec.input_Value_id
1204      ,p_balance_uom            => p_rec.balance_uom
1205      ,p_balance_type_id        => p_rec.balance_type_id
1206      );
1207   end if;
1208 
1209   pay_blt_bus.chk_df(p_rec);
1210   --
1211   hr_utility.set_location(' Leaving:'||l_proc, 10);
1212 End insert_validate;
1213 --
1214 -- ----------------------------------------------------------------------------
1215 -- |---------------------------< update_validate >----------------------------|
1216 -- ----------------------------------------------------------------------------
1217 Procedure update_validate
1218   (p_effective_date               in date
1219   ,p_rec                          in pay_blt_shd.g_rec_type
1220   ,p_balance_name_warning         out nocopy number
1221 
1222   ) is
1223 --
1224   l_proc  varchar2(72) := g_package||'update_validate';
1225   l_balance_name_warning    number;
1226 
1227 --
1228 Begin
1229   hr_utility.set_location('Entering:'||l_proc, 5);
1230   --
1231   -- Call all supporting business operations
1232   --
1233   --
1234   chk_startup_action(false
1235                     ,p_rec.business_group_id
1236                     ,p_rec.legislation_code
1237                     );
1238   IF hr_startup_data_api_support.g_startup_mode
1239                      NOT IN ('GENERIC','STARTUP') THEN
1240      --
1241      -- Validate Important Attributes
1242      --
1243      hr_api.validate_bus_grp_id
1244        (p_business_group_id => p_rec.business_group_id
1245        ,p_associated_column1 => pay_blt_shd.g_tab_nam
1246                                 || '.BUSINESS_GROUP_ID');
1247      --
1248      -- After validating the set of important attributes,
1249      -- if Multiple Message Detection is enabled and at least
1250      -- one error has been found then abort further validation.
1251      --
1252      hr_multi_message.end_validation_set;
1253   END IF;
1254   --
1255   --
1256   -- Validate Dependent Attributes
1257   --
1258   chk_non_updateable_args
1259     (p_effective_date              => p_effective_date
1260       ,p_rec              => p_rec
1261     );
1262   --
1263   -- ----------------------------------------------------------------------------
1264   --
1265   chk_assignment_remuneration_fg
1266   (p_assignment_remuneration_flag   => p_rec.assignment_remuneration_flag
1267   ,p_business_group_id              => p_rec.business_group_id
1268   ,p_legislation_code               => p_rec.legislation_code
1269   );
1270   -- ----------------------------------------------------------------------------
1271   --
1272   chk_currency_code
1273   (p_effective_date  	   => p_effective_date
1274   ,p_business_group_id     => p_rec.business_group_id
1275   ,p_legislation_code      => p_rec.legislation_code
1276   ,p_balance_uom           => p_rec.balance_uom
1277   ,p_currency_code         => p_rec.currency_code
1278   );
1279 
1280   -- ----------------------------------------------------------------------------
1281   if nvl(p_rec.balance_name,hr_api.g_varchar2) <>
1282        nvl(pay_blt_shd.g_old_rec.balance_name,hr_api.g_varchar2) then
1283      chk_balance_name
1284      (p_business_group_id     => p_rec.business_group_id
1285      ,p_legislation_code      => p_rec.legislation_code
1286      ,p_balance_type_id       => p_rec.balance_type_id
1287      ,p_balance_name          => p_rec.balance_name
1288      ,p_balance_name_warning  => l_balance_name_warning
1289      );
1290       p_balance_name_warning := l_balance_name_warning;
1291   end if;
1292 
1293 
1294   -- ----------------------------------------------------------------------------
1295 
1296   chk_balance_uom
1297   (p_effective_date  	           => p_effective_date
1298   ,p_balance_uom                   => p_rec.balance_uom
1299   ,p_assignment_remuneration_flag  => p_rec.assignment_remuneration_flag
1300   ,p_balance_type_id               => p_rec.balance_type_id
1301   ,p_object_version_number         => p_rec.object_version_number
1302   );
1303   -- ----------------------------------------------------------------------------
1304 
1305   if (p_rec.reporting_name is not null  and
1306       nvl(p_rec.reporting_name,hr_api.g_varchar2) <>
1307            nvl(pay_blt_shd.g_old_rec.reporting_name,hr_api.g_varchar2)) then
1308      chk_reporting_name
1309      (p_business_group_id     => p_rec.business_group_id
1310      ,p_legislation_code      => p_rec.legislation_code
1311      ,p_reporting_name        => p_rec.reporting_name
1312      );
1313   end if;
1314   -- ----------------------------------------------------------------------------
1315   if p_rec.balance_category_id is not null then
1316      chk_balance_category_id
1317      (p_effective_date        => p_effective_date
1318      ,p_business_group_id     => p_rec.business_group_id
1319      ,p_legislation_code      => p_rec.legislation_code
1320      ,p_balance_category_id   => p_rec.balance_category_id
1321      );
1322   end if;
1323   -- ----------------------------------------------------------------------------
1324   if p_rec.base_balance_type_id is not null then
1325      chk_base_balance_type_id
1326      (p_effective_date        => p_effective_date
1327      ,p_business_group_id     => p_rec.business_group_id
1328      ,p_legislation_code      => p_rec.legislation_code
1329      ,p_base_balance_type_id  => p_rec.base_balance_type_id
1330      ) ;
1331   end if;
1332   -- ----------------------------------------------------------------------------
1333   if p_rec.input_value_id is not null then
1334      chk_input_value_id
1335      (p_effective_date         => p_effective_date
1336      ,p_input_value_id         => p_rec.input_Value_id
1337      ,p_balance_uom            => p_rec.balance_uom
1338      ,p_balance_type_id        => p_rec.balance_type_id
1339      );
1340   end if;
1341 -- ----------------------------------------------------------------------------
1342 
1343   --
1344   pay_blt_bus.chk_df(p_rec);
1345   --
1346   hr_utility.set_location(' Leaving:'||l_proc, 10);
1347 End update_validate;
1348 --
1349 -- ----------------------------------------------------------------------------
1350 -- |---------------------------< delete_validate >----------------------------|
1351 -- ----------------------------------------------------------------------------
1352 Procedure delete_validate
1353   (p_rec                          in pay_blt_shd.g_rec_type
1354   ) is
1355 --
1356   l_proc  varchar2(72) := g_package||'delete_validate';
1357 --
1358 Begin
1359   hr_utility.set_location('Entering:'||l_proc, 5);
1360   --
1361     --
1362   chk_startup_action(false
1363                     ,pay_blt_shd.g_old_rec.business_group_id
1364                     ,pay_blt_shd.g_old_rec.legislation_code
1365                     );
1366   IF hr_startup_data_api_support.g_startup_mode
1367                      NOT IN ('GENERIC','STARTUP') THEN
1368      --
1369      -- Validate Important Attributes
1370      --
1371      --
1372      -- After validating the set of important attributes,
1373      -- if Multiple Message Detection is enabled and at least
1374      -- one error has been found then abort further validation.
1375      --
1376      hr_multi_message.end_validation_set;
1377   END IF;
1378   --
1379   -- Call all supporting business operations
1380   --
1381   hr_utility.set_location(' Leaving:'||l_proc, 10);
1382 End delete_validate;
1383 --
1384 end pay_blt_bus;