[Home] [Help]
PACKAGE BODY: APPS.HXC_APPROVAL_PERIOD_COMPS_API
Source
1 Package Body hxc_approval_period_comps_api as
2 /* $Header: hxcapcapi.pkb 120.2 2005/09/23 08:04:10 sechandr noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' hxc_approval_period_comps_api.';
7 g_debug boolean := hr_utility.debug_enabled;
8 --
9 -- ----------------------------------------------------------------------------
10 -- |--------------------------< create_approval_period_comps >----------------|
11 -- ----------------------------------------------------------------------------
12 --
13 procedure create_approval_period_comps
14 (p_validate in boolean default false
15 ,p_approval_period_comp_id in out nocopy number
16 ,p_object_version_number in out nocopy number
17 ,p_approval_period_set_id in number
18 ,p_time_recipient_id in number
19 ,p_recurring_period_id in number
20 ,p_effective_date in date default null
21 ) is
22 --
23 -- Declare cursors and local variables
24 --
25
26 l_proc varchar2(72);
27 l_object_version_number hxc_approval_period_comps.object_version_number%TYPE;
28 l_approval_period_comp_id hxc_approval_period_comps.approval_period_comp_id%TYPE;
29 --
30 Begin
31 --
32 g_debug:=hr_utility.debug_enabled;
33 if g_debug then
34 l_proc := g_package||'create_approval_period_comps';
35 hr_utility.set_location('Entering:'|| l_proc, 10);
36 end if;
37 --
38 -- Issue a savepoint
39 --
40 savepoint create_approval_period_comps;
41 --
42 if g_debug then
43 hr_utility.set_location(l_proc, 20);
44 end if;
45 --
46 -- Truncate the time portion from all IN date parameters
47 --
48
49 --
50 -- Call Before Process User Hook
51 --
52 begin
53 hxc_approval_period_comps_bk_1.create_approval_period_comps_b
54 (p_approval_period_comp_id => p_approval_period_comp_id
55 ,p_object_version_number => p_object_version_number
56 ,p_approval_period_set_id => p_approval_period_set_id
57 ,p_time_recipient_id => p_time_recipient_id
58 ,p_recurring_period_id => p_recurring_period_id
59 ,p_effective_date => p_effective_date
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_approval_period_comps'
65 ,p_hook_type => 'BP'
66 );
67 end;
68 --
69 if g_debug then
70 hr_utility.set_location(l_proc, 30);
71 end if;
72 --
73
74 --
75 -- Validation in addition to Row Handlers
76 --
77
78
79
80 --
81 -- Process Logic
82 --
83 if g_debug then
84 hr_utility.set_location(l_proc, 40);
85 end if;
86 --
87 -- call row handler
88 --
89 hxc_apc_ins.ins
90 (p_effective_date => p_effective_date
91 ,p_recurring_period_id => p_recurring_period_id
92 ,p_approval_period_set_id => p_approval_period_set_id
93 ,p_time_recipient_id => p_time_recipient_id
94 ,p_approval_period_comp_id => l_approval_period_comp_id
95 ,p_object_version_number => l_object_version_number
96 );
97 --
98 if g_debug then
99 hr_utility.set_location(l_proc, 50);
100 end if;
101 --
102 -- Call After Process User Hook
103 --
104 begin
105 hxc_approval_period_comps_bk_1.create_approval_period_comps_a
106 (p_approval_period_comp_id => p_approval_period_comp_id
107 ,p_object_version_number => p_object_version_number
108 ,p_approval_period_set_id => p_approval_period_set_id
109 ,p_time_recipient_id => p_time_recipient_id
110 ,p_recurring_period_id => p_recurring_period_id
111 ,p_effective_date => p_effective_date
112 );
113 exception
114 when hr_api.cannot_find_prog_unit then
115 hr_api.cannot_find_prog_unit_error
116 (p_module_name => 'create_approval_period_comps'
117 ,p_hook_type => 'AP'
118 );
119 end;
120 --
121 if g_debug then
122 hr_utility.set_location(l_proc, 60);
123 end if;
124 --
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 --if g_debug then
133 --hr_utility.set_location(' Leaving:'||l_proc, 70);
134 --end if;
135 --
136 --
137 -- Set all output arguments
138 --
139 p_approval_period_comp_id := l_approval_period_comp_id;
140 p_object_version_number := l_object_version_number;
141 --
142 if g_debug then
143 hr_utility.set_location(' Leaving:'||l_proc, 70);
144 end if;
145 exception
146 when hr_api.validate_enabled then
147 --
148 -- As the Validate_Enabled exception has been raised
149 -- we must rollback to the savepoint
150 --
151 rollback to create_approval_period_comps;
152 --
153 -- Only set output warning arguments
154 -- (Any key or derived arguments must be set to null
155 -- when validation only mode is being used.)
156 --
157 p_approval_period_comp_id := null;
158 p_object_version_number := null;
159 if g_debug then
160 hr_utility.set_location(' Leaving:'||l_proc, 80);
161 end if;
162 when others then
163 --
164 -- A validation or unexpected error has occured
165 --
166 rollback to create_approval_period_comps;
167 if g_debug then
168 hr_utility.set_location(' Leaving:'||l_proc, 90);
169 end if;
170 raise;
171 --
172 end create_approval_period_comps;
173 --
174 --
175 -- ----------------------------------------------------------------------------
176 -- |------------------------< update_approval_period_comps>-------------------|
177 -- ----------------------------------------------------------------------------
178 --
179 procedure update_approval_period_comps
180 (p_validate in boolean default false
181 ,p_approval_period_comp_id in number
182 ,p_object_version_number in out nocopy number
183 ,p_approval_period_set_id in number
184 ,p_time_recipient_id in number
185 ,p_recurring_period_id in number
186 ,p_effective_date in date default null
187 )is
188 --
189 -- Declare cursors and local variables
190 --
191 l_proc varchar2(72);
192 l_object_version_number hxc_approval_period_comps.object_version_number%TYPE := p_object_version_number;
193 --
194 Begin
195 --
196 g_debug:=hr_utility.debug_enabled;
197 if g_debug then
198 l_proc := g_package||' update_approval_period_comps';
199 hr_utility.set_location('Entering:'|| l_proc, 10);
200 end if;
201 --
202 -- Issue a savepoint if operating in validation only mode
203 --
204 savepoint update_approval_period_comps;
205 --
206 if g_debug then
207 hr_utility.set_location(l_proc, 20);
208 end if;
209 --
210 -- Call Before Process User Hook
211 --
212 begin
213 hxc_approval_period_comps_bk_1.update_approval_period_comps_b
214 (p_approval_period_comp_id => p_approval_period_comp_id
215 ,p_object_version_number => p_object_version_number
216 ,p_approval_period_set_id => p_approval_period_set_id
217 ,p_time_recipient_id => p_time_recipient_id
218 ,p_recurring_period_id => p_recurring_period_id
219 ,p_effective_date => p_effective_date
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_approval_period_comps'
225 ,p_hook_type => 'BP'
226 );
227 end;
228 --
229 --insert into mtemp values('out of comp_b');
230 --commit;
231 --if g_debug then
232 --hr_utility.set_location(l_proc, 30);
233 --end if;
234 --
235 -- Process Logic
236 --
237 -- call row handler
238 --
239 --insert into mtemp values('calling hxc_hac_upd.upd');
240 -- commit;
241 hxc_apc_upd.upd
242 (p_effective_date => p_effective_date
243 ,p_approval_period_comp_id => p_approval_period_comp_id
244 ,p_object_version_number => l_object_version_number
245 ,p_recurring_period_id => p_recurring_period_id
246 ,p_approval_period_set_id => p_approval_period_set_id
247 ,p_time_recipient_id => p_time_recipient_id
248 );
249 --
250 --
251 --insert into mtemp values('out of hax_hac_upd');
252 --commit;
253
254 if g_debug then
255 hr_utility.set_location(l_proc, 40);
256 end if;
257 --
258 -- Call After Process User Hook
259 --
260 begin
261 hxc_approval_period_comps_bk_1.update_approval_period_comps_a
262 (p_approval_period_comp_id => p_approval_period_comp_id
263 ,p_object_version_number => p_object_version_number
264 ,p_recurring_period_id => p_recurring_period_id
265 ,p_approval_period_set_id => p_approval_period_set_id
266 ,p_time_recipient_id => p_time_recipient_id
267 ,p_effective_date => p_effective_date
268 );
269 exception
270 when hr_api.cannot_find_prog_unit then
271 hr_api.cannot_find_prog_unit_error
272 (p_module_name => 'update_approval_period_comps'
273 ,p_hook_type => 'AP'
274 );
275 end;
276 --
277 --insert into mtemp values('out of comp_a');
278 --commit;
279
280 if g_debug then
281 hr_utility.set_location(l_proc, 50);
282 end if;
283 --
284 -- When in validation only mode raise the Validate_Enabled exception
285 --
286 if p_validate then
287 raise hr_api.validate_enabled;
288 end if;
289 --
290 if g_debug then
291 hr_utility.set_location(' Leaving:'||l_proc, 60);
292 end if;
293 --
294 -- Set all output arguments
295 --
296 --insert into mtemp values('setting OVN value ');
297 --commit;
298
299 p_object_version_number := l_object_version_number;
300 --
301 --insert into mtemp values('OVN value set');
302 --commit;
303
304 exception
305 --
306 when hr_api.validate_enabled then
307 --
308 -- As the Validate_Enabled exception has been raised
309 -- we must rollback to the savepoint
310 --
311 ROLLBACK TO update_approval_period_comps;
312 --
313 -- Only set output warning arguments
314 -- (Any key or derived arguments must be set to null
315 -- when validation only mode is being used.)
316 --
317 p_object_version_number := null;
318 --
319 --insert into mtemp values('OVN set to null');
320 --commit;
321
322 if g_debug then
323 hr_utility.set_location(' Leaving:'||l_proc, 60);
324 end if;
325 --
326 when others then
327 --
328 -- A validation or unexpected error has occured
329 --
330 ROLLBACK TO update_approval_period_comps;
331 if g_debug then
332 hr_utility.set_location(' Leaving:'||l_proc, 70);
333 end if;
334 raise;
335 --
336 END update_approval_period_comps;
337 --
338 -- ----------------------------------------------------------------------------
339 -- |------------------------< delete_approval_period_comps >------------------|
340 -- ----------------------------------------------------------------------------
341 --
342 procedure delete_approval_period_comps
343 (p_validate in boolean default false
344 ,p_approval_period_comp_id in number
345 ,p_object_version_number in number
346 ) is
347 --
348 -- Declare cursors and local variables
349 --
350 l_proc varchar2(72);
351 --
352 begin
353 --
354 g_debug:=hr_utility.debug_enabled;
355 if g_debug then
356 l_proc := g_package||'delete_approval_period_comps';
357 hr_utility.set_location('Entering:'|| l_proc, 10);
358 end if;--
359 -- Issue a savepoint if operating in validation only mode
360 --
361 savepoint delete_approval_period_comps;
362 --
363 if g_debug then
364 hr_utility.set_location(l_proc, 20);
365 end if;
366 --
367 -- Call Before Process User Hook
368 --
369 begin
370 --
371 hxc_approval_period_comps_bk_1.delete_approval_period_comps_b
372 (p_approval_period_comp_id => p_approval_period_comp_id
373 ,p_object_version_number => p_object_version_number
374 );
375 exception
376 when hr_api.cannot_find_prog_unit then
377 hr_api.cannot_find_prog_unit_error
378 (p_module_name => 'delete_approval_period_comps'
379 ,p_hook_type => 'BP'
380 );
381 end;
382 --
383 if g_debug then
384 hr_utility.set_location(l_proc, 30);
385 end if;
386 --
387 -- Process Logic
388 --
389 hxc_apc_del.del
390 (
391 p_approval_period_comp_id => p_approval_period_comp_id
392 ,p_object_version_number => p_object_version_number
393 );
394 --
395 if g_debug then
396 hr_utility.set_location(l_proc, 40);
397 end if;
398 --
399 -- Call After Process User Hook
400 --
401 begin
402 --
403 hxc_approval_period_comps_bk_1.delete_approval_period_comps_a
404 (p_approval_period_comp_id => p_approval_period_comp_id
405 ,p_object_version_number => p_object_version_number
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_approval_period_comps'
411 ,p_hook_type => 'AP'
412 );
413 end;
414 --
415 -- When in validation only mode raise the Validate_Enabled exception
416 --
417 if p_validate then
418 raise hr_api.validate_enabled;
419 end if;
420 --
421 if g_debug then
422 hr_utility.set_location(' Leaving:'||l_proc, 50);
423 end if;
424 --
425 exception
426 --
427 when hr_api.validate_enabled then
428 --
429 -- As the Validate_Enabled exception has been raised
430 -- we must rollback to the savepoint
431 --
432 ROLLBACK TO delete_approval_period_comps;
433 --
434 when others then
435 --
436 -- A validation or unexpected error has occured
437 --
438 ROLLBACK TO delete_approval_period_comps;
439 raise;
440 --
441 end delete_approval_period_comps;
442 --
443 end hxc_approval_period_comps_api;