[Home] [Help]
PACKAGE BODY: APPS.FF_ARCHIVE_API
Source
1 Package Body ff_archive_api as
2 /* $Header: ffarcapi.pkb 115.4 2002/12/23 15:12:07 arashid ship $ */
3 --
4 -- Package Variables
5 --
6 Type context_id_tab_type is table of number index by binary_integer;
7 --
8 g_context_ids context_id_tab_type;
9 g_context_stored_names context_tab_type;
10 g_context_names context_tab_type;
11 g_context_values context_tab_type;
12 g_package varchar2(33) := ' ff_archive_api.';
13 --
14 -- ----------------------------------------------------------------------------
15 -- |------------------------< convert_params (private)>-----------------------|
16 -- ----------------------------------------------------------------------------
17 --
18 procedure convert_params
19 ( p_context_name1 in varchar2 default null
20 ,p_context1 in varchar2 default null
21 ,p_context_name2 in varchar2 default null
22 ,p_context2 in varchar2 default null
23 ,p_context_name3 in varchar2 default null
24 ,p_context3 in varchar2 default null
25 ,p_context_name4 in varchar2 default null
26 ,p_context4 in varchar2 default null
27 ,p_context_name5 in varchar2 default null
28 ,p_context5 in varchar2 default null
29 ,p_context_name6 in varchar2 default null
30 ,p_context6 in varchar2 default null
31 ,p_context_name7 in varchar2 default null
32 ,p_context7 in varchar2 default null
33 ,p_context_name8 in varchar2 default null
34 ,p_context8 in varchar2 default null
35 ,p_context_name9 in varchar2 default null
36 ,p_context9 in varchar2 default null
37 ,p_context_name10 in varchar2 default null
38 ,p_context10 in varchar2 default null
39 ,p_context_name11 in varchar2 default null
40 ,p_context11 in varchar2 default null
41 ,p_context_name12 in varchar2 default null
42 ,p_context12 in varchar2 default null
43 ,p_context_name13 in varchar2 default null
44 ,p_context13 in varchar2 default null
45 ,p_context_name14 in varchar2 default null
46 ,p_context14 in varchar2 default null
47 ,p_context_name15 in varchar2 default null
48 ,p_context15 in varchar2 default null
49 ,p_context_name16 in varchar2 default null
50 ,p_context16 in varchar2 default null
51 ,p_context_name17 in varchar2 default null
52 ,p_context17 in varchar2 default null
53 ,p_context_name18 in varchar2 default null
54 ,p_context18 in varchar2 default null
55 ,p_context_name19 in varchar2 default null
56 ,p_context19 in varchar2 default null
57 ,p_context_name20 in varchar2 default null
58 ,p_context20 in varchar2 default null
59 ,p_context_name21 in varchar2 default null
60 ,p_context21 in varchar2 default null
61 ,p_context_name22 in varchar2 default null
62 ,p_context22 in varchar2 default null
63 ,p_context_name23 in varchar2 default null
64 ,p_context23 in varchar2 default null
65 ,p_context_name24 in varchar2 default null
66 ,p_context24 in varchar2 default null
67 ,p_context_name25 in varchar2 default null
68 ,p_context25 in varchar2 default null
69 ,p_context_name26 in varchar2 default null
70 ,p_context26 in varchar2 default null
71 ,p_context_name27 in varchar2 default null
72 ,p_context27 in varchar2 default null
73 ,p_context_name28 in varchar2 default null
74 ,p_context28 in varchar2 default null
75 ,p_context_name29 in varchar2 default null
76 ,p_context29 in varchar2 default null
77 ,p_context_name30 in varchar2 default null
78 ,p_context30 in varchar2 default null
79 ,p_context_name31 in varchar2 default null
80 ,p_context31 in varchar2 default null
81 ) IS
82 --
83 l_proc varchar2(70) := g_package||'convert_params';
84 --
85 BEGIN
86 --
87 hr_utility.set_location('Entering:'||l_proc, 5);
88 --
89 g_context_names(1) := p_context_name1;
90 g_context_values(1) := p_context1;
91 g_context_names(2) := p_context_name2;
92 g_context_values(2) := p_context2;
93 g_context_names(3) := p_context_name3;
94 g_context_values(3) := p_context3;
95 g_context_names(4) := p_context_name4;
96 g_context_values(4) := p_context4;
97 g_context_names(5) := p_context_name5;
98 g_context_values(5) := p_context5;
99 g_context_names(6) := p_context_name6;
100 g_context_values(6) := p_context6;
101 g_context_names(7) := p_context_name7;
102 g_context_values(7) := p_context7;
103 g_context_names(8) := p_context_name8;
104 g_context_values(8) := p_context8;
105 g_context_names(9) := p_context_name9;
106 g_context_values(9) := p_context9;
107 g_context_names(10) := p_context_name10;
108 g_context_values(10) := p_context10;
109 g_context_names(11) := p_context_name11;
110 g_context_values(11) := p_context11;
111 g_context_names(12) := p_context_name12;
112 g_context_values(12) := p_context12;
113 g_context_names(13) := p_context_name13;
114 g_context_values(13) := p_context13;
115 g_context_names(14) := p_context_name14;
116 g_context_values(14) := p_context14;
117 g_context_names(15) := p_context_name15;
118 g_context_values(15) := p_context15;
119 g_context_names(16) := p_context_name16;
120 g_context_values(16) := p_context16;
121 g_context_names(17) := p_context_name17;
122 g_context_values(17) := p_context17;
123 g_context_names(18) := p_context_name18;
124 g_context_values(18) := p_context18;
125 g_context_names(19) := p_context_name19;
126 g_context_values(19) := p_context19;
127 g_context_names(20) := p_context_name20;
128 g_context_values(20) := p_context20;
129 g_context_names(21) := p_context_name21;
130 g_context_values(21) := p_context21;
131 g_context_names(22) := p_context_name22;
132 g_context_values(22) := p_context22;
133 g_context_names(23) := p_context_name23;
134 g_context_values(23) := p_context23;
135 g_context_names(24) := p_context_name24;
136 g_context_values(24) := p_context24;
137 g_context_names(25) := p_context_name25;
138 g_context_values(25) := p_context25;
139 g_context_names(26) := p_context_name26;
140 g_context_values(26) := p_context26;
141 g_context_names(27) := p_context_name27;
142 g_context_values(27) := p_context27;
143 g_context_names(28) := p_context_name28;
144 g_context_values(28) := p_context28;
145 g_context_names(29) := p_context_name29;
146 g_context_values(29) := p_context29;
147 g_context_names(30) := p_context_name30;
148 g_context_values(30) := p_context30;
149 g_context_names(31) := p_context_name31;
150 g_context_values(31) := p_context31;
151 --
152 hr_utility.set_location('Leaving:'||l_proc, 10);
153 --
154 end convert_params;
155 -- ----------------------------------------------------------------------------
156 -- |------------------------< get_context_id (private)>-----------------------|
157 -- ----------------------------------------------------------------------------
158 --
159 FUNCTION get_context_id(p_context_name in varchar2,
160 p_legislation_code in varchar2) RETURN NUMBER IS
161 --
162 l_context_id number;
163 l_count number;
164 --
165 cursor get_context1 (c_context_name varchar2, c_legislation_code varchar2) is
166 select plc.context_id
167 from pay_legislation_contexts plc
168 where plc.legislation_name = c_context_name
169 and plc.legislation_code = c_legislation_code;
170 --
171 cursor get_context2 (c_context_name varchar2) is
172 select ffc.context_id
173 from ff_contexts ffc
174 where ffc.context_name = c_context_name;
175 --
176 BEGIN
177 --
178 l_count := 0;
179 BEGIN
180 LOOP
181 l_count := l_count + 1;
182 IF g_context_stored_names(l_count) = p_context_name THEN
183 l_context_id := g_context_ids(l_count);
184 hr_utility.trace('Using Cached Context ID for '||p_context_name);
185 exit;
186 END IF;
187 END LOOP;
188 EXCEPTION WHEN NO_DATA_FOUND THEN
189 --
190 open get_context2(p_context_name);
191 fetch get_context2 into l_context_id;
192 close get_context2;
193 --
194 if l_context_id is null then
195 open get_context1(p_context_name,p_legislation_code);
196 fetch get_context1 into l_context_id;
197 close get_context1;
198 end if;
199 --
200 g_context_stored_names(l_count) := p_context_name;
201 g_context_ids(l_count) := l_context_id;
202 END;
203 --
204 RETURN l_context_id;
205 --
206 end get_context_id;
207 -- ----------------------------------------------------------------------------
208 -- |--------------------------< create_archive_item >--------------------------|
209 -- ----------------------------------------------------------------------------
210 --
211 procedure create_archive_item
212 (p_validate in boolean default false
213 ,p_archive_item_id out nocopy number
214 ,p_user_entity_id in number
215 ,p_archive_value in varchar2
216 ,p_archive_type in varchar2 default 'AAP'
217 ,p_action_id in number
218 ,p_legislation_code in varchar2
219 ,p_object_version_number out nocopy number
220 ,p_context_name1 in varchar2 default null
221 ,p_context1 in varchar2 default null
222 ,p_context_name2 in varchar2 default null
223 ,p_context2 in varchar2 default null
224 ,p_context_name3 in varchar2 default null
225 ,p_context3 in varchar2 default null
226 ,p_context_name4 in varchar2 default null
227 ,p_context4 in varchar2 default null
228 ,p_context_name5 in varchar2 default null
229 ,p_context5 in varchar2 default null
230 ,p_context_name6 in varchar2 default null
231 ,p_context6 in varchar2 default null
232 ,p_context_name7 in varchar2 default null
233 ,p_context7 in varchar2 default null
234 ,p_context_name8 in varchar2 default null
235 ,p_context8 in varchar2 default null
236 ,p_context_name9 in varchar2 default null
237 ,p_context9 in varchar2 default null
238 ,p_context_name10 in varchar2 default null
239 ,p_context10 in varchar2 default null
240 ,p_context_name11 in varchar2 default null
241 ,p_context11 in varchar2 default null
242 ,p_context_name12 in varchar2 default null
243 ,p_context12 in varchar2 default null
244 ,p_context_name13 in varchar2 default null
245 ,p_context13 in varchar2 default null
246 ,p_context_name14 in varchar2 default null
247 ,p_context14 in varchar2 default null
248 ,p_context_name15 in varchar2 default null
249 ,p_context15 in varchar2 default null
250 ,p_context_name16 in varchar2 default null
251 ,p_context16 in varchar2 default null
252 ,p_context_name17 in varchar2 default null
253 ,p_context17 in varchar2 default null
254 ,p_context_name18 in varchar2 default null
255 ,p_context18 in varchar2 default null
256 ,p_context_name19 in varchar2 default null
257 ,p_context19 in varchar2 default null
258 ,p_context_name20 in varchar2 default null
259 ,p_context20 in varchar2 default null
260 ,p_context_name21 in varchar2 default null
261 ,p_context21 in varchar2 default null
262 ,p_context_name22 in varchar2 default null
263 ,p_context22 in varchar2 default null
264 ,p_context_name23 in varchar2 default null
265 ,p_context23 in varchar2 default null
266 ,p_context_name24 in varchar2 default null
267 ,p_context24 in varchar2 default null
268 ,p_context_name25 in varchar2 default null
269 ,p_context25 in varchar2 default null
270 ,p_context_name26 in varchar2 default null
271 ,p_context26 in varchar2 default null
272 ,p_context_name27 in varchar2 default null
273 ,p_context27 in varchar2 default null
274 ,p_context_name28 in varchar2 default null
275 ,p_context28 in varchar2 default null
276 ,p_context_name29 in varchar2 default null
277 ,p_context29 in varchar2 default null
278 ,p_context_name30 in varchar2 default null
279 ,p_context30 in varchar2 default null
280 ,p_context_name31 in varchar2 default null
281 ,p_context31 in varchar2 default null
282 ,p_some_warning out nocopy boolean
283 ) is
284 --
285 -- Declare cursors and local variables
286 --
287 l_table_archive_type varchar2(60);
288 l_dummy number;
289 l_context_id number;
290 l_archive_item_id number;
291 l_object_version_number number;
292 l_count number := 0;
293 --
294 cursor get_format_item (c_user_entity_id number) is
295 select 1 from dual where exists
296 (select prfi.archive_type
297 from pay_report_format_items_f prfi
298 where prfi.user_entity_id = c_user_entity_id);
299 --
300 l_proc varchar2(72) := g_package||'create_archive_item';
301 invalid_archive_type exception;
302 invalid_context exception;
303 begin
304 hr_utility.set_location('Entering:'|| l_proc, 10);
305 --
306 -- Issue a savepoint
307 --
308 savepoint create_archive_item;
309 hr_utility.set_location(l_proc, 20);
310 --
311 -- Validation in addition to Row Handlers
312 --
313 --1)Is the parameterised or defaulted archive type in the set
314 -- 'AAC','AAP','PA'. Error if not. If so, check whether there
315 -- exists a row in PAY_REPORT_FORMAT_ITEMS_F for this user entity.
316 -- This check is only necessary for AAC and PA types, an AAP type
317 -- can be valid with no row in the format items table.
318 --
319 IF p_archive_type not in ('AAC','PA','AAP') then
320 --
321 -- Incorrect archive type passed in. Error.
322 raise invalid_archive_type;
323 --
324 ELSE
325 --
326 if p_archive_type <> 'AAP' then
327 --
328 open get_format_item(p_user_entity_id);
332 end if;
329 fetch get_format_item into l_dummy;
330 if get_format_item%NOTFOUND then
331 raise invalid_archive_type;
333 close get_format_item;
334 end if;
335 --
336 END IF;
337 --
338 hr_utility.set_location(l_proc, 40);
339 --
340 --2)Is the parameter p_action_id either a valid assignment action
341 -- or a valid payroll_action. If not, error.
342 -- (This validation removed, with fix for 1162102).
343 --
344 -- Process Logic
345 --
346 --3)The single row has now been BP-validated so insert into
347 -- FF_ARCHIVE_ITEMS using the Row Handler.
348 --
349 ff_arc_ins.ins
350 (p_archive_item_id => l_archive_item_id, -- an out param.
351 p_user_entity_id => p_user_entity_id,
352 p_archive_type => p_archive_type,
353 p_context1 => p_action_id,
354 p_value => p_archive_value,
355 p_object_version_number => l_object_version_number); -- an out param.
356 --
357 hr_utility.set_location(l_proc, 60);
358 --
359 -- Child table validation. Convert the parameters into a table structure.
360 convert_params(
361 p_context_name1 ,p_context1
362 ,p_context_name2 ,p_context2
363 ,p_context_name3 ,p_context3
364 ,p_context_name4 ,p_context4
365 ,p_context_name5 ,p_context5
366 ,p_context_name6 ,p_context6
367 ,p_context_name7 ,p_context7
368 ,p_context_name8 ,p_context8
369 ,p_context_name9 ,p_context9
370 ,p_context_name10 ,p_context10
371 ,p_context_name11 ,p_context11
372 ,p_context_name12 ,p_context12
373 ,p_context_name13 ,p_context13
374 ,p_context_name14 ,p_context14
375 ,p_context_name15 ,p_context15
376 ,p_context_name16 ,p_context16
377 ,p_context_name17 ,p_context17
378 ,p_context_name18 ,p_context18
379 ,p_context_name19 ,p_context19
380 ,p_context_name20 ,p_context20
381 ,p_context_name21 ,p_context21
382 ,p_context_name22 ,p_context22
383 ,p_context_name23 ,p_context23
384 ,p_context_name24 ,p_context24
385 ,p_context_name25 ,p_context25
386 ,p_context_name26 ,p_context26
387 ,p_context_name27 ,p_context27
388 ,p_context_name28 ,p_context28
389 ,p_context_name29 ,p_context29
390 ,p_context_name30 ,p_context30
391 ,p_context_name31 ,p_context31);
392 --
393 --4)Now loop through the record structure, and
394 -- validate against either PAY_LEGISLATION_CONTEXTS or FF_CONTEXTS,
395 -- by calling private function get_context_id. If there is no
396 -- context ID for this, raise an error.
397 -- If validated, call the archive_item_context API to insert the
398 -- child rows.
399 --
400 BEGIN
401 --
402 -- Test that all necessary rows are in table.
403 LOOP
404 l_count := l_count + 1;
405 --
406 IF g_context_names(l_count) is not null then
407 --
408 -- Validate the Context by selecting its ID
409 --
410 l_context_id := get_context_id(g_context_names(l_count),p_legislation_code);
411 --
412 hr_utility.trace('Child Context ID:'||to_char(l_context_id));
413 --
414 IF l_context_id is null then
415 raise invalid_context;
416 END IF;
417 --
418 -- Now validated, insert using the Row Handler
419 --
420 ff_con_ins.ins
421 (p_archive_item_id => l_archive_item_id,
422 p_sequence_no => l_count,
423 p_context => g_context_values(l_count),
424 p_context_id => l_context_id);
425 --
426 END IF;
427 --
428 hr_utility.trace('Child Context Count:'||to_char(l_count));
429 hr_utility.trace('Child Context Name:'||g_context_names(l_count));
430 hr_utility.trace('Child Context Value:'||g_context_values(l_count));
431 --
432 EXIT WHEN g_context_names(l_count) IS NULL;
433 --
434 END LOOP;
435 --
436 EXCEPTION
437 WHEN NO_DATA_FOUND THEN
438 -- Finished looping through rows. Handle with null.
439 hr_utility.trace('No Data Found raised');
440 null;
441 END;
442 --
443 -- When in validation only mode raise the Validate_Enabled exception
444 --
445 if p_validate then
446 raise hr_api.validate_enabled;
447 end if;
448 --
449 -- Set all output arguments
450 --
451 p_archive_item_id := l_archive_item_id;
452 p_object_version_number := l_object_version_number;
453 p_some_warning := FALSE;
454 --
455 hr_utility.set_location(' Leaving:'||l_proc, 70);
456 --
457 exception
458 --
459 when invalid_context then
460 --
461 rollback to create_archive_item;
462 --
463 -- NOCOPY change.
464 --
465 p_archive_item_id := null;
466 p_object_version_number := null;
467 p_some_warning := null;
468 --
469 hr_utility.set_message(800, 'FF_34957_INVALID_CONTEXT_NAME');
470 hr_utility.raise_error;
471 --
472 when invalid_archive_type then
476 -- NOCOPY change.
473 --
474 rollback to create_archive_item;
475 --
477 --
478 p_archive_item_id := null;
479 p_object_version_number := null;
480 p_some_warning := null;
481 --
482 hr_utility.set_message(800, 'FF_34958_INVALID_ARCHIVE_TYPE');
483 hr_utility.raise_error;
484 --
485 when hr_api.validate_enabled then
486 --
487 -- As the Validate_Enabled exception has been raised
488 -- we must rollback to the savepoint
489 --
490 rollback to create_archive_item;
491 --
492 -- Only set output warning arguments
493 -- (Any key or derived arguments must be set to null
494 -- when validation only mode is being used.)
495 --
496 p_archive_item_id := null;
497 p_object_version_number := null;
498 p_some_warning := FALSE;
499 hr_utility.set_location(' Leaving:'||l_proc, 80);
500 when others then
501 --
502 -- NOCOPY change.
503 --
504 p_archive_item_id := null;
505 p_object_version_number := null;
506 p_some_warning := null;
507 --
508 -- A validation or unexpected error has occured
509 --
510 rollback to create_archive_item;
511 hr_utility.set_location(' Leaving:'||l_proc, 90);
512 raise;
513 end create_archive_item;
514 --
515 -- ----------------------------------------------------------------------------
516 -- |--------------------------< update_archive_item >--------------------------|
517 -- ----------------------------------------------------------------------------
518 --
519 procedure update_archive_item
520 (p_archive_item_id in number
521 ,p_effective_date in date
522 ,p_validate in boolean default false
523 ,p_archive_value in varchar2
524 ,p_object_version_number in out nocopy number
525 ,p_some_warning out nocopy boolean
526 ) is
527 --
528 -- Declare cursors and local variables
529 --
530 l_archive_type varchar2(10);
531 l_fi_archive_type varchar2(10);
532 l_updatable_flag varchar2(1);
533 l_report_type varchar2(30);
534 l_report_qualifier varchar2(30);
535 l_report_category varchar2(30);
536 l_mapping_updatable_flag varchar2(1);
537 l_context1 number;
538 l_user_entity_id number;
539 l_object_version_number number;
540 --
541 cursor get_archive_rec (c_archive_item_id number) is
542 select user_entity_id,
543 archive_type,
544 context1
545 from ff_archive_items
546 where archive_item_id = c_archive_item_id;
547 --
548 cursor get_report_details(c_payroll_action_id number) is
549 select ppa.report_type,
550 ppa.report_qualifier,
551 ppa.report_category
552 from pay_payroll_actions ppa
553 where ppa.payroll_action_id = c_payroll_action_id;
554 --
555 cursor get_format_item (c_report_type varchar2,
556 c_report_qualifier varchar2,
557 c_report_category varchar2,
558 c_user_entity_id number,
559 c_effective_date date) is
560 select prfi.updatable_flag,
561 prfi.archive_type
562 from pay_report_format_items_f prfi
563 where prfi.report_type = c_report_type
564 and prfi.report_qualifier = c_report_qualifier
565 and prfi.report_category = c_report_category
566 and prfi.user_entity_id = c_user_entity_id
567 and c_effective_date between
568 prfi.effective_start_date and prfi.effective_end_date;
569 --
570 cursor get_format_mapping (c_report_type varchar2, c_report_qualifier varchar2,
571 c_report_category varchar2, c_effective_date date) is
572 select prfm.updatable_flag
573 from pay_report_format_mappings_f prfm
574 where prfm.report_type = c_report_type
575 and prfm.report_qualifier = c_report_qualifier
576 and prfm.report_category = c_report_category
577 and c_effective_date between
578 prfm.effective_start_date and prfm.effective_end_date;
579 --
580 cursor get_action_details(c_context1 number) is
581 select paa.assignment_action_id,
582 paa.payroll_action_id
583 from pay_assignment_actions paa
584 where paa.assignment_action_id = c_context1;
585 --
586 cursor get_locked_asg_action(c_assignment_action_id number) is
587 select locked_action_id
588 from pay_action_interlocks
589 where locked_action_id = c_assignment_action_id;
590 --
591 l_proc varchar2(72) := g_package||'update_archive_item';
592 l_assignment_action_id number;
593 l_payroll_action_id number;
594 cannot_update_item exception;
595 invalid_action exception;
596 invalid_archive_type exception;
597 locked_action exception;
598 --
599 BEGIN
600 hr_utility.set_location('Entering:'|| l_proc, 10);
601 l_object_version_number := p_object_version_number;
602 --
603 -- Convert rowid into the necessary table values:
604 --
605 open get_archive_rec(p_archive_item_id);
606 fetch get_archive_rec into
607 l_user_entity_id,
608 l_archive_type,
609 l_context1;
613 close get_archive_rec;
610 if get_archive_rec%notfound then
611 raise no_data_found;
612 end if;
614
615 -- Issue a savepoint
616 --
617 savepoint update_archive_item;
618 hr_utility.set_location(l_proc, 20);
619 --
620 -- Validation in addition to Row Handlers
621 --
622 -- 1. Check that the type passed in is updatable, ie the type
623 -- must be 'AAP', ie at assignment action level. Then, ensure that
624 -- this assignment action is valid
625 --
626 IF l_archive_type <> 'AAP' THEN
627 --
628 raise invalid_archive_type;
629 ELSE
630 --
631 -- Check this assignment action
632 --
633 open get_action_details(l_context1);
634 fetch get_action_details into l_assignment_action_id,
635 l_payroll_action_id;
636 if get_action_details%notfound then
637 raise invalid_action;
638 end if;
639 close get_action_details;
640 --
641 END IF;
642 --
643 -- 2. Check the PAY_REPORT_FORMAT_ITEMS_F value of UPDATABLE_FLAG
644 -- and ARCHIVE_TYPE given this USER_ENTITY_ID and other
645 -- report information from the payroll action.
646 --
647 open get_report_details(l_payroll_action_id);
648 fetch get_report_details into l_report_type,
649 l_report_qualifier,
650 l_report_category;
651 close get_report_details;
652 --
653 hr_utility.set_location(l_proc, 30);
654 --
655 -- Must use the payroll actions report details,
656 -- and the user entity id from this archive item
657 --
658 open get_format_item(l_report_type,
659 l_report_qualifier,
660 l_report_category,
661 l_user_entity_id,
662 p_effective_date);
663 fetch get_format_item into l_updatable_flag, l_fi_archive_type;
664 close get_format_item;
665
666 IF l_updatable_flag = 'N' OR l_updatable_flag IS NULL OR l_fi_archive_type <> 'AAP' THEN
667 --
668 -- Cannot Update, raise error if 'N' for update, OR no
669 -- row exists in pay_report_format_items_f, as this defaults
670 -- to non-updatable where there is no row.
671 --
672 raise cannot_update_item;
673 --
674 END IF;
675 --
676 -- 3. Check the PAY_REPORT_FORMAT_MAPPINGS_F's value of UPDATABLE_FLAG,
677 -- given the information retrieved above. There will be a link value
678 -- in PAY_REPORT_FORMAT_ITEMS_F to reach this point.
679 --
680 open get_format_mapping(l_report_type,l_report_qualifier,
681 l_report_category, p_effective_date);
682 fetch get_format_mapping into l_mapping_updatable_flag;
683 if get_format_mapping%notfound then
684 raise cannot_update_item;
685 end if;
686 close get_format_mapping;
687 --
688 hr_utility.set_location(l_proc, 40);
689 --
690 IF l_mapping_updatable_flag = 'N' THEN
691 --
692 -- Cannot Update, raise error
693 --
694 raise cannot_update_item;
695 --
696 END IF;
697 --
698 -- 4. Check that the Assignment Action is not being locked by
699 -- another process. This is done at assignment action level.
700 --
701 open get_locked_asg_action(l_context1);
702 fetch get_locked_asg_action into l_assignment_action_id;
703 if get_locked_asg_action%found then
704 raise locked_action;
705 end if;
706 --
707 -- Process Logic.
708 --
709 hr_utility.set_location(l_proc, 50);
710 hr_utility.trace('Archive Item ID:'||to_char(p_archive_item_id));
711 hr_utility.trace('Report Type:'||l_report_type);
712 hr_utility.trace('Report Category:'||l_report_category);
713 hr_utility.trace('Report Qualifier:'||l_report_qualifier);
714 --
715 -- Now update the archive item as all Business Process validation is
716 -- complete.
717 --
718 ff_arc_upd.upd
719 (p_archive_item_id => p_archive_item_id,
720 p_value => p_archive_value,
721 p_object_version_number => l_object_version_number);
722 --
723 hr_utility.set_location(l_proc, 60);
724 --
725 -- When in validation only mode raise the Validate_Enabled exception
726 --
727 if p_validate then
728 raise hr_api.validate_enabled;
729 end if;
730 --
731 -- Set all output arguments
732 --
733 p_object_version_number := l_object_version_number;
734 p_some_warning := FALSE;
735 --
736 hr_utility.set_location(' Leaving:'||l_proc, 70);
737 exception
738 when cannot_update_item then
739 --
740 rollback to update_archive_item;
741 --
742 -- NOCOPY change.
743 --
744 p_some_warning := null;
745 --
746 hr_utility.set_message(800, 'FF_34961_ARCHIVE_SECURITY');
747 hr_utility.raise_error;
748 --
749 when invalid_archive_type then
750 --
751 -- NOCOPY change.
752 --
753 p_some_warning := null;
754 --
755 rollback to update_archive_item;
756 --
757 hr_utility.set_message(800, 'FF_34958_INVALID_ARCHIVE_TYPE');
758 hr_utility.raise_error;
759 --
760 when hr_api.validate_enabled then
761 --
762 -- As the Validate_Enabled exception has been raised
763 -- we must rollback to the savepoint
764 --
765 rollback to update_archive_item;
769 -- when validation only mode is being used.)
766 --
767 -- Only set output warning arguments
768 -- (Any key or derived arguments must be set to null
770 --
771 p_object_version_number := null;
772 p_some_warning := FALSE;
773 hr_utility.set_location(' Leaving:'||l_proc, 80);
774 when no_data_found then
775 --
776 rollback to update_archive_item;
777 --
778 -- NOCOPY change.
779 --
780 p_some_warning := null;
781 --
782 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
783 hr_utility.set_message_token('PROCEDURE', l_proc);
784 hr_utility.set_message_token('STEP','10');
785 hr_utility.raise_error;
786 when locked_action then
787 --
788 rollback to update_archive_item;
789 --
790 -- NOCOPY change.
791 --
792 p_some_warning := null;
793 --
794 hr_utility.set_message(800, 'FF_34962_ARCH_ACT_INTERLOCK');
795 hr_utility.raise_error;
796 when others then
797 --
798 -- A validation or unexpected error has occured
799 --
800 rollback to update_archive_item;
801 --
802 -- NOCOPY change.
803 --
804 p_some_warning := null;
805 --
806 hr_utility.set_location(' Leaving:'||l_proc, 90);
807 raise;
808 --
809 end update_archive_item;
810 --
811 end ff_archive_api;