[Home] [Help]
PACKAGE BODY: APPS.PAY_ELEMENT_LINK_API
Source
1 Package Body PAY_ELEMENT_LINK_API as
2 /* $Header: pypelapi.pkb 120.3.12010000.1 2008/07/27 23:21:41 appldev ship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := 'pay_element_link_api';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------<create_element_link>--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_element_link
13 (p_validate in boolean default false
14 ,p_effective_date in date
15 ,p_element_type_id in number
16 ,p_business_group_id in number
17 ,p_costable_type in varchar2
18 ,p_payroll_id in number default null
19 ,p_job_id in number default null
20 ,p_position_id in number default null
21 ,p_people_group_id in number default null
22 ,p_cost_allocation_keyflex_id in number default null
23 ,p_organization_id in number default null
24 ,p_location_id in number default null
25 ,p_grade_id in number default null
26 ,p_balancing_keyflex_id in number default null
27 ,p_element_set_id in number default null
28 ,p_pay_basis_id in number default null
29 ,p_link_to_all_payrolls_flag in varchar2 default 'N'
30 ,p_standard_link_flag in varchar2 default null
31 ,p_transfer_to_gl_flag in varchar2 default 'N'
32 ,p_comments in varchar2 default null
33 ,p_employment_category in varchar2 default null
34 ,p_qualifying_age in number default null
35 ,p_qualifying_length_of_service in number default null
36 ,p_qualifying_units in varchar2 default null
37 ,p_attribute_category in varchar2 default null
38 ,p_attribute1 in varchar2 default null
39 ,p_attribute2 in varchar2 default null
40 ,p_attribute3 in varchar2 default null
41 ,p_attribute4 in varchar2 default null
42 ,p_attribute5 in varchar2 default null
43 ,p_attribute6 in varchar2 default null
44 ,p_attribute7 in varchar2 default null
45 ,p_attribute8 in varchar2 default null
46 ,p_attribute9 in varchar2 default null
47 ,p_attribute10 in varchar2 default null
48 ,p_attribute11 in varchar2 default null
49 ,p_attribute12 in varchar2 default null
50 ,p_attribute13 in varchar2 default null
51 ,p_attribute14 in varchar2 default null
52 ,p_attribute15 in varchar2 default null
53 ,p_attribute16 in varchar2 default null
54 ,p_attribute17 in varchar2 default null
55 ,p_attribute18 in varchar2 default null
56 ,p_attribute19 in varchar2 default null
57 ,p_attribute20 in varchar2 default null
58 ,p_cost_segment1 in varchar2 default null
59 ,p_cost_segment2 in varchar2 default null
60 ,p_cost_segment3 in varchar2 default null
61 ,p_cost_segment4 in varchar2 default null
62 ,p_cost_segment5 in varchar2 default null
63 ,p_cost_segment6 in varchar2 default null
64 ,p_cost_segment7 in varchar2 default null
65 ,p_cost_segment8 in varchar2 default null
66 ,p_cost_segment9 in varchar2 default null
67 ,p_cost_segment10 in varchar2 default null
68 ,p_cost_segment11 in varchar2 default null
69 ,p_cost_segment12 in varchar2 default null
70 ,p_cost_segment13 in varchar2 default null
71 ,p_cost_segment14 in varchar2 default null
72 ,p_cost_segment15 in varchar2 default null
73 ,p_cost_segment16 in varchar2 default null
74 ,p_cost_segment17 in varchar2 default null
75 ,p_cost_segment18 in varchar2 default null
76 ,p_cost_segment19 in varchar2 default null
77 ,p_cost_segment20 in varchar2 default null
78 ,p_cost_segment21 in varchar2 default null
79 ,p_cost_segment22 in varchar2 default null
80 ,p_cost_segment23 in varchar2 default null
81 ,p_cost_segment24 in varchar2 default null
82 ,p_cost_segment25 in varchar2 default null
83 ,p_cost_segment26 in varchar2 default null
84 ,p_cost_segment27 in varchar2 default null
85 ,p_cost_segment28 in varchar2 default null
86 ,p_cost_segment29 in varchar2 default null
87 ,p_cost_segment30 in varchar2 default null
88 ,p_balance_segment1 in varchar2 default null
89 ,p_balance_segment2 in varchar2 default null
90 ,p_balance_segment3 in varchar2 default null
91 ,p_balance_segment4 in varchar2 default null
92 ,p_balance_segment5 in varchar2 default null
93 ,p_balance_segment6 in varchar2 default null
94 ,p_balance_segment7 in varchar2 default null
95 ,p_balance_segment8 in varchar2 default null
96 ,p_balance_segment9 in varchar2 default null
97 ,p_balance_segment10 in varchar2 default null
98 ,p_balance_segment11 in varchar2 default null
99 ,p_balance_segment12 in varchar2 default null
100 ,p_balance_segment13 in varchar2 default null
101 ,p_balance_segment14 in varchar2 default null
102 ,p_balance_segment15 in varchar2 default null
103 ,p_balance_segment16 in varchar2 default null
104 ,p_balance_segment17 in varchar2 default null
105 ,p_balance_segment18 in varchar2 default null
106 ,p_balance_segment19 in varchar2 default null
107 ,p_balance_segment20 in varchar2 default null
108 ,p_balance_segment21 in varchar2 default null
109 ,p_balance_segment22 in varchar2 default null
110 ,p_balance_segment23 in varchar2 default null
111 ,p_balance_segment24 in varchar2 default null
112 ,p_balance_segment25 in varchar2 default null
113 ,p_balance_segment26 in varchar2 default null
114 ,p_balance_segment27 in varchar2 default null
115 ,p_balance_segment28 in varchar2 default null
116 ,p_balance_segment29 in varchar2 default null
117 ,p_balance_segment30 in varchar2 default null
118 ,p_cost_concat_segments in varchar2
119 ,p_balance_concat_segments in varchar2
120 ,p_element_link_id out nocopy number
121 ,p_comment_id out nocopy number
122 ,p_object_version_number out nocopy number
123 ,p_effective_start_date out nocopy date
124 ,p_effective_end_date out nocopy date
125 ) is
126 --
127 -- Declare cursors and local variables
128 --
129 l_proc varchar2(72) := g_package||'create_element_link';
130 l_effective_date date;
131
132 l_standard_link_flag pay_element_links_f.standard_link_flag%type
133 := p_standard_link_flag;
134 l_cost_allocation_id number := p_cost_allocation_keyflex_id;
135 l_bal_allocation_id number := p_balancing_keyflex_id;
136
137 --
138 -- Variables to hold the values returned.
139 --
140 l_element_link_id number;
141 l_comment_id number;
142 l_object_version_number number;
143 l_effective_start_date date;
144 l_effective_end_date date;
145 --
146 begin
147 hr_utility.set_location('Entering:'|| l_proc, 10);
148 --
149 -- Issue a savepoint
150 --
151 savepoint create_element_link;
152 --
153 -- Truncate the time portion from all IN date parameters
154 --
155 l_effective_date := trunc(p_effective_date);
156
157 --
158 -- Call Before Process User Hook
159 --
160 begin
161 pay_element_link_BK1.create_element_link_b
162 (p_effective_date => l_effective_date
163 ,p_element_type_id => p_element_type_id
164 ,p_business_group_id => p_business_group_id
165 ,p_costable_type => p_costable_type
166 ,p_payroll_id => p_payroll_id
167 ,p_job_id => p_job_id
168 ,p_position_id => p_position_id
169 ,p_people_group_id => p_people_group_id
170 ,p_cost_allocation_keyflex_id => l_cost_allocation_id
171 ,p_organization_id => p_organization_id
172 ,p_location_id => p_location_id
173 ,p_grade_id => p_grade_id
174 ,p_balancing_keyflex_id => l_bal_allocation_id
175 ,p_element_set_id => p_element_set_id
176 ,p_pay_basis_id => p_pay_basis_id
177 ,p_link_to_all_payrolls_flag => p_link_to_all_payrolls_flag
178 ,p_standard_link_flag => l_standard_link_flag
179 ,p_transfer_to_gl_flag => p_transfer_to_gl_flag
180 ,p_comments => p_comments
181 ,p_employment_category => p_employment_category
182 ,p_qualifying_age => p_qualifying_age
183 ,p_qualifying_length_of_service => p_qualifying_length_of_service
184 ,p_qualifying_units => p_qualifying_units
185 ,p_attribute_category => p_attribute_category
186 ,p_attribute1 => p_attribute1
187 ,p_attribute2 => p_attribute2
188 ,p_attribute3 => p_attribute3
189 ,p_attribute4 => p_attribute4
190 ,p_attribute5 => p_attribute5
191 ,p_attribute6 => p_attribute6
192 ,p_attribute7 => p_attribute7
193 ,p_attribute8 => p_attribute8
194 ,p_attribute9 => p_attribute9
195 ,p_attribute10 => p_attribute10
196 ,p_attribute11 => p_attribute11
197 ,p_attribute12 => p_attribute12
198 ,p_attribute13 => p_attribute13
199 ,p_attribute14 => p_attribute14
200 ,p_attribute15 => p_attribute15
201 ,p_attribute16 => p_attribute16
202 ,p_attribute17 => p_attribute17
203 ,p_attribute18 => p_attribute18
204 ,p_attribute19 => p_attribute19
205 ,p_attribute20 => p_attribute20
206 ,p_cost_segment1 => p_cost_segment1
207 ,p_cost_segment2 => p_cost_segment2
208 ,p_cost_segment3 => p_cost_segment3
209 ,p_cost_segment4 => p_cost_segment4
210 ,p_cost_segment5 => p_cost_segment5
211 ,p_cost_segment6 => p_cost_segment6
212 ,p_cost_segment7 => p_cost_segment7
213 ,p_cost_segment8 => p_cost_segment8
214 ,p_cost_segment9 => p_cost_segment9
215 ,p_cost_segment10 => p_cost_segment10
216 ,p_cost_segment11 => p_cost_segment11
217 ,p_cost_segment12 => p_cost_segment12
218 ,p_cost_segment13 => p_cost_segment13
219 ,p_cost_segment14 => p_cost_segment14
220 ,p_cost_segment15 => p_cost_segment15
221 ,p_cost_segment16 => p_cost_segment16
222 ,p_cost_segment17 => p_cost_segment17
223 ,p_cost_segment18 => p_cost_segment18
224 ,p_cost_segment19 => p_cost_segment19
225 ,p_cost_segment20 => p_cost_segment20
226 ,p_cost_segment21 => p_cost_segment21
227 ,p_cost_segment22 => p_cost_segment22
228 ,p_cost_segment23 => p_cost_segment23
229 ,p_cost_segment24 => p_cost_segment24
230 ,p_cost_segment25 => p_cost_segment25
231 ,p_cost_segment26 => p_cost_segment26
232 ,p_cost_segment27 => p_cost_segment27
233 ,p_cost_segment28 => p_cost_segment28
234 ,p_cost_segment29 => p_cost_segment29
235 ,p_cost_segment30 => p_cost_segment30
236 ,p_balance_segment1 => p_balance_segment1
237 ,p_balance_segment2 => p_balance_segment2
238 ,p_balance_segment3 => p_balance_segment3
239 ,p_balance_segment4 => p_balance_segment4
240 ,p_balance_segment5 => p_balance_segment5
241 ,p_balance_segment6 => p_balance_segment6
242 ,p_balance_segment7 => p_balance_segment7
243 ,p_balance_segment8 => p_balance_segment8
244 ,p_balance_segment9 => p_balance_segment9
245 ,p_balance_segment10 => p_balance_segment10
246 ,p_balance_segment11 => p_balance_segment11
247 ,p_balance_segment12 => p_balance_segment12
248 ,p_balance_segment13 => p_balance_segment13
249 ,p_balance_segment14 => p_balance_segment14
250 ,p_balance_segment15 => p_balance_segment15
251 ,p_balance_segment16 => p_balance_segment16
252 ,p_balance_segment17 => p_balance_segment17
253 ,p_balance_segment18 => p_balance_segment18
254 ,p_balance_segment19 => p_balance_segment19
255 ,p_balance_segment20 => p_balance_segment20
256 ,p_balance_segment21 => p_balance_segment21
257 ,p_balance_segment22 => p_balance_segment22
258 ,p_balance_segment23 => p_balance_segment23
259 ,p_balance_segment24 => p_balance_segment24
260 ,p_balance_segment25 => p_balance_segment25
261 ,p_balance_segment26 => p_balance_segment26
262 ,p_balance_segment27 => p_balance_segment27
263 ,p_balance_segment28 => p_balance_segment28
264 ,p_balance_segment29 => p_balance_segment29
265 ,p_balance_segment30 => p_balance_segment30
266 ,p_cost_concat_segments => p_cost_concat_segments
267 ,p_balance_concat_segments => p_balance_concat_segments
268 );
269 exception
270 when hr_api.cannot_find_prog_unit then
271 hr_api.cannot_find_prog_unit_error
272 (p_module_name => 'create_element_link'
273 ,p_hook_type => 'BP'
274 );
275 end;
276
277 hr_utility.set_location(l_proc, 20);
278 --
279 -- The main creation process has been moved to pypelbsi.pkb.
280 --
281 pay_element_link_internal.create_element_link
282 (p_effective_date => l_effective_date
283 ,p_element_type_id => p_element_type_id
284 ,p_business_group_id => p_business_group_id
285 ,p_costable_type => p_costable_type
286 ,p_payroll_id => p_payroll_id
287 ,p_job_id => p_job_id
288 ,p_position_id => p_position_id
289 ,p_people_group_id => p_people_group_id
290 ,p_cost_allocation_keyflex_id => l_cost_allocation_id
291 ,p_organization_id => p_organization_id
292 ,p_location_id => p_location_id
293 ,p_grade_id => p_grade_id
294 ,p_balancing_keyflex_id => l_bal_allocation_id
295 ,p_element_set_id => p_element_set_id
296 ,p_pay_basis_id => p_pay_basis_id
297 ,p_link_to_all_payrolls_flag => p_link_to_all_payrolls_flag
298 ,p_standard_link_flag => l_standard_link_flag
299 ,p_transfer_to_gl_flag => p_transfer_to_gl_flag
300 ,p_comments => p_comments
301 ,p_employment_category => p_employment_category
302 ,p_qualifying_age => p_qualifying_age
303 ,p_qualifying_length_of_service => p_qualifying_length_of_service
304 ,p_qualifying_units => p_qualifying_units
305 ,p_attribute_category => p_attribute_category
306 ,p_attribute1 => p_attribute1
307 ,p_attribute2 => p_attribute2
308 ,p_attribute3 => p_attribute3
309 ,p_attribute4 => p_attribute4
310 ,p_attribute5 => p_attribute5
311 ,p_attribute6 => p_attribute6
312 ,p_attribute7 => p_attribute7
313 ,p_attribute8 => p_attribute8
314 ,p_attribute9 => p_attribute9
315 ,p_attribute10 => p_attribute10
316 ,p_attribute11 => p_attribute11
317 ,p_attribute12 => p_attribute12
318 ,p_attribute13 => p_attribute13
319 ,p_attribute14 => p_attribute14
320 ,p_attribute15 => p_attribute15
321 ,p_attribute16 => p_attribute16
322 ,p_attribute17 => p_attribute17
323 ,p_attribute18 => p_attribute18
324 ,p_attribute19 => p_attribute19
325 ,p_attribute20 => p_attribute20
326 ,p_cost_segment1 => p_cost_segment1
327 ,p_cost_segment2 => p_cost_segment2
328 ,p_cost_segment3 => p_cost_segment3
329 ,p_cost_segment4 => p_cost_segment4
330 ,p_cost_segment5 => p_cost_segment5
331 ,p_cost_segment6 => p_cost_segment6
332 ,p_cost_segment7 => p_cost_segment7
333 ,p_cost_segment8 => p_cost_segment8
334 ,p_cost_segment9 => p_cost_segment9
335 ,p_cost_segment10 => p_cost_segment10
336 ,p_cost_segment11 => p_cost_segment11
337 ,p_cost_segment12 => p_cost_segment12
338 ,p_cost_segment13 => p_cost_segment13
339 ,p_cost_segment14 => p_cost_segment14
340 ,p_cost_segment15 => p_cost_segment15
341 ,p_cost_segment16 => p_cost_segment16
342 ,p_cost_segment17 => p_cost_segment17
343 ,p_cost_segment18 => p_cost_segment18
344 ,p_cost_segment19 => p_cost_segment19
345 ,p_cost_segment20 => p_cost_segment20
346 ,p_cost_segment21 => p_cost_segment21
347 ,p_cost_segment22 => p_cost_segment22
348 ,p_cost_segment23 => p_cost_segment23
349 ,p_cost_segment24 => p_cost_segment24
350 ,p_cost_segment25 => p_cost_segment25
351 ,p_cost_segment26 => p_cost_segment26
352 ,p_cost_segment27 => p_cost_segment27
353 ,p_cost_segment28 => p_cost_segment28
354 ,p_cost_segment29 => p_cost_segment29
355 ,p_cost_segment30 => p_cost_segment30
356 ,p_balance_segment1 => p_balance_segment1
357 ,p_balance_segment2 => p_balance_segment2
358 ,p_balance_segment3 => p_balance_segment3
359 ,p_balance_segment4 => p_balance_segment4
360 ,p_balance_segment5 => p_balance_segment5
361 ,p_balance_segment6 => p_balance_segment6
362 ,p_balance_segment7 => p_balance_segment7
363 ,p_balance_segment8 => p_balance_segment8
364 ,p_balance_segment9 => p_balance_segment9
365 ,p_balance_segment10 => p_balance_segment10
366 ,p_balance_segment11 => p_balance_segment11
367 ,p_balance_segment12 => p_balance_segment12
368 ,p_balance_segment13 => p_balance_segment13
369 ,p_balance_segment14 => p_balance_segment14
370 ,p_balance_segment15 => p_balance_segment15
371 ,p_balance_segment16 => p_balance_segment16
372 ,p_balance_segment17 => p_balance_segment17
373 ,p_balance_segment18 => p_balance_segment18
374 ,p_balance_segment19 => p_balance_segment19
375 ,p_balance_segment20 => p_balance_segment20
376 ,p_balance_segment21 => p_balance_segment21
377 ,p_balance_segment22 => p_balance_segment22
378 ,p_balance_segment23 => p_balance_segment23
379 ,p_balance_segment24 => p_balance_segment24
380 ,p_balance_segment25 => p_balance_segment25
381 ,p_balance_segment26 => p_balance_segment26
382 ,p_balance_segment27 => p_balance_segment27
383 ,p_balance_segment28 => p_balance_segment28
384 ,p_balance_segment29 => p_balance_segment29
385 ,p_balance_segment30 => p_balance_segment30
386 ,p_cost_concat_segments => p_cost_concat_segments
387 ,p_balance_concat_segments => p_balance_concat_segments
388 ,p_element_link_id => l_element_link_id
389 ,p_comment_id => l_comment_id
390 ,p_object_version_number => l_object_version_number
391 ,p_effective_start_date => l_effective_start_date
392 ,p_effective_end_date => l_effective_end_date
393 );
394
395 -- Creates assignment link usages if people group criteria is specified
396 if p_people_group_id is not null then
397 pay_pel_bus.chk_asg_link_usages
398 (p_business_group_id => p_business_group_id
399 ,p_people_group_id => p_people_group_id
400 ,p_element_link_id => l_element_link_id
401 ,p_effective_start_date => l_effective_start_date
402 ,p_effective_end_date => l_effective_end_date
403 );
404 end if;
405
406 -- Creates Standard Entries in case Standard link flag is 'Y'
407 if l_standard_link_flag = 'Y' then
408 pay_pel_bus.chk_standard_entries
409 (p_business_group_id => p_business_group_id
410 ,p_element_link_id => l_element_link_id
411 ,p_element_type_id => p_element_type_id
412 ,p_effective_start_date => l_effective_start_date
413 ,p_effective_end_date => l_effective_end_date
414 ,p_payroll_id => p_payroll_id
415 ,p_link_to_all_payrolls_flag => p_link_to_all_payrolls_flag
416 ,p_job_id => p_job_id
417 ,p_grade_id => p_grade_id
418 ,p_position_id => p_position_id
419 ,p_organization_id => p_organization_id
420 ,p_location_id => p_location_id
421 ,p_pay_basis_id => p_pay_basis_id
422 ,p_employment_category => p_employment_category
423 ,p_people_group_id => p_people_group_id
424 );
425 end if;
426
427 --
428 -- Call After Process User Hook
429 --
430 begin
431 pay_element_link_BK1.create_element_link_a
432 (p_effective_date => l_effective_date
433 ,p_element_type_id => p_element_type_id
434 ,p_business_group_id => p_business_group_id
435 ,p_costable_type => p_costable_type
436 ,p_payroll_id => p_payroll_id
437 ,p_job_id => p_job_id
438 ,p_position_id => p_position_id
439 ,p_people_group_id => p_people_group_id
440 ,p_cost_allocation_keyflex_id => l_cost_allocation_id
441 ,p_organization_id => p_organization_id
442 ,p_location_id => p_location_id
443 ,p_grade_id => p_grade_id
444 ,p_balancing_keyflex_id => l_bal_allocation_id
445 ,p_element_set_id => p_element_set_id
446 ,p_pay_basis_id => p_pay_basis_id
447 ,p_link_to_all_payrolls_flag => p_link_to_all_payrolls_flag
448 ,p_standard_link_flag => p_standard_link_flag
449 ,p_transfer_to_gl_flag => p_transfer_to_gl_flag
450 ,p_comments => p_comments
451 ,p_employment_category => p_employment_category
452 ,p_qualifying_age => p_qualifying_age
453 ,p_qualifying_length_of_service => p_qualifying_length_of_service
454 ,p_qualifying_units => p_qualifying_units
455 ,p_attribute_category => p_attribute_category
456 ,p_attribute1 => p_attribute1
457 ,p_attribute2 => p_attribute2
458 ,p_attribute3 => p_attribute3
459 ,p_attribute4 => p_attribute4
460 ,p_attribute5 => p_attribute5
461 ,p_attribute6 => p_attribute6
462 ,p_attribute7 => p_attribute7
463 ,p_attribute8 => p_attribute8
464 ,p_attribute9 => p_attribute9
465 ,p_attribute10 => p_attribute10
466 ,p_attribute11 => p_attribute11
467 ,p_attribute12 => p_attribute12
468 ,p_attribute13 => p_attribute13
469 ,p_attribute14 => p_attribute14
470 ,p_attribute15 => p_attribute15
471 ,p_attribute16 => p_attribute16
472 ,p_attribute17 => p_attribute17
473 ,p_attribute18 => p_attribute18
474 ,p_attribute19 => p_attribute19
475 ,p_attribute20 => p_attribute20
476 ,p_cost_segment1 => p_cost_segment1
477 ,p_cost_segment2 => p_cost_segment2
478 ,p_cost_segment3 => p_cost_segment3
479 ,p_cost_segment4 => p_cost_segment4
480 ,p_cost_segment5 => p_cost_segment5
481 ,p_cost_segment6 => p_cost_segment6
482 ,p_cost_segment7 => p_cost_segment7
483 ,p_cost_segment8 => p_cost_segment8
484 ,p_cost_segment9 => p_cost_segment9
485 ,p_cost_segment10 => p_cost_segment10
486 ,p_cost_segment11 => p_cost_segment11
487 ,p_cost_segment12 => p_cost_segment12
488 ,p_cost_segment13 => p_cost_segment13
489 ,p_cost_segment14 => p_cost_segment14
490 ,p_cost_segment15 => p_cost_segment15
491 ,p_cost_segment16 => p_cost_segment16
492 ,p_cost_segment17 => p_cost_segment17
493 ,p_cost_segment18 => p_cost_segment18
494 ,p_cost_segment19 => p_cost_segment19
495 ,p_cost_segment20 => p_cost_segment20
496 ,p_cost_segment21 => p_cost_segment21
497 ,p_cost_segment22 => p_cost_segment22
498 ,p_cost_segment23 => p_cost_segment23
499 ,p_cost_segment24 => p_cost_segment24
500 ,p_cost_segment25 => p_cost_segment25
501 ,p_cost_segment26 => p_cost_segment26
502 ,p_cost_segment27 => p_cost_segment27
503 ,p_cost_segment28 => p_cost_segment28
504 ,p_cost_segment29 => p_cost_segment29
505 ,p_cost_segment30 => p_cost_segment30
506 ,p_balance_segment1 => p_balance_segment1
507 ,p_balance_segment2 => p_balance_segment2
508 ,p_balance_segment3 => p_balance_segment3
509 ,p_balance_segment4 => p_balance_segment4
510 ,p_balance_segment5 => p_balance_segment5
511 ,p_balance_segment6 => p_balance_segment6
512 ,p_balance_segment7 => p_balance_segment7
513 ,p_balance_segment8 => p_balance_segment8
514 ,p_balance_segment9 => p_balance_segment9
515 ,p_balance_segment10 => p_balance_segment10
516 ,p_balance_segment11 => p_balance_segment11
517 ,p_balance_segment12 => p_balance_segment12
518 ,p_balance_segment13 => p_balance_segment13
519 ,p_balance_segment14 => p_balance_segment14
520 ,p_balance_segment15 => p_balance_segment15
521 ,p_balance_segment16 => p_balance_segment16
522 ,p_balance_segment17 => p_balance_segment17
523 ,p_balance_segment18 => p_balance_segment18
524 ,p_balance_segment19 => p_balance_segment19
525 ,p_balance_segment20 => p_balance_segment20
526 ,p_balance_segment21 => p_balance_segment21
527 ,p_balance_segment22 => p_balance_segment22
528 ,p_balance_segment23 => p_balance_segment23
529 ,p_balance_segment24 => p_balance_segment24
530 ,p_balance_segment25 => p_balance_segment25
531 ,p_balance_segment26 => p_balance_segment26
532 ,p_balance_segment27 => p_balance_segment27
533 ,p_balance_segment28 => p_balance_segment28
534 ,p_balance_segment29 => p_balance_segment29
535 ,p_balance_segment30 => p_balance_segment30
536 ,p_cost_concat_segments => p_cost_concat_segments
537 ,p_balance_concat_segments => p_balance_concat_segments
538 ,p_element_link_id => l_element_link_id
539 ,p_comment_id => l_comment_id
540 ,p_object_version_number => l_object_version_number
541 ,p_effective_start_date => l_effective_start_date
542 ,p_effective_end_date => l_effective_end_date
543 );
544 exception
545 when hr_api.cannot_find_prog_unit then
546 hr_api.cannot_find_prog_unit_error
547 (p_module_name => 'create_element_link'
548 ,p_hook_type => 'AP'
549 );
550 end;
551 --
552 -- When in validation only mode raise the Validate_Enabled exception
553 --
554 if p_validate then
555 raise hr_api.validate_enabled;
556 end if;
557
558 --
559 -- Set out variables
560 --
561 p_element_link_id := l_element_link_id;
562 p_comment_id := l_comment_id;
563 p_object_version_number := l_object_version_number;
564 p_effective_start_date := l_effective_start_date;
565 p_effective_end_date := l_effective_end_date;
566
567 hr_utility.set_location(' Leaving:'||l_proc, 70);
568 exception
569 when hr_api.validate_enabled then
570 --
571 -- As the Validate_Enabled exception has been raised
572 -- we must rollback to the savepoint
573 --
574 rollback to create_element_link;
575 --
576 -- Only set output warning arguments
577 -- (Any key or derived arguments must be set to null
578 -- when validation only mode is being used.)
579 --
580 p_element_link_id := null;
581 p_object_version_number := null;
582
583
584 hr_utility.set_location(' Leaving:'||l_proc, 80);
585 when others then
586 --
587 -- A validation or unexpected error has occured
588 --
589 rollback to create_element_link;
590 hr_utility.set_location(' Leaving:'||l_proc, 90);
591 raise;
592 end create_element_link;
593 -- ----------------------------------------------------------------------------
594 -- |--------------------------<update_element_link>--------------------------|
595 -- ----------------------------------------------------------------------------
596 --
597 procedure update_element_link
598 (p_validate in boolean default false
599 ,p_effective_date in date
600 ,p_element_link_id in number
601 ,p_datetrack_mode in varchar2
602 ,p_costable_type in varchar2 default hr_api.g_varchar2
603 ,p_element_set_id in number default hr_api.g_number
604 ,p_multiply_value_flag in varchar2 default hr_api.g_varchar2
605 ,p_standard_link_flag in varchar2 default hr_api.g_varchar2
606 ,p_transfer_to_gl_flag in varchar2 default hr_api.g_varchar2
607 ,p_comments in varchar2 default hr_api.g_varchar2
608 ,p_comment_id in varchar2 default hr_api.g_varchar2
609 ,p_employment_category in varchar2 default hr_api.g_varchar2
610 ,p_qualifying_age in number default hr_api.g_number
611 ,p_qualifying_length_of_service in number default hr_api.g_number
612 ,p_qualifying_units in varchar2 default hr_api.g_varchar2
613 ,p_attribute_category in varchar2 default hr_api.g_varchar2
614 ,p_attribute1 in varchar2 default hr_api.g_varchar2
615 ,p_attribute2 in varchar2 default hr_api.g_varchar2
616 ,p_attribute3 in varchar2 default hr_api.g_varchar2
617 ,p_attribute4 in varchar2 default hr_api.g_varchar2
618 ,p_attribute5 in varchar2 default hr_api.g_varchar2
619 ,p_attribute6 in varchar2 default hr_api.g_varchar2
620 ,p_attribute7 in varchar2 default hr_api.g_varchar2
621 ,p_attribute8 in varchar2 default hr_api.g_varchar2
622 ,p_attribute9 in varchar2 default hr_api.g_varchar2
623 ,p_attribute10 in varchar2 default hr_api.g_varchar2
624 ,p_attribute11 in varchar2 default hr_api.g_varchar2
625 ,p_attribute12 in varchar2 default hr_api.g_varchar2
626 ,p_attribute13 in varchar2 default hr_api.g_varchar2
627 ,p_attribute14 in varchar2 default hr_api.g_varchar2
628 ,p_attribute15 in varchar2 default hr_api.g_varchar2
629 ,p_attribute16 in varchar2 default hr_api.g_varchar2
630 ,p_attribute17 in varchar2 default hr_api.g_varchar2
631 ,p_attribute18 in varchar2 default hr_api.g_varchar2
632 ,p_attribute19 in varchar2 default hr_api.g_varchar2
633 ,p_attribute20 in varchar2 default hr_api.g_varchar2
634 ,p_cost_segment1 in varchar2 default hr_api.g_varchar2
635 ,p_cost_segment2 in varchar2 default hr_api.g_varchar2
636 ,p_cost_segment3 in varchar2 default hr_api.g_varchar2
637 ,p_cost_segment4 in varchar2 default hr_api.g_varchar2
638 ,p_cost_segment5 in varchar2 default hr_api.g_varchar2
639 ,p_cost_segment6 in varchar2 default hr_api.g_varchar2
640 ,p_cost_segment7 in varchar2 default hr_api.g_varchar2
641 ,p_cost_segment8 in varchar2 default hr_api.g_varchar2
642 ,p_cost_segment9 in varchar2 default hr_api.g_varchar2
643 ,p_cost_segment10 in varchar2 default hr_api.g_varchar2
644 ,p_cost_segment11 in varchar2 default hr_api.g_varchar2
645 ,p_cost_segment12 in varchar2 default hr_api.g_varchar2
646 ,p_cost_segment13 in varchar2 default hr_api.g_varchar2
647 ,p_cost_segment14 in varchar2 default hr_api.g_varchar2
648 ,p_cost_segment15 in varchar2 default hr_api.g_varchar2
649 ,p_cost_segment16 in varchar2 default hr_api.g_varchar2
650 ,p_cost_segment17 in varchar2 default hr_api.g_varchar2
651 ,p_cost_segment18 in varchar2 default hr_api.g_varchar2
652 ,p_cost_segment19 in varchar2 default hr_api.g_varchar2
653 ,p_cost_segment20 in varchar2 default hr_api.g_varchar2
654 ,p_cost_segment21 in varchar2 default hr_api.g_varchar2
655 ,p_cost_segment22 in varchar2 default hr_api.g_varchar2
656 ,p_cost_segment23 in varchar2 default hr_api.g_varchar2
657 ,p_cost_segment24 in varchar2 default hr_api.g_varchar2
658 ,p_cost_segment25 in varchar2 default hr_api.g_varchar2
659 ,p_cost_segment26 in varchar2 default hr_api.g_varchar2
660 ,p_cost_segment27 in varchar2 default hr_api.g_varchar2
661 ,p_cost_segment28 in varchar2 default hr_api.g_varchar2
662 ,p_cost_segment29 in varchar2 default hr_api.g_varchar2
663 ,p_cost_segment30 in varchar2 default hr_api.g_varchar2
664 ,p_balance_segment1 in varchar2 default hr_api.g_varchar2
665 ,p_balance_segment2 in varchar2 default hr_api.g_varchar2
666 ,p_balance_segment3 in varchar2 default hr_api.g_varchar2
667 ,p_balance_segment4 in varchar2 default hr_api.g_varchar2
668 ,p_balance_segment5 in varchar2 default hr_api.g_varchar2
669 ,p_balance_segment6 in varchar2 default hr_api.g_varchar2
670 ,p_balance_segment7 in varchar2 default hr_api.g_varchar2
671 ,p_balance_segment8 in varchar2 default hr_api.g_varchar2
672 ,p_balance_segment9 in varchar2 default hr_api.g_varchar2
673 ,p_balance_segment10 in varchar2 default hr_api.g_varchar2
674 ,p_balance_segment11 in varchar2 default hr_api.g_varchar2
675 ,p_balance_segment12 in varchar2 default hr_api.g_varchar2
676 ,p_balance_segment13 in varchar2 default hr_api.g_varchar2
677 ,p_balance_segment14 in varchar2 default hr_api.g_varchar2
678 ,p_balance_segment15 in varchar2 default hr_api.g_varchar2
679 ,p_balance_segment16 in varchar2 default hr_api.g_varchar2
680 ,p_balance_segment17 in varchar2 default hr_api.g_varchar2
681 ,p_balance_segment18 in varchar2 default hr_api.g_varchar2
682 ,p_balance_segment19 in varchar2 default hr_api.g_varchar2
683 ,p_balance_segment20 in varchar2 default hr_api.g_varchar2
684 ,p_balance_segment21 in varchar2 default hr_api.g_varchar2
685 ,p_balance_segment22 in varchar2 default hr_api.g_varchar2
686 ,p_balance_segment23 in varchar2 default hr_api.g_varchar2
687 ,p_balance_segment24 in varchar2 default hr_api.g_varchar2
688 ,p_balance_segment25 in varchar2 default hr_api.g_varchar2
689 ,p_balance_segment26 in varchar2 default hr_api.g_varchar2
690 ,p_balance_segment27 in varchar2 default hr_api.g_varchar2
691 ,p_balance_segment28 in varchar2 default hr_api.g_varchar2
692 ,p_balance_segment29 in varchar2 default hr_api.g_varchar2
693 ,p_balance_segment30 in varchar2 default hr_api.g_varchar2
694 ,p_cost_concat_segments_in in varchar2 default hr_api.g_varchar2
695 ,p_balance_concat_segments_in in varchar2 default hr_api.g_varchar2
696 ,p_object_version_number in out nocopy number
697 ,p_cost_allocation_keyflex_id out nocopy number
698 ,p_balancing_keyflex_id out nocopy number
699 ,p_cost_concat_segments_out out nocopy varchar2
700 ,p_balance_concat_segments_out out nocopy varchar2
701 ,p_effective_start_date out nocopy date
702 ,p_effective_end_date out nocopy date
703 ) is
704 --
705 -- Declare cursors and local variables
706 --
707 l_proc varchar2(72) := g_package||'update_element_link';
708 l_effective_date date;
709
710 -- The variables to get the cost/balance id and structure number
711 l_flex_num number;
712 l_cost_allocation_id number;
713 l_bal_allocation_id number;
714
715 -- cursor to fetch the current values of the element link record
716 cursor csr_bg_et is
717 select business_group_id
718 ,element_type_id
719 ,standard_link_flag
720 ,payroll_id
721 ,link_to_all_payrolls_flag
722 ,job_id
723 ,grade_id
724 ,position_id
725 ,organization_id
726 ,location_id
727 ,pay_basis_id
728 ,employment_category
729 ,people_group_id
730 from pay_element_links_f
731 where element_link_id = p_element_link_id
732 and l_effective_date between effective_start_date
733 and effective_end_date;
734
735 -- Cursor to get the structure number to be passed to get the cost/balance id
736 cursor csr_flexnum(p_business_group_id number) is
737 select cost_allocation_structure
738 from per_business_groups
739 where business_group_id = p_business_group_id;
740 --
741 l_element_link_rec csr_bg_et%rowtype;
742 --
743 begin
744 hr_utility.set_location('Entering:'|| l_proc, 10);
745 --
746 -- Issue a savepoint
747 --
748 savepoint update_element_link;
749 --
750 hr_utility.set_location('Entering:'|| l_proc, 20);
751 --
752 -- Truncate the time portion from all IN date parameters
753 --
754 l_effective_date := trunc(p_effective_date);
755 --
756 open csr_bg_et;
757 fetch csr_bg_et into l_element_link_rec;
758 close csr_bg_et;
759 --
760 -- Call Before Process User Hook
761 --
762 begin
763 pay_element_link_BK2.update_element_link_b
764 (l_effective_date
765 ,p_element_link_id
766 ,p_datetrack_mode
767 ,p_costable_type
768 ,p_element_set_id
769 ,p_multiply_value_flag
770 ,p_standard_link_flag
771 ,p_transfer_to_gl_flag
772 ,p_comments
773 ,p_comment_id
774 ,p_employment_category
775 ,p_qualifying_age
776 ,p_qualifying_length_of_service
777 ,p_qualifying_units
778 ,p_attribute_category
779 ,p_attribute1
780 ,p_attribute2
781 ,p_attribute3
782 ,p_attribute4
783 ,p_attribute5
784 ,p_attribute6
785 ,p_attribute7
786 ,p_attribute8
787 ,p_attribute9
788 ,p_attribute10
789 ,p_attribute11
790 ,p_attribute12
791 ,p_attribute13
792 ,p_attribute14
793 ,p_attribute15
794 ,p_attribute16
795 ,p_attribute17
796 ,p_attribute18
797 ,p_attribute19
798 ,p_attribute20
799 ,p_cost_segment1
800 ,p_cost_segment2
801 ,p_cost_segment3
802 ,p_cost_segment4
803 ,p_cost_segment5
804 ,p_cost_segment6
805 ,p_cost_segment7
806 ,p_cost_segment8
807 ,p_cost_segment9
808 ,p_cost_segment10
809 ,p_cost_segment11
810 ,p_cost_segment12
811 ,p_cost_segment13
812 ,p_cost_segment14
813 ,p_cost_segment15
814 ,p_cost_segment16
815 ,p_cost_segment17
816 ,p_cost_segment18
817 ,p_cost_segment19
818 ,p_cost_segment20
819 ,p_cost_segment21
820 ,p_cost_segment22
821 ,p_cost_segment23
822 ,p_cost_segment24
823 ,p_cost_segment25
824 ,p_cost_segment26
825 ,p_cost_segment27
826 ,p_cost_segment28
827 ,p_cost_segment29
828 ,p_cost_segment30
829 ,p_balance_segment1
830 ,p_balance_segment2
831 ,p_balance_segment3
832 ,p_balance_segment4
833 ,p_balance_segment5
834 ,p_balance_segment6
835 ,p_balance_segment7
836 ,p_balance_segment8
837 ,p_balance_segment9
838 ,p_balance_segment10
839 ,p_balance_segment11
840 ,p_balance_segment12
841 ,p_balance_segment13
842 ,p_balance_segment14
843 ,p_balance_segment15
844 ,p_balance_segment16
845 ,p_balance_segment17
846 ,p_balance_segment18
847 ,p_balance_segment19
848 ,p_balance_segment20
849 ,p_balance_segment21
850 ,p_balance_segment22
851 ,p_balance_segment23
852 ,p_balance_segment24
853 ,p_balance_segment25
854 ,p_balance_segment26
855 ,p_balance_segment27
856 ,p_balance_segment28
857 ,p_balance_segment29
858 ,p_balance_segment30
859 ,p_cost_concat_segments_in
860 ,p_balance_concat_segments_in
861 ,p_object_version_number
862 );
863 exception
864 when hr_api.cannot_find_prog_unit then
865 hr_api.cannot_find_prog_unit_error
866 (p_module_name => 'update_element_link'
867 ,p_hook_type => 'BP'
868 );
869 end;
870 --
871 -- If the costable type is Distributed/Costed/Fixed Costed then call
872 -- hr_kflex_utility for mandatory balancing segments
873
874 if (p_costable_type = 'D' or p_costable_type = 'C'
875 or p_costable_type = 'F') then
876
877 hr_utility.set_location('Entering:'|| l_proc, 30);
878
879 -- Get the structure number for the business_group id supplied
880 open csr_Flexnum(l_element_link_rec.business_group_id);
881 fetch csr_Flexnum into l_flex_num;
882 if csr_Flexnum%notfound then
883 close csr_Flexnum;
884 hr_utility.set_message(801,'HR_7471_FLEX_PEA_INVALID_ID');
885 hr_utility.raise_error;
886 end if;
887
888 hr_kflex_utility.upd_or_sel_keyflex_comb
889 (p_appl_short_name => 'PAY'
890 ,p_flex_code => 'COST'
891 ,p_flex_num => l_flex_num
892 ,p_segment1 => p_balance_segment1
893 ,p_segment2 => p_balance_segment2
894 ,p_segment3 => p_balance_segment3
895 ,p_segment4 => p_balance_segment4
896 ,p_segment5 => p_balance_segment5
897 ,p_segment6 => p_balance_segment6
898 ,p_segment7 => p_balance_segment7
899 ,p_segment8 => p_balance_segment8
900 ,p_segment9 => p_balance_segment9
901 ,p_segment10 => p_balance_segment10
902 ,p_segment11 => p_balance_segment11
903 ,p_segment12 => p_balance_segment12
904 ,p_segment13 => p_balance_segment13
905 ,p_segment14 => p_balance_segment14
906 ,p_segment15 => p_balance_segment15
907 ,p_segment16 => p_balance_segment16
908 ,p_segment17 => p_balance_segment17
909 ,p_segment18 => p_balance_segment18
910 ,p_segment19 => p_balance_segment19
911 ,p_segment20 => p_balance_segment20
912 ,p_segment21 => p_balance_segment21
913 ,p_segment22 => p_balance_segment22
914 ,p_segment23 => p_balance_segment23
915 ,p_segment24 => p_balance_segment24
916 ,p_segment25 => p_balance_segment25
917 ,p_segment26 => p_balance_segment26
918 ,p_segment27 => p_balance_segment27
919 ,p_segment28 => p_balance_segment28
920 ,p_segment29 => p_balance_segment29
921 ,p_segment30 => p_balance_segment30
922 ,p_concat_segments_in => p_balance_concat_segments_in
923 ,p_ccid => l_bal_allocation_id
924 ,p_concat_segments_out => p_balance_concat_segments_out
925 );
926
927 -- Call the hr_kflex_untility for optional costing if that info is
928 -- supplied
929 if (p_cost_segment1 is not null or p_cost_segment2 is not null or
930 p_cost_segment3 is not null or p_cost_segment4 is not null or
931 p_cost_segment5 is not null or p_cost_segment6 is not null or
932 p_cost_segment7 is not null or p_cost_segment8 is not null or
933 p_cost_segment9 is not null or p_cost_segment10 is not null or
934 p_cost_segment11 is not null or p_cost_segment12 is not null or
935 p_cost_segment13 is not null or p_cost_segment14 is not null or
936 p_cost_segment15 is not null or p_cost_segment16 is not null or
937 p_cost_segment17 is not null or p_cost_segment18 is not null or
938 p_cost_segment19 is not null or p_cost_segment20 is not null or
939 p_cost_segment21 is not null or p_cost_segment22 is not null or
940 p_cost_segment23 is not null or p_cost_segment24 is not null or
941 p_cost_segment25 is not null or p_cost_segment26 is not null or
942 p_cost_segment27 is not null or p_cost_segment28 is not null or
943 p_cost_segment29 is not null or p_cost_segment30 is not null) then
944
945 hr_kflex_utility.upd_or_sel_keyflex_comb
946 (p_appl_short_name => 'PAY'
947 ,p_flex_code => 'COST'
948 ,p_flex_num => l_flex_num
949 ,p_segment1 => p_cost_segment1
950 ,p_segment2 => p_cost_segment2
951 ,p_segment3 => p_cost_segment3
952 ,p_segment4 => p_cost_segment4
953 ,p_segment5 => p_cost_segment5
954 ,p_segment6 => p_cost_segment6
955 ,p_segment7 => p_cost_segment7
956 ,p_segment8 => p_cost_segment8
957 ,p_segment9 => p_cost_segment9
958 ,p_segment10 => p_cost_segment10
959 ,p_segment11 => p_cost_segment11
960 ,p_segment12 => p_cost_segment12
961 ,p_segment13 => p_cost_segment13
962 ,p_segment14 => p_cost_segment14
963 ,p_segment15 => p_cost_segment15
964 ,p_segment16 => p_cost_segment16
965 ,p_segment17 => p_cost_segment17
966 ,p_segment18 => p_cost_segment18
967 ,p_segment19 => p_cost_segment19
968 ,p_segment20 => p_cost_segment20
969 ,p_segment21 => p_cost_segment21
970 ,p_segment22 => p_cost_segment22
971 ,p_segment23 => p_cost_segment23
972 ,p_segment24 => p_cost_segment24
973 ,p_segment25 => p_cost_segment25
974 ,p_segment26 => p_cost_segment26
975 ,p_segment27 => p_cost_segment27
976 ,p_segment28 => p_cost_segment28
977 ,p_segment29 => p_cost_segment29
978 ,p_segment30 => p_cost_segment30
979 ,p_concat_segments_in => p_cost_concat_segments_in
980 ,p_ccid => l_cost_allocation_id
981 ,p_concat_segments_out => p_cost_concat_segments_out
982 );
983 end if;
984
985 end if;
986 --
987 l_cost_allocation_id := nvl(l_cost_allocation_id,hr_api.g_number);
988 l_bal_allocation_id := nvl(l_bal_allocation_id,hr_api.g_number);
989 --
990 -- Process Logic
991 --
992 pay_pel_upd.upd(
993 p_effective_date => l_effective_date
994 ,p_element_type_id => l_element_link_rec.element_type_id
995 ,p_business_group_id => l_element_link_rec.business_group_id
996 ,p_costable_type => p_costable_type
997 ,p_multiply_value_flag => p_multiply_value_flag
998 ,p_standard_link_flag => p_standard_link_flag
999 ,p_transfer_to_gl_flag => p_transfer_to_gl_flag
1000 ,p_cost_allocation_keyflex_id => l_cost_allocation_id
1001 ,p_balancing_keyflex_id => l_bal_allocation_id
1002 ,p_element_set_id => p_element_set_id
1003 ,p_comments => p_comments
1004 ,p_employment_category => p_employment_category
1005 ,p_qualifying_age => p_qualifying_age
1006 ,p_qualifying_length_of_service => p_qualifying_length_of_service
1007 ,p_qualifying_units => p_qualifying_units
1008 ,p_attribute_category => p_attribute_category
1009 ,p_attribute1 => p_attribute1
1010 ,p_attribute2 => p_attribute2
1011 ,p_attribute3 => p_attribute3
1012 ,p_attribute4 => p_attribute4
1013 ,p_attribute5 => p_attribute5
1014 ,p_attribute6 => p_attribute6
1015 ,p_attribute7 => p_attribute7
1016 ,p_attribute8 => p_attribute8
1017 ,p_attribute9 => p_attribute9
1018 ,p_attribute10 => p_attribute10
1019 ,p_attribute11 => p_attribute11
1020 ,p_attribute12 => p_attribute12
1021 ,p_attribute13 => p_attribute13
1022 ,p_attribute14 => p_attribute14
1023 ,p_attribute15 => p_attribute15
1024 ,p_attribute16 => p_attribute16
1025 ,p_attribute17 => p_attribute17
1026 ,p_attribute18 => p_attribute18
1027 ,p_attribute19 => p_attribute19
1028 ,p_attribute20 => p_attribute20
1029 ,p_element_link_id => p_element_link_id
1030 ,p_datetrack_mode => p_datetrack_mode
1031 ,p_object_version_number => p_object_version_number
1032 ,p_effective_start_date => p_effective_start_date
1033 ,p_effective_end_date => p_effective_end_date
1034 );
1035 --
1036 -- Create element entries if the standard_link_flag is changed from 'N' to 'Y',
1037 -- with the following conditions -
1038 -- 1. Entries for the link should not exist.
1039 -- 2. All required input values should have a default value.
1040 --
1041 if ((l_element_link_rec.standard_link_flag = 'N' and
1042 p_standard_link_flag = 'Y')) and
1043 (NOT pay_element_links_pkg.element_entries_exist(p_element_link_id,
1044 TRUE))
1045 then
1046 --
1047 pay_link_input_values_pkg.check_required_defaults
1048 (p_element_link_id,
1049 p_effective_date);
1050 --
1051 pay_pel_bus.chk_standard_entries
1052 (p_business_group_id => l_element_link_rec.business_group_id
1053 ,p_element_link_id => p_element_link_id
1054 ,p_element_type_id => l_element_link_rec.element_type_id
1055 ,p_effective_start_date => p_effective_start_date
1056 ,p_effective_end_date => p_effective_end_date
1057 ,p_payroll_id => l_element_link_rec.payroll_id
1058 ,p_link_to_all_payrolls_flag => l_element_link_rec.link_to_all_payrolls_flag
1059 ,p_job_id => l_element_link_rec.job_id
1060 ,p_grade_id => l_element_link_rec.grade_id
1061 ,p_position_id => l_element_link_rec.position_id
1062 ,p_organization_id => l_element_link_rec.organization_id
1063 ,p_location_id => l_element_link_rec.location_id
1064 ,p_pay_basis_id => l_element_link_rec.pay_basis_id
1065 ,p_employment_category => l_element_link_rec.employment_category
1066 ,p_people_group_id => l_element_link_rec.people_group_id
1067 );
1068 --
1069 end if;
1070 --
1071 -- Call After Process User Hook
1072 --
1073 begin
1074 pay_element_link_BK2.update_element_link_a
1075 (l_effective_date
1076 ,p_element_link_id
1077 ,p_datetrack_mode
1078 ,p_costable_type
1079 ,p_element_set_id
1080 ,p_multiply_value_flag
1081 ,p_standard_link_flag
1082 ,p_transfer_to_gl_flag
1083 ,p_comments
1084 ,p_comment_id
1085 ,p_employment_category
1086 ,p_qualifying_age
1087 ,p_qualifying_length_of_service
1088 ,p_qualifying_units
1089 ,p_attribute_category
1090 ,p_attribute1
1091 ,p_attribute2
1092 ,p_attribute3
1093 ,p_attribute4
1094 ,p_attribute5
1095 ,p_attribute6
1096 ,p_attribute7
1097 ,p_attribute8
1098 ,p_attribute9
1099 ,p_attribute10
1100 ,p_attribute11
1101 ,p_attribute12
1102 ,p_attribute13
1103 ,p_attribute14
1104 ,p_attribute15
1105 ,p_attribute16
1106 ,p_attribute17
1107 ,p_attribute18
1108 ,p_attribute19
1109 ,p_attribute20
1110 ,p_cost_segment1
1111 ,p_cost_segment2
1112 ,p_cost_segment3
1113 ,p_cost_segment4
1114 ,p_cost_segment5
1115 ,p_cost_segment6
1116 ,p_cost_segment7
1117 ,p_cost_segment8
1118 ,p_cost_segment9
1119 ,p_cost_segment10
1120 ,p_cost_segment11
1121 ,p_cost_segment12
1122 ,p_cost_segment13
1123 ,p_cost_segment14
1124 ,p_cost_segment15
1125 ,p_cost_segment16
1126 ,p_cost_segment17
1127 ,p_cost_segment18
1128 ,p_cost_segment19
1129 ,p_cost_segment20
1130 ,p_cost_segment21
1131 ,p_cost_segment22
1132 ,p_cost_segment23
1133 ,p_cost_segment24
1134 ,p_cost_segment25
1135 ,p_cost_segment26
1136 ,p_cost_segment27
1137 ,p_cost_segment28
1138 ,p_cost_segment29
1139 ,p_cost_segment30
1140 ,p_balance_segment1
1141 ,p_balance_segment2
1142 ,p_balance_segment3
1143 ,p_balance_segment4
1144 ,p_balance_segment5
1145 ,p_balance_segment6
1146 ,p_balance_segment7
1147 ,p_balance_segment8
1148 ,p_balance_segment9
1149 ,p_balance_segment10
1150 ,p_balance_segment11
1151 ,p_balance_segment12
1152 ,p_balance_segment13
1153 ,p_balance_segment14
1154 ,p_balance_segment15
1155 ,p_balance_segment16
1156 ,p_balance_segment17
1157 ,p_balance_segment18
1158 ,p_balance_segment19
1159 ,p_balance_segment20
1160 ,p_balance_segment21
1161 ,p_balance_segment22
1162 ,p_balance_segment23
1163 ,p_balance_segment24
1164 ,p_balance_segment25
1165 ,p_balance_segment26
1166 ,p_balance_segment27
1167 ,p_balance_segment28
1168 ,p_balance_segment29
1169 ,p_balance_segment30
1170 ,p_cost_concat_segments_in
1171 ,p_balance_concat_segments_in
1172 ,p_object_version_number
1173 ,l_cost_allocation_id
1174 ,l_bal_allocation_id
1175 ,p_cost_concat_segments_out
1176 ,p_balance_concat_segments_out
1177 ,p_effective_start_date
1178 ,p_effective_end_date
1179 );
1180 exception
1181 when hr_api.cannot_find_prog_unit then
1182 hr_api.cannot_find_prog_unit_error
1183 (p_module_name => 'update_element_link'
1184 ,p_hook_type => 'AP'
1185 );
1186 end;
1187 --
1188 -- When in validation only mode raise the Validate_Enabled exception
1189 --
1190 if p_validate then
1191 raise hr_api.validate_enabled;
1192 end if;
1193 --
1194 -- Set all output arguments
1195 --
1196 p_cost_allocation_keyflex_id := l_cost_allocation_id;
1197 p_balancing_keyflex_id := l_bal_allocation_id;
1198
1199 hr_utility.set_location(' Leaving:'||l_proc, 70);
1200 exception
1201 when hr_api.validate_enabled then
1202 --
1203 -- As the Validate_Enabled exception has been raised
1204 -- we must rollback to the savepoint
1205 --
1206 rollback to update_element_link;
1207 --
1208 -- Only set output warning arguments
1209 -- (Any key or derived arguments must be set to null
1210 -- when validation only mode is being used.)
1211 --
1212 p_object_version_number := null;
1213
1214 hr_utility.set_location(' Leaving:'||l_proc, 80);
1215 when others then
1216 --
1217 -- A validation or unexpected error has occured
1218 --
1219 rollback to update_element_link;
1220 hr_utility.set_location(' Leaving:'||l_proc, 90);
1221 raise;
1222 end update_element_link;
1223 --
1224 -- ----------------------------------------------------------------------------
1225 -- |-----------------------< delete_element_link_int >------------------------|
1226 -- ----------------------------------------------------------------------------
1227 procedure delete_element_link_int
1228 (p_effective_date in date
1229 ,p_element_link_id in number
1230 ,p_datetrack_delete_mode in varchar2
1231 ,p_object_version_number in out nocopy number
1232 ,p_effective_start_date out nocopy date
1233 ,p_effective_end_date out nocopy date
1234 ,p_entries_warning out nocopy boolean
1235 )
1236 is
1237 --
1238 l_proc varchar2(72) := g_package||'delete_element_link_int';
1239 l_validation_start_date date;
1240 l_validation_end_date date;
1241 l_object_version_number number:= p_object_version_number;
1242 l_effective_start_date date;
1243 l_effective_end_date date;
1244 l_entries_warning boolean;
1245 l_liv_ovn number;
1246 l_liv_esd date;
1247 l_liv_eed date;
1248 l_business_group_id number;
1249 l_people_group_id number;
1250 l_old_esd date;
1251 l_old_eed date;
1252 l_old_min_esd date;
1253 l_old_max_eed date;
1254 l_new_min_esd date;
1255 l_new_max_eed date;
1256 --
1257 cursor csr_links_entries is
1258 select element_entry_id
1259 from pay_element_entries_f
1260 where element_link_id = p_element_link_id
1261 and p_effective_date between effective_start_date
1262 and effective_end_date;
1263
1264 cursor csr_all_inputs_for_link is
1265 select link_input_value_id, object_version_number
1266 from pay_link_input_values_f pliv
1267 where element_link_id = p_element_link_id
1268 and p_effective_date between effective_start_date
1269 and effective_end_date;
1270
1271 cursor csr_last_liv is
1272 select link_input_value_id
1273 ,object_version_number
1274 ,effective_start_date
1275 ,effective_end_date
1276 from pay_link_input_values_f pliv
1277 where element_link_id = p_element_link_id
1278 and effective_end_date >= p_effective_date
1279 and not exists
1280 (select null
1281 from pay_link_input_values_f pliv2
1282 where pliv2.element_link_id = pliv.element_link_id
1283 and pliv2.input_value_id = pliv.input_value_id
1284 and pliv2.effective_start_date > pliv.effective_start_date);
1285
1286 cursor csr_link_date_range is
1287 select min(effective_start_date) min_effective_start_date
1288 ,max(effective_end_date) max_effective_end_date
1289 from pay_element_links_f
1290 where element_link_id = p_element_link_id
1291 ;
1292 --
1293 begin
1294 hr_utility.set_location('Entering:'||l_proc, 5);
1295 --
1296 -- Process Logic
1297 --
1298 -- 1) Lock the element link and identify the validation date range.
1299 -- 2) Validation in addition to the row handler.
1300 -- 3) Delete non datetrack child rows.
1301 -- 4) ZAP or End Date child rows.
1302 -- 5) Delete the element link.
1303 -- 6) Next Change or Future Change child rows.
1304 --
1305
1306 --
1307 -- Ensure that the DateTrack delete mode is valid
1308 --
1309 dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_delete_mode);
1310
1311
1312 hr_utility.set_location(l_proc, 10);
1313 --
1314 -- 1) Lock the element link and identify the validation date range.
1315 --
1316 pay_pel_shd.lck
1317 (p_effective_date => p_effective_date
1318 ,p_datetrack_mode => p_datetrack_delete_mode
1319 ,p_element_link_id => p_element_link_id
1320 ,p_object_version_number => l_object_version_number
1321 ,p_validation_start_date => l_validation_start_date
1322 ,p_validation_end_date => l_validation_end_date
1323 ,p_enforce_foreign_locking => false
1324 );
1325
1326 --
1327 -- Set the element link information obtained by the lock.
1328 --
1329 l_business_group_id := pay_pel_shd.g_old_rec.business_group_id;
1330 l_people_group_id := pay_pel_shd.g_old_rec.people_group_id;
1331 l_old_esd := pay_pel_shd.g_old_rec.effective_start_date;
1332 l_old_eed := pay_pel_shd.g_old_rec.effective_end_date;
1333
1334 --
1335 -- Remember the date range of the element link.
1336 --
1337 open csr_link_date_range;
1338 fetch csr_link_date_range into l_old_min_esd, l_old_max_eed;
1339 close csr_link_date_range;
1340
1341 hr_utility.set_location(l_proc, 20);
1342 --
1343 -- 2) Validation in addition to the row handler.
1344 --
1345 -- Check to see if this delete is allowed.
1346 -- ie. We allow the cascade delete only when no element entry rows are
1347 -- to be deleted.
1348 --
1349 pay_pel_bus.chk_date_eff_delete
1350 (p_element_link_id => p_element_link_id
1351 ,p_delete_mode => p_datetrack_delete_mode
1352 ,p_validation_start_date => l_validation_start_date
1353 );
1354
1355 hr_utility.set_location(l_proc, 30);
1356 --
1357 -- 3) Delete non datetrack child rows.
1358 -- Bug 5512101. Batch Element Link support.
1359 --
1360 if p_datetrack_delete_mode = hr_api.g_zap then
1361 -- Delete the batch object status.
1362 pay_batch_object_status_pkg.delete_object_status
1363 (p_object_type => 'EL'
1364 ,p_object_id => p_element_link_id
1365 ,p_payroll_action_id => null
1366 );
1367 else
1368 -- Ensure that the batch object status is complete.
1369 pay_batch_object_status_pkg.chk_complete_status
1370 (p_object_type => 'EL'
1371 ,p_object_id => p_element_link_id
1372 );
1373 end if;
1374
1375 hr_utility.set_location(l_proc, 40);
1376 --
1377 -- 4) ZAP or End Date child rows.
1378 --
1379 if p_datetrack_delete_mode in (hr_api.g_zap, hr_api.g_delete) then
1380
1381 -- Delete element entries
1382 for fetched_entry in csr_links_entries
1383 loop
1384 hr_entry_api.delete_element_entry
1385 (p_datetrack_delete_mode,
1386 p_effective_date,
1387 fetched_entry.element_entry_id
1388 );
1389 end loop;
1390
1391 -- Delete link input values
1392 for fetched_input_value in csr_all_inputs_for_link
1393 loop
1394 l_liv_ovn := fetched_input_value.object_version_number;
1395 l_liv_esd := null;
1396 l_liv_eed := null;
1397 pay_liv_del.del
1398 (p_effective_date => p_effective_date
1399 ,p_datetrack_mode => p_datetrack_delete_mode
1400 ,p_link_input_value_id => fetched_input_value.link_input_value_id
1401 ,p_object_version_number => l_liv_ovn
1402 ,p_effective_start_date => l_liv_esd
1403 ,p_effective_end_date => l_liv_eed
1404 );
1405 end loop;
1406
1407 -- Delete assignment link usuages
1408 pay_asg_link_usages_pkg.cascade_link_deletion
1409 (p_element_link_id => p_element_link_id
1410 ,p_business_group_id => l_business_group_id
1411 ,p_people_group_id => l_people_group_id
1412 ,p_delete_mode => p_datetrack_delete_mode
1413 ,p_effective_start_date => l_old_esd
1414 ,p_effective_end_date => l_old_eed
1415 ,p_validation_start_date => l_validation_start_date
1416 ,p_validation_end_date => l_validation_end_date
1417 );
1418
1419 end if;
1420
1421 hr_utility.set_location(l_proc, 80);
1422 --
1423 -- 5) Delete the element link.
1424 --
1425 pay_pel_del.del
1426 (p_effective_date => p_effective_date
1427 ,p_element_link_id => p_element_link_id
1428 ,p_datetrack_delete_mode => p_datetrack_delete_mode
1429 ,p_object_version_number => l_object_version_number
1430 ,p_effective_start_date => l_effective_start_date
1431 ,p_effective_end_date => l_effective_end_date
1432 ,p_warning => l_entries_warning
1433 );
1434
1435 hr_utility.set_location(l_proc, 90);
1436 --
1437 -- 6) Next Change or Future Change child rows.
1438 --
1439 if p_datetrack_delete_mode in (hr_api.g_delete_next_change
1440 ,hr_api.g_future_change) then
1441
1442 --
1443 -- We should extend the duration of child records only when
1444 -- the effective end date of the parent element link is extended.
1445 --
1446
1447 -- Obtain the new date range.
1448 --
1449 open csr_link_date_range;
1450 fetch csr_link_date_range into l_new_min_esd, l_new_max_eed;
1451 close csr_link_date_range;
1452
1453 if l_new_max_eed > l_old_max_eed then
1454
1455 -- Delete assignment link usuages
1456
1457 pay_asg_link_usages_pkg.cascade_link_deletion
1458 (p_element_link_id => p_element_link_id
1459 ,p_business_group_id => l_business_group_id
1460 ,p_people_group_id => l_people_group_id
1461 ,p_delete_mode => hr_api.g_delete_next_change
1462 ,p_effective_start_date => l_new_min_esd
1463 ,p_effective_end_date => l_new_max_eed
1464 ,p_validation_start_date => l_validation_start_date
1465 ,p_validation_end_date => l_validation_end_date
1466 );
1467
1468 -- Delete link input values
1469 --
1470 for last_liv_rec in csr_last_liv
1471 loop
1472 l_liv_ovn := last_liv_rec.object_version_number;
1473 l_liv_esd := null;
1474 l_liv_eed := null;
1475 if last_liv_rec.effective_end_date < l_new_max_eed then
1476 pay_liv_del.del
1477 (p_effective_date => last_liv_rec.effective_end_date
1478 ,p_datetrack_mode => hr_api.g_delete_next_change
1479 ,p_link_input_value_id => last_liv_rec.link_input_value_id
1480 ,p_object_version_number => l_liv_ovn
1481 ,p_effective_start_date => l_liv_esd
1482 ,p_effective_end_date => l_liv_eed
1483 );
1484 end if;
1485 end loop;
1486
1487 -- Delete element entries
1488 for fetched_entry in csr_links_entries
1489 loop
1490 hr_entry_api.delete_element_entry
1491 (p_datetrack_delete_mode,
1492 p_effective_date,
1493 fetched_entry.element_entry_id
1494 );
1495 end loop;
1496
1497 end if;
1498 end if;
1499
1500 --
1501 -- Set out variables
1502 --
1503 p_object_version_number := l_object_version_number;
1504 p_effective_start_date := l_effective_start_date;
1505 p_effective_end_date := l_effective_end_date;
1506 p_entries_warning := l_entries_warning;
1507 --
1508 hr_utility.set_location(' Leaving:'||l_proc, 100);
1509 end delete_element_link_int;
1510 --
1511 -- ----------------------------------------------------------------------------
1512 -- |--------------------------<delete_element_link> -------------------------|
1513 -- ----------------------------------------------------------------------------
1514 --
1515 procedure delete_element_link
1516 (p_validate in boolean default false
1517 ,p_effective_date in date
1518 ,p_element_link_id in number
1519 ,p_datetrack_delete_mode in varchar2
1520 ,p_object_version_number in out nocopy number
1521 ,p_effective_start_date out nocopy date
1522 ,p_effective_end_date out nocopy date
1523 ,p_entries_warning out nocopy boolean
1524 ) is
1525 --
1526 -- Declare cursors and local variables
1527 --
1528 l_proc varchar2(72) := g_package||'delete_element_link';
1529 l_effective_date date;
1530
1531 begin
1532 hr_utility.set_location('Entering:'|| l_proc, 10);
1533 --
1534 -- Issue a savepoint
1535 --
1536 savepoint delete_element_link;
1537
1538 --
1539 -- Truncate the time portion from all IN date parameters
1540 --
1541 l_effective_date := trunc(p_effective_date);
1542 --
1543 -- Call Before Process User Hook
1544 --
1545 begin
1546 pay_element_link_BK3.delete_element_link_b
1547 (l_effective_date
1548 ,p_element_link_id
1549 ,p_datetrack_delete_mode
1550 ,p_object_version_number
1551 );
1552 exception
1553 when hr_api.cannot_find_prog_unit then
1554 hr_api.cannot_find_prog_unit_error
1555 (p_module_name => 'delete_element_link'
1556 ,p_hook_type => 'BP'
1557 );
1558 end;
1559
1560 --
1561 -- Validation in addition to Row Handlers
1562 --
1563 -- Bug 6004788. Replaced the call to pay_pel_del.del with call to
1564 -- delete_element_link_int.
1565 -- Process Logic
1566 --
1567 delete_element_link_int
1568 (p_effective_date => l_effective_date
1569 ,p_element_link_id => p_element_link_id
1570 ,p_datetrack_delete_mode => p_datetrack_delete_mode
1571 ,p_object_version_number => p_object_version_number
1572 ,p_effective_start_date => p_effective_start_date
1573 ,p_effective_end_date => p_effective_end_date
1574 ,p_entries_warning => p_entries_warning
1575 );
1576 --
1577 -- Call After Process User Hook
1578 --
1579 begin
1580 pay_element_link_BK3.delete_element_link_a
1581 (l_effective_date
1582 ,p_element_link_id
1583 ,p_datetrack_delete_mode
1584 ,p_object_version_number
1585 ,p_effective_start_date
1586 ,p_effective_end_date
1587 ,p_entries_warning
1588 );
1589 exception
1590 when hr_api.cannot_find_prog_unit then
1591 hr_api.cannot_find_prog_unit_error
1592 (p_module_name => 'delete_element_link'
1593 ,p_hook_type => 'AP'
1594 );
1595 end;
1596
1597 --
1598 -- When in validation only mode raise the Validate_Enabled exception
1599 --
1600 if p_validate then
1601 raise hr_api.validate_enabled;
1602 end if;
1603
1604 hr_utility.set_location(' Leaving:'||l_proc, 70);
1605 exception
1606 when hr_api.validate_enabled then
1607 --
1608 -- As the Validate_Enabled exception has been raised
1609 -- we must rollback to the savepoint
1610 --
1611 rollback to delete_element_link;
1612 --
1613 -- Only set output warning arguments
1614 -- (Any key or derived arguments must be set to null
1615 -- when validation only mode is being used.)
1616 --
1617
1618 hr_utility.set_location(' Leaving:'||l_proc, 80);
1619 when others then
1620 --
1621 -- A validation or unexpected error has occured
1622 --
1623 rollback to delete_element_link;
1624 hr_utility.set_location(' Leaving:'||l_proc, 90);
1625 raise;
1626 end delete_element_link;
1627 --
1628
1629 end PAY_ELEMENT_LINK_API;