DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SPH_SHD

Source


4 -- ----------------------------------------------------------------------------
1 Package Body per_sph_shd as
2 /* $Header: pesphrhi.pkb 120.4 2011/05/06 09:30:35 vkodedal noship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_sph_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_SP_PLAN_PK') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
37   Else
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
38     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41     fnd_message.raise_error;
42   End If;
43   --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50   (p_plan_id                              in     number
51   ,p_object_version_number                in     number
52   )
53   Return Boolean Is
54   --
55   --
56   -- Cursor selects the 'current' row from the HR Schema
57   --
58   Cursor C_Sel1 is
59     select
60        plan_id
61       ,plan_type
62       ,plan_name
63       ,successee_id
64       ,business_group_id
65       ,description
66       ,status
67       ,plan_owner
68       ,start_date
69       ,end_date
70       ,filled_from_plan
71       ,filled_by
72       ,filled_on
73       ,next_review_date
74       ,criteria_set_id
75       ,attribute_category
76       ,attribute1
77       ,attribute2
78       ,attribute3
79       ,attribute4
80       ,attribute5
81       ,attribute6
82       ,attribute7
83       ,attribute8
84       ,attribute9
85       ,attribute10
86       ,attribute11
87       ,attribute12
88       ,attribute13
89       ,attribute14
90       ,attribute15
91       ,attribute16
92       ,attribute17
93       ,attribute18
94       ,attribute19
95       ,attribute20
96       ,object_version_number
97     from        per_sp_plan
98     where       plan_id = p_plan_id;
99   --
100   l_fct_ret     boolean;
101   --
102 Begin
103   --
104   If (p_plan_id is null and
105       p_object_version_number is null
106      ) Then
107     --
108     -- One of the primary key arguments is null therefore we must
109     -- set the returning function value to false
110     --
111     l_fct_ret := false;
112   Else
113     If (p_plan_id
114         = per_sph_shd.g_old_rec.plan_id and
115         p_object_version_number
116         = per_sph_shd.g_old_rec.object_version_number
117        ) Then
118       --
119       -- The g_old_rec is current therefore we must
120       -- set the returning function to true
121       --
122       l_fct_ret := true;
123     Else
124       --
125       -- Select the current row into g_old_rec
126       --
127       Open C_Sel1;
128       Fetch C_Sel1 Into per_sph_shd.g_old_rec;
129       If C_Sel1%notfound Then
130         Close C_Sel1;
131         --
132         -- The primary key is invalid therefore we must error
133         --
134         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
135         fnd_message.raise_error;
136       End If;
137       Close C_Sel1;
138       If (p_object_version_number
139           <> per_sph_shd.g_old_rec.object_version_number) Then
140         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
141         fnd_message.raise_error;
142       End If;
143       l_fct_ret := true;
144     End If;
145   End If;
146   Return (l_fct_ret);
147 --
148 End api_updating;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |---------------------------------< lck >----------------------------------|
152 -- ----------------------------------------------------------------------------
153 Procedure lck
154   (p_plan_id                              in     number
155   ,p_object_version_number                in     number
156   ) is
157 --
158 -- Cursor selects the 'current' row from the HR Schema
159 --
160   Cursor C_Sel1 is
161     select
162        plan_id
163       ,plan_type
164       ,plan_name
165       ,successee_id
166       ,business_group_id
167       ,description
168       ,status
169       ,plan_owner
170       ,start_date
171       ,end_date
172       ,filled_from_plan
173       ,filled_by
174       ,filled_on
175       ,next_review_date
176       ,criteria_set_id
177       ,attribute_category
178       ,attribute1
179       ,attribute2
180       ,attribute3
181       ,attribute4
182       ,attribute5
183       ,attribute6
184       ,attribute7
185       ,attribute8
186       ,attribute9
187       ,attribute10
188       ,attribute11
189       ,attribute12
190       ,attribute13
191       ,attribute14
192       ,attribute15
193       ,attribute16
194       ,attribute17
195       ,attribute18
196       ,attribute19
197       ,attribute20
198       ,object_version_number
199     from        per_sp_plan
200     where       plan_id = p_plan_id
201     for update nowait;
202 --
203   l_proc        varchar2(72) := g_package||'lck';
204 --
205 Begin
206   hr_utility.set_location('Entering:'||l_proc, 5);
210     ,p_argument           => 'PLAN_ID'
207   --
208   hr_api.mandatory_arg_error
209     (p_api_name           => l_proc
211     ,p_argument_value     => p_plan_id
212     );
213   hr_utility.set_location(l_proc,6);
214   hr_api.mandatory_arg_error
215     (p_api_name           => l_proc
216     ,p_argument           => 'OBJECT_VERSION_NUMBER'
217     ,p_argument_value     => p_object_version_number
218     );
219   --
220   Open  C_Sel1;
221   Fetch C_Sel1 Into per_sph_shd.g_old_rec;
222   If C_Sel1%notfound then
223     Close C_Sel1;
224     --
225     -- The primary key is invalid therefore we must error
226     --
227     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
228     fnd_message.raise_error;
229   End If;
230   Close C_Sel1;
231   If (p_object_version_number
232       <> per_sph_shd.g_old_rec.object_version_number) Then
233         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
234         fnd_message.raise_error;
235   End If;
236   --
237   hr_utility.set_location(' Leaving:'||l_proc, 10);
238   --
239   -- We need to trap the ORA LOCK exception
240   --
241 Exception
242   When HR_Api.Object_Locked then
243     --
244     -- The object is locked therefore we need to supply a meaningful
245     -- error message.
246     --
247     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
248     fnd_message.set_token('TABLE_NAME', 'per_sp_plan');
249     fnd_message.raise_error;
250 End lck;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |-----------------------------< convert_args >-----------------------------|
254 -- ----------------------------------------------------------------------------
255 Function convert_args
256   (p_plan_id                        in number
257   ,p_plan_type                      in varchar2
258   ,p_plan_name                      in varchar2
259   ,p_successee_id                   in number
260   ,p_business_group_id              in number
261   ,p_description                    in varchar2
262   ,p_status                         in varchar2
263   ,p_plan_owner                     in number
264   ,p_start_date                     in date
265   ,p_end_date                       in date
266   ,p_filled_from_plan               in varchar2
267   ,p_filled_by                      in number
268   ,p_filled_on                      in date
269   ,p_next_review_date               in date
270   ,p_criteria_set_id                in number
271   ,p_attribute_category             in varchar2
272   ,p_attribute1                     in varchar2
273   ,p_attribute2                     in varchar2
274   ,p_attribute3                     in varchar2
275   ,p_attribute4                     in varchar2
276   ,p_attribute5                     in varchar2
277   ,p_attribute6                     in varchar2
278   ,p_attribute7                     in varchar2
279   ,p_attribute8                     in varchar2
280   ,p_attribute9                     in varchar2
281   ,p_attribute10                    in varchar2
282   ,p_attribute11                    in varchar2
283   ,p_attribute12                    in varchar2
284   ,p_attribute13                    in varchar2
285   ,p_attribute14                    in varchar2
286   ,p_attribute15                    in varchar2
287   ,p_attribute16                    in varchar2
288   ,p_attribute17                    in varchar2
289   ,p_attribute18                    in varchar2
290   ,p_attribute19                    in varchar2
291   ,p_attribute20                    in varchar2
292   ,p_object_version_number          in number
293   )
294   Return g_rec_type is
295 --
296   l_rec   g_rec_type;
297 --
298 Begin
299   --
300   -- Convert arguments into local l_rec structure.
301   --
302   l_rec.plan_id                          := p_plan_id;
303   l_rec.plan_type                        := p_plan_type;
304   l_rec.plan_name                        := p_plan_name;
305   l_rec.successee_id                     := p_successee_id;
306   l_rec.business_group_id                := p_business_group_id;
307   l_rec.description                      := p_description;
308   l_rec.status                           := p_status;
309   l_rec.plan_owner                       := p_plan_owner;
310   l_rec.start_date                       := p_start_date;
311   l_rec.end_date                         := p_end_date;
312   l_rec.filled_from_plan                 := p_filled_from_plan;
313   l_rec.filled_by                        := p_filled_by;
314   l_rec.filled_on                        := p_filled_on;
315   l_rec.next_review_date                 := p_next_review_date;
316   l_rec.criteria_set_id                  := p_criteria_set_id;
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.object_version_number            := p_object_version_number;
339   --
340   -- Return the plsql record structure.
341   --
342   Return(l_rec);
343 --
344 End convert_args;
345 --
346 end per_sph_shd;