DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TMT_BUS

Source


1 Package Body ota_tmt_bus as
2 /* $Header: ottmtrhi.pkb 115.6 2002/11/26 17:09:48 hwinsor noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tmt_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_tp_measurement_type_id      number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 Procedure set_security_group_id
20   (p_tp_measurement_type_id       in ota_tp_measurement_types.tp_measurement_type_id%TYPE
21   ) is
22   --
23   -- Declare cursor
24   --
25   cursor csr_sec_grp is
26     select inf.org_information14
27     from   hr_organization_information inf
28           ,ota_tp_measurement_types tmt
29     where  tmt.tp_measurement_type_id        = p_tp_measurement_type_id
30     and    inf.organization_id               = tmt.business_group_id
31     and    inf.org_information_context || '' = 'Business Group Information';
32 
33 
34 
35   --  Declare local variables
36   --
37   l_security_group_id number;
38   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
39   --
40 begin
41   --
42   hr_utility.set_location('Entering:'|| l_proc, 10);
43   --
44   -- Ensure that all the mandatory parameter are not null
45   --
46   hr_api.mandatory_arg_error
47     (p_api_name           => l_proc
48     ,p_argument           => 'tp_measurement_type_id'
49     ,p_argument_value     => p_tp_measurement_type_id
50     );
51   --
52   open csr_sec_grp;
53   fetch csr_sec_grp into l_security_group_id;
54   --
55   if csr_sec_grp%notfound then
56      --
57      close csr_sec_grp;
58      --
59      -- The primary key is invalid therefore we must error
60      --
61      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
62      fnd_message.raise_error;
63      --
64   end if;
65   close csr_sec_grp;
66   --
67   -- Set the security_group_id in CLIENT_INFO
68   --
69   hr_api.set_security_group_id
70     (p_security_group_id => l_security_group_id
71     );
72   --
73   hr_utility.set_location(' Leaving:'|| l_proc, 20);
74   --
75 end set_security_group_id;
76 --
77 --  ---------------------------------------------------------------------------
78 --  |---------------------< return_legislation_code >-------------------------|
79 --  ---------------------------------------------------------------------------
80 --
81 Function return_legislation_code
82   (p_tp_measurement_type_id               in     number
83   )
84   Return Varchar2 Is
85   --
86   -- Declare cursor
87   --
88   cursor csr_leg_code is
89     select pbg.legislation_code
90       from per_business_groups pbg
91          , ota_tp_measurement_types tmt
92      where tmt.tp_measurement_type_id = p_tp_measurement_type_id
93        and pbg.business_group_id = tmt.business_group_id;
94   --
95   -- Declare local variables
96   --
97   l_legislation_code  varchar2(150);
98   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
99   --
100 Begin
101   --
102   hr_utility.set_location('Entering:'|| l_proc, 10);
103   --
104   -- Ensure that all the mandatory parameter are not null
105   --
106   hr_api.mandatory_arg_error
107     (p_api_name           => l_proc
108     ,p_argument           => 'tp_measurement_type_id'
109     ,p_argument_value     => p_tp_measurement_type_id
110     );
111   --
112   if ( nvl(ota_tmt_bus.g_tp_measurement_type_id, hr_api.g_number)
113        = p_tp_measurement_type_id) then
114     --
115     -- The legislation code has already been found with a previous
116     -- call to this function. Just return the value in the global
117     -- variable.
118     --
119     l_legislation_code := ota_tmt_bus.g_legislation_code;
120     hr_utility.set_location(l_proc, 20);
121   else
122     --
123     -- The ID is different to the last call to this function
124     -- or this is the first call to this function.
125     --
126     open csr_leg_code;
127     fetch csr_leg_code into l_legislation_code;
128     --
129     if csr_leg_code%notfound then
130       --
131       -- The primary key is invalid therefore we must error
132       --
133       close csr_leg_code;
134       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
135       fnd_message.raise_error;
136     end if;
137     hr_utility.set_location(l_proc,30);
138     --
139     -- Set the global variables so the values are
140     -- available for the next call to this function.
141     --
142     close csr_leg_code;
143     ota_tmt_bus.g_tp_measurement_type_id := p_tp_measurement_type_id;
144     ota_tmt_bus.g_legislation_code  := l_legislation_code;
145   end if;
146   hr_utility.set_location(' Leaving:'|| l_proc, 40);
147   return l_legislation_code;
148 end return_legislation_code;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |------------------------------< chk_df >----------------------------------|
152 -- ----------------------------------------------------------------------------
153 --
154 -- Description:
155 --   Validates all the Descriptive Flexfield values.
156 --
157 -- Prerequisites:
158 --   All other columns have been validated.  Must be called as the
159 --   last step from insert_validate and update_validate.
160 --
161 -- In Arguments:
162 --   p_rec
163 --
164 -- Post Success:
165 --   If the Descriptive Flexfield structure column and data values are
166 --   all valid this procedure will end normally and processing will
167 --   continue.
168 --
169 -- Post Failure:
170 --   If the Descriptive Flexfield structure column value or any of
171 --   the data values are invalid then an application error is raised as
172 --   a PL/SQL exception.
173 --
174 -- Access Status:
175 --   Internal Row Handler Use Only.
176 --
177 -- ----------------------------------------------------------------------------
178 procedure chk_df
179   (p_rec in ota_tmt_shd.g_rec_type
180   ) is
181 --
182   l_proc   varchar2(72) := g_package || 'chk_df';
183 --
184 begin
185   hr_utility.set_location('Entering:'||l_proc,10);
186   --
187   if ((p_rec.tp_measurement_type_id is not null)  and (
188     nvl(ota_tmt_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
189     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
190     nvl(ota_tmt_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
191     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
192     nvl(ota_tmt_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
193     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
194     nvl(ota_tmt_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
195     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
196     nvl(ota_tmt_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
197     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
198     nvl(ota_tmt_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
199     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
200     nvl(ota_tmt_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
201     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
202     nvl(ota_tmt_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
203     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
204     nvl(ota_tmt_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
205     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
206     nvl(ota_tmt_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
207     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
208     nvl(ota_tmt_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
209     nvl(p_rec.attribute10, hr_api.g_varchar2)  or
210     nvl(ota_tmt_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
211     nvl(p_rec.attribute11, hr_api.g_varchar2)  or
212     nvl(ota_tmt_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
213     nvl(p_rec.attribute12, hr_api.g_varchar2)  or
214     nvl(ota_tmt_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
215     nvl(p_rec.attribute13, hr_api.g_varchar2)  or
216     nvl(ota_tmt_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
217     nvl(p_rec.attribute14, hr_api.g_varchar2)  or
218     nvl(ota_tmt_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
219     nvl(p_rec.attribute15, hr_api.g_varchar2)  or
220     nvl(ota_tmt_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
221     nvl(p_rec.attribute16, hr_api.g_varchar2)  or
222     nvl(ota_tmt_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
223     nvl(p_rec.attribute17, hr_api.g_varchar2)  or
224     nvl(ota_tmt_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
225     nvl(p_rec.attribute18, hr_api.g_varchar2)  or
226     nvl(ota_tmt_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
227     nvl(p_rec.attribute19, hr_api.g_varchar2)  or
228     nvl(ota_tmt_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
229     nvl(p_rec.attribute20, hr_api.g_varchar2)  or
230     nvl(ota_tmt_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
231     nvl(p_rec.attribute21, hr_api.g_varchar2)  or
232     nvl(ota_tmt_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
233     nvl(p_rec.attribute22, hr_api.g_varchar2)  or
234     nvl(ota_tmt_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
235     nvl(p_rec.attribute23, hr_api.g_varchar2)  or
236     nvl(ota_tmt_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
237     nvl(p_rec.attribute24, hr_api.g_varchar2)  or
238     nvl(ota_tmt_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
239     nvl(p_rec.attribute25, hr_api.g_varchar2)  or
240     nvl(ota_tmt_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
241     nvl(p_rec.attribute26, hr_api.g_varchar2)  or
242     nvl(ota_tmt_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
243     nvl(p_rec.attribute27, hr_api.g_varchar2)  or
244     nvl(ota_tmt_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
245     nvl(p_rec.attribute28, hr_api.g_varchar2)  or
246     nvl(ota_tmt_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
247     nvl(p_rec.attribute29, hr_api.g_varchar2)  or
248     nvl(ota_tmt_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
249     nvl(p_rec.attribute30, hr_api.g_varchar2) ) )
250     or (p_rec.tp_measurement_type_id is null) then
251     --
252     -- Only execute the validation if absolutely necessary:
253     -- a) During update, the structure column value or any
254     --    of the attribute values have actually changed.
255     -- b) During insert.
256     --
257     hr_dflex_utility.ins_or_upd_descflex_attribs
258       (p_appl_short_name                 => 'OTA'
259       ,p_descflex_name                   => 'OTA_TP_MEASUREMENT_TYPES'
260       ,p_attribute_category              => p_rec.attribute_category
261       ,p_attribute1_name                 => 'ATTRIBUTE1'
262       ,p_attribute1_value                => p_rec.attribute1
263       ,p_attribute2_name                 => 'ATTRIBUTE2'
264       ,p_attribute2_value                => p_rec.attribute2
265       ,p_attribute3_name                 => 'ATTRIBUTE3'
266       ,p_attribute3_value                => p_rec.attribute3
267       ,p_attribute4_name                 => 'ATTRIBUTE4'
268       ,p_attribute4_value                => p_rec.attribute4
269       ,p_attribute5_name                 => 'ATTRIBUTE5'
270       ,p_attribute5_value                => p_rec.attribute5
271       ,p_attribute6_name                 => 'ATTRIBUTE6'
272       ,p_attribute6_value                => p_rec.attribute6
273       ,p_attribute7_name                 => 'ATTRIBUTE7'
274       ,p_attribute7_value                => p_rec.attribute7
275       ,p_attribute8_name                 => 'ATTRIBUTE8'
276       ,p_attribute8_value                => p_rec.attribute8
277       ,p_attribute9_name                 => 'ATTRIBUTE9'
278       ,p_attribute9_value                => p_rec.attribute9
279       ,p_attribute10_name                => 'ATTRIBUTE10'
280       ,p_attribute10_value               => p_rec.attribute10
281       ,p_attribute11_name                => 'ATTRIBUTE11'
282       ,p_attribute11_value               => p_rec.attribute11
283       ,p_attribute12_name                => 'ATTRIBUTE12'
284       ,p_attribute12_value               => p_rec.attribute12
285       ,p_attribute13_name                => 'ATTRIBUTE13'
286       ,p_attribute13_value               => p_rec.attribute13
287       ,p_attribute14_name                => 'ATTRIBUTE14'
288       ,p_attribute14_value               => p_rec.attribute14
289       ,p_attribute15_name                => 'ATTRIBUTE15'
290       ,p_attribute15_value               => p_rec.attribute15
291       ,p_attribute16_name                => 'ATTRIBUTE16'
292       ,p_attribute16_value               => p_rec.attribute16
293       ,p_attribute17_name                => 'ATTRIBUTE17'
294       ,p_attribute17_value               => p_rec.attribute17
295       ,p_attribute18_name                => 'ATTRIBUTE18'
296       ,p_attribute18_value               => p_rec.attribute18
297       ,p_attribute19_name                => 'ATTRIBUTE19'
298       ,p_attribute19_value               => p_rec.attribute19
299       ,p_attribute20_name                => 'ATTRIBUTE20'
300       ,p_attribute20_value               => p_rec.attribute20
301       ,p_attribute21_name                => 'ATTRIBUTE21'
302       ,p_attribute21_value               => p_rec.attribute21
303       ,p_attribute22_name                => 'ATTRIBUTE22'
304       ,p_attribute22_value               => p_rec.attribute22
305       ,p_attribute23_name                => 'ATTRIBUTE23'
306       ,p_attribute23_value               => p_rec.attribute23
307       ,p_attribute24_name                => 'ATTRIBUTE24'
308       ,p_attribute24_value               => p_rec.attribute24
309       ,p_attribute25_name                => 'ATTRIBUTE25'
310       ,p_attribute25_value               => p_rec.attribute25
311       ,p_attribute26_name                => 'ATTRIBUTE26'
312       ,p_attribute26_value               => p_rec.attribute26
313       ,p_attribute27_name                => 'ATTRIBUTE27'
314       ,p_attribute27_value               => p_rec.attribute27
315       ,p_attribute28_name                => 'ATTRIBUTE28'
316       ,p_attribute28_value               => p_rec.attribute28
317       ,p_attribute29_name                => 'ATTRIBUTE29'
318       ,p_attribute29_value               => p_rec.attribute29
319       ,p_attribute30_name                => 'ATTRIBUTE30'
320       ,p_attribute30_value               => p_rec.attribute30
321       );
322   end if;
323   --
324   hr_utility.set_location(' Leaving:'||l_proc,20);
325 end chk_df;
326 --
327 -- ----------------------------------------------------------------------------
331 --
328 -- |-----------------------< chk_non_updateable_args >------------------------|
329 -- ----------------------------------------------------------------------------
330 -- {Start Of Comments}
332 -- Description:
333 --   This procedure is used to ensure that non updateable attributes have
334 --   not been updated. If an attribute has been updated an error is generated.
335 --
336 -- Pre Conditions:
337 --   g_old_rec has been populated with details of the values currently in
338 --   the database.
339 --
340 -- In Arguments:
341 --   p_rec has been populated with the updated values the user would like the
342 --   record set to.
343 --
344 -- Post Success:
345 --   Processing continues if all the non updateable attributes have not
346 --   changed.
347 --
348 -- Post Failure:
349 --   An application error is raised if any of the non updatable attributes
350 --   have been altered.
351 --
352 -- {End Of Comments}
353 -- ----------------------------------------------------------------------------
354 Procedure chk_non_updateable_args
355   (p_effective_date               in date
356   ,p_rec                          in ota_tmt_shd.g_rec_type
357   ) IS
358 --
359   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
360   l_error    EXCEPTION;
361   l_argument varchar2(30);
362 --
363 Begin
364   --
365   -- Only proceed with the validation if a row exists for the current
366   -- record in the HR Schema.
367   --
368   IF NOT ota_tmt_shd.api_updating
369       (p_tp_measurement_type_id               => p_rec.tp_measurement_type_id
370       ,p_object_version_number                => p_rec.object_version_number
371       ) THEN
372      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
373      fnd_message.set_token('PROCEDURE ', l_proc);
374      fnd_message.set_token('STEP ', '5');
375      fnd_message.raise_error;
376   END IF;
377   --
378   --
379   hr_utility.set_location(' Step:'|| l_proc, 10);
380   if nvl(p_rec.business_group_id, hr_api.g_number) <>
381      nvl(ota_tmt_shd.g_old_rec.business_group_id, hr_api.g_number) then
382      l_argument := 'business_group_id';
383      raise l_error;
384   end if;
385   --
386   hr_utility.set_location(' Step:'|| l_proc, 20);
387   if nvl(p_rec.tp_measurement_type_id, hr_api.g_number) <>
388      nvl(ota_tmt_shd.g_old_rec.tp_measurement_type_id, hr_api.g_number) then
389      l_argument := 'tp_measurement_type_id';
390      raise l_error;
391   end if;
392   --
393   hr_utility.set_location(' Step:'|| l_proc, 30);
394   if nvl(p_rec.tp_measurement_code, hr_api.g_varchar2) <>
395      nvl(ota_tmt_shd.g_old_rec.tp_measurement_code, hr_api.g_varchar2) then
396      l_argument := 'tp_measurement_code';
397      raise l_error;
398   end if;
399   --
400   EXCEPTION
401     WHEN l_error THEN
402        hr_api.argument_changed_error
403          (p_api_name => l_proc
404          ,p_argument => l_argument);
405     WHEN OTHERS THEN
406        RAISE;
407 End chk_non_updateable_args;
408 --
409 -- ----------------------------------------------------------------------------
410 -- |---------------------------< insert_validate >----------------------------|
411 -- ----------------------------------------------------------------------------
412 Procedure insert_validate
413   (p_effective_date               in date
414   ,p_rec                          in ota_tmt_shd.g_rec_type
415   ) is
416 --
417   cursor csr_leg_code is
418     select pbg.legislation_code
419     from per_business_groups pbg
420     where pbg.business_group_id = p_rec.business_group_id;
421     l_proc  varchar2(72) := g_package||'insert_validate';
422     l_legislation_code per_business_groups.legislation_code%TYPE;
423 --
424 Begin
425   hr_utility.set_location('Entering:'||l_proc, 5);
426   --
427   -- Call all supporting business operations
428   --
429   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
430   --
431   hr_utility.set_location(' Step:'|| l_proc, 10);
432   ota_tmt_bus1.chk_tp_measurement_code(
433                           p_effective_date         => p_effective_date
434                          ,p_tp_measurement_code    => p_rec.tp_measurement_code
435                          ,p_business_group_id      => p_rec.business_group_id);
436   --
437   hr_utility.set_location(' Step:'|| l_proc, 20);
438   ota_tmt_bus1.chk_unit(
439                           p_effective_date         => p_effective_date
440                          ,p_unit                   => p_rec.unit
441                          ,p_business_group_id      => p_rec.business_group_id
442                          ,p_object_version_number  => p_rec.object_version_number
443                          ,p_tp_measurement_type_id => p_rec.tp_measurement_type_id);
444   hr_utility.set_location(' Step:'|| l_proc, 30);
445   ota_tmt_bus1.chk_budget_level(
446                           p_effective_date         =>  p_effective_date
447                          ,p_business_group_id      =>  p_rec.business_group_id
448                          ,p_budget_level           =>  p_rec.budget_level
449                          ,p_tp_measurement_code    =>  p_rec.tp_measurement_code
450                          ,p_object_version_number  =>  p_rec.object_version_number
451                          ,p_tp_measurement_type_id =>  p_rec.tp_measurement_type_id);
452   hr_utility.set_location(' Step:'|| l_proc, 40);
456                          ,p_cost_level             =>  p_rec.cost_level
453   ota_tmt_bus1.chk_cost_level(
454                           p_effective_date         =>  p_effective_date
455                          ,p_business_group_id      =>  p_rec.business_group_id
457                          ,p_object_version_number  =>  p_rec.object_version_number
458                          ,p_tp_measurement_type_id =>  p_rec.tp_measurement_type_id);
459   hr_utility.set_location(' Step:'|| l_proc, 50);
460   ota_tmt_bus1.chk_budget_cost_combination(
461                           p_budget_level           =>  p_rec.budget_level
462                          ,p_cost_level             =>  p_rec.cost_level
463                          ,p_object_version_number  =>  p_rec.object_version_number
464                          ,p_tp_measurement_type_id =>  p_rec.tp_measurement_type_id);
465   hr_utility.set_location(' Step:'|| l_proc, 60);
466   ota_tmt_bus1.chk_many_budget_values_flag(
467                           p_effective_date          =>  p_effective_date
468                          ,p_business_group_id       =>  p_rec.business_group_id
469                          ,p_many_budget_values_flag =>  p_rec.many_budget_values_flag
470                          ,p_tp_measurement_code     =>  p_rec.tp_measurement_code
471                          ,p_object_version_number   =>  p_rec.object_version_number
472                          ,p_tp_measurement_type_id  =>  p_rec.tp_measurement_type_id);
473   hr_utility.set_location(' Step:'|| l_proc, 70);
474   ota_tmt_bus1.chk_item_type_usage_id(
475                           p_item_type_usage_id      =>  p_rec.item_type_usage_id
476                          ,p_business_group_id       =>  p_rec.business_group_id
477                          ,p_object_version_number   =>  p_rec.object_version_number
478                          ,p_tp_measurement_type_id  =>  p_rec.tp_measurement_type_id);
479   --
480   hr_utility.set_location(' Step:'|| l_proc, 80);
481   open csr_leg_code;
482   fetch csr_leg_code into l_legislation_code;
483   close csr_leg_code;
484   hr_utility.set_location(' Step:'|| l_proc, 90);
485   ota_tmt_bus1.chk_legislative_setup(
486                           p_legislation_code        => l_legislation_code
487                          ,p_tp_measurement_code     => p_rec.tp_measurement_code
488                          ,p_unit                    => p_rec.unit
489                          ,p_budget_level            => p_rec.budget_level
490                          ,p_cost_level              => p_rec.cost_level
491                          ,p_many_budget_values_flag => p_rec.many_budget_values_flag
492                          ,p_object_version_number   => p_rec.object_version_number
493                          ,p_tp_measurement_type_id  => p_rec.tp_measurement_type_id);
494  --
495  ota_tmt_bus.chk_df(p_rec);
496   --
497   hr_utility.set_location(' Leaving:'||l_proc, 100);
498 End insert_validate;
499 --
500 -- ----------------------------------------------------------------------------
501 -- |---------------------------< update_validate >----------------------------|
502 -- ----------------------------------------------------------------------------
503 Procedure update_validate
504   (p_effective_date               in date
505   ,p_rec                          in ota_tmt_shd.g_rec_type
506   ) is
507 --
508   cursor csr_leg_code is
509     select pbg.legislation_code
510     from per_business_groups pbg
511     where pbg.business_group_id = p_rec.business_group_id;
512   l_legislation_code per_business_groups.legislation_code%TYPE;
513   l_proc  varchar2(72) := g_package||'update_validate';
514 --
515 Begin
516   hr_utility.set_location('Entering:'||l_proc, 5);
517   --
518   -- Call all supporting business operations
519   --
520   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
521   --
522   chk_non_updateable_args(p_effective_date         => p_effective_date
523                          ,p_rec                    => p_rec);
524   --
525   --
526   hr_utility.set_location(' Step:'|| l_proc, 10);
527   ota_tmt_bus1.chk_unit(
528                           p_effective_date         => p_effective_date
529                          ,p_unit                   => p_rec.unit
530                          ,p_business_group_id      => p_rec.business_group_id
531                          ,p_object_version_number  => p_rec.object_version_number
532                          ,p_tp_measurement_type_id => p_rec.tp_measurement_type_id);
533   hr_utility.set_location(' Step:'|| l_proc, 20);
534   ota_tmt_bus1.chk_budget_level(
535                           p_effective_date         =>  p_effective_date
536                          ,p_business_group_id      =>  p_rec.business_group_id
537                          ,p_budget_level           =>  p_rec.budget_level
538                          ,p_tp_measurement_code    =>  p_rec.tp_measurement_code
539                          ,p_object_version_number  =>  p_rec.object_version_number
540                          ,p_tp_measurement_type_id =>  p_rec.tp_measurement_type_id);
541   hr_utility.set_location(' Step:'|| l_proc, 30);
542   ota_tmt_bus1.chk_cost_level(
543                           p_effective_date         =>  p_effective_date
544                          ,p_business_group_id      =>  p_rec.business_group_id
545                          ,p_cost_level             =>  p_rec.cost_level
546                          ,p_object_version_number  =>  p_rec.object_version_number
547                          ,p_tp_measurement_type_id =>  p_rec.tp_measurement_type_id);
548   hr_utility.set_location(' Step:'|| l_proc, 40);
552                          ,p_object_version_number  =>  p_rec.object_version_number
549   ota_tmt_bus1.chk_budget_cost_combination(
550                           p_budget_level           =>  p_rec.budget_level
551                          ,p_cost_level             =>  p_rec.cost_level
553                          ,p_tp_measurement_type_id =>  p_rec.tp_measurement_type_id);
554   hr_utility.set_location(' Step:'|| l_proc, 50);
555   ota_tmt_bus1.chk_many_budget_values_flag(
556                           p_effective_date          =>  p_effective_date
557                          ,p_business_group_id       =>  p_rec.business_group_id
558                          ,p_many_budget_values_flag =>  p_rec.many_budget_values_flag
559                          ,p_tp_measurement_code     =>  p_rec.tp_measurement_code
560                          ,p_object_version_number   =>  p_rec.object_version_number
561                          ,p_tp_measurement_type_id  =>  p_rec.tp_measurement_type_id);
562   hr_utility.set_location(' Step:'|| l_proc, 60);
563   ota_tmt_bus1.chk_item_type_usage_id(
564                           p_item_type_usage_id      =>  p_rec.item_type_usage_id
565                          ,p_business_group_id       =>  p_rec.business_group_id
566                          ,p_object_version_number   =>  p_rec.object_version_number
567                          ,p_tp_measurement_type_id  =>  p_rec.tp_measurement_type_id);
568   --
569   hr_utility.set_location(' Step:'|| l_proc, 70);
570   open csr_leg_code;
571   fetch csr_leg_code into l_legislation_code;
572   close csr_leg_code;
573   hr_utility.set_location(' Step:'|| l_proc, 80);
574   ota_tmt_bus1.chk_legislative_setup(
575                           p_legislation_code        => l_legislation_code
576                          ,p_tp_measurement_code     => p_rec.tp_measurement_code
577                          ,p_unit                    => p_rec.unit
578                          ,p_budget_level            => p_rec.budget_level
579                          ,p_cost_level              => p_rec.cost_level
580                          ,p_many_budget_values_flag => p_rec.many_budget_values_flag
581                          ,p_object_version_number   => p_rec.object_version_number
582                          ,p_tp_measurement_type_id  => p_rec.tp_measurement_type_id);
583   --
584   ota_tmt_bus.chk_df(p_rec);
585   --
586   hr_utility.set_location(' Leaving:'||l_proc, 90);
587 End update_validate;
588 --
589 -- ----------------------------------------------------------------------------
590 -- |---------------------------< delete_validate >----------------------------|
591 -- ----------------------------------------------------------------------------
592 Procedure delete_validate
593   (p_rec                          in ota_tmt_shd.g_rec_type
594   ) is
595 --
596   l_proc  varchar2(72) := g_package||'delete_validate';
597 --
598 Begin
599   hr_utility.set_location('Entering:'||l_proc, 5);
600   --
601   -- Call all supporting business operations
602   --
603   hr_utility.set_location(' Step:'|| l_proc, 10);
604   ota_tmt_bus1.chk_del_tp_measurement_code(
605     p_tp_measurement_code       => ota_tmt_shd.g_old_rec.tp_measurement_code
606    ,p_tp_measurement_type_id    => ota_tmt_shd.g_old_rec.tp_measurement_type_id
607    ,p_business_group_id         => ota_tmt_shd.g_old_rec.business_group_id);
608   hr_utility.set_location(' Step:'|| l_proc, 20);
609   ota_tmt_bus1.chk_del_tp_measurement_type_id(
610     p_tp_measurement_type_id    => ota_tmt_shd.g_old_rec.tp_measurement_type_id);
611   hr_utility.set_location(' Leaving:'||l_proc, 10);
612 End delete_validate;
613 --
614 end ota_tmt_bus;