DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PPB_SHD

Source


1 Package Body per_ppb_shd as
2 /* $Header: peppbrhi.pkb 120.0 2005/05/31 14:56:26 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ppb_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_PAYBAS_PAY_BASIS_CHK') 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   ElsIf (p_constraint_name = 'PER_PAYBAS_RATE_BASIS_CHK') Then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'PER_PAY_BASES_FK2') Then
43     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('STEP','15');
46     fnd_message.raise_error;
47   ElsIf (p_constraint_name = 'PER_PAY_BASES_FK3') Then
48     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('STEP','20');
51     fnd_message.raise_error;
52   ElsIf (p_constraint_name = 'PER_PAY_BASES_PK') Then
53     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
54     fnd_message.set_token('PROCEDURE', l_proc);
55     fnd_message.set_token('STEP','25');
56     fnd_message.raise_error;
57   ElsIf (p_constraint_name = 'PER_PAY_BASES_UK2') Then
58     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
59     fnd_message.set_token('PROCEDURE', l_proc);
60     fnd_message.set_token('STEP','30');
61     fnd_message.raise_error;
62   ElsIf (p_constraint_name = 'PER_PAY_BASES_UK3') Then
63     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
64     fnd_message.set_token('PROCEDURE', l_proc);
65     fnd_message.set_token('STEP','35');
66     fnd_message.raise_error;
67   Else
68     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
69     fnd_message.set_token('PROCEDURE', l_proc);
70     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
71     fnd_message.raise_error;
72   End If;
73   --
74 End constraint_error;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |-----------------------------< api_updating >-----------------------------|
78 -- ----------------------------------------------------------------------------
79 Function api_updating
80   (p_pay_basis_id                         in     number
81   ,p_object_version_number                in     number
82   )
83   Return Boolean Is
84   --
85   --
86   -- Cursor selects the 'current' row from the HR Schema
87   --
88   Cursor C_Sel1 is
89     select
90        pay_basis_id
91       ,input_value_id
92       ,rate_id
93       ,business_group_id
94       ,name
95       ,pay_basis
96       ,rate_basis
97       ,attribute_category
98       ,attribute1
99       ,attribute2
100       ,attribute3
101       ,attribute4
102       ,attribute5
103       ,attribute6
104       ,attribute7
105       ,attribute8
106       ,attribute9
107       ,attribute10
108       ,attribute11
109       ,attribute12
110       ,attribute13
111       ,attribute14
112       ,attribute15
113       ,attribute16
114       ,attribute17
115       ,attribute18
116       ,attribute19
117       ,attribute20
118       ,annualized_hours
119       ,pay_annualization_factor
120       ,grade_annualization_factor
121       ,information_category
122       ,information1
123       ,information2
124       ,information3
125       ,information4
126       ,information5
127       ,information6
128       ,information7
129       ,information8
130       ,information9
131       ,information10
132       ,information11
133       ,information12
134       ,information13
135       ,information14
136       ,information15
137       ,information16
138       ,information17
139       ,information18
140       ,information19
141       ,information20
142       ,object_version_number
143     from        per_pay_bases
144     where       pay_basis_id = p_pay_basis_id;
145   --
146   l_fct_ret     boolean;
147   --
148 Begin
149   --
150   If (p_pay_basis_id is null and
151       p_object_version_number is null
152      ) Then
153     --
154     -- One of the primary key arguments is null therefore we must
155     -- set the returning function value to false
156     --
157     l_fct_ret := false;
158   Else
159     If (p_pay_basis_id
160         = per_ppb_shd.g_old_rec.pay_basis_id and
161         p_object_version_number
162         = per_ppb_shd.g_old_rec.object_version_number
163        ) Then
164       --
165       -- The g_old_rec is current therefore we must
166       -- set the returning function to true
167       --
168       l_fct_ret := true;
169     Else
170       --
171       -- Select the current row into g_old_rec
172       --
173       Open C_Sel1;
174       Fetch C_Sel1 Into per_ppb_shd.g_old_rec;
175       If C_Sel1%notfound Then
176         Close C_Sel1;
177         --
178         -- The primary key is invalid therefore we must error
179         --
180         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
181         fnd_message.raise_error;
182       End If;
183       Close C_Sel1;
184       If (p_object_version_number
185           <> per_ppb_shd.g_old_rec.object_version_number) Then
186         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
187         fnd_message.raise_error;
188       End If;
189       l_fct_ret := true;
190     End If;
191   End If;
192   Return (l_fct_ret);
193 --
194 End api_updating;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |---------------------------------< lck >----------------------------------|
198 -- ----------------------------------------------------------------------------
199 Procedure lck
200   (p_pay_basis_id                         in     number
201   ,p_object_version_number                in     number
202   ) is
203 --
204 -- Cursor selects the 'current' row from the HR Schema
205 --
206   Cursor C_Sel1 is
207     select
208        pay_basis_id
209       ,input_value_id
210       ,rate_id
211       ,business_group_id
212       ,name
213       ,pay_basis
214       ,rate_basis
215       ,attribute_category
216       ,attribute1
217       ,attribute2
218       ,attribute3
219       ,attribute4
220       ,attribute5
221       ,attribute6
222       ,attribute7
223       ,attribute8
224       ,attribute9
225       ,attribute10
226       ,attribute11
227       ,attribute12
228       ,attribute13
229       ,attribute14
230       ,attribute15
231       ,attribute16
232       ,attribute17
233       ,attribute18
234       ,attribute19
235       ,attribute20
236       ,annualized_hours
237       ,pay_annualization_factor
238       ,grade_annualization_factor
239       ,information_category
240       ,information1
241       ,information2
242       ,information3
243       ,information4
244       ,information5
245       ,information6
246       ,information7
247       ,information8
248       ,information9
249       ,information10
250       ,information11
251       ,information12
252       ,information13
253       ,information14
254       ,information15
255       ,information16
256       ,information17
257       ,information18
258       ,information19
259       ,information20
260       ,object_version_number
261     from        per_pay_bases
262     where       pay_basis_id = p_pay_basis_id
263     for update nowait;
264 --
265   l_proc        varchar2(72) := g_package||'lck';
266 --
267 Begin
268   hr_utility.set_location('Entering:'||l_proc, 5);
269   --
270   hr_api.mandatory_arg_error
271     (p_api_name           => l_proc
272     ,p_argument           => 'PAY_BASIS_ID'
273     ,p_argument_value     => p_pay_basis_id
274     );
275   hr_utility.set_location(l_proc,6);
276   hr_api.mandatory_arg_error
277     (p_api_name           => l_proc
278     ,p_argument           => 'OBJECT_VERSION_NUMBER'
279     ,p_argument_value     => p_object_version_number
280     );
281   --
282   Open  C_Sel1;
283   Fetch C_Sel1 Into per_ppb_shd.g_old_rec;
284   If C_Sel1%notfound then
285     Close C_Sel1;
286     --
287     -- The primary key is invalid therefore we must error
288     --
289     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
290     fnd_message.raise_error;
291   End If;
292   Close C_Sel1;
293   If (p_object_version_number
294       <> per_ppb_shd.g_old_rec.object_version_number) Then
295         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
296         fnd_message.raise_error;
297   End If;
298   --
299   hr_utility.set_location(' Leaving:'||l_proc, 10);
300   --
301   -- We need to trap the ORA LOCK exception
302   --
303 Exception
304   When HR_Api.Object_Locked then
305     --
306     -- The object is locked therefore we need to supply a meaningful
307     -- error message.
308     --
309     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
310     fnd_message.set_token('TABLE_NAME', 'per_pay_bases');
311     fnd_message.raise_error;
312 End lck;
313 --
314 -- ----------------------------------------------------------------------------
315 -- |-----------------------------< convert_args >-----------------------------|
316 -- ----------------------------------------------------------------------------
317 Function convert_args
318   (p_pay_basis_id                   in number
319   ,p_input_value_id                 in number
320   ,p_rate_id                        in number
321   ,p_business_group_id              in number
322   ,p_name                           in varchar2
323   ,p_pay_basis                      in varchar2
324   ,p_rate_basis                     in varchar2
325   ,p_attribute_category             in varchar2
326   ,p_attribute1                     in varchar2
327   ,p_attribute2                     in varchar2
328   ,p_attribute3                     in varchar2
329   ,p_attribute4                     in varchar2
330   ,p_attribute5                     in varchar2
331   ,p_attribute6                     in varchar2
332   ,p_attribute7                     in varchar2
333   ,p_attribute8                     in varchar2
334   ,p_attribute9                     in varchar2
335   ,p_attribute10                    in varchar2
336   ,p_attribute11                    in varchar2
337   ,p_attribute12                    in varchar2
338   ,p_attribute13                    in varchar2
339   ,p_attribute14                    in varchar2
340   ,p_attribute15                    in varchar2
341   ,p_attribute16                    in varchar2
342   ,p_attribute17                    in varchar2
343   ,p_attribute18                    in varchar2
344   ,p_attribute19                    in varchar2
345   ,p_attribute20                    in varchar2
346   ,p_annualized_hours               in number
347   ,p_pay_annualization_factor       in number
348   ,p_grade_annualization_factor     in number
349   ,p_information_category           in varchar2
350   ,p_information1                   in varchar2
351   ,p_information2                   in varchar2
352   ,p_information3                   in varchar2
353   ,p_information4                   in varchar2
354   ,p_information5                   in varchar2
355   ,p_information6                   in varchar2
356   ,p_information7                   in varchar2
357   ,p_information8                   in varchar2
358   ,p_information9                   in varchar2
359   ,p_information10                  in varchar2
360   ,p_information11                  in varchar2
361   ,p_information12                  in varchar2
365   ,p_information16                  in varchar2
362   ,p_information13                  in varchar2
363   ,p_information14                  in varchar2
364   ,p_information15                  in varchar2
366   ,p_information17                  in varchar2
367   ,p_information18                  in varchar2
368   ,p_information19                  in varchar2
369   ,p_information20                  in varchar2
370   ,p_object_version_number          in number
371   )
372   Return g_rec_type is
373 --
374   l_rec   g_rec_type;
375 --
376 Begin
377   --
378   -- Convert arguments into local l_rec structure.
379   --
380   l_rec.pay_basis_id                     := p_pay_basis_id;
381   l_rec.input_value_id                   := p_input_value_id;
382   l_rec.rate_id                          := p_rate_id;
383   l_rec.business_group_id                := p_business_group_id;
384   l_rec.name                             := p_name;
385   l_rec.pay_basis                        := p_pay_basis;
386   l_rec.rate_basis                       := p_rate_basis;
387   l_rec.attribute_category               := p_attribute_category;
388   l_rec.attribute1                       := p_attribute1;
389   l_rec.attribute2                       := p_attribute2;
390   l_rec.attribute3                       := p_attribute3;
391   l_rec.attribute4                       := p_attribute4;
392   l_rec.attribute5                       := p_attribute5;
393   l_rec.attribute6                       := p_attribute6;
394   l_rec.attribute7                       := p_attribute7;
395   l_rec.attribute8                       := p_attribute8;
396   l_rec.attribute9                       := p_attribute9;
397   l_rec.attribute10                      := p_attribute10;
398   l_rec.attribute11                      := p_attribute11;
399   l_rec.attribute12                      := p_attribute12;
400   l_rec.attribute13                      := p_attribute13;
401   l_rec.attribute14                      := p_attribute14;
402   l_rec.attribute15                      := p_attribute15;
403   l_rec.attribute16                      := p_attribute16;
404   l_rec.attribute17                      := p_attribute17;
405   l_rec.attribute18                      := p_attribute18;
406   l_rec.attribute19                      := p_attribute19;
407   l_rec.attribute20                      := p_attribute20;
408   l_rec.annualized_hours                 := p_annualized_hours;
409   l_rec.pay_annualization_factor         := p_pay_annualization_factor;
410   l_rec.grade_annualization_factor       := p_grade_annualization_factor;
411   l_rec.information_category             := p_information_category;
412   l_rec.information1                     := p_information1;
413   l_rec.information2                     := p_information2;
414   l_rec.information3                     := p_information3;
415   l_rec.information4                     := p_information4;
416   l_rec.information5                     := p_information5;
417   l_rec.information6                     := p_information6;
418   l_rec.information7                     := p_information7;
419   l_rec.information8                     := p_information8;
420   l_rec.information9                     := p_information9;
421   l_rec.information10                    := p_information10;
422   l_rec.information11                    := p_information11;
423   l_rec.information12                    := p_information12;
424   l_rec.information13                    := p_information13;
425   l_rec.information14                    := p_information14;
426   l_rec.information15                    := p_information15;
427   l_rec.information16                    := p_information16;
428   l_rec.information17                    := p_information17;
429   l_rec.information18                    := p_information18;
430   l_rec.information19                    := p_information19;
431   l_rec.information20                    := p_information20;
432   l_rec.object_version_number            := p_object_version_number;
433   --
434   -- Return the plsql record structure.
435   --
436   Return(l_rec);
437 --
438 End convert_args;
439 --
440 end per_ppb_shd;