DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PMP_SHD

Source


1 Package Body per_pmp_shd as
2 /* $Header: pepmprhi.pkb 120.12.12020000.1 2012/06/29 01:50:28 appldev ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pmp_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc        varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'PER_PERF_MGMT_PLANS_PK') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_plan_id                              in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        plan_id
50       ,object_version_number
51       ,plan_name
52       ,administrator_person_id
53       ,previous_plan_id
54       ,start_date
55       ,end_date
56       ,status_code
57       ,hierarchy_type_code
58       ,supervisor_id
59       ,supervisor_assignment_id
60       ,organization_structure_id
61       ,org_structure_version_id
62       ,top_organization_id
63       ,position_structure_id
64       ,pos_structure_version_id
65       ,top_position_id
66       ,hierarchy_levels
67       ,automatic_enrollment_flag
68       ,assignment_types_code
69       ,primary_asg_only_flag
70       ,include_obj_setting_flag
71       ,obj_setting_start_date
72       ,obj_setting_deadline
73       ,obj_set_outside_period_flag
74       ,method_code
75       ,notify_population_flag
76       ,automatic_allocation_flag
77       ,copy_past_objectives_flag
78       ,sharing_alignment_task_flag
79       ,include_appraisals_flag
80       ,change_sc_status_flag
81       ,attribute_category
82       ,attribute1
83       ,attribute2
84       ,attribute3
85       ,attribute4
86       ,attribute5
87       ,attribute6
88       ,attribute7
89       ,attribute8
90       ,attribute9
91       ,attribute10
92       ,attribute11
93       ,attribute12
94       ,attribute13
95       ,attribute14
96       ,attribute15
97       ,attribute16
98       ,attribute17
99       ,attribute18
100       ,attribute19
101       ,attribute20
102       ,attribute21
103       ,attribute22
104       ,attribute23
105       ,attribute24
106       ,attribute25
107       ,attribute26
108       ,attribute27
109       ,attribute28
110       ,attribute29
111       ,attribute30
112      ,update_library_objectives    -- 8740021 bug fix
113      ,automatic_approval_flag
114     from        per_perf_mgmt_plans
115     where       plan_id = p_plan_id;
116   --
117   l_fct_ret     boolean;
118   --
119 Begin
120   --
121   If (p_plan_id is null and
122       p_object_version_number is null
123      ) Then
124     --
125     -- One of the primary key arguments is null therefore we must
126     -- set the returning function value to false
127     --
128     l_fct_ret := false;
129   Else
130     If (p_plan_id
131         = per_pmp_shd.g_old_rec.plan_id and
132         p_object_version_number
133         = per_pmp_shd.g_old_rec.object_version_number
134        ) Then
135       --
136       -- The g_old_rec is current therefore we must
137       -- set the returning function to true
138       --
139       l_fct_ret := true;
140     Else
141       --
142       -- Select the current row into g_old_rec
143       --
144       Open C_Sel1;
145       Fetch C_Sel1 Into per_pmp_shd.g_old_rec;
146       If C_Sel1%notfound Then
147         Close C_Sel1;
148         --
149         -- The primary key is invalid therefore we must error
150         --
151         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
152         fnd_message.raise_error;
153       End If;
154       Close C_Sel1;
155       If (p_object_version_number
156           <> per_pmp_shd.g_old_rec.object_version_number) Then
157         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
158         fnd_message.raise_error;
159       End If;
160       l_fct_ret := true;
161     End If;
162   End If;
163   Return (l_fct_ret);
164 --
165 End api_updating;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |---------------------------------< lck >----------------------------------|
169 -- ----------------------------------------------------------------------------
170 Procedure lck
171   (p_plan_id                              in     number
172   ,p_object_version_number                in     number
173   ) is
174 --
175 -- Cursor selects the 'current' row from the HR Schema
176 --
177   Cursor C_Sel1 is
178     select
179        plan_id
180       ,object_version_number
181       ,plan_name
182       ,administrator_person_id
183       ,previous_plan_id
184       ,start_date
185       ,end_date
186       ,status_code
190       ,organization_structure_id
187       ,hierarchy_type_code
188       ,supervisor_id
189       ,supervisor_assignment_id
191       ,org_structure_version_id
192       ,top_organization_id
193       ,position_structure_id
194       ,pos_structure_version_id
195       ,top_position_id
196       ,hierarchy_levels
197       ,automatic_enrollment_flag
198       ,assignment_types_code
199       ,primary_asg_only_flag
200       ,include_obj_setting_flag
201       ,obj_setting_start_date
202       ,obj_setting_deadline
203       ,obj_set_outside_period_flag
204       ,method_code
205       ,notify_population_flag
206       ,automatic_allocation_flag
207       ,copy_past_objectives_flag
208       ,sharing_alignment_task_flag
209       ,include_appraisals_flag
210       ,change_sc_status_flag
211       ,attribute_category
212       ,attribute1
213       ,attribute2
214       ,attribute3
215       ,attribute4
216       ,attribute5
217       ,attribute6
218       ,attribute7
219       ,attribute8
220       ,attribute9
221       ,attribute10
222       ,attribute11
223       ,attribute12
224       ,attribute13
225       ,attribute14
226       ,attribute15
227       ,attribute16
228       ,attribute17
229       ,attribute18
230       ,attribute19
231       ,attribute20
232       ,attribute21
233       ,attribute22
234       ,attribute23
235       ,attribute24
236       ,attribute25
237       ,attribute26
238       ,attribute27
239       ,attribute28
240       ,attribute29
241       ,attribute30
242       ,update_library_objectives    -- 8740021 bug fix
243       ,automatic_approval_flag
244     from        per_perf_mgmt_plans
245     where       plan_id = p_plan_id
246     for update nowait;
247 --
248   l_proc        varchar2(72) := g_package||'lck';
249 --
250 Begin
251   hr_utility.set_location('Entering:'||l_proc, 5);
252   --
253   hr_api.mandatory_arg_error
254     (p_api_name           => l_proc
255     ,p_argument           => 'PLAN_ID'
256     ,p_argument_value     => p_plan_id
257     );
258   hr_utility.set_location(l_proc,6);
259   hr_api.mandatory_arg_error
260     (p_api_name           => l_proc
261     ,p_argument           => 'OBJECT_VERSION_NUMBER'
262     ,p_argument_value     => p_object_version_number
263     );
264   --
265   Open  C_Sel1;
266   Fetch C_Sel1 Into per_pmp_shd.g_old_rec;
267   If C_Sel1%notfound then
268     Close C_Sel1;
269     --
270     -- The primary key is invalid therefore we must error
271     --
272     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
273     fnd_message.raise_error;
274   End If;
275   Close C_Sel1;
276   If (p_object_version_number
277       <> per_pmp_shd.g_old_rec.object_version_number) Then
278         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
279         fnd_message.raise_error;
280   End If;
281   --
282   hr_utility.set_location(' Leaving:'||l_proc, 10);
283   --
284   -- We need to trap the ORA LOCK exception
285   --
286 Exception
287   When HR_Api.Object_Locked then
288     --
289     -- The object is locked therefore we need to supply a meaningful
290     -- error message.
291     --
292     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
293     fnd_message.set_token('TABLE_NAME', 'per_perf_mgmt_plans');
294     fnd_message.raise_error;
295 End lck;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |-----------------------------< convert_args >-----------------------------|
299 -- ----------------------------------------------------------------------------
300 Function convert_args
301   (p_plan_id                        in number
302   ,p_object_version_number          in number
303   ,p_plan_name                      in varchar2
304   ,p_administrator_person_id        in number
305   ,p_previous_plan_id               in number
306   ,p_start_date                     in date
307   ,p_end_date                       in date
308   ,p_status_code                    in varchar2
309   ,p_hierarchy_type_code            in varchar2
310   ,p_supervisor_id                  in number
311   ,p_supervisor_assignment_id       in number
312   ,p_organization_structure_id      in number
313   ,p_org_structure_version_id       in number
314   ,p_top_organization_id            in number
315   ,p_position_structure_id          in number
316   ,p_pos_structure_version_id       in number
317   ,p_top_position_id                in number
318   ,p_hierarchy_levels               in number
319   ,p_automatic_enrollment_flag      in varchar2
320   ,p_assignment_types_code          in varchar2
321   ,p_primary_asg_only_flag          in varchar2
322   ,p_include_obj_setting_flag       in varchar2
323   ,p_obj_setting_start_date         in date
324   ,p_obj_setting_deadline           in date
325   ,p_obj_set_outside_period_flag    in varchar2
326   ,p_method_code                    in varchar2
327   ,p_notify_population_flag         in varchar2
328   ,p_automatic_allocation_flag      in varchar2
329   ,p_copy_past_objectives_flag      in varchar2
330   ,p_sharing_alignment_task_flag    in varchar2
331   ,p_include_appraisals_flag        in varchar2
332   ,p_change_sc_status_flag   in varchar2
333   ,p_attribute_category             in varchar2
334   ,p_attribute1                     in varchar2
335   ,p_attribute2                     in varchar2
336   ,p_attribute3                     in varchar2
340   ,p_attribute7                     in varchar2
337   ,p_attribute4                     in varchar2
338   ,p_attribute5                     in varchar2
339   ,p_attribute6                     in varchar2
341   ,p_attribute8                     in varchar2
342   ,p_attribute9                     in varchar2
343   ,p_attribute10                    in varchar2
344   ,p_attribute11                    in varchar2
345   ,p_attribute12                    in varchar2
346   ,p_attribute13                    in varchar2
347   ,p_attribute14                    in varchar2
348   ,p_attribute15                    in varchar2
349   ,p_attribute16                    in varchar2
350   ,p_attribute17                    in varchar2
351   ,p_attribute18                    in varchar2
352   ,p_attribute19                    in varchar2
353   ,p_attribute20                    in varchar2
354   ,p_attribute21                    in varchar2
355   ,p_attribute22                    in varchar2
356   ,p_attribute23                    in varchar2
357   ,p_attribute24                    in varchar2
358   ,p_attribute25                    in varchar2
359   ,p_attribute26                    in varchar2
360   ,p_attribute27                    in varchar2
361   ,p_attribute28                    in varchar2
362   ,p_attribute29                    in varchar2
363   ,p_attribute30                    in varchar2
364   ,p_update_library_objectives in varchar2   -- 8740021 bug fix
365   ,p_automatic_approval_flag in varchar2
366   )
367   Return g_rec_type is
368 --
369   l_rec   g_rec_type;
370 --
371 Begin
372   --
373   -- Convert arguments into local l_rec structure.
374   --
375   l_rec.plan_id                          := p_plan_id;
376   l_rec.object_version_number            := p_object_version_number;
377   l_rec.plan_name                        := p_plan_name;
378   l_rec.administrator_person_id          := p_administrator_person_id;
379   l_rec.previous_plan_id                 := p_previous_plan_id;
380   l_rec.start_date                       := p_start_date;
381   l_rec.end_date                         := p_end_date;
382   l_rec.status_code                      := p_status_code;
383   l_rec.hierarchy_type_code              := p_hierarchy_type_code;
384   l_rec.supervisor_id                    := p_supervisor_id;
385   l_rec.supervisor_assignment_id         := p_supervisor_assignment_id;
386   l_rec.organization_structure_id        := p_organization_structure_id;
387   l_rec.org_structure_version_id         := p_org_structure_version_id;
388   l_rec.top_organization_id              := p_top_organization_id;
389   l_rec.position_structure_id            := p_position_structure_id;
390   l_rec.pos_structure_version_id         := p_pos_structure_version_id;
391   l_rec.top_position_id                  := p_top_position_id;
392   l_rec.hierarchy_levels                 := p_hierarchy_levels;
393   l_rec.automatic_enrollment_flag        := p_automatic_enrollment_flag;
394   l_rec.assignment_types_code            := p_assignment_types_code;
395   l_rec.primary_asg_only_flag            := p_primary_asg_only_flag;
396   l_rec.include_obj_setting_flag         := p_include_obj_setting_flag;
397   l_rec.obj_setting_start_date           := p_obj_setting_start_date;
398   l_rec.obj_setting_deadline             := p_obj_setting_deadline;
399   l_rec.obj_set_outside_period_flag      := p_obj_set_outside_period_flag;
400   l_rec.method_code                      := p_method_code;
401   l_rec.notify_population_flag           := p_notify_population_flag;
402   l_rec.automatic_allocation_flag        := p_automatic_allocation_flag;
403   l_rec.copy_past_objectives_flag        := p_copy_past_objectives_flag;
404   l_rec.sharing_alignment_task_flag      := p_sharing_alignment_task_flag;
405   l_rec.include_appraisals_flag          := p_include_appraisals_flag;
406   l_rec.change_sc_status_flag     := p_change_sc_status_flag;
407   l_rec.attribute_category               := p_attribute_category;
408   l_rec.attribute1                       := p_attribute1;
409   l_rec.attribute2                       := p_attribute2;
410   l_rec.attribute3                       := p_attribute3;
411   l_rec.attribute4                       := p_attribute4;
412   l_rec.attribute5                       := p_attribute5;
413   l_rec.attribute6                       := p_attribute6;
414   l_rec.attribute7                       := p_attribute7;
415   l_rec.attribute8                       := p_attribute8;
416   l_rec.attribute9                       := p_attribute9;
417   l_rec.attribute10                      := p_attribute10;
418   l_rec.attribute11                      := p_attribute11;
419   l_rec.attribute12                      := p_attribute12;
420   l_rec.attribute13                      := p_attribute13;
421   l_rec.attribute14                      := p_attribute14;
422   l_rec.attribute15                      := p_attribute15;
423   l_rec.attribute16                      := p_attribute16;
424   l_rec.attribute17                      := p_attribute17;
425   l_rec.attribute18                      := p_attribute18;
426   l_rec.attribute19                      := p_attribute19;
427   l_rec.attribute20                      := p_attribute20;
428   l_rec.attribute21                      := p_attribute21;
429   l_rec.attribute22                      := p_attribute22;
430   l_rec.attribute23                      := p_attribute23;
431   l_rec.attribute24                      := p_attribute24;
432   l_rec.attribute25                      := p_attribute25;
433   l_rec.attribute26                      := p_attribute26;
434   l_rec.attribute27                      := p_attribute27;
435   l_rec.attribute28                      := p_attribute28;
436   l_rec.attribute29                      := p_attribute29;
437   l_rec.attribute30                      := p_attribute30;
438   l_rec.update_library_objectives        := p_update_library_objectives;
439   l_rec.automatic_approval_flag        := p_automatic_approval_flag;
440   --
441   -- Return the plsql record structure.
442   --
443   Return(l_rec);
444 --
445 End convert_args;
446 --
447 end per_pmp_shd;