DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_APPROVAL_COMPS_API

Source


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