DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_BF_BALANCE_TYPES_API

Source


1 Package Body PER_Bf_balance_types_api as
2 /* $Header: pebbtapi.pkb 115.6 2002/11/29 15:28:12 apholt noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  per_bf_balance_types_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-----------------------< <create_balance_type> >-------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_balance_type
13  ( p_balance_type_id	          out nocopy    number
14   ,p_object_version_number        out nocopy    number
15   --
16   ,p_input_value_id               in     number         default null
17   ,p_business_group_id            in     number
18   ,p_displayed_name               in     varchar2
19   ,p_internal_name                in     varchar2
20   ,p_uom                          in     varchar2       default null
21   ,p_currency                     in     varchar2       default null
22   ,p_category                     in     varchar2       default null
23   ,p_date_from                    in     date           default null
24   ,p_date_to                      in     date           default null
25   ,p_validate                     in     boolean        default false
26   ,p_effective_date               in     date
27   )
28 is
29   --
30   --
31   -- Declare cursors and local variables
32   --
33   l_balance_type_id        per_bf_balance_types.balance_type_id%TYPE;
34   l_object_version_number  per_bf_balance_types.object_version_number%TYPE;
35   --
36   l_proc                varchar2(72) := g_package||'create_balance_type';
37 begin
38   hr_utility.set_location('Entering:'|| l_proc, 10);
39   --
40   -- Issue a savepoint
41   --
42   savepoint create_balance_type;
43   hr_utility.set_location(l_proc, 20);
44   --
45   -- Truncate the time portion from all IN date parameters
46   --
47 
48   --
49   -- Call Before Process User Hook
50   --
51   begin
52     per_bf_balance_types_bk1.create_balance_type_b
53       (
54         p_input_value_id               => p_input_value_id
55        ,p_business_group_id            => p_business_group_id
56        ,p_displayed_name               => p_displayed_name
57        ,p_internal_name                => p_internal_name
58        ,p_uom                          => p_uom
59        ,p_currency                     => p_currency
60        ,p_category                     => p_category
61        ,p_date_from                    => p_date_from
62        ,p_date_to                      => p_date_to
63        ,p_effective_date               => p_effective_date
64        );
65   exception
66     when hr_api.cannot_find_prog_unit then
67       hr_api.cannot_find_prog_unit_error
68         (p_module_name => 'CREATE_BALANCE_TYPE'
69         ,p_hook_type   => 'BP'
70         );
71   end;
72   hr_utility.set_location(l_proc, 30);
73   --
74   -- Validation in addition to Row Handlers
75   --
76   hr_utility.set_location(l_proc, 40);
77   --
78   -- Process Logic
79   --
80   per_bbt_ins.ins
81   (p_effective_date               => p_effective_date
82   ,p_input_value_id               => p_input_value_id
83   ,p_business_group_id            => p_business_group_id
84   ,p_displayed_name               => p_displayed_name
85   ,p_internal_name                => p_internal_name
86   ,p_uom                          => p_uom
87   ,p_currency                     => p_currency
88   ,p_category                     => p_category
89   ,p_date_from                    => p_date_from
90   ,p_date_to                      => p_date_to
91   --
92   ,p_balance_type_id              => l_balance_type_id
93   ,p_object_version_number        => l_object_version_number
94   );
95 
96   hr_utility.set_location(l_proc, 50);
97   --
98   -- Call After Process User Hook
99   --
100   begin
101     per_bf_balance_types_bk1.create_balance_type_a
102       (
103         p_input_value_id               => p_input_value_id
104        ,p_business_group_id            => p_business_group_id
105        ,p_displayed_name               => p_displayed_name
106        ,p_internal_name                => p_internal_name
107        ,p_uom                          => p_uom
108        ,p_currency                     => p_currency
109        ,p_category                     => p_category
110        ,p_date_from                    => p_date_from
111        ,p_date_to                      => p_date_to
112        ,p_effective_date               => p_effective_date
113        ,p_balance_type_id              => l_balance_type_id
114        ,p_object_version_number        => l_object_version_number
115       );
116   exception
117     when hr_api.cannot_find_prog_unit then
118       hr_api.cannot_find_prog_unit_error
119         (p_module_name => 'CREATE_BALANCE_TYPE'
120         ,p_hook_type   => 'AP'
121         );
122   end;
123   hr_utility.set_location(l_proc, 60);
124   --
125   -- When in validation only mode raise the Validate_Enabled exception
126   --
127   if p_validate then
128     raise hr_api.validate_enabled;
129   end if;
130   --
131   -- Set all output arguments
132   --
133   p_balance_type_id        := l_balance_type_id;
134   p_object_version_number  := l_object_version_number;
135   --
136   hr_utility.set_location(' Leaving:'||l_proc, 70);
137 exception
138   when hr_api.validate_enabled then
139     --
140     -- As the Validate_Enabled exception has been raised
141     -- we must rollback to the savepoint
142     --
143     rollback to create_balance_type;
144     --
145     -- Only set output warning arguments
146     -- (Any key or derived arguments must be set to null
147     -- when validation only mode is being used.)
148     --
149     p_balance_type_id        := null;
150     p_object_version_number  := null;
151     hr_utility.set_location(' Leaving:'||l_proc, 80);
152   when others then
153     --
154     -- A validation or unexpected error has occured
155     --
156     --set out variables
157     p_balance_type_id    := null;
158     p_object_version_number  := null;
159     rollback to create_balance_type;
160     hr_utility.set_location(' Leaving:'||l_proc, 90);
161     raise;
162 end create_balance_type;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |-----------------------< <update_balance_type> >--------------------------|
166 -- ----------------------------------------------------------------------------
167 --
168 procedure update_balance_type
169  ( p_balance_type_id              in number
170   ,p_input_value_id               in number     default hr_api.g_number
171   ,p_displayed_name               in varchar2   default hr_api.g_varchar2
172   ,p_internal_name                in varchar2   default hr_api.g_varchar2
173   ,p_uom                          in varchar2   default hr_api.g_varchar2
174   ,p_currency                     in varchar2   default hr_api.g_varchar2
175   ,p_category                     in varchar2   default hr_api.g_varchar2
176   ,p_date_from                    in date       default hr_api.g_date
177   ,p_date_to                      in date       default hr_api.g_date
178   ,p_validate                     in boolean    default false
179   ,p_effective_date               in date
180   ,p_object_version_number        in out nocopy number
181   )
182 is
183   --
184   --
185   -- Declare cursors and local variables
186   --
187   l_object_version_number  per_bf_balance_types.object_version_number%TYPE;
188   --
189   l_proc                varchar2(72) := g_package||'update_balance_type';
190 begin
191   hr_utility.set_location('Entering:'|| l_proc, 10);
192   --
193   -- Issue a savepoint
194   --
195   savepoint update_balance_type;
196   --
197   hr_utility.set_location(l_proc, 20);
198   --
199   -- Truncate the time portion from all IN date parameters
200   --
201   --
202   -- Call Before Process User Hook
203   --
204   begin
205     per_bf_balance_types_bk2.update_balance_type_b
206       (
207 	p_balance_type_id              => p_balance_type_id
208        ,p_input_value_id               => p_input_value_id
209        ,p_displayed_name               => p_displayed_name
210        ,p_internal_name                => p_internal_name
211        ,p_uom                          => p_uom
212        ,p_currency                     => p_currency
213        ,p_category                     => p_category
214        ,p_date_from                    => p_date_from
215        ,p_date_to                      => p_date_to
216        ,p_effective_date               => p_effective_date
217        ,p_object_version_number        => p_object_version_number
218        );
219   exception
220     when hr_api.cannot_find_prog_unit then
221       hr_api.cannot_find_prog_unit_error
222         (p_module_name => 'UPDATE_BALANCE_TYPE'
223         ,p_hook_type   => 'BP'
224         );
225   end;
226   hr_utility.set_location(l_proc, 30);
227   --
228   -- Validation in addition to Row Handlers
229   --
230   hr_utility.set_location(l_proc, 40);
231   --
232   -- Process Logic
233   --
234   l_object_version_number := p_object_version_number;
235   --
236   per_bbt_upd.upd
237   (p_effective_date               => p_effective_date
238   ,p_input_value_id               => p_input_value_id
239   ,p_displayed_name               => p_displayed_name
240   ,p_internal_name                => p_internal_name
241   ,p_uom                          => p_uom
242   ,p_currency                     => p_currency
243   ,p_category                     => p_category
244   ,p_date_from                    => p_date_from
245   ,p_date_to                      => p_date_to
246   --
247   ,p_balance_type_id              => p_balance_type_id
248   ,p_object_version_number        => l_object_version_number
249   );
250 
251   hr_utility.set_location(l_proc, 50);
252   --
253   -- Call After Process User Hook
254   --
255   begin
256     per_bf_balance_types_bk2.update_balance_type_a
257       (
258         p_input_value_id               => p_input_value_id
259        ,p_displayed_name               => p_displayed_name
260        ,p_internal_name                => p_internal_name
261        ,p_uom                          => p_uom
262        ,p_currency                     => p_currency
263        ,p_category                     => p_category
264        ,p_date_from                    => p_date_from
265        ,p_date_to                      => p_date_to
266        ,p_effective_date               => p_effective_date
267        ,p_balance_type_id              => p_balance_type_id
268        ,p_object_version_number        => l_object_version_number
269       );
270   exception
271     when hr_api.cannot_find_prog_unit then
272       hr_api.cannot_find_prog_unit_error
273         (p_module_name => 'UPDATE_BALANCE_TYPE'
274         ,p_hook_type   => 'AP'
275         );
276   end;
277   hr_utility.set_location(l_proc, 60);
278   --
279   -- When in validation only mode raise the Validate_Enabled exception
280   --
281   if p_validate then
282     raise hr_api.validate_enabled;
283   end if;
284   --
285   -- Set all output arguments
286   --
287   p_object_version_number  := l_object_version_number;
288   --
289   hr_utility.set_location(' Leaving:'||l_proc, 70);
290 exception
291   when hr_api.validate_enabled then
292     --
293     -- As the Validate_Enabled exception has been raised
294     -- we must rollback to the savepoint
295     --
296     rollback to update_balance_type;
297     --
298     -- Only set output warning arguments
299     -- (Any key or derived arguments must be set to null
300     -- when validation only mode is being used.)
301     --
302     p_object_version_number  := null;
303     hr_utility.set_location(' Leaving:'||l_proc, 80);
304   when others then
305     --
306     -- A validation or unexpected error has occured
307     --
308     --set out variables
309     p_object_version_number  := null;
310     rollback to update_balance_type;
311     hr_utility.set_location(' Leaving:'||l_proc, 90);
312     raise;
313 end update_balance_type;
314 --
315 -- ----------------------------------------------------------------------------
316 -- |-----------------------< <delete_balance_type> >--------------------------|
317 -- ----------------------------------------------------------------------------
318 --
319 procedure delete_balance_type
320   (p_validate                           in boolean default false,
321    p_balance_type_id                    in number,
322    p_object_version_number              in number
323   )
324 is
325   --
326   --
327   -- Declare cursors and local variables
328   --
329   l_proc                varchar2(72) := g_package||'delete_balance_type';
330 begin
331   hr_utility.set_location('Entering:'|| l_proc, 10);
332   --
333   -- Issue a savepoint
334   --
335   savepoint delete_balance_type;
336   --
337   hr_utility.set_location(l_proc, 20);
338   --
339   -- Truncate the time portion from all IN date parameters
340   --
341   --
342   -- Call Before Process User Hook
343   --
344   begin
345     per_bf_balance_types_bk3.delete_balance_type_b
346       (
347         p_balance_type_id              => p_balance_type_id
348       , p_object_version_number        => p_object_version_number
349       );
350   exception
351     when hr_api.cannot_find_prog_unit then
352       hr_api.cannot_find_prog_unit_error
353         (p_module_name => 'DELETE_BALANCE_TYPE'
354         ,p_hook_type   => 'BP'
355         );
356   end;
357   hr_utility.set_location(l_proc, 30);
358   --
359   -- Validation in addition to Row Handlers
360   --
361   hr_utility.set_location(l_proc, 40);
362   --
363   -- Process Logic
364   --
365   per_bbt_del.del
366   (
367    p_balance_type_id              => p_balance_type_id
368   ,p_object_version_number        => p_object_version_number
369   );
370 
371   hr_utility.set_location(l_proc, 50);
372   --
373   -- Call After Process User Hook
374   --
375   begin
376     per_bf_balance_types_bk3.delete_balance_type_a
377       (
378         p_balance_type_id              => p_balance_type_id
379        ,p_object_version_number        => p_object_version_number
380       );
381   exception
382     when hr_api.cannot_find_prog_unit then
383       hr_api.cannot_find_prog_unit_error
384         (p_module_name => 'DELETE_BALANCE_TYPE'
385         ,p_hook_type   => 'AP'
386         );
387   end;
388   hr_utility.set_location(l_proc, 60);
389   --
390   -- When in validation only mode raise the Validate_Enabled exception
391   --
392   if p_validate then
393     raise hr_api.validate_enabled;
394   end if;
395   --
396   -- Set all output arguments
397   --
398   hr_utility.set_location(' Leaving:'||l_proc, 70);
399 exception
400   when hr_api.validate_enabled then
401     --
402     -- As the Validate_Enabled exception has been raised
403     -- we must rollback to the savepoint
404     --
405     rollback to delete_balance_type ;
406     --
407     -- Only set output warning arguments
408     -- (Any key or derived arguments must be set to null
409     -- when validation only mode is being used.)
410     --
411     hr_utility.set_location(' Leaving:'||l_proc, 80);
412   when others then
413     --
414     -- A validation or unexpected error has occured
415     --
416     rollback to delete_balance_type;
417     hr_utility.set_location(' Leaving:'||l_proc, 90);
418     raise;
419 end delete_balance_type;
420 end PER_Bf_balance_types_api;