DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_OBJECTIVES_SWI

Source


1 Package Body hr_objectives_swi As
2 /* $Header: peobjswi.pkb 120.13.12000000.3 2007/02/19 04:16:17 svittal ship $ */
3 --
4 -- Package variables
5 --
6 g_package  varchar2(33) := 'hr_objectives_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-----------------------------< chk_cascading >----------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure chk_cascading
13   (
14    p_aligned_with_obj_id IN number
15   ,p_objective_id        IN number
16   ,p_scorecard_id        IN number
17   )
18 AS
19   PRAGMA AUTONOMOUS_TRANSACTION;
20   --
21   cursor chk_obj_shared is
22   SELECT scorecard_id
23         ,sharing_access_code
24         ,object_version_number
25   FROM per_objectives
26   WHERE objective_id = p_aligned_with_obj_id;
27 
28   l_mgr_scorecard_id        number;
29   l_access_code             per_objectives.sharing_access_code%TYPE;
30   l_mgr_obj_ovn             number;
31   l_weightin_over_warn      boolean :=FALSE;
32   l_weightin_appraisal_warn boolean :=FALSE;
33   l_align_access            per_objectives.sharing_access_code%TYPE := 'ALIGN';
34 --
35   cursor chk_shr_instance(p_mgr_scorecard_id in number)
36   is
37   SELECT 'Y'
38   FROM per_scorecard_sharing shr
39       ,per_personal_scorecards  psc
40   WHERE shr.scorecard_id = p_mgr_scorecard_id
41   AND   psc.scorecard_id = p_scorecard_id
42   AND   shr.person_id    = psc.person_id;
43   --
44   l_exists varchar2(1);
45 --
46   cursor csr_get_emp_personid is
47   select person_id from per_personal_scorecards
48   where scorecard_id = p_scorecard_id;
49   --
50   l_person_id           number;
51   l_cur_person_ovn      number;
52   l_sharing_instance_id number;
53   --
54 begin
55   --
56   open chk_obj_shared;
57   fetch chk_obj_shared into l_mgr_scorecard_id,l_access_code,l_mgr_obj_ovn;
58   close chk_obj_shared;
59   --
60   if nvl(l_access_code,'9Z') <> 'ALIGN' then
61     --
62     -- Update aligned with objective record to mark for aligning
63     --
64      hr_objectives_api.update_objective
65        (p_effective_date               => trunc(sysdate),
66         p_objective_id                 => p_aligned_with_obj_id,
67         p_sharing_access_code          => l_align_access,
68         p_object_version_number        => l_mgr_obj_ovn,
69         p_weighting_over_100_warning   => l_weightin_over_warn,
70         p_weighting_appraisal_warning  => l_weightin_appraisal_warn
71        );
72   --
73   end if;
74   --
75   -- Check whether the objective is shared to the current person
76   --
77   open chk_shr_instance(l_mgr_scorecard_id);
78   fetch chk_shr_instance into l_exists;
79   close chk_shr_instance;
80   if nvl(l_exists,'N') <>'Y' THEN
81     --
82     -- Objective is not shared. Get the current objective person_id
83     -- to be able to mark this person to sharing instance
84     --
85     open csr_get_emp_personid;
86     fetch csr_get_emp_personid into l_person_id;
87     close csr_get_emp_personid;
88     --
89     -- Create Scorecard Sharing for this person
90     --
91     hr_scorecard_sharing_api.create_sharing_instance
92         (
93          p_scorecard_id          => l_mgr_scorecard_id
94         ,p_person_id             => l_person_id
95         ,p_sharing_instance_id   => l_sharing_instance_id
96         ,p_object_version_number => l_cur_person_ovn
97         );
98     --
99   end if;
100   --
101   commit;
102 exception
103   when others then
104     raise;
105 end chk_cascading;
106 --
107 -- ----------------------------------------------------------------------------
108 -- |---------------------------< create_objective >---------------------------|
109 -- ----------------------------------------------------------------------------
110 PROCEDURE create_objective
111   (p_validate                     in     number    default hr_api.g_false_num
112   ,p_effective_date               in     date
113   ,p_business_group_id            in     number
114   ,p_name                         in     varchar2
115   ,p_start_date                   in     date
116   ,p_owning_person_id             in     number
117   ,p_target_date                  in     date      default null
118   ,p_achievement_date             in     date      default null
119   ,p_detail                       in     varchar2  default null
120   ,p_comments                     in     varchar2  default null
121   ,p_success_criteria             in     varchar2  default null
122   ,p_appraisal_id                 in     number    default null
123   ,p_attribute_category           in     varchar2  default null
124   ,p_attribute1                   in     varchar2  default null
125   ,p_attribute2                   in     varchar2  default null
126   ,p_attribute3                   in     varchar2  default null
127   ,p_attribute4                   in     varchar2  default null
128   ,p_attribute5                   in     varchar2  default null
129   ,p_attribute6                   in     varchar2  default null
130   ,p_attribute7                   in     varchar2  default null
131   ,p_attribute8                   in     varchar2  default null
132   ,p_attribute9                   in     varchar2  default null
133   ,p_attribute10                  in     varchar2  default null
134   ,p_attribute11                  in     varchar2  default null
135   ,p_attribute12                  in     varchar2  default null
136   ,p_attribute13                  in     varchar2  default null
137   ,p_attribute14                  in     varchar2  default null
138   ,p_attribute15                  in     varchar2  default null
139   ,p_attribute16                  in     varchar2  default null
140   ,p_attribute17                  in     varchar2  default null
141   ,p_attribute18                  in     varchar2  default null
142   ,p_attribute19                  in     varchar2  default null
143   ,p_attribute20                  in     varchar2  default null
144 
145   ,p_attribute21                  in     varchar2  default null
146   ,p_attribute22                  in     varchar2  default null
147   ,p_attribute23                  in     varchar2  default null
148   ,p_attribute24                  in     varchar2  default null
149   ,p_attribute25                  in     varchar2  default null
150   ,p_attribute26                  in     varchar2  default null
151   ,p_attribute27                  in     varchar2  default null
152   ,p_attribute28                  in     varchar2  default null
153   ,p_attribute29                  in     varchar2  default null
154   ,p_attribute30                  in     varchar2  default null
155   ,p_scorecard_id                 in     number    default null
156   ,p_copied_from_library_id       in     number    default null
157   ,p_copied_from_objective_id     in     number    default null
158   ,p_aligned_with_objective_id    in     number    default null
159   ,p_next_review_date             in     date      default null
160   ,p_group_code                   in     varchar2  default null
161   ,p_priority_code                in     varchar2  default null
162   ,p_appraise_flag                in     varchar2  default null
163   ,p_verified_flag                in     varchar2  default null
164   ,p_target_value                 in     number    default null
165   ,p_actual_value                 in     number    default null
166   ,p_weighting_percent            in     number    default null
167   ,p_complete_percent             in     number    default null
168   ,p_uom_code                     in     varchar2  default null
169   ,p_measurement_style_code       in     varchar2  default null
170   ,p_measure_name                 in     varchar2  default null
171   ,p_measure_type_code            in     varchar2  default null
172   ,p_measure_comments             in     varchar2  default null
173   ,p_sharing_access_code          in     varchar2  default null
174 
175   ,p_objective_id                 in	 number
176   ,p_object_version_number           out nocopy number
177   ,p_return_status                   out nocopy varchar2
178   ) is
179   --
180   -- Variables for API Boolean parameters
181   l_validate                      boolean;
182   l_objective_id number;
183   --
184   -- Variables for IN/OUT parameters
185   l_weighting_over_100_warning    boolean;
186   l_weighting_appraisal_warning   boolean;
187   --
188   -- Other variables
189   l_proc    varchar2(72) := g_package ||'create_objective';
190 Begin
191   hr_utility.set_location(' Entering:' || l_proc,10);
192   --
193   -- Issue a savepoint
194   --
195   savepoint create_objective_swi;
196   --
197   -- Initialise Multiple Message Detection
198   --
199   hr_multi_message.enable_message_list;
200   --
201   -- Remember IN OUT parameter IN values
202   --
203   --
204   -- Convert constant values to their corresponding boolean value
205   --
206   l_validate :=
207     hr_api.constant_to_boolean
208       (p_constant_value => p_validate);
209   --
210   -- Register Surrogate ID or user key values
211   --
212   per_obj_ins.set_base_key_value
213       (p_objective_id => p_objective_id
214     );
215 --
216 
217 --
218   IF ((nvl(p_copied_from_objective_id,-1) = nvl(p_aligned_with_objective_id,-2))
219       and not (nvl(p_scorecard_id,-1) = -1) and p_appraisal_id is null)
220   THEN
221 
222     chk_cascading (p_aligned_with_obj_id => p_aligned_with_objective_id
223                    ,p_objective_id       => p_objective_id
224                    ,p_scorecard_id       => p_scorecard_id
225                   );
226   END IF;
227 
228 --
229   --
230   -- Call API
231   --
232   hr_objectives_api.create_objective
233     (p_validate                     => l_validate
234     ,p_effective_date               => p_effective_date
235     ,p_business_group_id            => p_business_group_id
236     ,p_name                         => p_name
237     ,p_start_date                   => p_start_date
238     ,p_owning_person_id             => p_owning_person_id
239     ,p_target_date                  => p_target_date
240     ,p_achievement_date             => p_achievement_date
241     ,p_detail                       => p_detail
242     ,p_comments                     => p_comments
243     ,p_success_criteria             => p_success_criteria
244     ,p_appraisal_id                 => p_appraisal_id
245     ,p_attribute_category           => p_attribute_category
246     ,p_attribute1                   => p_attribute1
247     ,p_attribute2                   => p_attribute2
248     ,p_attribute3                   => p_attribute3
249     ,p_attribute4                   => p_attribute4
250     ,p_attribute5                   => p_attribute5
251     ,p_attribute6                   => p_attribute6
252     ,p_attribute7                   => p_attribute7
253     ,p_attribute8                   => p_attribute8
254     ,p_attribute9                   => p_attribute9
255     ,p_attribute10                  => p_attribute10
256     ,p_attribute11                  => p_attribute11
257     ,p_attribute12                  => p_attribute12
258     ,p_attribute13                  => p_attribute13
259     ,p_attribute14                  => p_attribute14
260     ,p_attribute15                  => p_attribute15
261     ,p_attribute16                  => p_attribute16
262     ,p_attribute17                  => p_attribute17
263     ,p_attribute18                  => p_attribute18
264     ,p_attribute19                  => p_attribute19
265     ,p_attribute20                  => p_attribute20
266 
267     ,p_attribute21                  => p_attribute21
268     ,p_attribute22                  => p_attribute22
269     ,p_attribute23                  => p_attribute23
270     ,p_attribute24                  => p_attribute24
271     ,p_attribute25                  => p_attribute25
272     ,p_attribute26                  => p_attribute26
273     ,p_attribute27                  => p_attribute27
274     ,p_attribute28                  => p_attribute28
275     ,p_attribute29                  => p_attribute29
276     ,p_attribute30                  => p_attribute30
277     ,p_scorecard_id                 => p_scorecard_id
278     ,p_copied_from_library_id       => p_copied_from_library_id
279     ,p_copied_from_objective_id     => p_copied_from_objective_id
280     ,p_aligned_with_objective_id    => p_aligned_with_objective_id
281     ,p_next_review_date             => p_next_review_date
282     ,p_group_code                   => p_group_code
283     ,p_priority_code                => p_priority_code
284     ,p_appraise_flag                => p_appraise_flag
285     ,p_verified_flag                => p_verified_flag
286     ,p_target_value                 => p_target_value
287     ,p_actual_value                 => p_actual_value
288     ,p_weighting_percent            => p_weighting_percent
289     ,p_complete_percent             => p_complete_percent
290     ,p_uom_code                     => p_uom_code
291     ,p_measurement_style_code       => p_measurement_style_code
292     ,p_measure_name                 => p_measure_name
293     ,p_measure_type_code            => p_measure_type_code
294     ,p_measure_comments             => p_measure_comments
295     ,p_sharing_access_code          => p_sharing_access_code
296 
297     ,p_weighting_over_100_warning   => l_weighting_over_100_warning
298     ,p_weighting_appraisal_warning  => l_weighting_appraisal_warning
299 
300     ,p_objective_id                 => l_objective_id
301     ,p_object_version_number        => p_object_version_number
302     );
303   --
304   -- Convert API warning boolean parameter values to specific
305   -- messages and add them to Multiple Message List
306   --
307   if l_weighting_over_100_warning then
308      fnd_message.set_name('PER', 'HR_50198_WPM_WEIGHT_WARN');
309       hr_multi_message.add
310         (p_message_type => hr_multi_message.g_warning_msg
311         );
312   end if;
313   if l_weighting_appraisal_warning then
314      fnd_message.set_name('PER', 'HR_50223_WPM_APPRAISE_WARN');
315       hr_multi_message.add
316         (p_message_type => hr_multi_message.g_warning_msg
317         );
318   end if;
319   --
320   -- Convert API non-warning boolean parameter values
321   --
322   --
323   -- Derive the API return status value based on whether
324   -- messages of any type exist in the Multiple Message List.
325   -- Also disable Multiple Message Detection.
326   --
327   p_return_status := hr_multi_message.get_return_status_disable;
328   hr_utility.set_location(' Leaving:' || l_proc,20);
329   --
330 exception
331   when hr_multi_message.error_message_exist then
332     --
333     -- Catch the Multiple Message List exception which
334     -- indicates API processing has been aborted because
335     -- at least one message exists in the list.
336     --
337     rollback to create_objective_swi;
338     --
339     -- Reset IN OUT parameters and set OUT parameters
340     --
341     p_object_version_number        := null;
342     p_return_status := hr_multi_message.get_return_status_disable;
343     hr_utility.set_location(' Leaving:' || l_proc, 30);
344   when others then
345     --
346     -- When Multiple Message Detection is enabled catch
347     -- any Application specific or other unexpected
348     -- exceptions.  Adding appropriate details to the
349     -- Multiple Message List.  Otherwise re-raise the
350     -- error.
351     --
352     rollback to create_objective_swi;
353     if hr_multi_message.unexpected_error_add(l_proc) then
354        hr_utility.set_location(' Leaving:' || l_proc,40);
355        raise;
356     end if;
357     --
358     -- Reset IN OUT and set OUT parameters
359     --
360     p_object_version_number        := null;
361     p_return_status := hr_multi_message.get_return_status_disable;
362     hr_utility.set_location(' Leaving:' || l_proc,50);
363 end create_objective;
364 -- ----------------------------------------------------------------------------
365 -- |---------------------------< delete_objective >---------------------------|
366 -- ----------------------------------------------------------------------------
367 PROCEDURE delete_objective
368   (p_validate                     in     number    default hr_api.g_false_num
369   ,p_objective_id                 in     number
370   ,p_object_version_number        in     number
371   ,p_return_status                   out nocopy varchar2
372   ) is
373   --
374   -- Variables for API Boolean parameters
375   l_validate                      boolean;
376   --
377   -- Variables for IN/OUT parameters
378   --
379   -- Other variables
380   l_proc    varchar2(72) := g_package ||'delete_objective';
381   l_object_version_number per_objectives.object_version_number%TYPE;
382 
383   cursor get_object_version_number(p_obj_id per_objectives.objective_id%TYPE) is
384   select object_version_number from per_objectives
385   where objective_id = p_obj_id;
386 
387 Begin
388   hr_utility.set_location(' Entering:' || l_proc,10);
389   --
390   -- Issue a savepoint
391   --
392   savepoint delete_objective_swi;
393   --
394   -- Initialise Multiple Message Detection
395   --
396   hr_multi_message.enable_message_list;
397   --
398   -- Remember IN OUT parameter IN values
399   --
400   --
401   -- Convert constant values to their corresponding boolean value
402   --
403   l_validate :=
404     hr_api.constant_to_boolean
405       (p_constant_value => p_validate);
406   --
407   -- Register Surrogate ID or user key values
408   --
409   --
410   -- Call API
411   --
412 
413   l_object_version_number := p_object_version_number;
414 
415   if(p_object_version_number is null or p_object_version_number < 0) then
416     open get_object_version_number(p_objective_id);
417     fetch get_object_version_number into l_object_version_number;
418     close get_object_version_number;
419   end if;
420 
421 
422   hr_objectives_api.delete_objective
423     (p_validate                     => l_validate
424     ,p_objective_id                 => p_objective_id
425     ,p_object_version_number        => l_object_version_number
426     );
427   --
428   -- Convert API warning boolean parameter values to specific
429   -- messages and add them to Multiple Message List
430   --
431   --
432   -- Convert API non-warning boolean parameter values
433   --
434   --
435   -- Derive the API return status value based on whether
436   -- messages of any type exist in the Multiple Message List.
437   -- Also disable Multiple Message Detection.
438   --
439   p_return_status := hr_multi_message.get_return_status_disable;
440   hr_utility.set_location(' Leaving:' || l_proc,20);
441   --
442 exception
443   when hr_multi_message.error_message_exist then
444     --
445     -- Catch the Multiple Message List exception which
446     -- indicates API processing has been aborted because
447     -- at least one message exists in the list.
448     --
449     rollback to delete_objective_swi;
450     --
451     -- Reset IN OUT parameters and set OUT parameters
452     --
453     p_return_status := hr_multi_message.get_return_status_disable;
454     hr_utility.set_location(' Leaving:' || l_proc, 30);
455   when others then
456     --
457     -- When Multiple Message Detection is enabled catch
458     -- any Application specific or other unexpected
459     -- exceptions.  Adding appropriate details to the
460     -- Multiple Message List.  Otherwise re-raise the
461     -- error.
462     --
463     rollback to delete_objective_swi;
464     if hr_multi_message.unexpected_error_add(l_proc) then
465        hr_utility.set_location(' Leaving:' || l_proc,40);
466        raise;
467     end if;
468     --
469     -- Reset IN OUT and set OUT parameters
470     --
471     p_return_status := hr_multi_message.get_return_status_disable;
472     hr_utility.set_location(' Leaving:' || l_proc,50);
473 end delete_objective;
474 -- ----------------------------------------------------------------------------
475 -- |---------------------------< update_objective >---------------------------|
476 -- ----------------------------------------------------------------------------
477 PROCEDURE update_objective
478   (p_validate                     in     number    default hr_api.g_false_num
479   ,p_effective_date               in     date
480   ,p_objective_id                 in     number
481   ,p_object_version_number        in out nocopy number
482   ,p_name                         in     varchar2  default hr_api.g_varchar2
483   ,p_target_date                  in     date      default hr_api.g_date
484   ,p_start_date                   in     date      default hr_api.g_date
485   ,p_achievement_date             in     date      default hr_api.g_date
486   ,p_detail                       in     varchar2  default hr_api.g_varchar2
487   ,p_comments                     in     varchar2  default hr_api.g_varchar2
488   ,p_success_criteria             in     varchar2  default hr_api.g_varchar2
489   ,p_attribute_category           in     varchar2  default hr_api.g_varchar2
490   ,p_attribute1                   in     varchar2  default hr_api.g_varchar2
491   ,p_attribute2                   in     varchar2  default hr_api.g_varchar2
492   ,p_attribute3                   in     varchar2  default hr_api.g_varchar2
493   ,p_attribute4                   in     varchar2  default hr_api.g_varchar2
494   ,p_attribute5                   in     varchar2  default hr_api.g_varchar2
495   ,p_attribute6                   in     varchar2  default hr_api.g_varchar2
496   ,p_attribute7                   in     varchar2  default hr_api.g_varchar2
497   ,p_attribute8                   in     varchar2  default hr_api.g_varchar2
498   ,p_attribute9                   in     varchar2  default hr_api.g_varchar2
499   ,p_attribute10                  in     varchar2  default hr_api.g_varchar2
500   ,p_attribute11                  in     varchar2  default hr_api.g_varchar2
501   ,p_attribute12                  in     varchar2  default hr_api.g_varchar2
502   ,p_attribute13                  in     varchar2  default hr_api.g_varchar2
503   ,p_attribute14                  in     varchar2  default hr_api.g_varchar2
504   ,p_attribute15                  in     varchar2  default hr_api.g_varchar2
505   ,p_attribute16                  in     varchar2  default hr_api.g_varchar2
506   ,p_attribute17                  in     varchar2  default hr_api.g_varchar2
507   ,p_attribute18                  in     varchar2  default hr_api.g_varchar2
508   ,p_attribute19                  in     varchar2  default hr_api.g_varchar2
509   ,p_attribute20                  in     varchar2  default hr_api.g_varchar2
510 
511   ,p_attribute21                  in     varchar2  default hr_api.g_varchar2
512   ,p_attribute22                  in     varchar2  default hr_api.g_varchar2
513   ,p_attribute23                  in     varchar2  default hr_api.g_varchar2
514   ,p_attribute24                  in     varchar2  default hr_api.g_varchar2
515   ,p_attribute25                  in     varchar2  default hr_api.g_varchar2
516   ,p_attribute26                  in     varchar2  default hr_api.g_varchar2
517   ,p_attribute27                  in     varchar2  default hr_api.g_varchar2
518   ,p_attribute28                  in     varchar2  default hr_api.g_varchar2
519   ,p_attribute29                  in     varchar2  default hr_api.g_varchar2
520   ,p_attribute30                  in     varchar2  default hr_api.g_varchar2
521   ,p_scorecard_id                 in     number    default hr_api.g_number
522   ,p_copied_from_library_id       in     number    default hr_api.g_number
523   ,p_copied_from_objective_id     in     number    default hr_api.g_number
524   ,p_aligned_with_objective_id    in     number    default hr_api.g_number
525   ,p_next_review_date             in     date      default hr_api.g_date
526   ,p_group_code                   in     varchar2  default hr_api.g_varchar2
527   ,p_priority_code                in     varchar2  default hr_api.g_varchar2
528   ,p_appraise_flag                in     varchar2  default hr_api.g_varchar2
529   ,p_verified_flag                in     varchar2  default hr_api.g_varchar2
530   ,p_target_value                 in     number    default hr_api.g_number
531   ,p_actual_value                 in     number    default hr_api.g_number
532   ,p_weighting_percent            in     number    default hr_api.g_number
533   ,p_complete_percent             in     number    default hr_api.g_number
534   ,p_uom_code                     in     varchar2  default hr_api.g_varchar2
535   ,p_measurement_style_code       in     varchar2  default hr_api.g_varchar2
536   ,p_measure_name                 in     varchar2  default hr_api.g_varchar2
537   ,p_measure_type_code            in     varchar2  default hr_api.g_varchar2
538   ,p_measure_comments             in     varchar2  default hr_api.g_varchar2
539   ,p_sharing_access_code          in     varchar2  default hr_api.g_varchar2
540   ,p_appraisal_id                 in     number    default hr_api.g_number
541   ,p_return_status                   out nocopy varchar2
542   ) is
543   --
544   -- Variables for API Boolean parameters
545   l_validate                      boolean;
546   --
547   -- Variables for IN/OUT parameters
548   l_object_version_number         number;
549   l_weighting_over_100_warning    boolean;
550   l_weighting_appraisal_warning   boolean;
551   l_copied_from_objective_id number;
552   l_aligned_with_objective_id number;
553   l_appraisal_id number;
554   l_scorecard_id number;
555   t_copied_from_objective_id number;
556   t_aligned_with_objective_id number;
557   t_appraisal_id number;
558   t_scorecard_id number;
559 
560   cursor get_obj_info is
561   select copied_from_objective_id, aligned_with_objective_id, scorecard_id, appraisal_id
562   from per_objectives
563   where objective_id = p_objective_id;
564 
565   --
566   -- Other variables
567   l_proc    varchar2(72) := g_package ||'update_objective';
568 Begin
569   hr_utility.set_location(' Entering:' || l_proc,10);
570   --
571   -- Issue a savepoint
572   --
573   savepoint update_objective_swi;
574   --
575   -- Initialise Multiple Message Detection
576   --
577   hr_multi_message.enable_message_list;
578   --
579   -- Remember IN OUT parameter IN values
580   --
581   l_object_version_number         := p_object_version_number;
582   --
583   -- Convert constant values to their corresponding boolean value
584   --
585   l_validate :=
586     hr_api.constant_to_boolean
587       (p_constant_value => p_validate);
588   --
589   -- Register Surrogate ID or user key values
590   --
591 --
592 
593   open get_obj_info;
594   fetch get_obj_info into t_copied_from_objective_id, t_aligned_with_objective_id, t_scorecard_id, t_appraisal_id;
595   close get_obj_info;
596 
597 
598   l_copied_from_objective_id := p_copied_from_objective_id;
599   l_aligned_with_objective_id := p_aligned_with_objective_id;
600   l_scorecard_id := p_scorecard_id;
601   l_appraisal_id := p_appraisal_id;
602 
603   if(p_copied_from_objective_id = hr_api.g_number) then
604     l_copied_from_objective_id := t_copied_from_objective_id;
605   end if;
606 
607   if(p_aligned_with_objective_id = hr_api.g_number) then
608     l_aligned_with_objective_id := t_aligned_with_objective_id;
609   end if;
610 
611   if(p_scorecard_id = hr_api.g_number) then
612     l_scorecard_id := t_scorecard_id;
613   end if;
614 
615   if(p_appraisal_id = hr_api.g_number) then
616     l_appraisal_id := t_appraisal_id;
617   end if;
618 
619 --
620   IF ((nvl(l_copied_from_objective_id,-1) = nvl(l_aligned_with_objective_id,-2))
621       and not (nvl(l_scorecard_id,-1) = -1) and l_appraisal_id is null)
622   THEN
623 
624     chk_cascading (p_aligned_with_obj_id => p_aligned_with_objective_id
625                    ,p_objective_id       => p_objective_id
626                    ,p_scorecard_id       => p_scorecard_id
627                   );
628   END IF;
629 
630 --
631   --
632   -- Call API
633   --
634   hr_objectives_api.update_objective
635     (p_validate                     => l_validate
636     ,p_effective_date               => p_effective_date
637     ,p_objective_id                 => p_objective_id
638     ,p_object_version_number        => p_object_version_number
639     ,p_name                         => p_name
640     ,p_target_date                  => p_target_date
641     ,p_start_date                   => p_start_date
642     ,p_achievement_date             => p_achievement_date
643     ,p_detail                       => p_detail
644     ,p_comments                     => p_comments
645     ,p_success_criteria             => p_success_criteria
646     ,p_attribute_category           => p_attribute_category
647     ,p_attribute1                   => p_attribute1
648     ,p_attribute2                   => p_attribute2
649     ,p_attribute3                   => p_attribute3
650     ,p_attribute4                   => p_attribute4
651     ,p_attribute5                   => p_attribute5
652     ,p_attribute6                   => p_attribute6
653     ,p_attribute7                   => p_attribute7
654     ,p_attribute8                   => p_attribute8
655     ,p_attribute9                   => p_attribute9
656     ,p_attribute10                  => p_attribute10
657     ,p_attribute11                  => p_attribute11
658     ,p_attribute12                  => p_attribute12
659     ,p_attribute13                  => p_attribute13
660     ,p_attribute14                  => p_attribute14
661     ,p_attribute15                  => p_attribute15
662     ,p_attribute16                  => p_attribute16
663     ,p_attribute17                  => p_attribute17
664     ,p_attribute18                  => p_attribute18
665     ,p_attribute19                  => p_attribute19
666     ,p_attribute20                  => p_attribute20
667 
668     ,p_attribute21                  => p_attribute21
669     ,p_attribute22                  => p_attribute22
670     ,p_attribute23                  => p_attribute23
671     ,p_attribute24                  => p_attribute24
672     ,p_attribute25                  => p_attribute25
673     ,p_attribute26                  => p_attribute26
674     ,p_attribute27                  => p_attribute27
675     ,p_attribute28                  => p_attribute28
676     ,p_attribute29                  => p_attribute29
677     ,p_attribute30                  => p_attribute30
678     ,p_scorecard_id                 => p_scorecard_id
679     ,p_copied_from_library_id       => p_copied_from_library_id
680     ,p_copied_from_objective_id     => p_copied_from_objective_id
681     ,p_aligned_with_objective_id    => p_aligned_with_objective_id
682     ,p_next_review_date             => p_next_review_date
683     ,p_group_code                   => p_group_code
684     ,p_priority_code                => p_priority_code
685     ,p_appraise_flag                => p_appraise_flag
686     ,p_verified_flag                => p_verified_flag
687     ,p_target_value                 => p_target_value
688     ,p_actual_value                 => p_actual_value
689     ,p_weighting_percent            => p_weighting_percent
690     ,p_complete_percent             => p_complete_percent
691     ,p_uom_code                     => p_uom_code
692     ,p_measurement_style_code       => p_measurement_style_code
693     ,p_measure_name                 => p_measure_name
694     ,p_measure_type_code            => p_measure_type_code
695     ,p_measure_comments             => p_measure_comments
696     ,p_sharing_access_code          => p_sharing_access_code
697 
698     ,p_weighting_over_100_warning   => l_weighting_over_100_warning
699     ,p_weighting_appraisal_warning  => l_weighting_appraisal_warning
700     ,p_appraisal_id                 => p_appraisal_id
701 
702     );
703   --
704   -- Convert API warning boolean parameter values to specific
705   -- messages and add them to Multiple Message List
706   --
707   if l_weighting_over_100_warning then
708      fnd_message.set_name('PER', 'HR_50198_WPM_WEIGHT_WARN');
709       hr_multi_message.add
710         (p_message_type => hr_multi_message.g_warning_msg
711         );
712   end if;
713   if l_weighting_appraisal_warning then
714      fnd_message.set_name('PER', 'HR_50223_WPM_APPRAISE_WARN');
715       hr_multi_message.add
716         (p_message_type => hr_multi_message.g_warning_msg
717         );
718   end if;
719   --
720   -- Convert API non-warning boolean parameter values
721   --
722   --
723   -- Derive the API return status value based on whether
724   -- messages of any type exist in the Multiple Message List.
725   -- Also disable Multiple Message Detection.
726   --
727   p_return_status := hr_multi_message.get_return_status_disable;
728   hr_utility.set_location(' Leaving:' || l_proc,20);
729   --
730 exception
731   when hr_multi_message.error_message_exist then
732     --
733     -- Catch the Multiple Message List exception which
734     -- indicates API processing has been aborted because
735     -- at least one message exists in the list.
736     --
737     rollback to update_objective_swi;
738     --
739     -- Reset IN OUT parameters and set OUT parameters
740     --
741     p_object_version_number        := l_object_version_number;
742     p_return_status := hr_multi_message.get_return_status_disable;
743     hr_utility.set_location(' Leaving:' || l_proc, 30);
744   when others then
745     --
746     -- When Multiple Message Detection is enabled catch
747     -- any Application specific or other unexpected
748     -- exceptions.  Adding appropriate details to the
749     -- Multiple Message List.  Otherwise re-raise the
750     -- error.
751     --
752     rollback to update_objective_swi;
753     if hr_multi_message.unexpected_error_add(l_proc) then
754        hr_utility.set_location(' Leaving:' || l_proc,40);
755        raise;
756     end if;
757     --
758     -- Reset IN OUT and set OUT parameters
759     --
760     p_object_version_number        := l_object_version_number;
761     p_return_status := hr_multi_message.get_return_status_disable;
762     hr_utility.set_location(' Leaving:' || l_proc,50);
763 end update_objective;
764 
765 -- ----------------------------------------------------------------------------
766 -- |---------------------------< process_api >--------------------------------|
767 -- ----------------------------------------------------------------------------
768 
769 Procedure process_api
770 ( p_document            in         CLOB
771  ,p_return_status       out nocopy VARCHAR2
772  ,p_validate            in         number    default hr_api.g_false_num
773  ,p_effective_date      in         date      default null
774 )
775 IS
776    l_postState VARCHAR2(2);
777    l_return_status VARCHAR2(1);
778    l_object_version_number number;
779    l_commitElement xmldom.DOMElement;
780    l_parser xmlparser.Parser;
781    l_CommitNode xmldom.DOMNode;
782    l_proc    varchar2(72) := g_package || 'process_api';
783 
784 BEGIN
785 
786    hr_utility.set_location(' Entering:' || l_proc,10);
787    hr_utility.set_location(' CLOB --> xmldom.DOMNode:' || l_proc,15);
788 
789    l_parser      := xmlparser.newParser;
790    xmlparser.ParseCLOB(l_parser,p_document);
791    l_CommitNode  := xmldom.makeNode(xmldom.getDocumentElement(xmlparser.getDocument(l_parser)));
792 
793    hr_utility.set_location('Extracting the PostState:' || l_proc,20);
794 
795    l_commitElement := xmldom.makeElement(l_CommitNode);
796    l_postState := xmldom.getAttribute(l_commitElement, 'PS');
797    l_object_version_number := hr_transaction_swi.getNumberValue(l_CommitNode,'ObjectVersionNumber');
798 
799    if l_postState = '0' then
800 
801         create_objective
802       ( p_validate                     => p_validate
803        ,p_effective_date               => p_effective_date
804        ,p_business_group_id            => hr_transaction_swi.getNumberValue(l_CommitNode,'BusinessGroupId',null)
805        ,p_name                         => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Name',null)
806        ,p_start_date                   => hr_transaction_swi.getDateValue(l_CommitNode,'StartDate',null)
807        ,p_owning_person_id             => hr_transaction_swi.getNumberValue(l_CommitNode,'OwningPersonId',null)
808        ,p_target_date                  => hr_transaction_swi.getDateValue(l_CommitNode,'TargetDate',null)
809        ,p_achievement_date             => hr_transaction_swi.getDateValue(l_CommitNode,'AchievementDate',null)
810        ,p_detail                       => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Detail',null)
811        ,p_comments                     => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Comments',null)
812        ,p_success_criteria             => hr_transaction_swi.getVarchar2Value(l_CommitNode,'SuccessCriteria',null)
813        ,p_appraisal_id                 => hr_transaction_swi.getNumberValue(l_CommitNode,'AppraisalId',null)
814        ,p_attribute_category           => hr_transaction_swi.getVarchar2Value(l_CommitNode,'AttributeCategory',null)
815        ,p_attribute1                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute1',null)
816        ,p_attribute2                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute2',null)
817        ,p_attribute3                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute3',null)
818        ,p_attribute4                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute4',null)
819        ,p_attribute5                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute5',null)
820        ,p_attribute6                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute6',null)
821        ,p_attribute7                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute7',null)
822        ,p_attribute8                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute8',null)
823        ,p_attribute9                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute9',null)
824        ,p_attribute10                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute10',null)
825        ,p_attribute11                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute11',null)
826        ,p_attribute12                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute12',null)
827        ,p_attribute13                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute13',null)
828        ,p_attribute14                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute14',null)
829        ,p_attribute15                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute15',null)
830        ,p_attribute16                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute16',null)
831        ,p_attribute17                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute17',null)
832        ,p_attribute18                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute18',null)
833        ,p_attribute19                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute19',null)
834        ,p_attribute20                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute20',null)
835 
836        ,p_attribute21                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute21',null)
837        ,p_attribute22                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute22',null)
838        ,p_attribute23                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute23',null)
839        ,p_attribute24                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute24',null)
840        ,p_attribute25                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute25',null)
841        ,p_attribute26                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute26',null)
842        ,p_attribute27                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute27',null)
843        ,p_attribute28                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute28',null)
844        ,p_attribute29                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute29',null)
845        ,p_attribute30                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute30',null)
846 
847         ,p_scorecard_id                 => hr_transaction_swi.getNumberValue(l_CommitNode,'ScorecardId',null)
848         ,p_copied_from_library_id       => hr_transaction_swi.getNumberValue(l_CommitNode,'CopiedFromLibraryId',null)
849         ,p_copied_from_objective_id     => hr_transaction_swi.getNumberValue(l_CommitNode,'CopiedFromObjectiveId',null)
850         ,p_aligned_with_objective_id    => hr_transaction_swi.getNumberValue(l_CommitNode,'AlignedWithObjectiveId',null)
851         ,p_next_review_date             => hr_transaction_swi.getDateValue(l_CommitNode,'NextReviewDate',null)
852         ,p_group_code                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'GroupCode',null)
853         ,p_priority_code                => hr_transaction_swi.getVarchar2Value(l_CommitNode,'PriorityCode',null)
854         ,p_appraise_flag                => hr_transaction_swi.getVarchar2Value(l_CommitNode,'AppraiseFlag',null)
855         ,p_verified_flag                => hr_transaction_swi.getVarchar2Value(l_CommitNode,'VerifiedFlag',null)
856         ,p_target_value                 => hr_transaction_swi.getNumberValue(l_CommitNode,'TargetValue',null)
857         ,p_actual_value                 => hr_transaction_swi.getNumberValue(l_CommitNode,'ActualValue',null)
858         ,p_weighting_percent            => hr_transaction_swi.getNumberValue(l_CommitNode,'WeightingPercent',null)
859         ,p_complete_percent             => hr_transaction_swi.getNumberValue(l_CommitNode,'CompletePercent',null)
860         ,p_uom_code                     => hr_transaction_swi.getVarchar2Value(l_CommitNode,'UomCode',null)
861         ,p_measurement_style_code       => hr_transaction_swi.getVarchar2Value(l_CommitNode,'MeasurementStyleCode',null)
862         ,p_measure_name                 => hr_transaction_swi.getVarchar2Value(l_CommitNode,'MeasureName',null)
863         ,p_measure_type_code            => hr_transaction_swi.getVarchar2Value(l_CommitNode,'MeasureTypeCode',null)
864         ,p_measure_comments             => hr_transaction_swi.getVarchar2Value(l_CommitNode,'MeasureComments',null)
865         ,p_sharing_access_code          => hr_transaction_swi.getVarchar2Value(l_CommitNode,'SharingAccessCode',null)
866 
867        ,p_objective_id                 => hr_transaction_swi.getNumberValue(l_CommitNode,'ObjectiveId',null)
868        ,p_object_version_number        => l_object_version_number
869        ,p_return_status                => l_return_status
870       );
871 
872    elsif l_postState = '2' then
873 
874         update_objective
875       ( p_validate                     => p_validate
876        ,p_effective_date               => p_effective_date
877        ,p_objective_id                 => hr_transaction_swi.getNumberValue(l_CommitNode,'ObjectiveId')
878        ,p_object_version_number        => l_object_version_number
879        ,p_name                         => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Name')
880        ,p_target_date                  => hr_transaction_swi.getDateValue(l_CommitNode,'TargetDate')
881        ,p_start_date                   => hr_transaction_swi.getDateValue(l_CommitNode,'StartDate')
882        ,p_achievement_date             => hr_transaction_swi.getDateValue(l_CommitNode,'AchievementDate')
883        ,p_detail                       => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Detail')
884        ,p_comments                     => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Comments')
885        ,p_success_criteria             => hr_transaction_swi.getVarchar2Value(l_CommitNode,'SuccessCriteria')
886        ,p_attribute_category           => hr_transaction_swi.getVarchar2Value(l_CommitNode,'AttributeCategory')
887        ,p_attribute1                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute1')
888        ,p_attribute2                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute2')
889        ,p_attribute3                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute3')
890        ,p_attribute4                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute4')
891        ,p_attribute5                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute5')
892        ,p_attribute6                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute6')
893        ,p_attribute7                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute7')
894        ,p_attribute8                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute8')
895        ,p_attribute9                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute9')
896        ,p_attribute10                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute10')
897        ,p_attribute11                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute11')
898        ,p_attribute12                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute12')
899        ,p_attribute13                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute13')
900        ,p_attribute14                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute14')
901        ,p_attribute15                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute15')
902        ,p_attribute16                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute16')
903        ,p_attribute17                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute17')
904        ,p_attribute18                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute18')
905        ,p_attribute19                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute19')
906        ,p_attribute20                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute20')
907 
908        ,p_attribute21                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute21')
909        ,p_attribute22                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute22')
910        ,p_attribute23                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute23')
911        ,p_attribute24                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute24')
912        ,p_attribute25                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute25')
913        ,p_attribute26                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute26')
914        ,p_attribute27                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute27')
915        ,p_attribute28                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute28')
916        ,p_attribute29                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute29')
917        ,p_attribute30                  => hr_transaction_swi.getVarchar2Value(l_CommitNode,'Attribute30')
918 
919         ,p_scorecard_id                 => hr_transaction_swi.getNumberValue(l_CommitNode,'ScorecardId')
920         ,p_copied_from_library_id       => hr_transaction_swi.getNumberValue(l_CommitNode,'CopiedFromLibraryId')
921         ,p_copied_from_objective_id     => hr_transaction_swi.getNumberValue(l_CommitNode,'CopiedFromObjectiveId')
922         ,p_aligned_with_objective_id    => hr_transaction_swi.getNumberValue(l_CommitNode,'AlignedWithObjectiveId')
923         ,p_next_review_date             => hr_transaction_swi.getDateValue(l_CommitNode,'NextReviewDate')
924         ,p_group_code                   => hr_transaction_swi.getVarchar2Value(l_CommitNode,'GroupCode')
925         ,p_priority_code                => hr_transaction_swi.getVarchar2Value(l_CommitNode,'PriorityCode')
926         ,p_appraise_flag                => hr_transaction_swi.getVarchar2Value(l_CommitNode,'AppraiseFlag')
927         ,p_verified_flag                => hr_transaction_swi.getVarchar2Value(l_CommitNode,'VerifiedFlag')
928         ,p_target_value                 => hr_transaction_swi.getNumberValue(l_CommitNode,'TargetValue')
929         ,p_actual_value                 => hr_transaction_swi.getNumberValue(l_CommitNode,'ActualValue')
930         ,p_weighting_percent            => hr_transaction_swi.getNumberValue(l_CommitNode,'WeightingPercent')
931         ,p_complete_percent             => hr_transaction_swi.getNumberValue(l_CommitNode,'CompletePercent')
932         ,p_uom_code                     => hr_transaction_swi.getVarchar2Value(l_CommitNode,'UomCode')
933         ,p_measurement_style_code       => hr_transaction_swi.getVarchar2Value(l_CommitNode,'MeasurementStyleCode')
934         ,p_measure_name                 => hr_transaction_swi.getVarchar2Value(l_CommitNode,'MeasureName')
935         ,p_measure_type_code            => hr_transaction_swi.getVarchar2Value(l_CommitNode,'MeasureTypeCode')
936         ,p_measure_comments             => hr_transaction_swi.getVarchar2Value(l_CommitNode,'MeasureComments')
937         ,p_sharing_access_code          => hr_transaction_swi.getVarchar2Value(l_CommitNode,'SharingAccessCode')
938         ,p_appraisal_id                 => hr_transaction_swi.getNumberValue(l_CommitNode,'AppraisalId')
939        ,p_return_status                => l_return_status
940       );
941 
942    elsif l_postState = '3' then
943 
944       delete_objective
945       ( p_validate                     => p_validate
946        ,p_objective_id                 => hr_transaction_swi.getNumberValue(l_CommitNode,'ObjectiveId')
947        ,p_object_version_number        => l_object_version_number
948        ,p_return_status                => l_return_status
949       );
950 
951       p_return_status := l_return_status;
952 
953    end if;
954 
955    hr_utility.set_location('Exiting:' || l_proc,40);
956 
957 END process_api;
958 
959 end hr_objectives_swi;