DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_GRD_SHD

Source


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