DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_RUN_TYPE_ORG_METHOD_API

Source


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