DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PMA_SHD

Source


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