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