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