DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TMT_API

Source


1 Package Body OTA_TMT_API as
2 /* $Header: ottmtapi.pkb 115.5 2002/11/26 17:03:17 hwinsor noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  OTA_TMT_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------------< CREATE_MEASURE >--------------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_measure
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_business_group_id             in     number
16   ,p_tp_measurement_code           in     varchar2
17   ,p_unit                          in     varchar2
18   ,p_budget_level                  in     varchar2
19   ,p_cost_level                    in     varchar2
20   ,p_many_budget_values_flag       in     varchar2
21   ,p_reporting_sequence            in     number   default null
22   ,p_item_type_usage_id            in     number   default null
23   ,p_attribute_category            in     varchar2 default null
24   ,p_attribute1                    in     varchar2 default null
25   ,p_attribute2                    in     varchar2 default null
26   ,p_attribute3                    in     varchar2 default null
27   ,p_attribute4                    in     varchar2 default null
28   ,p_attribute5                    in     varchar2 default null
29   ,p_attribute6                    in     varchar2 default null
30   ,p_attribute7                    in     varchar2 default null
31   ,p_attribute8                    in     varchar2 default null
32   ,p_attribute9                    in     varchar2 default null
33   ,p_attribute10                   in     varchar2 default null
34   ,p_attribute11                   in     varchar2 default null
35   ,p_attribute12                   in     varchar2 default null
36   ,p_attribute13                   in     varchar2 default null
37   ,p_attribute14                   in     varchar2 default null
38   ,p_attribute15                   in     varchar2 default null
39   ,p_attribute16                   in     varchar2 default null
40   ,p_attribute17                   in     varchar2 default null
41   ,p_attribute18                   in     varchar2 default null
42   ,p_attribute19                   in     varchar2 default null
43   ,p_attribute20                   in     varchar2 default null
44   ,p_attribute21                   in     varchar2 default null
45   ,p_attribute22                   in     varchar2 default null
46   ,p_attribute23                   in     varchar2 default null
47   ,p_attribute24                   in     varchar2 default null
48   ,p_attribute25                   in     varchar2 default null
49   ,p_attribute26                   in     varchar2 default null
50   ,p_attribute27                   in     varchar2 default null
51   ,p_attribute28                   in     varchar2 default null
52   ,p_attribute29                   in     varchar2 default null
53   ,p_attribute30                   in     varchar2 default null
54   ,p_tp_measurement_type_id           out nocopy number
55   ,p_object_version_number            out nocopy number
56   ) is
57   --
58   -- Declare cursors and local variables
59   --
60   l_proc                    varchar2(72) := g_package||' Create Measure';
61   l_tp_measurement_type_id  number;
62   l_object_version_number   number;
63   l_effective_date          date;
64 begin
65   hr_utility.set_location('Entering:'|| l_proc, 10);
66   --
67   -- Issue a savepoint
68   --
69   savepoint create_measure;
70   --
71   -- Truncate the time portion from all IN date parameters
72   --
73   l_effective_date := trunc(p_effective_date);
74   --
75   -- Call Before Process User Hook
76   --
77   begin
78     ota_tmt_api_bk1.create_measure_b
79   (p_effective_date              => l_effective_date
80   ,p_business_group_id           => p_business_group_id
81   ,p_tp_measurement_code         => p_tp_measurement_code
82   ,p_unit                        => p_unit
83   ,p_budget_level                => p_budget_level
84   ,p_cost_level                  => p_cost_level
85   ,p_many_budget_values_flag     => p_many_budget_values_flag
86   ,p_reporting_sequence          => p_reporting_sequence
87   ,p_item_type_usage_id          => p_item_type_usage_id
88   ,p_attribute_category          => p_attribute_category
89   ,p_attribute1                  => p_attribute1
90   ,p_attribute2                  => p_attribute2
91   ,p_attribute3                  => p_attribute3
92   ,p_attribute4                  => p_attribute4
93   ,p_attribute5                  => p_attribute5
94   ,p_attribute6                  => p_attribute6
95   ,p_attribute7                  => p_attribute7
96   ,p_attribute8                  => p_attribute8
97   ,p_attribute9                  => p_attribute9
98   ,p_attribute10                 => p_attribute10
99   ,p_attribute11                 => p_attribute11
100   ,p_attribute12                 => p_attribute12
101   ,p_attribute13                 => p_attribute13
102   ,p_attribute14                 => p_attribute14
103   ,p_attribute15                 => p_attribute15
104   ,p_attribute16                 => p_attribute16
105   ,p_attribute17                 => p_attribute17
106   ,p_attribute18                 => p_attribute18
107   ,p_attribute19                 => p_attribute19
108   ,p_attribute20                 => p_attribute20
109   ,p_attribute21                 => p_attribute21
110   ,p_attribute22                 => p_attribute22
111   ,p_attribute23                 => p_attribute23
112   ,p_attribute24                 => p_attribute24
113   ,p_attribute25                 => p_attribute25
114   ,p_attribute26                 => p_attribute26
115   ,p_attribute27                 => p_attribute27
116   ,p_attribute28                 => p_attribute28
117   ,p_attribute29                 => p_attribute29
118   ,p_attribute30                 => p_attribute30
119   );
120   exception
121     when hr_api.cannot_find_prog_unit then
122       hr_api.cannot_find_prog_unit_error
123         (p_module_name => 'Create_measure'
124         ,p_hook_type   => 'BP'
125         );
126   end;
127   --
128   -- Validation in addition to Row Handlers
129   --
130   --
131   -- Process Logic
132   --
133   ota_tmt_ins.ins
134   (p_effective_date                 => l_effective_date
135   ,p_tp_measurement_code            => p_tp_measurement_code
136   ,p_unit                           => p_unit
137   ,p_budget_level                   => p_budget_level
138   ,p_cost_level                     => p_cost_level
139   ,p_many_budget_values_flag        => p_many_budget_values_flag
140   ,p_business_group_id              => p_business_group_id
141   ,p_reporting_sequence             => p_reporting_sequence
142   ,p_item_type_usage_id             => p_item_type_usage_id
143   ,p_attribute_category             => p_attribute_category
144   ,p_attribute1                     => p_attribute1
145   ,p_attribute2                     => p_attribute2
146   ,p_attribute3                     => p_attribute3
147   ,p_attribute4                     => p_attribute4
148   ,p_attribute5                     => p_attribute5
149   ,p_attribute6                     => p_attribute6
150   ,p_attribute7                     => p_attribute7
151   ,p_attribute8                     => p_attribute8
152   ,p_attribute9                     => p_attribute9
153   ,p_attribute10                    => p_attribute10
154   ,p_attribute11                    => p_attribute11
155   ,p_attribute12                    => p_attribute12
156   ,p_attribute13                    => p_attribute13
157   ,p_attribute14                    => p_attribute14
158   ,p_attribute15                    => p_attribute15
159   ,p_attribute16                    => p_attribute16
160   ,p_attribute17                    => p_attribute17
161   ,p_attribute18                    => p_attribute18
162   ,p_attribute19                    => p_attribute19
163   ,p_attribute20                    => p_attribute20
164   ,p_attribute21                    => p_attribute21
165   ,p_attribute22                    => p_attribute22
166   ,p_attribute23                    => p_attribute23
167   ,p_attribute24                    => p_attribute24
168   ,p_attribute25                    => p_attribute25
169   ,p_attribute26                    => p_attribute26
170   ,p_attribute27                    => p_attribute27
171   ,p_attribute28                    => p_attribute28
172   ,p_attribute29                    => p_attribute29
173   ,p_attribute30                    => p_attribute30
174   ,p_tp_measurement_type_id         => l_tp_measurement_type_id
175   ,p_object_version_number          => l_object_version_number);
176   --
177   -- Call After Process User Hook
178   --
179   begin
180   ota_tmt_api_bk1.create_measure_a
181   (p_effective_date              => l_effective_date
182   ,p_business_group_id           => p_business_group_id
183   ,p_tp_measurement_code         => p_tp_measurement_code
184   ,p_unit                        => p_unit
185   ,p_budget_level                => p_budget_level
186   ,p_cost_level                  => p_cost_level
187   ,p_many_budget_values_flag     => p_many_budget_values_flag
188   ,p_reporting_sequence          => p_reporting_sequence
189   ,p_item_type_usage_id          => p_item_type_usage_id
190   ,p_attribute_category          => p_attribute_category
191   ,p_attribute1                  => p_attribute1
192   ,p_attribute2                  => p_attribute2
193   ,p_attribute3                  => p_attribute3
194   ,p_attribute4                  => p_attribute4
195   ,p_attribute5                  => p_attribute5
196   ,p_attribute6                  => p_attribute6
197   ,p_attribute7                  => p_attribute7
198   ,p_attribute8                  => p_attribute8
199   ,p_attribute9                  => p_attribute9
200   ,p_attribute10                 => p_attribute10
201   ,p_attribute11                 => p_attribute11
202   ,p_attribute12                 => p_attribute12
203   ,p_attribute13                 => p_attribute13
204   ,p_attribute14                 => p_attribute14
205   ,p_attribute15                 => p_attribute15
206   ,p_attribute16                 => p_attribute16
207   ,p_attribute17                 => p_attribute17
208   ,p_attribute18                 => p_attribute18
209   ,p_attribute19                 => p_attribute19
210   ,p_attribute20                 => p_attribute20
211   ,p_attribute21                 => p_attribute21
212   ,p_attribute22                 => p_attribute22
213   ,p_attribute23                 => p_attribute23
214   ,p_attribute24                 => p_attribute24
215   ,p_attribute25                 => p_attribute25
216   ,p_attribute26                 => p_attribute26
217   ,p_attribute27                 => p_attribute27
218   ,p_attribute28                 => p_attribute28
219   ,p_attribute29                 => p_attribute29
220   ,p_attribute30                 => p_attribute30
221   ,p_tp_measurement_type_id      => l_tp_measurement_type_id
222   ,p_object_version_number       => l_object_version_number
223   );
224   exception
225     when hr_api.cannot_find_prog_unit then
226       hr_api.cannot_find_prog_unit_error
227         (p_module_name => 'create_measure'
228         ,p_hook_type   => 'AP'
229         );
230   end;
231   --
232   -- When in validation only mode raise the Validate_Enabled exception
233   --
234   if p_validate then
235     raise hr_api.validate_enabled;
236   end if;
237   --
238   -- Set all output arguments
239   --
240   p_tp_measurement_type_id := l_tp_measurement_type_id;
241   p_object_version_number  := l_object_version_number;
242   --
243   hr_utility.set_location(' Leaving:'||l_proc, 70);
244 exception
245   when hr_api.validate_enabled then
246     --
247     -- As the Validate_Enabled exception has been raised
248     -- we must rollback to the savepoint
249     --
250     rollback to create_measure;
251     --
252     -- Only set output warning arguments
253     -- (Any key or derived arguments must be set to null
254     -- when validation only mode is being used.)
255     --
256     p_tp_measurement_type_id := null;
257     p_object_version_number  := null;
258     hr_utility.set_location(' Leaving:'||l_proc, 80);
259   when others then
260     --
261     -- A validation or unexpected error has occured
262     --
263     rollback to create_measure;
264     p_tp_measurement_type_id := null;
265     p_object_version_number := null;
266     hr_utility.set_location(' Leaving:'||l_proc, 90);
267     raise;
268 end create_measure;
269 -- ----------------------------------------------------------------------------
270 -- |-------------------------< UPDATE_MEASURE >-------------------------------|
271 -- ----------------------------------------------------------------------------
272 --
273 procedure update_measure
274   (p_validate                      in     boolean  default false
275   ,p_effective_date                in     date
276   ,p_tp_measurement_type_id        in     number
277   ,p_object_version_number         in out nocopy number
278   ,p_unit                          in     varchar2 default hr_api.g_varchar2
279   ,p_budget_level                  in     varchar2 default hr_api.g_varchar2
280   ,p_cost_level                    in     varchar2 default hr_api.g_varchar2
281   ,p_many_budget_values_flag       in     varchar2 default hr_api.g_varchar2
282   ,p_reporting_sequence            in     number   default hr_api.g_number
283   ,p_item_type_usage_id            in     number   default hr_api.g_number
284   ,p_attribute_category            in     varchar2 default hr_api.g_varchar2
285   ,p_attribute1                    in     varchar2 default hr_api.g_varchar2
286   ,p_attribute2                    in     varchar2 default hr_api.g_varchar2
287   ,p_attribute3                    in     varchar2 default hr_api.g_varchar2
288   ,p_attribute4                    in     varchar2 default hr_api.g_varchar2
289   ,p_attribute5                    in     varchar2 default hr_api.g_varchar2
290   ,p_attribute6                    in     varchar2 default hr_api.g_varchar2
291   ,p_attribute7                    in     varchar2 default hr_api.g_varchar2
292   ,p_attribute8                    in     varchar2 default hr_api.g_varchar2
293   ,p_attribute9                    in     varchar2 default hr_api.g_varchar2
294   ,p_attribute10                   in     varchar2 default hr_api.g_varchar2
295   ,p_attribute11                   in     varchar2 default hr_api.g_varchar2
296   ,p_attribute12                   in     varchar2 default hr_api.g_varchar2
297   ,p_attribute13                   in     varchar2 default hr_api.g_varchar2
298   ,p_attribute14                   in     varchar2 default hr_api.g_varchar2
299   ,p_attribute15                   in     varchar2 default hr_api.g_varchar2
300   ,p_attribute16                   in     varchar2 default hr_api.g_varchar2
301   ,p_attribute17                   in     varchar2 default hr_api.g_varchar2
302   ,p_attribute18                   in     varchar2 default hr_api.g_varchar2
303   ,p_attribute19                   in     varchar2 default hr_api.g_varchar2
304   ,p_attribute20                   in     varchar2 default hr_api.g_varchar2
305   ,p_attribute21                   in     varchar2 default hr_api.g_varchar2
306   ,p_attribute22                   in     varchar2 default hr_api.g_varchar2
307   ,p_attribute23                   in     varchar2 default hr_api.g_varchar2
308   ,p_attribute24                   in     varchar2 default hr_api.g_varchar2
309   ,p_attribute25                   in     varchar2 default hr_api.g_varchar2
310   ,p_attribute26                   in     varchar2 default hr_api.g_varchar2
311   ,p_attribute27                   in     varchar2 default hr_api.g_varchar2
312   ,p_attribute28                   in     varchar2 default hr_api.g_varchar2
313   ,p_attribute29                   in     varchar2 default hr_api.g_varchar2
314   ,p_attribute30                   in     varchar2 default hr_api.g_varchar2
315   ) is
316   --
317   -- Declare cursors and local variables
318   --
319   l_proc                    varchar2(72) := g_package||' Update Measure';
320   l_object_version_number   number       := p_object_version_number;
321   l_effective_date          date;
322 begin
323   hr_utility.set_location('Entering:'|| l_proc, 10);
324   --
325   -- Issue a savepoint
326   --
327   savepoint update_measure;
328   --
329   -- Truncate the time portion from all IN date parameters
333   -- Call Before Process User Hook
330   --
331   l_effective_date := trunc(p_effective_date);
332   --
334   --
335   begin
336     ota_tmt_api_bk2.update_measure_b
337   (p_effective_date              => l_effective_date
338   ,p_tp_measurement_type_id      => p_tp_measurement_type_id
339   ,p_object_version_number       => l_object_version_number
340   ,p_unit                        => p_unit
341   ,p_budget_level                => p_budget_level
342   ,p_cost_level                  => p_cost_level
343   ,p_many_budget_values_flag     => p_many_budget_values_flag
344   ,p_reporting_sequence          => p_reporting_sequence
345   ,p_item_type_usage_id          => p_item_type_usage_id
346   ,p_attribute_category          => p_attribute_category
347   ,p_attribute1                  => p_attribute1
348   ,p_attribute2                  => p_attribute2
349   ,p_attribute3                  => p_attribute3
350   ,p_attribute4                  => p_attribute4
351   ,p_attribute5                  => p_attribute5
352   ,p_attribute6                  => p_attribute6
353   ,p_attribute7                  => p_attribute7
354   ,p_attribute8                  => p_attribute8
355   ,p_attribute9                  => p_attribute9
356   ,p_attribute10                 => p_attribute10
357   ,p_attribute11                 => p_attribute11
358   ,p_attribute12                 => p_attribute12
359   ,p_attribute13                 => p_attribute13
360   ,p_attribute14                 => p_attribute14
361   ,p_attribute15                 => p_attribute15
362   ,p_attribute16                 => p_attribute16
363   ,p_attribute17                 => p_attribute17
364   ,p_attribute18                 => p_attribute18
365   ,p_attribute19                 => p_attribute19
366   ,p_attribute20                 => p_attribute20
367   ,p_attribute21                 => p_attribute21
368   ,p_attribute22                 => p_attribute22
369   ,p_attribute23                 => p_attribute23
370   ,p_attribute24                 => p_attribute24
371   ,p_attribute25                 => p_attribute25
372   ,p_attribute26                 => p_attribute26
373   ,p_attribute27                 => p_attribute27
374   ,p_attribute28                 => p_attribute28
375   ,p_attribute29                 => p_attribute29
376   ,p_attribute30                 => p_attribute30
377   );
378   exception
379     when hr_api.cannot_find_prog_unit then
380       hr_api.cannot_find_prog_unit_error
381         (p_module_name => 'Update_measure'
382         ,p_hook_type   => 'BP'
383         );
384   end;
385   --
386   -- Validation in addition to Row Handlers
387   --
388   --
389   -- Process Logic
390   --
391   ota_tmt_upd.upd
392   (p_effective_date                 => l_effective_date
393   ,p_tp_measurement_type_id         => p_tp_measurement_type_id
394   ,p_object_version_number          => l_object_version_number
395   ,p_unit                           => p_unit
396   ,p_budget_level                   => p_budget_level
397   ,p_cost_level                     => p_cost_level
398   ,p_many_budget_values_flag        => p_many_budget_values_flag
399   ,p_reporting_sequence             => p_reporting_sequence
400   ,p_item_type_usage_id             => p_item_type_usage_id
401   ,p_attribute_category             => p_attribute_category
402   ,p_attribute1                     => p_attribute1
403   ,p_attribute2                     => p_attribute2
404   ,p_attribute3                     => p_attribute3
405   ,p_attribute4                     => p_attribute4
406   ,p_attribute5                     => p_attribute5
407   ,p_attribute6                     => p_attribute6
408   ,p_attribute7                     => p_attribute7
409   ,p_attribute8                     => p_attribute8
410   ,p_attribute9                     => p_attribute9
411   ,p_attribute10                    => p_attribute10
412   ,p_attribute11                    => p_attribute11
413   ,p_attribute12                    => p_attribute12
414   ,p_attribute13                    => p_attribute13
415   ,p_attribute14                    => p_attribute14
416   ,p_attribute15                    => p_attribute15
417   ,p_attribute16                    => p_attribute16
418   ,p_attribute17                    => p_attribute17
419   ,p_attribute18                    => p_attribute18
420   ,p_attribute19                    => p_attribute19
421   ,p_attribute20                    => p_attribute20
422   ,p_attribute21                    => p_attribute21
423   ,p_attribute22                    => p_attribute22
424   ,p_attribute23                    => p_attribute23
425   ,p_attribute24                    => p_attribute24
426   ,p_attribute25                    => p_attribute25
427   ,p_attribute26                    => p_attribute26
428   ,p_attribute27                    => p_attribute27
429   ,p_attribute28                    => p_attribute28
430   ,p_attribute29                    => p_attribute29
431   ,p_attribute30                    => p_attribute30);
432   --
433   -- Call After Process User Hook
434   --
435   begin
436   ota_tmt_api_bk2.update_measure_a
437   (p_effective_date              => l_effective_date
438   ,p_tp_measurement_type_id      => p_tp_measurement_type_id
439   ,p_object_version_number       => l_object_version_number
440   ,p_unit                        => p_unit
441   ,p_budget_level                => p_budget_level
442   ,p_cost_level                  => p_cost_level
443   ,p_many_budget_values_flag     => p_many_budget_values_flag
447   ,p_attribute1                  => p_attribute1
444   ,p_reporting_sequence          => p_reporting_sequence
445   ,p_item_type_usage_id          => p_item_type_usage_id
446   ,p_attribute_category          => p_attribute_category
448   ,p_attribute2                  => p_attribute2
449   ,p_attribute3                  => p_attribute3
450   ,p_attribute4                  => p_attribute4
451   ,p_attribute5                  => p_attribute5
452   ,p_attribute6                  => p_attribute6
453   ,p_attribute7                  => p_attribute7
454   ,p_attribute8                  => p_attribute8
455   ,p_attribute9                  => p_attribute9
456   ,p_attribute10                 => p_attribute10
457   ,p_attribute11                 => p_attribute11
458   ,p_attribute12                 => p_attribute12
459   ,p_attribute13                 => p_attribute13
460   ,p_attribute14                 => p_attribute14
461   ,p_attribute15                 => p_attribute15
462   ,p_attribute16                 => p_attribute16
463   ,p_attribute17                 => p_attribute17
464   ,p_attribute18                 => p_attribute18
465   ,p_attribute19                 => p_attribute19
466   ,p_attribute20                 => p_attribute20
467   ,p_attribute21                 => p_attribute21
468   ,p_attribute22                 => p_attribute22
469   ,p_attribute23                 => p_attribute23
470   ,p_attribute24                 => p_attribute24
471   ,p_attribute25                 => p_attribute25
472   ,p_attribute26                 => p_attribute26
473   ,p_attribute27                 => p_attribute27
474   ,p_attribute28                 => p_attribute28
475   ,p_attribute29                 => p_attribute29
476   ,p_attribute30                 => p_attribute30
477   );
478   exception
479     when hr_api.cannot_find_prog_unit then
480       hr_api.cannot_find_prog_unit_error
481         (p_module_name => 'update_measure'
482         ,p_hook_type   => 'AP'
483         );
484   end;
485   --
486   -- When in validation only mode raise the Validate_Enabled exception
487   --
488   if p_validate then
489     raise hr_api.validate_enabled;
490   end if;
491   --
492   -- Set all output arguments
493   --
494   p_object_version_number  := l_object_version_number;
495   --
496   hr_utility.set_location(' Leaving:'||l_proc, 70);
497 exception
498   when hr_api.validate_enabled then
499     --
500     -- As the Validate_Enabled exception has been raised
501     -- we must rollback to the savepoint
502     --
503     rollback to update_measure;
504     --
505     -- Only set output warning arguments
506     -- (Any key or derived arguments must be set to null
507     -- when validation only mode is being used.)
508     --
509     p_object_version_number  := null;
510     hr_utility.set_location(' Leaving:'||l_proc, 80);
511   when others then
512     --
513     -- A validation or unexpected error has occured
514     --
515     rollback to update_measure;
516     p_object_version_number  := l_object_version_number;
517     hr_utility.set_location(' Leaving:'||l_proc, 90);
518     raise;
519 end update_measure;
520 --
521 -- ----------------------------------------------------------------------------
522 -- |-------------------------< DELETE_MEASURE >-------------------------------|
523 -- ----------------------------------------------------------------------------
524 --
525 procedure delete_measure
526   (p_validate                      in     boolean  default false
527   ,p_tp_measurement_type_id        in     number
528   ,p_object_version_number         in     number
529   ) is
530   --
531   -- Declare cursors and local variables
532   --
533   l_proc                    varchar2(72) := g_package||' Delete Measure';
534   l_row_id                  varchar2(30);
535   l_budget_version_id       number;
536   l_budget_element_rowid    varchar2(30);
537   l_exists                  varchar2(1);
538   --
539   cursor csr_get_budget_rowid is
540     select pb.rowid row_id
541     from   PER_BUDGETS pb
542     where  ota_tmt_shd.g_old_rec.tp_measurement_code    = pb.unit
543     and    ota_tmt_shd.g_old_rec.business_group_id      = pb.business_group_id
544     and    ota_tmt_shd.g_old_rec.tp_measurement_type_id = p_tp_measurement_type_id
545     and    pb.budget_type_code       = 'OTA_BUDGET';
546   --
547   cursor csr_get_budget_version_rowid is
548     select pbv.rowid row_id
549     from   PER_BUDGETS pb
550           ,PER_BUDGET_VERSIONS pbv
551     where  ota_tmt_shd.g_old_rec.tp_measurement_code    = pb.unit
552     and    ota_tmt_shd.g_old_rec.business_group_id      = pb.business_group_id
553     and    ota_tmt_shd.g_old_rec.tp_measurement_type_id = p_tp_measurement_type_id
554     and    pb.budget_id                                 = pbv.budget_id
555     and    pb.budget_type_code       = 'OTA_BUDGET';
556   --
557 begin
558   hr_utility.set_location('Entering:'|| l_proc, 10);
559   --
560   -- Issue a savepoint
561   --
562   savepoint delete_measure;
563   --
564   -- Truncate the time portion from all IN date parameters
565   --
566   --
567   -- Call Before Process User Hook
568   --
569   begin
570     ota_tmt_api_bk3.delete_measure_b
571   (p_tp_measurement_type_id      => p_tp_measurement_type_id
572   ,p_object_version_number       => p_object_version_number
573   );
574   exception
578         ,p_hook_type   => 'BP'
575     when hr_api.cannot_find_prog_unit then
576       hr_api.cannot_find_prog_unit_error
577         (p_module_name => 'Delete_measure'
579         );
580   end;
581   --
582   -- Validation in addition to Row Handlers
583   --
584   --
585   -- Process Logic
586   --
587   hr_utility.set_location(' Step:'|| l_proc, 60);
588   ota_tmt_del.del
589   (p_tp_measurement_type_id         => p_tp_measurement_type_id
590   ,p_object_version_number          => p_object_version_number
591   );
592   hr_utility.set_location(' Step:'|| l_proc, 65);
593   --
594   -- The business rules only allow deletion of the measure if no
595   -- PER_BUDGET_VALUES records exist For the business group.
596   -- An exception would have been raised by the chk_ procedures
597   -- if this was the case, so we can proceed and delete the
598   -- per_budget_elements records, then the per_budgets rcords
599   --
600   -- Delete the per_budget_version records (if any exist)
601   --
602   FOR l_loop IN csr_get_budget_version_rowid LOOP
603     hr_utility.set_location(' Step:'|| l_proc, 70);
604     PER_BUDGET_VERSION_RULES_PKG.Delete_Row(X_Rowid => l_loop.row_id);
605   END LOOP;
606   --
607   -- Delete the per_budgets records (if any exist)
608   --
609   FOR l_loop IN csr_get_budget_rowid LOOP
610     hr_utility.set_location(' Step:'|| l_proc, 80);
611     per_budgets_pkg.delete_row(X_Rowid => l_loop.row_id);
612   END LOOP;
613   --
614   -- Call After Process User Hook
615   --
616   begin
617   ota_tmt_api_bk3.delete_measure_a
618   (p_tp_measurement_type_id      => p_tp_measurement_type_id
619   ,p_object_version_number       => p_object_version_number
620   );
621   exception
622     when hr_api.cannot_find_prog_unit then
623       hr_api.cannot_find_prog_unit_error
624         (p_module_name => 'delete_measure'
625         ,p_hook_type   => 'AP'
626         );
627   end;
628   --
629   -- When in validation only mode raise the Validate_Enabled exception
630   --
631   if p_validate then
632     raise hr_api.validate_enabled;
633   end if;
634   --
635   -- Set all output arguments
636   --
637   --
638   hr_utility.set_location(' Leaving:'||l_proc, 170);
639 exception
640   when hr_api.validate_enabled then
641     --
642     -- As the Validate_Enabled exception has been raised
643     -- we must rollback to the savepoint
644     --
645     rollback to delete_measure;
646     --
647     -- Only set output warning arguments
648     -- (Any key or derived arguments must be set to null
649     -- when validation only mode is being used.)
650     --
651     hr_utility.set_location(' Leaving:'||l_proc, 180);
652   when others then
653     --
654     -- A validation or unexpected error has occured
655     --
659 end delete_measure;
656     rollback to delete_measure;
657     hr_utility.set_location(' Leaving:'||l_proc, 190);
658     raise;
660 --
661 end ota_tmt_api;