DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PYP_SHD

Source


1 Package Body per_pyp_shd as
2 /* $Header: pepyprhi.pkb 120.17.12010000.3 2008/09/23 08:15:15 schowdhu ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_pyp_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'PER_PAY_PROPOSALS_FK3') Then
37     hr_utility.set_location(l_proc,15);
38     hr_utility.set_message(801,'HR_51317_PPC_INVAL_BUS_GRP_ID');
39     hr_utility.raise_error;
40   ElsIf (p_constraint_name = 'PER_PAY_PROPOSALS_FK4') Then
41     hr_utility.set_location(l_proc,15);
42     hr_utility.set_message(800,'HR_52399_PYP_INVALID_REVIEW_ID');
43     hr_utility.raise_error;
44   ElsIf (p_constraint_name = 'PER_PAY_PROPOSALS_PK') Then
45     hr_utility.set_location(l_proc,20);
46     hr_utility.set_message(801,'HR_51310_PPC_INVAL_PRO_ID');
47     hr_utility.raise_error;
48   ElsIf (p_constraint_name = 'PER_PYP_APPROVED_CHK') Then
49     hr_utility.set_location(l_proc,25);
50     hr_utility.set_message(801, 'HR_51278_PYP_INVL_APPR_VAL');
51     hr_utility.raise_error;
52   ElsIf (p_constraint_name = 'PER_PYP_MULTIPLE_COMPONENT_CHK') Then
53     hr_utility.set_location(l_proc,30);
54     hr_utility.set_message(801, 'HR_51261_PYP_INVAL_MULTI_COMP');
55     hr_utility.raise_error;
56   Else
57     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
58     hr_utility.set_message_token('PROCEDURE', l_proc);
59     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
60     hr_utility.raise_error;
61   End If;
62   --
63   hr_utility.set_location(' Leaving:'||l_proc, 10);
64 End constraint_error;
65 --
66 -- ----------------------------------------------------------------------------
67 -- |-----------------------------< api_updating >-----------------------------|
68 -- ----------------------------------------------------------------------------
69 Function api_updating
70   (
71   p_pay_proposal_id                    in number,
72   p_object_version_number              in number
73   )      Return Boolean Is
74 --
75   --
76   -- Cursor selects the 'current' row from the HR Schema
77   --
78   Cursor C_Sel1 is
79     select
80         pay_proposal_id,
81         assignment_id,
82         business_group_id,
83         change_date,
84         comments,
85         last_change_date,
86         next_sal_review_date,
87         proposal_reason,
88         proposed_salary_n,
89         forced_ranking,
90 	date_to,
91         performance_review_id,
92         attribute_category,
93         attribute1,
94         attribute2,
95         attribute3,
96         attribute4,
97         attribute5,
98         attribute6,
99         attribute7,
100         attribute8,
101         attribute9,
102         attribute10,
103         attribute11,
104         attribute12,
105         attribute13,
106         attribute14,
107         attribute15,
108         attribute16,
109         attribute17,
110         attribute18,
111         attribute19,
112         attribute20,
113         object_version_number,
114         multiple_components,
115         approved
116 
117     from        per_pay_proposals
118     where        pay_proposal_id = p_pay_proposal_id;
119 --
120   l_proc        varchar2(72)        := g_package||'api_updating';
121   l_fct_ret        boolean;
122 --
123 Begin
124   hr_utility.set_location('Entering:'||l_proc, 5);
125   --
126   If (
127 	p_pay_proposal_id is null and
128 	p_object_version_number is null
129      ) Then
130     --
131     -- One of the primary key arguments is null therefore we must
132     -- set the returning function value to false
133     --
134     l_fct_ret := false;
135   Else
136     If (
137 	p_pay_proposal_id = g_old_rec.pay_proposal_id and
138 	p_object_version_number = g_old_rec.object_version_number
139        ) Then
140       hr_utility.set_location(l_proc, 10);
141       --
142       -- The g_old_rec is current therefore we must
143       -- set the returning function to true
144       --
145       l_fct_ret := true;
146     Else
147       --
148       -- Select the current row into g_old_rec
149       --
150       Open C_Sel1;
151       Fetch C_Sel1 Into g_old_rec;
152       If C_Sel1%notfound Then
153         Close C_Sel1;
154         --
155         -- The primary key is invalid therefore we must error
156         --
157         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
158         hr_utility.raise_error;
159       End If;
160       Close C_Sel1;
161       If (p_object_version_number <> g_old_rec.object_version_number) Then
162         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
163         hr_utility.raise_error;
164       End If;
165       hr_utility.set_location(l_proc, 15);
166       l_fct_ret := true;
167     End If;
168   End If;
169   hr_utility.set_location(' Leaving:'||l_proc, 20);
170   Return (l_fct_ret);
171 --
172 End api_updating;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |---------------------------------< lck >----------------------------------|
176 -- ----------------------------------------------------------------------------
177 Procedure lck
178   (
179   p_pay_proposal_id                    in number,
180   p_object_version_number              in number
181   ) is
182 --
183 -- Cursor selects the 'current' row from the HR Schema
184 --
185   Cursor C_Sel1 is
186     select         pay_proposal_id,
187         assignment_id,
188         business_group_id,
189         change_date,
190         comments,
191         last_change_date,
192         next_sal_review_date,
193         proposal_reason,
194         proposed_salary_n,
195         forced_ranking,
196 	date_to,
197         performance_review_id,
198         attribute_category,
199         attribute1,
200         attribute2,
201         attribute3,
202         attribute4,
203         attribute5,
204         attribute6,
205         attribute7,
206         attribute8,
207         attribute9,
208         attribute10,
209         attribute11,
210         attribute12,
211         attribute13,
212         attribute14,
213         attribute15,
214         attribute16,
215         attribute17,
216         attribute18,
217         attribute19,
218         attribute20,
219         object_version_number,
220         multiple_components,
221         approved
222     from        per_pay_proposals
223     where        pay_proposal_id = p_pay_proposal_id
224     for        update nowait;
225 --
226   l_proc	varchar2(72) := g_package||'lck';
227 --
228 Begin
229   hr_utility.set_location('Entering:'||l_proc, 5);
230   --
231   hr_api.mandatory_arg_error
232      (p_api_name       => l_proc,
233       p_argument       => 'object_version_number',
234       p_argument_value => p_object_version_number);
235   --
236   hr_api.mandatory_arg_error
237      (p_api_name       => l_proc,
238       p_argument       => 'pay_proposal_id',
239       p_argument_value => p_pay_proposal_id);
240 
241   Open  C_Sel1;
242   Fetch C_Sel1 Into g_old_rec;
243   If C_Sel1%notfound then
244     Close C_Sel1;
245     --
246     -- The primary key is invalid therefore we must error
247     --
248     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
249     hr_utility.raise_error;
250   End If;
251   Close C_Sel1;
252   If (p_object_version_number <> g_old_rec.object_version_number) Then
253         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
254         hr_utility.raise_error;
255       End If;
256 --
257   hr_utility.set_location(' Leaving:'||l_proc, 10);
258 --
259 -- We need to trap the ORA LOCK exception
260 --
261 Exception
262   When HR_Api.Object_Locked then
263     --
264     -- The object is locked therefore we need to supply a meaningful
265     -- error message.
266     --
267     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
268     hr_utility.set_message_token('TABLE_NAME', 'per_pay_proposals');
269     hr_utility.raise_error;
270 End lck;
271 --
272 -- ----------------------------------------------------------------------------
273 -- |-----------------------------< convert_args >-----------------------------|
274 -- ----------------------------------------------------------------------------
275 Function convert_args
276         (
277         p_pay_proposal_id               in number,
278         p_assignment_id                 in number,
279         p_business_group_id             in number,
280         p_change_date                   in date,
281         p_comments                      in varchar2,
282         p_last_change_date              in date,
283         p_next_sal_review_date          in date,
284         p_proposal_reason               in varchar2,
285         p_proposed_salary_n             in number,
286         p_forced_ranking                in number,
287 	p_date_to			in date,
288         p_performance_review_id         in number,
289         p_attribute_category            in varchar2,
290         p_attribute1                    in varchar2,
291         p_attribute2                    in varchar2,
292         p_attribute3                    in varchar2,
293         p_attribute4                    in varchar2,
294         p_attribute5                    in varchar2,
295         p_attribute6                    in varchar2,
296         p_attribute7                    in varchar2,
297         p_attribute8                    in varchar2,
298         p_attribute9                    in varchar2,
299         p_attribute10                   in varchar2,
300         p_attribute11                   in varchar2,
301         p_attribute12                   in varchar2,
302         p_attribute13                   in varchar2,
303         p_attribute14                   in varchar2,
304         p_attribute15                   in varchar2,
305         p_attribute16                   in varchar2,
306         p_attribute17                   in varchar2,
307         p_attribute18                   in varchar2,
308         p_attribute19                   in varchar2,
309         p_attribute20                   in varchar2,
310         p_object_version_number         in number,
311         p_multiple_components           in varchar2,
312         p_approved                      in varchar2
313         )
314         Return g_rec_type is
315 --
316   l_rec	  g_rec_type;
317   l_proc  varchar2(72) := g_package||'convert_args';
318 --
319 Begin
320   --
321   hr_utility.set_location('Entering:'||l_proc, 5);
322   --
323   -- Convert arguments into local l_rec structure.
324   --
325   l_rec.pay_proposal_id                  := p_pay_proposal_id;
326   l_rec.assignment_id                    := p_assignment_id;
327   l_rec.business_group_id                := p_business_group_id;
328   l_rec.change_date                      := p_change_date;
329   l_rec.comments                         := p_comments;
330   l_rec.last_change_date                 := p_last_change_date;
331   l_rec.next_sal_review_date             := p_next_sal_review_date;
332   l_rec.proposal_reason                  := p_proposal_reason;
333   l_rec.proposed_salary_n                := p_proposed_salary_n;
334   l_rec.forced_ranking                   := p_forced_ranking;
335   l_rec.date_to				 := p_date_to;
336   l_rec.performance_review_id            := p_performance_review_id;
337   l_rec.attribute_category               := p_attribute_category;
338   l_rec.attribute1                       := p_attribute1;
339   l_rec.attribute2                       := p_attribute2;
340   l_rec.attribute3                       := p_attribute3;
341   l_rec.attribute4                       := p_attribute4;
342   l_rec.attribute5                       := p_attribute5;
343   l_rec.attribute6                       := p_attribute6;
344   l_rec.attribute7                       := p_attribute7;
345   l_rec.attribute8                       := p_attribute8;
346   l_rec.attribute9                       := p_attribute9;
347   l_rec.attribute10                      := p_attribute10;
348   l_rec.attribute11                      := p_attribute11;
349   l_rec.attribute12                      := p_attribute12;
350   l_rec.attribute13                      := p_attribute13;
351   l_rec.attribute14                      := p_attribute14;
352   l_rec.attribute15                      := p_attribute15;
353   l_rec.attribute16                      := p_attribute16;
354   l_rec.attribute17                      := p_attribute17;
355   l_rec.attribute18                      := p_attribute18;
356   l_rec.attribute19                      := p_attribute19;
357   l_rec.attribute20                      := p_attribute20;
358   l_rec.object_version_number            := p_object_version_number;
359   l_rec.multiple_components              := p_multiple_components;
360   l_rec.approved                         := p_approved;
361   --
362   -- Return the plsql record structure.
363   --
364   hr_utility.set_location(' Leaving:'||l_proc, 10);
365   Return(l_rec);
366 --
367 End convert_args;
368 --
369 end per_pyp_shd;