DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PMS_SHD

Source


1 Package Body per_pms_shd as
2 /* $Header: pepmsrhi.pkb 120.2.12010000.2 2008/09/02 10:51:07 arumukhe ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pms_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_PERSONAL_SCORECAREDS_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_scorecard_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        scorecard_id
50       ,object_version_number
51       ,scorecard_name
52       ,person_id
53       ,assignment_id
54       ,start_date
55       ,end_date
56       ,plan_id
57       ,status_code
58       ,creator_type
59       ,error_log
60       ,attribute_category
61       ,attribute1
62       ,attribute2
63       ,attribute3
64       ,attribute4
65       ,attribute5
66       ,attribute6
67       ,attribute7
68       ,attribute8
69       ,attribute9
70       ,attribute10
71       ,attribute11
72       ,attribute12
73       ,attribute13
74       ,attribute14
75       ,attribute15
76       ,attribute16
77       ,attribute17
78       ,attribute18
79       ,attribute19
80       ,attribute20
81       ,attribute21
82       ,attribute22
83       ,attribute23
84       ,attribute24
85       ,attribute25
86       ,attribute26
87       ,attribute27
88       ,attribute28
89       ,attribute29
90       ,attribute30
91     from        per_personal_scorecards
92     where       scorecard_id = p_scorecard_id;
93   --
94   l_fct_ret     boolean;
95   --
96 Begin
97   --
98   If (p_scorecard_id is null and
99       p_object_version_number is null
100      ) Then
101     --
102     -- One of the primary key arguments is null therefore we must
103     -- set the returning function value to false
104     --
105     l_fct_ret := false;
106   Else
107     If (p_scorecard_id
108         = per_pms_shd.g_old_rec.scorecard_id and
109         p_object_version_number
110         = per_pms_shd.g_old_rec.object_version_number
111        ) Then
112       --
113       -- The g_old_rec is current therefore we must
114       -- set the returning function to true
115       --
116       l_fct_ret := true;
117     Else
118       --
119       -- Select the current row into g_old_rec
120       --
121       Open C_Sel1;
122       Fetch C_Sel1 Into per_pms_shd.g_old_rec;
123       If C_Sel1%notfound Then
124         Close C_Sel1;
125         --
126         -- The primary key is invalid therefore we must error
127         --
128         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
129         fnd_message.raise_error;
130       End If;
131       Close C_Sel1;
132       If (p_object_version_number
133           <> per_pms_shd.g_old_rec.object_version_number) Then
134         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
135         fnd_message.raise_error;
136       End If;
137       l_fct_ret := true;
138     End If;
139   End If;
140   Return (l_fct_ret);
141 --
142 End api_updating;
143 --
144 -- ----------------------------------------------------------------------------
145 -- |---------------------------------< lck >----------------------------------|
146 -- ----------------------------------------------------------------------------
147 Procedure lck
148   (p_scorecard_id                         in     number
149   ,p_object_version_number                in     number
150   ) is
151 --
152 -- Cursor selects the 'current' row from the HR Schema
153 --
154   Cursor C_Sel1 is
155     select
156        scorecard_id
157       ,object_version_number
158       ,scorecard_name
159       ,person_id
160       ,assignment_id
161       ,start_date
162       ,end_date
163       ,plan_id
164       ,status_code
165       ,creator_type
166       ,error_log
167       ,attribute_category
168       ,attribute1
169       ,attribute2
170       ,attribute3
171       ,attribute4
172       ,attribute5
173       ,attribute6
174       ,attribute7
175       ,attribute8
176       ,attribute9
177       ,attribute10
178       ,attribute11
179       ,attribute12
180       ,attribute13
181       ,attribute14
182       ,attribute15
183       ,attribute16
184       ,attribute17
185       ,attribute18
186       ,attribute19
187       ,attribute20
188       ,attribute21
189       ,attribute22
190       ,attribute23
191       ,attribute24
192       ,attribute25
193       ,attribute26
194       ,attribute27
195       ,attribute28
196       ,attribute29
197       ,attribute30
198     from        per_personal_scorecards
199     where       scorecard_id = p_scorecard_id
200     for update nowait;
201 --
202   l_proc        varchar2(72) := g_package||'lck';
203 --
204 Begin
205   hr_utility.set_location('Entering:'||l_proc, 5);
206   --
207   hr_api.mandatory_arg_error
208     (p_api_name           => l_proc
209     ,p_argument           => 'SCORECARD_ID'
210     ,p_argument_value     => p_scorecard_id
211     );
212   hr_utility.set_location(l_proc,6);
213   hr_api.mandatory_arg_error
214     (p_api_name           => l_proc
215     ,p_argument           => 'OBJECT_VERSION_NUMBER'
216     ,p_argument_value     => p_object_version_number
217     );
218   --
219   Open  C_Sel1;
220   Fetch C_Sel1 Into per_pms_shd.g_old_rec;
221   If C_Sel1%notfound then
222     Close C_Sel1;
223     --
224     -- The primary key is invalid therefore we must error
225     --
226     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
227     fnd_message.raise_error;
228   End If;
229   Close C_Sel1;
230   If (p_object_version_number
231       <> per_pms_shd.g_old_rec.object_version_number) Then
232         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
233         fnd_message.raise_error;
234   End If;
235   --
236   hr_utility.set_location(' Leaving:'||l_proc, 10);
237   --
238   -- We need to trap the ORA LOCK exception
239   --
240 Exception
241   When HR_Api.Object_Locked then
242     --
243     -- The object is locked therefore we need to supply a meaningful
244     -- error message.
245     --
246     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
247     fnd_message.set_token('TABLE_NAME', 'per_personal_scorecards');
248     fnd_message.raise_error;
249 End lck;
250 --
251 -- ----------------------------------------------------------------------------
252 -- |-----------------------------< convert_args >-----------------------------|
253 -- ----------------------------------------------------------------------------
254 Function convert_args
255   (p_scorecard_id                   in number
256   ,p_object_version_number          in number
257   ,p_scorecard_name                 in varchar2
258   ,p_person_id                      in number
259   ,p_assignment_id                  in number
260   ,p_start_date                     in date
261   ,p_end_date                       in date
262   ,p_plan_id                        in number
263   ,p_status_code                    in varchar2
264   ,p_creator_type                   in varchar2
265   ,p_error_log                      in varchar2
266   ,p_attribute_category             in varchar2
267   ,p_attribute1                     in varchar2
268   ,p_attribute2                     in varchar2
269   ,p_attribute3                     in varchar2
270   ,p_attribute4                     in varchar2
271   ,p_attribute5                     in varchar2
272   ,p_attribute6                     in varchar2
273   ,p_attribute7                     in varchar2
274   ,p_attribute8                     in varchar2
275   ,p_attribute9                     in varchar2
276   ,p_attribute10                    in varchar2
277   ,p_attribute11                    in varchar2
278   ,p_attribute12                    in varchar2
279   ,p_attribute13                    in varchar2
280   ,p_attribute14                    in varchar2
281   ,p_attribute15                    in varchar2
282   ,p_attribute16                    in varchar2
283   ,p_attribute17                    in varchar2
284   ,p_attribute18                    in varchar2
285   ,p_attribute19                    in varchar2
286   ,p_attribute20                    in varchar2
287   ,p_attribute21                    in varchar2
288   ,p_attribute22                    in varchar2
289   ,p_attribute23                    in varchar2
290   ,p_attribute24                    in varchar2
291   ,p_attribute25                    in varchar2
292   ,p_attribute26                    in varchar2
293   ,p_attribute27                    in varchar2
294   ,p_attribute28                    in varchar2
295   ,p_attribute29                    in varchar2
296   ,p_attribute30                    in varchar2
297   )
298   Return g_rec_type is
299 --
300   l_rec   g_rec_type;
301 --
302 Begin
303   --
304   -- Convert arguments into local l_rec structure.
305   --
306   l_rec.scorecard_id                     := p_scorecard_id;
307   l_rec.object_version_number            := p_object_version_number;
308   l_rec.scorecard_name                   := p_scorecard_name;
309   l_rec.person_id                        := p_person_id;
310   l_rec.assignment_id                    := p_assignment_id;
311   l_rec.start_date                       := p_start_date;
312   l_rec.end_date                         := p_end_date;
313   l_rec.plan_id                          := p_plan_id;
314   l_rec.status_code                      := p_status_code;
315   l_rec.creator_type                     := p_creator_type;
316   l_rec.error_log                        := p_error_log;
317   l_rec.attribute_category               := p_attribute_category;
318   l_rec.attribute1                       := p_attribute1;
319   l_rec.attribute2                       := p_attribute2;
320   l_rec.attribute3                       := p_attribute3;
321   l_rec.attribute4                       := p_attribute4;
322   l_rec.attribute5                       := p_attribute5;
323   l_rec.attribute6                       := p_attribute6;
324   l_rec.attribute7                       := p_attribute7;
325   l_rec.attribute8                       := p_attribute8;
326   l_rec.attribute9                       := p_attribute9;
327   l_rec.attribute10                      := p_attribute10;
328   l_rec.attribute11                      := p_attribute11;
329   l_rec.attribute12                      := p_attribute12;
330   l_rec.attribute13                      := p_attribute13;
331   l_rec.attribute14                      := p_attribute14;
332   l_rec.attribute15                      := p_attribute15;
333   l_rec.attribute16                      := p_attribute16;
334   l_rec.attribute17                      := p_attribute17;
335   l_rec.attribute18                      := p_attribute18;
336   l_rec.attribute19                      := p_attribute19;
337   l_rec.attribute20                      := p_attribute20;
338   l_rec.attribute21                      := p_attribute21;
339   l_rec.attribute22                      := p_attribute22;
340   l_rec.attribute23                      := p_attribute23;
341   l_rec.attribute24                      := p_attribute24;
342   l_rec.attribute25                      := p_attribute25;
343   l_rec.attribute26                      := p_attribute26;
344   l_rec.attribute27                      := p_attribute27;
345   l_rec.attribute28                      := p_attribute28;
346   l_rec.attribute29                      := p_attribute29;
347   l_rec.attribute30                      := p_attribute30;
348   --
349   -- Return the plsql record structure.
350   --
351   Return(l_rec);
352 --
353 End convert_args;
354 --
355 end per_pms_shd;