DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SIP_SHD

Source


4 -- ----------------------------------------------------------------------------
1 Package Body per_sip_shd as
2 /* $Header: pesiprhi.pkb 120.6.12020000.2 2012/07/05 05:02:18 amnaraya ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_sip_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc        varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'PER_SP_SUCCESSOR_IN_PLAN_PK') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   Else
38     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41     fnd_message.raise_error;
42   End If;
43   --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50   (p_successor_in_plan_id                 in     number
51   ,p_object_version_number                in     number
52   )
53   Return Boolean Is
54   --
55   --
56   -- Cursor selects the 'current' row from the HR Schema
57   --
58   Cursor C_Sel1 is
59     select
60        successor_in_plan_id
61       ,plan_id
62       ,successor_id
63       ,business_group_id
64       ,status
65       ,potential
66       ,performance_rating
67       ,risk_of_loss
68       ,impact_of_loss
69       ,readiness_pct
70       ,rank
71       ,eligible_for_promotion
72       ,earliest_succession_date
73       ,latest_succession_date
74       ,comments
75       ,attribute_category
76       ,attribute1
77       ,attribute2
78       ,attribute3
82       ,attribute7
79       ,attribute4
80       ,attribute5
81       ,attribute6
83       ,attribute8
84       ,attribute9
85       ,attribute10
86       ,attribute11
87       ,attribute12
88       ,attribute13
89       ,attribute14
90       ,attribute15
91       ,attribute16
92       ,attribute17
93       ,attribute18
94       ,attribute19
95       ,attribute20
96       ,planned_date
97       ,assignment_id
98       ,supervisor_id
99       ,grade_id
100       ,grade_ladder_id
101       ,grade_step_id
102       ,grade_point_id
103       ,position_id
104       ,job_id
105       ,assignment_status_type_id
106       ,organization_id
107       ,people_group_id
108       ,pay_basis_id
109       ,employee_category
110       ,bargaining_unit_code
111       ,labour_union_member_flag
112       ,collective_agreement_id
113       ,assignment_category
114       ,location_id
115       ,contract_id
116       ,object_version_number
117     from        per_sp_successor_in_plan
118     where       successor_in_plan_id = p_successor_in_plan_id;
119   --
120   l_fct_ret     boolean;
121   --
122 Begin
123   --
124   If (p_successor_in_plan_id is null and
125       p_object_version_number is null
126      ) Then
127     --
128     -- One of the primary key arguments is null therefore we must
129     -- set the returning function value to false
130     --
131     l_fct_ret := false;
132   Else
133     If (p_successor_in_plan_id
134         = per_sip_shd.g_old_rec.successor_in_plan_id and
135         p_object_version_number
136         = per_sip_shd.g_old_rec.object_version_number
137        ) Then
138       --
139       -- The g_old_rec is current therefore we must
140       -- set the returning function to true
141       --
142       l_fct_ret := true;
143     Else
144       --
145       -- Select the current row into g_old_rec
146       --
147       Open C_Sel1;
148       Fetch C_Sel1 Into per_sip_shd.g_old_rec;
149       If C_Sel1%notfound Then
150         Close C_Sel1;
151         --
152         -- The primary key is invalid therefore we must error
153         --
154         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
155         fnd_message.raise_error;
156       End If;
157       Close C_Sel1;
158       If (p_object_version_number
159           <> per_sip_shd.g_old_rec.object_version_number) Then
160         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
161         fnd_message.raise_error;
162       End If;
163       l_fct_ret := true;
164     End If;
165   End If;
166   Return (l_fct_ret);
167 --
168 End api_updating;
169 --
170 -- ----------------------------------------------------------------------------
171 -- |---------------------------------< lck >----------------------------------|
172 -- ----------------------------------------------------------------------------
173 Procedure lck
174   (p_successor_in_plan_id                 in     number
175   ,p_object_version_number                in     number
176   ) is
177 --
178 -- Cursor selects the 'current' row from the HR Schema
179 --
180   Cursor C_Sel1 is
181     select
182        successor_in_plan_id
183       ,plan_id
184       ,successor_id
185       ,business_group_id
186       ,status
187       ,potential
188       ,performance_rating
189       ,risk_of_loss
190       ,impact_of_loss
191       ,readiness_pct
192       ,rank
193       ,eligible_for_promotion
194       ,earliest_succession_date
195       ,latest_succession_date
196       ,comments
197       ,attribute_category
198       ,attribute1
199       ,attribute2
200       ,attribute3
201       ,attribute4
202       ,attribute5
203       ,attribute6
204       ,attribute7
205       ,attribute8
206       ,attribute9
207       ,attribute10
208       ,attribute11
209       ,attribute12
210       ,attribute13
211       ,attribute14
212       ,attribute15
213       ,attribute16
214       ,attribute17
215       ,attribute18
216       ,attribute19
217       ,attribute20
218       ,planned_date
219       ,assignment_id
220       ,supervisor_id
221       ,grade_id
222       ,grade_ladder_id
223       ,grade_step_id
224       ,grade_point_id
225       ,position_id
226       ,job_id
227       ,assignment_status_type_id
228       ,organization_id
229       ,people_group_id
230       ,pay_basis_id
231       ,employee_category
232       ,bargaining_unit_code
233       ,labour_union_member_flag
234       ,collective_agreement_id
235       ,assignment_category
236       ,location_id
237       ,contract_id
238       ,object_version_number
239     from        per_sp_successor_in_plan
240     where       successor_in_plan_id = p_successor_in_plan_id
241     for update nowait;
242 --
243   l_proc        varchar2(72) := g_package||'lck';
244 --
245 Begin
246   hr_utility.set_location('Entering:'||l_proc, 5);
247   --
248   hr_api.mandatory_arg_error
249     (p_api_name           => l_proc
250     ,p_argument           => 'SUCCESSOR_IN_PLAN_ID'
251     ,p_argument_value     => p_successor_in_plan_id
252     );
253   hr_utility.set_location(l_proc,6);
254   hr_api.mandatory_arg_error
255     (p_api_name           => l_proc
256     ,p_argument           => 'OBJECT_VERSION_NUMBER'
257     ,p_argument_value     => p_object_version_number
258     );
259   --
260   Open  C_Sel1;
261   Fetch C_Sel1 Into per_sip_shd.g_old_rec;
262   If C_Sel1%notfound then
263     Close C_Sel1;
264     --
265     -- The primary key is invalid therefore we must error
266     --
267     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
268     fnd_message.raise_error;
269   End If;
270   Close C_Sel1;
271   If (p_object_version_number
272       <> per_sip_shd.g_old_rec.object_version_number) Then
273         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
274         fnd_message.raise_error;
275   End If;
276   --
277   hr_utility.set_location(' Leaving:'||l_proc, 10);
278   --
279   -- We need to trap the ORA LOCK exception
280   --
281 Exception
282   When HR_Api.Object_Locked then
283     --
284     -- The object is locked therefore we need to supply a meaningful
285     -- error message.
286     --
287     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
288     fnd_message.set_token('TABLE_NAME', 'per_sp_successor_in_plan');
289     fnd_message.raise_error;
290 End lck;
291 --
292 -- ----------------------------------------------------------------------------
293 -- |-----------------------------< convert_args >-----------------------------|
294 -- ----------------------------------------------------------------------------
295 Function convert_args
296   (p_successor_in_plan_id           in number
297   ,p_plan_id                        in number
298   ,p_successor_id                   in number
299   ,p_business_group_id              in number
300   ,p_status                         in varchar2
301   ,p_potential                      in varchar2
302   ,p_performance_rating             in varchar2
303   ,p_risk_of_loss                   in varchar2
304   ,p_impact_of_loss                 in varchar2
305   ,p_readiness_pct                  in number
306   ,p_rank                           in number
307   ,p_eligible_for_promotion         in varchar2
308   ,p_earliest_succession_date       in date
309   ,p_latest_succession_date         in date
310   ,p_comments                       in varchar2
311   ,p_attribute_category             in varchar2
312   ,p_attribute1                     in varchar2
313   ,p_attribute2                     in varchar2
314   ,p_attribute3                     in varchar2
315   ,p_attribute4                     in varchar2
316   ,p_attribute5                     in varchar2
317   ,p_attribute6                     in varchar2
318   ,p_attribute7                     in varchar2
319   ,p_attribute8                     in varchar2
320   ,p_attribute9                     in varchar2
321   ,p_attribute10                    in varchar2
322   ,p_attribute11                    in varchar2
323   ,p_attribute12                    in varchar2
324   ,p_attribute13                    in varchar2
325   ,p_attribute14                    in varchar2
326   ,p_attribute15                    in varchar2
327   ,p_attribute16                    in varchar2
328   ,p_attribute17                    in varchar2
329   ,p_attribute18                    in varchar2
330   ,p_attribute19                    in varchar2
331   ,p_attribute20                    in varchar2
332   ,p_planned_date                   in date
333   ,p_assignment_id                  in number
334   ,p_supervisor_id                  in number
335   ,p_grade_id                       in number
336   ,p_grade_ladder_id                in number
337   ,p_grade_step_id                  in number
338   ,p_grade_point_id                 in number
339   ,p_position_id                    in number
340   ,p_job_id                         in number
341   ,p_assignment_status_type_id      in number
342   ,p_organization_id                in number
343   ,p_people_group_id                in number
344   ,p_pay_basis_id                   in number
345   ,p_employee_category              in varchar2
346   ,p_bargaining_unit_code           in varchar2
347   ,p_labour_union_member_flag       in varchar2
348   ,p_collective_agreement_id        in number
349   ,p_assignment_category            in varchar2
350   ,p_location_id                    in number
351   ,p_contract_id                    in number
352   ,p_object_version_number          in number
353   )
354   Return g_rec_type is
355 --
356   l_rec   g_rec_type;
357 --
358 Begin
359   --
360   -- Convert arguments into local l_rec structure.
361   --
362   l_rec.successor_in_plan_id             := p_successor_in_plan_id;
363   l_rec.plan_id                          := p_plan_id;
364   l_rec.successor_id                     := p_successor_id;
365   l_rec.business_group_id                := p_business_group_id;
366   l_rec.status                           := p_status;
367   l_rec.potential                        := p_potential;
368   l_rec.performance_rating               := p_performance_rating;
369   l_rec.risk_of_loss                     := p_risk_of_loss;
370   l_rec.impact_of_loss                   := p_impact_of_loss;
371   l_rec.readiness_pct                    := p_readiness_pct;
372   l_rec.rank                             := p_rank;
373   l_rec.eligible_for_promotion           := p_eligible_for_promotion;
374   l_rec.earliest_succession_date         := p_earliest_succession_date;
375   l_rec.latest_succession_date           := p_latest_succession_date;
376   l_rec.comments                         := p_comments;
377   l_rec.attribute_category               := p_attribute_category;
378   l_rec.attribute1                       := p_attribute1;
379   l_rec.attribute2                       := p_attribute2;
380   l_rec.attribute3                       := p_attribute3;
381   l_rec.attribute4                       := p_attribute4;
382   l_rec.attribute5                       := p_attribute5;
383   l_rec.attribute6                       := p_attribute6;
384   l_rec.attribute7                       := p_attribute7;
385   l_rec.attribute8                       := p_attribute8;
386   l_rec.attribute9                       := p_attribute9;
387   l_rec.attribute10                      := p_attribute10;
388   l_rec.attribute11                      := p_attribute11;
389   l_rec.attribute12                      := p_attribute12;
390   l_rec.attribute13                      := p_attribute13;
391   l_rec.attribute14                      := p_attribute14;
392   l_rec.attribute15                      := p_attribute15;
393   l_rec.attribute16                      := p_attribute16;
394   l_rec.attribute17                      := p_attribute17;
395   l_rec.attribute18                      := p_attribute18;
396   l_rec.attribute19                      := p_attribute19;
397   l_rec.attribute20                      := p_attribute20;
398   l_rec.planned_date                     := p_planned_date;
399   l_rec.assignment_id                    := p_assignment_id;
400   l_rec.supervisor_id                    := p_supervisor_id;
401   l_rec.grade_id                         := p_grade_id;
402   l_rec.grade_ladder_id                  := p_grade_ladder_id;
403   l_rec.grade_step_id                    := p_grade_step_id;
404   l_rec.grade_point_id                   := p_grade_point_id;
405   l_rec.position_id                      := p_position_id;
406   l_rec.job_id                           := p_job_id;
407   l_rec.assignment_status_type_id        := p_assignment_status_type_id;
408   l_rec.organization_id                  := p_organization_id;
409   l_rec.people_group_id                  := p_people_group_id;
410   l_rec.pay_basis_id                     := p_pay_basis_id;
411   l_rec.employee_category                := p_employee_category;
412   l_rec.bargaining_unit_code             := p_bargaining_unit_code;
413   l_rec.labour_union_member_flag         := p_labour_union_member_flag;
414   l_rec.collective_agreement_id          := p_collective_agreement_id;
415   l_rec.assignment_category              := p_assignment_category;
416   l_rec.location_id                      := p_location_id;
417   l_rec.contract_id                      := p_contract_id;
418   l_rec.object_version_number            := p_object_version_number;
419   --
420   -- Return the plsql record structure.
421   --
422   Return(l_rec);
423 --
424 End convert_args;
425 --
426 end per_sip_shd;