4 -- ----------------------------------------------------------------------------
1 Package Body per_res_ins as
2 /* $Header: peresrhi.pkb 115.2 2003/04/02 13:38:24 eumenyio noship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_res_ins.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |-----------------------< create_app_ownerships >--------------------------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description:
15 -- This procedure inserts a row into the HR_APPLICATION_OWNERSHIPS table
16 -- when the row handler is called in the appropriate mode.
17 --
18 -- ----------------------------------------------------------------------------
19 PROCEDURE create_app_ownerships(p_pk_column IN varchar2
20 ,p_pk_value IN varchar2) IS
21 --
22 CURSOR csr_definition IS
23 SELECT product_short_name
24 FROM hr_owner_definitions
25 WHERE session_id = hr_startup_data_api_support.g_session_id;
26 --
27 BEGIN
28 --
29 IF (hr_startup_data_api_support.return_startup_mode IN
30 ('STARTUP','GENERIC')) THEN
31 --
32 FOR c1 IN csr_definition LOOP
33 --
34 INSERT INTO hr_application_ownerships
35 (key_name
36 ,key_value
37 ,product_name
38 )
39 VALUES
40 (p_pk_column
41 ,fnd_number.number_to_canonical(p_pk_value)
42 ,c1.product_short_name
43 );
44 END LOOP;
45 END IF;
46 END create_app_ownerships;
47 --
48 -- ----------------------------------------------------------------------------
49 -- |-----------------------< create_app_ownerships >--------------------------|
50 -- ----------------------------------------------------------------------------
51 PROCEDURE create_app_ownerships(p_pk_column IN varchar2
52 ,p_pk_value IN number) IS
53 --
54 BEGIN
55 create_app_ownerships(p_pk_column, to_char(p_pk_value));
56 END create_app_ownerships;
57 --
58 -- ----------------------------------------------------------------------------
59 -- |------------------------------< insert_dml >------------------------------|
60 -- ----------------------------------------------------------------------------
61 -- {Start Of Comments}
62 --
63 -- Description:
64 -- This procedure controls the actual dml insert logic. The processing of
65 -- this procedure are as follows:
66 -- 1) Initialise the object_version_number to 1 if the object_version_number
67 -- is defined as an attribute for this entity.
68 -- 2) To set and unset the g_api_dml status as required (as we are about to
69 -- perform dml).
70 -- 3) To insert the row into the schema.
71 -- 4) To trap any constraint violations that may have occurred.
72 -- 5) To raise any other errors.
73 --
74 -- Prerequisites:
75 -- This is an internal private procedure which must be called from the ins
76 -- procedure and must have all mandatory attributes set (except the
77 -- object_version_number which is initialised within this procedure).
78 --
79 -- In Parameters:
80 -- A Pl/Sql record structre.
81 --
82 -- Post Success:
83 -- The specified row will be inserted into the schema.
84 --
85 -- Post Failure:
86 -- On the insert dml failure it is important to note that we always reset the
87 -- g_api_dml status to false.
88 -- If a check, unique or parent integrity constraint violation is raised the
89 -- constraint_error procedure will be called.
90 -- If any other error is reported, the error will be raised after the
91 -- g_api_dml status is reset.
92 --
93 -- Developer Implementation Notes:
94 -- None.
95 --
96 -- Access Status:
97 -- Internal Row Handler Use Only.
98 --
99 -- {End Of Comments}
100 -- ----------------------------------------------------------------------------
101 Procedure insert_dml
102 (p_rec in out nocopy per_res_shd.g_rec_type
103 ) is
104 --
105 l_proc varchar2(72) := g_package||'insert_dml';
106 --
107 Begin
108 hr_utility.set_location('Entering:'||l_proc, 5);
109 p_rec.object_version_number := 1; -- Initialise the object version
110 --
111 --
112 --
113 -- Insert the row into: per_cagr_entitlement_results
114 --
115 insert into per_cagr_entitlement_results
119 ,end_date
116 (cagr_entitlement_result_id
117 ,assignment_id
118 ,start_date
120 ,collective_agreement_id
121 ,cagr_entitlement_item_id
122 ,element_type_id
123 ,input_value_id
124 ,cagr_api_id
125 ,cagr_api_param_id
126 ,category_name
127 ,cagr_entitlement_id
128 ,cagr_entitlement_line_id
129 ,value
130 ,units_of_measure
131 ,range_from
132 ,range_to
133 ,grade_spine_id
134 ,parent_spine_id
135 ,step_id
136 ,from_step_id
137 ,to_step_id
138 ,beneficial_flag
139 ,oipl_id
140 ,chosen_flag
141 ,column_type
142 ,column_size
143 ,cagr_request_id
144 ,business_group_id
145 ,legislation_code
146 ,eligy_prfl_id
147 ,formula_id
148 ,object_version_number
149 )
150 Values
151 (p_rec.cagr_entitlement_result_id
152 ,p_rec.assignment_id
153 ,p_rec.start_date
154 ,p_rec.end_date
155 ,p_rec.collective_agreement_id
156 ,p_rec.cagr_entitlement_item_id
157 ,p_rec.element_type_id
158 ,p_rec.input_value_id
159 ,p_rec.cagr_api_id
160 ,p_rec.cagr_api_param_id
161 ,p_rec.category_name
162 ,p_rec.cagr_entitlement_id
163 ,p_rec.cagr_entitlement_line_id
164 ,p_rec.value
165 ,p_rec.units_of_measure
166 ,p_rec.range_from
167 ,p_rec.range_to
168 ,p_rec.grade_spine_id
169 ,p_rec.parent_spine_id
170 ,p_rec.step_id
171 ,p_rec.from_step_id
172 ,p_rec.to_step_id
173 ,p_rec.beneficial_flag
174 ,p_rec.oipl_id
175 ,p_rec.chosen_flag
176 ,p_rec.column_type
177 ,p_rec.column_size
178 ,p_rec.cagr_request_id
179 ,p_rec.business_group_id
180 ,p_rec.legislation_code
181 ,p_rec.eligy_prfl_id
182 ,p_rec.formula_id
183 ,p_rec.object_version_number
184 );
185 --
186 --
187 --
188 hr_utility.set_location(' Leaving:'||l_proc, 10);
189 Exception
190 When hr_api.check_integrity_violated Then
191 -- A check constraint has been violated
192 --
193 per_res_shd.constraint_error
194 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
195 When hr_api.parent_integrity_violated Then
196 -- Parent integrity has been violated
197 --
198 per_res_shd.constraint_error
199 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
200 When hr_api.unique_integrity_violated Then
201 -- Unique integrity has been violated
202 --
203 per_res_shd.constraint_error
204 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
205 When Others Then
206 --
207 Raise;
208 End insert_dml;
209 --
210 -- ----------------------------------------------------------------------------
211 -- |------------------------------< pre_insert >------------------------------|
212 -- ----------------------------------------------------------------------------
213 -- {Start Of Comments}
214 --
215 -- Description:
216 -- This private procedure contains any processing which is required before
217 -- the insert dml. Presently, if the entity has a corresponding primary
218 -- key which is maintained by an associating sequence, the primary key for
219 -- the entity will be populated with the next sequence value in
220 -- preparation for the insert dml.
221 --
222 -- Prerequisites:
223 -- This is an internal procedure which is called from the ins procedure.
224 --
228 -- Post Success:
225 -- In Parameters:
226 -- A Pl/Sql record structre.
227 --
229 -- Processing continues.
230 --
231 -- Post Failure:
232 -- If an error has occurred, an error message and exception will be raised
233 -- but not handled.
234 --
235 -- Developer Implementation Notes:
236 -- Any pre-processing required before the insert dml is issued should be
237 -- coded within this procedure. As stated above, a good example is the
238 -- generation of a primary key number via a corresponding sequence.
239 -- It is important to note that any 3rd party maintenance should be reviewed
240 -- before placing in this procedure.
241 --
242 -- Access Status:
243 -- Internal Row Handler Use Only.
244 --
245 -- {End Of Comments}
246 -- ----------------------------------------------------------------------------
247 Procedure pre_insert
248 (p_rec in out nocopy per_res_shd.g_rec_type
249 ) is
250 --
251 l_proc varchar2(72) := g_package||'pre_insert';
252 --
253 Cursor C_Sel1 is select per_cagr_entitlement_results_s.nextval from sys.dual;
254 --
255 Begin
256 hr_utility.set_location('Entering:'||l_proc, 5);
257 --
258 --
259 -- Select the next sequence number
260 --
261 Open C_Sel1;
262 Fetch C_Sel1 Into p_rec.cagr_entitlement_result_id;
263 Close C_Sel1;
264 --
265 hr_utility.set_location(' Leaving:'||l_proc, 10);
266 End pre_insert;
267 --
268 -- ----------------------------------------------------------------------------
269 -- |-----------------------------< post_insert >------------------------------|
270 -- ----------------------------------------------------------------------------
271 -- {Start Of Comments}
272 --
273 -- Description:
274 -- This private procedure contains any processing which is required after
275 -- the insert dml.
276 --
277 -- Prerequisites:
278 -- This is an internal procedure which is called from the ins procedure.
279 --
280 -- In Parameters:
281 -- A Pl/Sql record structre.
282 --
283 -- Post Success:
284 -- Processing continues.
285 --
286 -- Post Failure:
287 -- If an error has occurred, an error message and exception will be raised
288 -- but not handled.
289 --
290 -- Developer Implementation Notes:
291 -- Any post-processing required after the insert dml is issued should be
292 -- coded within this procedure. It is important to note that any 3rd party
293 -- maintenance should be reviewed before placing in this procedure.
294 --
295 -- Access Status:
296 -- Internal Row Handler Use Only.
297 --
298 -- {End Of Comments}
299 -- ----------------------------------------------------------------------------
300 Procedure post_insert
301 (p_effective_date in date
302 ,p_rec in per_res_shd.g_rec_type
303 ) is
304 --
305 l_proc varchar2(72) := g_package||'post_insert';
306 --
307 Begin
308 hr_utility.set_location('Entering:'||l_proc, 5);
309 /*
310 begin
311 --
312 null;
313
314 -- insert ownerships if applicable
315 create_app_ownerships
316 ('CAGR_ENTITLEMENT_RESULT_ID', p_rec.cagr_entitlement_result_id
317 );
318 --
319 --
320
321 per_res_rki.after_insert
322 (p_effective_date => p_effective_date
323 ,p_cagr_entitlement_result_id
324 => p_rec.cagr_entitlement_result_id
325 ,p_assignment_id
326 => p_rec.assignment_id
327 ,p_start_date
328 => p_rec.start_date
329 ,p_end_date
330 => p_rec.end_date
331 ,p_collective_agreement_id
332 => p_rec.collective_agreement_id
333 ,p_cagr_entitlement_item_id
334 => p_rec.cagr_entitlement_item_id
335 ,p_element_type_id
336 => p_rec.element_type_id
337 ,p_input_value_id
338 => p_rec.input_value_id
339 ,p_cagr_api_id
340 => p_rec.cagr_api_id
341 ,p_cagr_api_param_id
342 => p_rec.cagr_api_param_id
343 ,p_category_name
344 => p_rec.category_name
345 ,p_cagr_entitlement_id
346 => p_rec.cagr_entitlement_id
347 ,p_cagr_entitlement_line_id
348 => p_rec.cagr_entitlement_line_id
349 ,p_value
350 => p_rec.value
351 ,p_units_of_measure
352 => p_rec.units_of_measure
353 ,p_range_from
354 => p_rec.range_from
355 ,p_range_to
356 => p_rec.range_to
357 ,p_grade_spine_id
358 => p_rec.grade_spine_id
359 ,p_parent_spine_id
360 => p_rec.parent_spine_id
361 ,p_step_id
362 => p_rec.step_id
363 ,p_from_step_id
364 => p_rec.from_step_id
365 ,p_to_step_id
366 => p_rec.to_step_id
367 ,p_beneficial_flag
368 => p_rec.beneficial_flag
369 ,p_oipl_id
370 => p_rec.oipl_id
371 ,p_chosen_flag
372 => p_rec.chosen_flag
373 ,p_column_type
374 => p_rec.column_type
375 ,p_column_size
376 => p_rec.column_size
377 ,p_cagr_request_id
378 => p_rec.cagr_request_id
379 ,p_business_group_id
380 => p_rec.business_group_id
381 ,p_legislation_code
382 => p_rec.legislation_code
383 ,p_eligy_prfl_id
384 => p_rec.eligy_prfl_id
385 ,p_formula_id
386 => p_rec.formula_id
387 ,p_object_version_number
391 --
388 => p_rec.object_version_number
389 );
390 null;
392 exception
393 --
394 when hr_api.cannot_find_prog_unit then
395 --
396 hr_api.cannot_find_prog_unit_error
397 (p_module_name => 'PER_CAGR_ENTITLEMENT_RESULTS'
398 ,p_hook_type => 'AI');
399 --
400 end;
401 */
402 --
403 hr_utility.set_location(' Leaving:'||l_proc, 10);
404 End post_insert;
405 --
406 -- ----------------------------------------------------------------------------
407 -- |---------------------------------< ins >----------------------------------|
408 -- ----------------------------------------------------------------------------
409 Procedure ins
410 (p_effective_date in date
411 ,p_rec in out nocopy per_res_shd.g_rec_type
412 ) is
413 --
414 l_proc varchar2(72) := g_package||'ins';
415 --
416 Begin
417 hr_utility.set_location('Entering:'||l_proc, 5);
418 --
419 -- Call the supporting insert validate operations
420 --
421 per_res_bus.insert_validate
422 (p_effective_date
423 ,p_rec
424 );
425 --
426 -- Call the supporting pre-insert operation
427 --
428 per_res_ins.pre_insert(p_rec);
429 --
430 -- Insert the row
431 --
432 per_res_ins.insert_dml(p_rec);
433 --
434 -- Call the supporting post-insert operation
435 --
436 per_res_ins.post_insert
437 (p_effective_date
438 ,p_rec
439 );
440 --
441 hr_utility.set_location('Leaving:'||l_proc, 20);
442 end ins;
443 --
444 -- ----------------------------------------------------------------------------
445 -- |---------------------------------< ins >----------------------------------|
446 -- ----------------------------------------------------------------------------
447 Procedure ins
448 (p_effective_date in date
449 ,p_start_date in date
450 ,p_collective_agreement_id in number
451 ,p_cagr_entitlement_item_id in number
452 ,p_category_name in varchar2
453 ,p_cagr_entitlement_id in number
454 ,p_column_type in varchar2
455 ,p_column_size in number
456 ,p_assignment_id in number default null
457 ,p_end_date in date default null
458 ,p_element_type_id in number default null
459 ,p_input_value_id in number default null
460 ,p_cagr_api_id in number default null
461 ,p_cagr_api_param_id in number default null
462 ,p_cagr_entitlement_line_id in number default null
463 ,p_value in varchar2 default null
464 ,p_units_of_measure in varchar2 default null
465 ,p_range_from in varchar2 default null
466 ,p_range_to in varchar2 default null
467 ,p_grade_spine_id in number default null
468 ,p_parent_spine_id in number default null
469 ,p_step_id in number default null
470 ,p_from_step_id in number default null
471 ,p_to_step_id in number default null
472 ,p_beneficial_flag in varchar2 default null
473 ,p_oipl_id in number default null
474 ,p_chosen_flag in varchar2 default null
475 ,p_cagr_request_id in number default null
476 ,p_business_group_id in number default null
477 ,p_legislation_code in varchar2 default null
478 ,p_eligy_prfl_id in number default null
479 ,p_formula_id in number default null
480 ,p_cagr_entitlement_result_id out nocopy number
481 ,p_object_version_number out nocopy number
482 ) is
483 --
484 l_rec per_res_shd.g_rec_type;
485 l_proc varchar2(72) := g_package||'ins';
486 --
487 Begin
488 hr_utility.set_location('Entering:'||l_proc, 5);
489 --
490 -- Call conversion function to turn arguments into the
491 -- p_rec structure.
492 --
493 l_rec :=
494 per_res_shd.convert_args
495 (null
496 ,p_assignment_id
497 ,p_start_date
498 ,p_end_date
499 ,p_collective_agreement_id
500 ,p_cagr_entitlement_item_id
501 ,p_element_type_id
502 ,p_input_value_id
503 ,p_cagr_api_id
504 ,p_cagr_api_param_id
505 ,p_category_name
506 ,p_cagr_entitlement_id
507 ,p_cagr_entitlement_line_id
508 ,p_value
509 ,p_units_of_measure
510 ,p_range_from
511 ,p_range_to
512 ,p_grade_spine_id
513 ,p_parent_spine_id
514 ,p_step_id
515 ,p_from_step_id
516 ,p_to_step_id
517 ,p_beneficial_flag
518 ,p_oipl_id
519 ,p_chosen_flag
520 ,p_column_type
521 ,p_column_size
522 ,p_cagr_request_id
523 ,p_business_group_id
524 ,p_legislation_code
525 ,p_eligy_prfl_id
526 ,p_formula_id
527 ,null
528 );
529 --
530 -- Having converted the arguments into the per_res_rec
531 -- plsql record structure we call the corresponding record business process.
532 --
533 per_res_ins.ins
534 (p_effective_date
535 ,l_rec
536 );
537 --
538 -- As the primary key argument(s)
539 -- are specified as an OUT's we must set these values.
540 --
541 p_cagr_entitlement_result_id := l_rec.cagr_entitlement_result_id;
542 p_object_version_number := l_rec.object_version_number;
543 --
544 hr_utility.set_location(' Leaving:'||l_proc, 10);
545 End ins;
546 --
547 end per_res_ins;