[Home] [Help]
PACKAGE BODY: APPS.PER_POS_SHD
Source
1 Package Body per_pos_shd as
2 /* $Header: peposrhi.pkb 115.26 2003/11/26 15:25:03 hsajja ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_pos_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 --
12 -- ----------------------------------------------------------------------------
13 -- |------------------------< return_api_dml_status >-------------------------|
14 -- ----------------------------------------------------------------------------
15 Function return_api_dml_status Return Boolean Is
16 --
17 l_proc varchar2(72) := g_package||'return_api_dml_status';
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 Return (nvl(g_api_dml, false));
23 --
24 hr_utility.set_location(' Leaving:'||l_proc, 10);
25 End return_api_dml_status;
26 --
27 -- ----------------------------------------------------------------------------
28 -- |---------------------------< constraint_error >---------------------------|
29 -- ----------------------------------------------------------------------------
30 Procedure constraint_error
31 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
32 --
33 l_proc varchar2(72) := g_package||'constraint_error';
34 --
35 Begin
36 hr_utility.set_location('Entering:'||l_proc, 5);
37 --
38 If (p_constraint_name = 'PER_POSITIONS_FK1') Then
39 hr_utility.set_message(801, 'HR_7208_API_BUS_GRP_INVALID');
40 hr_utility.raise_error;
41 ElsIf (p_constraint_name = 'PER_POSITIONS_FK2') Then
42 hr_utility.set_message(801, 'HR_51090_JOB_NOT_EXIST');
43 hr_utility.raise_error;
44 ElsIf (p_constraint_name = 'PER_POSITIONS_FK3') Then
45 hr_utility.set_message(801, 'HR_51371_POS_ORG_NOT_EXIST');
46 hr_utility.raise_error;
47 ElsIf (p_constraint_name = 'PER_POSITIONS_FK4') Then
48 fnd_message.set_name('PER','PER_52979_POS_SUCC_NOT_EXIST');
49 fnd_message.raise_error;
50 ElsIf (p_constraint_name = 'PER_POSITIONS_FK5') Then
51 fnd_message.set_name('PER','PER_52980_POS_RELF_NOT_EXIST');
52 fnd_message.raise_error;
53 ElsIf (p_constraint_name = 'PER_POSITIONS_FK6') Then
54 hr_utility.set_message(801, 'HR_51357_POS_LOC_NOT_EXIST');
55 hr_utility.raise_error;
56 ElsIf (p_constraint_name = 'PER_POSITIONS_FK7') Then
57 hr_utility.set_message(801, 'HR_51369_POS_DEF_NOT_EXIST');
58 hr_utility.raise_error;
59 ElsIf (p_constraint_name = 'PER_POSITIONS_PK') Then
60 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
61 hr_utility.raise_error;
62 ElsIf (p_constraint_name = 'PER_POSITIONS_UK2') Then
63 hr_utility.set_message(801, 'PER_7415_POS_EXISTS');
64 hr_utility.raise_error;
65 ElsIf (p_constraint_name = 'PER_POST_REPLACEMENT_REQUI_CHK') Then
66 hr_utility.set_message(801, 'HR_51370_POS_REPL_REQ_FLAG');
67 hr_utility.raise_error;
68 Else
69 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
70 hr_utility.set_message_token('PROCEDURE', l_proc);
71 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
72 hr_utility.raise_error;
73 End If;
74 --
75 hr_utility.set_location(' Leaving:'||l_proc, 10);
76 End constraint_error;
77 --
78 -- ----------------------------------------------------------------------------
79 -- |-----------------------------< api_updating >-----------------------------|
80 -- ----------------------------------------------------------------------------
81 Function api_updating
82 (
83 p_position_id in number,
84 p_object_version_number in number
85 ) Return Boolean Is
86 --
87 --
88 -- Cursor selects the 'current' row from the HR Schema
89 --
90 Cursor C_Sel1 is
91 select
92 position_id,
93 business_group_id,
94 job_id,
95 organization_id,
96 successor_position_id,
97 relief_position_id,
98 location_id,
99 position_definition_id,
100 date_effective,
101 comments,
102 date_end,
103 frequency,
104 name,
105 probation_period,
106 probation_period_units,
107 replacement_required_flag,
108 time_normal_finish,
109 time_normal_start,
110 status,
111 working_hours,
112 request_id,
113 program_application_id,
114 program_id,
115 program_update_date,
116 attribute_category,
117 attribute1,
118 attribute2,
119 attribute3,
120 attribute4,
121 attribute5,
122 attribute6,
123 attribute7,
124 attribute8,
125 attribute9,
126 attribute10,
127 attribute11,
128 attribute12,
129 attribute13,
130 attribute14,
131 attribute15,
132 attribute16,
133 attribute17,
134 attribute18,
135 attribute19,
136 attribute20,
137 object_version_number
138 from per_positions
139 where position_id = p_position_id;
140 --
141 l_proc varchar2(72) := g_package||'api_updating';
142 l_fct_ret boolean;
143 --
144 Begin
145 hr_utility.set_location('Entering:'||l_proc, 5);
146 --
147 If (
148 p_position_id is null and
149 p_object_version_number is null
150 ) or per_pos_shd.G_DT_INS Then
151 --
152 -- One of the primary key arguments is null therefore we must
153 -- set the returning function value to false
154 --
155 l_fct_ret := false;
156 Else
157 If (
158 p_position_id = g_old_rec.position_id and
159 p_object_version_number = g_old_rec.object_version_number
160 ) Then
161 hr_utility.set_location(l_proc, 10);
162 --
163 -- The g_old_rec is current therefore we must
164 -- set the returning function to true
165 --
166 l_fct_ret := true;
167 Else
168 --
169 -- Select the current row into g_old_rec
170 --
171 Open C_Sel1;
172 Fetch C_Sel1 Into g_old_rec;
173 If C_Sel1%notfound Then
174 Close C_Sel1;
175 --
176 -- The primary key is invalid therefore we must error
177 --
178 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
179 hr_utility.raise_error;
180 End If;
181 Close C_Sel1;
182 If (p_object_version_number <> g_old_rec.object_version_number) Then
183 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
184 hr_utility.raise_error;
185 End If;
186 hr_utility.set_location(l_proc, 15);
187 l_fct_ret := true;
188 End If;
189 End If;
190 hr_utility.set_location(' Leaving:'||l_proc, 20);
191 Return (l_fct_ret);
192 --
193 End api_updating;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |---------------------------------< lck >----------------------------------|
197 -- ----------------------------------------------------------------------------
198 Procedure lck
199 (
200 p_position_id in number,
201 p_object_version_number in number
202 ) is
203 --
204 -- Cursor selects the 'current' row from the HR Schema
205 --
206 Cursor C_Sel1 is
207 select position_id,
208 business_group_id,
209 job_id,
210 organization_id,
211 successor_position_id,
212 relief_position_id,
213 location_id,
214 position_definition_id,
215 date_effective,
216 comments,
217 date_end,
218 frequency,
219 name,
220 probation_period,
221 probation_period_units,
222 replacement_required_flag,
223 time_normal_finish,
224 time_normal_start,
225 status,
226 working_hours,
227 request_id,
228 program_application_id,
229 program_id,
230 program_update_date,
231 attribute_category,
232 attribute1,
233 attribute2,
234 attribute3,
235 attribute4,
236 attribute5,
237 attribute6,
238 attribute7,
239 attribute8,
240 attribute9,
241 attribute10,
242 attribute11,
243 attribute12,
244 attribute13,
245 attribute14,
246 attribute15,
247 attribute16,
248 attribute17,
249 attribute18,
250 attribute19,
251 attribute20,
252 object_version_number
253 from per_all_positions
254 where position_id = p_position_id
255 for update nowait;
256 --
257 l_proc varchar2(72) := g_package||'lck';
258 --
259 Begin
260 hr_utility.set_location('Entering:'||l_proc, 5);
261 --
262 -- Add any mandatory argument checking here:
263 --
264 hr_api.mandatory_arg_error
265 (p_api_name => l_proc
266 ,p_argument => 'position_id'
267 ,p_argument_value => p_position_id);
268 --
269 hr_api.mandatory_arg_error
270 (p_api_name => l_proc
271 ,p_argument => 'object_version_number'
272 ,p_argument_value => p_object_version_number);
273 --
274 Open C_Sel1;
275 Fetch C_Sel1 Into g_old_rec;
276 If C_Sel1%notfound then
277 Close C_Sel1;
278 --
279 -- The primary key is invalid therefore we must error
280 --
281 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
282 hr_utility.raise_error;
283 End If;
284 Close C_Sel1;
285 If (p_object_version_number <> g_old_rec.object_version_number) Then
286 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
287 hr_utility.raise_error;
288 End If;
289 --
290 hr_utility.set_location(' Leaving:'||l_proc, 10);
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 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
301 hr_utility.set_message_token('TABLE_NAME', 'per_all_positions');
302 hr_utility.raise_error;
303 End lck;
304 --
305 -- ----------------------------------------------------------------------------
306 -- |-----------------------------< convert_args >-----------------------------|
307 -- ----------------------------------------------------------------------------
308 Function convert_args
309 (
310 p_position_id in number,
311 p_business_group_id in number,
312 p_job_id in number,
313 p_organization_id in number,
314 p_successor_position_id in number,
315 p_relief_position_id in number,
316 p_location_id in number,
317 p_position_definition_id in number,
318 p_date_effective in date,
319 p_comments in varchar2,
320 p_date_end in date,
321 p_frequency in varchar2,
322 p_name in varchar2,
323 p_probation_period in number,
324 p_probation_period_units in varchar2,
325 p_replacement_required_flag in varchar2,
326 p_time_normal_finish in varchar2,
327 p_time_normal_start in varchar2,
328 p_status in varchar2,
329 p_working_hours in number,
330 p_request_id in number,
331 p_program_application_id in number,
332 p_program_id in number,
333 p_program_update_date in date,
334 p_attribute_category in varchar2,
335 p_attribute1 in varchar2,
336 p_attribute2 in varchar2,
337 p_attribute3 in varchar2,
338 p_attribute4 in varchar2,
339 p_attribute5 in varchar2,
340 p_attribute6 in varchar2,
341 p_attribute7 in varchar2,
342 p_attribute8 in varchar2,
343 p_attribute9 in varchar2,
344 p_attribute10 in varchar2,
345 p_attribute11 in varchar2,
346 p_attribute12 in varchar2,
347 p_attribute13 in varchar2,
348 p_attribute14 in varchar2,
349 p_attribute15 in varchar2,
350 p_attribute16 in varchar2,
351 p_attribute17 in varchar2,
352 p_attribute18 in varchar2,
353 p_attribute19 in varchar2,
354 p_attribute20 in varchar2,
355 p_object_version_number in number
356 )
357 Return g_rec_type is
358 --
359 l_rec g_rec_type;
360 l_proc varchar2(72) := g_package||'convert_args';
361 --
362 Begin
363 --
364 hr_utility.set_location('Entering:'||l_proc, 5);
365 --
366 -- Convert arguments into local l_rec structure.
367 --
368 l_rec.position_id := p_position_id;
369 l_rec.business_group_id := p_business_group_id;
370 l_rec.job_id := p_job_id;
371 l_rec.organization_id := p_organization_id;
372 l_rec.successor_position_id := p_successor_position_id;
373 l_rec.relief_position_id := p_relief_position_id;
374 l_rec.location_id := p_location_id;
375 l_rec.position_definition_id := p_position_definition_id;
376 l_rec.date_effective := p_date_effective;
377 l_rec.comments := p_comments;
378 l_rec.date_end := p_date_end;
379 l_rec.frequency := p_frequency;
380 l_rec.name := p_name;
381 l_rec.probation_period := p_probation_period;
382 l_rec.probation_period_units := p_probation_period_units;
383 l_rec.replacement_required_flag := p_replacement_required_flag;
384 l_rec.time_normal_finish := p_time_normal_finish;
385 l_rec.time_normal_start := p_time_normal_start;
386 l_rec.status := p_status;
387 l_rec.working_hours := p_working_hours;
388 l_rec.request_id := p_request_id;
389 l_rec.program_application_id := p_program_application_id;
390 l_rec.program_id := p_program_id;
391 l_rec.program_update_date := p_program_update_date;
392 l_rec.attribute_category := p_attribute_category;
393 l_rec.attribute1 := p_attribute1;
394 l_rec.attribute2 := p_attribute2;
395 l_rec.attribute3 := p_attribute3;
396 l_rec.attribute4 := p_attribute4;
397 l_rec.attribute5 := p_attribute5;
398 l_rec.attribute6 := p_attribute6;
399 l_rec.attribute7 := p_attribute7;
400 l_rec.attribute8 := p_attribute8;
401 l_rec.attribute9 := p_attribute9;
402 l_rec.attribute10 := p_attribute10;
403 l_rec.attribute11 := p_attribute11;
404 l_rec.attribute12 := p_attribute12;
405 l_rec.attribute13 := p_attribute13;
406 l_rec.attribute14 := p_attribute14;
407 l_rec.attribute15 := p_attribute15;
408 l_rec.attribute16 := p_attribute16;
409 l_rec.attribute17 := p_attribute17;
410 l_rec.attribute18 := p_attribute18;
411 l_rec.attribute19 := p_attribute19;
412 l_rec.attribute20 := p_attribute20;
413 l_rec.object_version_number := p_object_version_number;
414 --
415 -- Return the plsql record structure.
416 --
417 hr_utility.set_location(' Leaving:'||l_proc, 10);
418 Return(l_rec);
419 --
420 End convert_args;
421 --
422 end per_pos_shd;