DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_RUN_TYPE_USAGE_API

Source


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