[Home] [Help]
PACKAGE BODY: APPS.BEN_PCP_INS
Source
1 Package Body ben_pcp_ins as
2 /* $Header: bepcprhi.pkb 115.13 2002/12/16 12:00:12 vsethi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_pcp_ins.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml insert logic. The processing of
17 -- this procedure are as follows:
18 -- 1) Initialise the object_version_number to 1 if the object_version_number
19 -- is defined as an attribute for this entity.
20 -- 2) To set and unset the g_api_dml status as required (as we are about to
21 -- perform dml).
22 -- 3) To insert the row into the schema.
23 -- 4) To trap any constraint violations that may have occurred.
24 -- 5) To raise any other errors.
25 --
26 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the ins
28 -- procedure and must have all mandatory attributes set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 -- A Pl/Sql record structre.
33 --
34 -- Post Success:
35 -- The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 -- On the insert dml failure it is important to note that we always reset the
39 -- g_api_dml status to false.
40 -- If a check, unique or parent integrity constraint violation is raised the
41 -- constraint_error procedure will be called.
42 -- If any other error is reported, the error will be raised after the
43 -- g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 -- None.
47 --
48 -- Access Status:
49 -- Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml
54 (p_rec in out nocopy ben_pcp_shd.g_rec_type
55 ) is
56 --
57 l_proc varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60 hr_utility.set_location('Entering:'||l_proc, 5);
61 p_rec.object_version_number := 1; -- Initialise the object version
62 --
63 ben_pcp_shd.g_api_dml := true; -- Set the api dml status
64 --
65 -- Insert the row into: ben_pl_pcp
66 --
67 insert into ben_pl_pcp
68 (pl_pcp_id
69 ,pl_id
70 ,business_group_id
71 ,pcp_strt_dt_cd
72 ,pcp_dsgn_cd
73 ,pcp_dpnt_dsgn_cd
74 ,pcp_rpstry_flag
75 ,pcp_can_keep_flag
76 ,pcp_radius
77 ,pcp_radius_uom
78 ,pcp_radius_warn_flag
79 ,pcp_num_chgs
80 ,pcp_num_chgs_uom
81 ,pcp_attribute_category
82 ,pcp_attribute1
83 ,pcp_attribute2
84 ,pcp_attribute3
85 ,pcp_attribute4
86 ,pcp_attribute5
87 ,pcp_attribute6
88 ,pcp_attribute7
89 ,pcp_attribute8
90 ,pcp_attribute9
91 ,pcp_attribute10
92 ,pcp_attribute11
93 ,pcp_attribute12
94 ,pcp_attribute13
95 ,pcp_attribute14
96 ,pcp_attribute15
97 ,pcp_attribute16
98 ,pcp_attribute17
99 ,pcp_attribute18
100 ,pcp_attribute19
101 ,pcp_attribute20
102 ,pcp_attribute21
103 ,pcp_attribute22
107 ,pcp_attribute26
104 ,pcp_attribute23
105 ,pcp_attribute24
106 ,pcp_attribute25
108 ,pcp_attribute27
109 ,pcp_attribute28
110 ,pcp_attribute29
111 ,pcp_attribute30
112 ,object_version_number
113 )
114 Values
115 (p_rec.pl_pcp_id
116 ,p_rec.pl_id
117 ,p_rec.business_group_id
118 ,p_rec.pcp_strt_dt_cd
119 ,p_rec.pcp_dsgn_cd
120 ,p_rec.pcp_dpnt_dsgn_cd
121 ,p_rec.pcp_rpstry_flag
122 ,p_rec.pcp_can_keep_flag
123 ,p_rec.pcp_radius
124 ,p_rec.pcp_radius_uom
125 ,p_rec.pcp_radius_warn_flag
126 ,p_rec.pcp_num_chgs
127 ,p_rec.pcp_num_chgs_uom
128 ,p_rec.pcp_attribute_category
129 ,p_rec.pcp_attribute1
130 ,p_rec.pcp_attribute2
131 ,p_rec.pcp_attribute3
132 ,p_rec.pcp_attribute4
133 ,p_rec.pcp_attribute5
134 ,p_rec.pcp_attribute6
135 ,p_rec.pcp_attribute7
136 ,p_rec.pcp_attribute8
137 ,p_rec.pcp_attribute9
138 ,p_rec.pcp_attribute10
139 ,p_rec.pcp_attribute11
140 ,p_rec.pcp_attribute12
141 ,p_rec.pcp_attribute13
142 ,p_rec.pcp_attribute14
143 ,p_rec.pcp_attribute15
144 ,p_rec.pcp_attribute16
145 ,p_rec.pcp_attribute17
146 ,p_rec.pcp_attribute18
147 ,p_rec.pcp_attribute19
148 ,p_rec.pcp_attribute20
149 ,p_rec.pcp_attribute21
150 ,p_rec.pcp_attribute22
151 ,p_rec.pcp_attribute23
152 ,p_rec.pcp_attribute24
153 ,p_rec.pcp_attribute25
154 ,p_rec.pcp_attribute26
155 ,p_rec.pcp_attribute27
156 ,p_rec.pcp_attribute28
157 ,p_rec.pcp_attribute29
158 ,p_rec.pcp_attribute30
159 ,p_rec.object_version_number
160 );
161 --
162 ben_pcp_shd.g_api_dml := false; -- Unset the api dml status
163 --
164 hr_utility.set_location(' Leaving:'||l_proc, 10);
165 Exception
166 When hr_api.check_integrity_violated Then
167 -- A check constraint has been violated
168 ben_pcp_shd.g_api_dml := false; -- Unset the api dml status
169 ben_pcp_shd.constraint_error
170 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
171 When hr_api.parent_integrity_violated Then
172 -- Parent integrity has been violated
173 ben_pcp_shd.g_api_dml := false; -- Unset the api dml status
174 ben_pcp_shd.constraint_error
175 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
176 When hr_api.unique_integrity_violated Then
177 -- Unique integrity has been violated
178 ben_pcp_shd.g_api_dml := false; -- Unset the api dml status
179 ben_pcp_shd.constraint_error
180 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
181 When Others Then
182 ben_pcp_shd.g_api_dml := false; -- Unset the api dml status
183 Raise;
184 End insert_dml;
185 --
186 -- ----------------------------------------------------------------------------
187 -- |------------------------------< pre_insert >------------------------------|
188 -- ----------------------------------------------------------------------------
189 -- {Start Of Comments}
190 --
191 -- Description:
192 -- This private procedure contains any processing which is required before
193 -- the insert dml. Presently, if the entity has a corresponding primary
194 -- key which is maintained by an associating sequence, the primary key for
195 -- the entity will be populated with the next sequence value in
196 -- preparation for the insert dml.
197 --
198 -- Prerequisites:
199 -- This is an internal procedure which is called from the ins procedure.
200 --
201 -- In Parameters:
202 -- A Pl/Sql record structre.
203 --
204 -- Post Success:
205 -- Processing continues.
206 --
207 -- Post Failure:
208 -- If an error has occurred, an error message and exception will be raised
209 -- but not handled.
210 --
211 -- Developer Implementation Notes:
212 -- Any pre-processing required before the insert dml is issued should be
213 -- coded within this procedure. As stated above, a good example is the
214 -- generation of a primary key number via a corresponding sequence.
215 -- It is important to note that any 3rd party maintenance should be reviewed
216 -- before placing in this procedure.
217 --
218 -- Access Status:
219 -- Internal Row Handler Use Only.
220 --
221 -- {End Of Comments}
222 -- ----------------------------------------------------------------------------
223 Procedure pre_insert
224 (p_rec in out nocopy ben_pcp_shd.g_rec_type
225 ) is
226 --
227 l_proc varchar2(72) := g_package||'pre_insert';
228 --
229 Cursor C_Sel1 is select ben_pl_pcp_s.nextval from sys.dual;
230 --
231 Begin
232 hr_utility.set_location('Entering:'||l_proc, 5);
233 --
234 --
235 -- Select the next sequence number
236 --
237 Open C_Sel1;
238 Fetch C_Sel1 Into p_rec.pl_pcp_id;
239 Close C_Sel1;
240 --
241 hr_utility.set_location(' Leaving:'||l_proc, 10);
242 End pre_insert;
243 --
244 -- ----------------------------------------------------------------------------
245 -- |-----------------------------< post_insert >------------------------------|
246 -- ----------------------------------------------------------------------------
247 -- {Start Of Comments}
248 --
249 -- Description:
250 -- This private procedure contains any processing which is required after the
251 -- insert dml.
252 --
253 -- Prerequisites:
254 -- This is an internal procedure which is called from the ins procedure.
255 --
256 -- In Parameters:
257 -- A Pl/Sql record structre.
258 --
259 -- Post Success:
263 -- If an error has occurred, an error message and exception will be raised
260 -- Processing continues.
261 --
262 -- Post Failure:
264 -- but not handled.
265 --
266 -- Developer Implementation Notes:
267 -- Any post-processing required after the insert dml is issued should be
268 -- coded within this procedure. It is important to note that any 3rd party
269 -- maintenance should be reviewed before placing in this procedure.
270 --
271 -- Access Status:
272 -- Internal Row Handler Use Only.
273 --
274 -- {End Of Comments}
275 -- ----------------------------------------------------------------------------
276 Procedure post_insert
277 (p_rec in ben_pcp_shd.g_rec_type
278 ) is
279 --
280 l_proc varchar2(72) := g_package||'post_insert';
281 --
282 Begin
283 hr_utility.set_location('Entering:'||l_proc, 5);
284 begin
285 --
286 ben_pcp_rki.after_insert
287 (p_pl_pcp_id
288 => p_rec.pl_pcp_id
289 ,p_pl_id
290 => p_rec.pl_id
291 ,p_business_group_id
292 => p_rec.business_group_id
293 ,p_pcp_strt_dt_cd
294 => p_rec.pcp_strt_dt_cd
295 ,p_pcp_dsgn_cd
296 => p_rec.pcp_dsgn_cd
297 ,p_pcp_dpnt_dsgn_cd
298 => p_rec.pcp_dpnt_dsgn_cd
299 ,p_pcp_rpstry_flag
300 => p_rec.pcp_rpstry_flag
301 ,p_pcp_can_keep_flag
302 => p_rec.pcp_can_keep_flag
303 ,p_pcp_radius
304 => p_rec.pcp_radius
305 ,p_pcp_radius_uom
306 => p_rec.pcp_radius_uom
307 ,p_pcp_radius_warn_flag
308 => p_rec.pcp_radius_warn_flag
309 ,p_pcp_num_chgs
310 => p_rec.pcp_num_chgs
311 ,p_pcp_num_chgs_uom
312 => p_rec.pcp_num_chgs_uom
313 ,p_pcp_attribute_category
314 => p_rec.pcp_attribute_category
315 ,p_pcp_attribute1
316 => p_rec.pcp_attribute1
317 ,p_pcp_attribute2
318 => p_rec.pcp_attribute2
319 ,p_pcp_attribute3
320 => p_rec.pcp_attribute3
321 ,p_pcp_attribute4
322 => p_rec.pcp_attribute4
323 ,p_pcp_attribute5
324 => p_rec.pcp_attribute5
325 ,p_pcp_attribute6
326 => p_rec.pcp_attribute6
327 ,p_pcp_attribute7
328 => p_rec.pcp_attribute7
329 ,p_pcp_attribute8
330 => p_rec.pcp_attribute8
331 ,p_pcp_attribute9
332 => p_rec.pcp_attribute9
333 ,p_pcp_attribute10
334 => p_rec.pcp_attribute10
335 ,p_pcp_attribute11
336 => p_rec.pcp_attribute11
337 ,p_pcp_attribute12
338 => p_rec.pcp_attribute12
339 ,p_pcp_attribute13
340 => p_rec.pcp_attribute13
341 ,p_pcp_attribute14
342 => p_rec.pcp_attribute14
343 ,p_pcp_attribute15
344 => p_rec.pcp_attribute15
345 ,p_pcp_attribute16
346 => p_rec.pcp_attribute16
347 ,p_pcp_attribute17
348 => p_rec.pcp_attribute17
349 ,p_pcp_attribute18
350 => p_rec.pcp_attribute18
351 ,p_pcp_attribute19
352 => p_rec.pcp_attribute19
353 ,p_pcp_attribute20
354 => p_rec.pcp_attribute20
355 ,p_pcp_attribute21
356 => p_rec.pcp_attribute21
357 ,p_pcp_attribute22
358 => p_rec.pcp_attribute22
359 ,p_pcp_attribute23
360 => p_rec.pcp_attribute23
361 ,p_pcp_attribute24
362 => p_rec.pcp_attribute24
363 ,p_pcp_attribute25
364 => p_rec.pcp_attribute25
365 ,p_pcp_attribute26
366 => p_rec.pcp_attribute26
367 ,p_pcp_attribute27
368 => p_rec.pcp_attribute27
369 ,p_pcp_attribute28
370 => p_rec.pcp_attribute28
371 ,p_pcp_attribute29
372 => p_rec.pcp_attribute29
373 ,p_pcp_attribute30
374 => p_rec.pcp_attribute30
375 ,p_object_version_number
376 => p_rec.object_version_number
377 );
378 --
379 exception
380 --
381 when hr_api.cannot_find_prog_unit then
382 --
383 hr_api.cannot_find_prog_unit_error
384 (p_module_name => 'BEN_PL_PCP'
385 ,p_hook_type => 'AI');
386 --
387 end;
388 --
389 hr_utility.set_location(' Leaving:'||l_proc, 10);
390 End post_insert;
391 --
392 -- ----------------------------------------------------------------------------
393 -- |---------------------------------< ins >----------------------------------|
394 -- ----------------------------------------------------------------------------
395 Procedure ins
396 (p_effective_date in date,
397 p_rec in out nocopy ben_pcp_shd.g_rec_type) is
398 --
399 l_proc varchar2(72) := g_package||'ins';
400 --
401 Begin
402 hr_utility.set_location('Entering:'||l_proc, 5);
403 --
404 -- Call the supporting insert validate operations
405 --
406 ben_pcp_bus.insert_validate
407 (p_rec
408 ,p_effective_date);
409 --
410 -- Call the supporting pre-insert operation
411 --
412 ben_pcp_ins.pre_insert(p_rec);
413 --
414 -- Insert the row
415 --
416 ben_pcp_ins.insert_dml(p_rec);
417 --
418 -- Call the supporting post-insert operation
419 --
420 ben_pcp_ins.post_insert
421 (p_rec
422 );
423 --
424 hr_utility.set_location('Leaving:'||l_proc, 20);
425 end ins;
426 --
427 -- ----------------------------------------------------------------------------
431 ( p_effective_date in date
428 -- |---------------------------------< ins >----------------------------------|
429 -- ----------------------------------------------------------------------------
430 Procedure ins
432 ,p_pl_id in number
433 ,p_business_group_id in number
434 ,p_pcp_rpstry_flag in varchar2
435 ,p_pcp_can_keep_flag in varchar2
436 ,p_pcp_radius_warn_flag in varchar2
437 ,p_pcp_strt_dt_cd in varchar2 default null
438 ,p_pcp_dsgn_cd in varchar2 default null
439 ,p_pcp_dpnt_dsgn_cd in varchar2 default null
440 ,p_pcp_radius in number default null
441 ,p_pcp_radius_uom in varchar2 default null
442 ,p_pcp_num_chgs in number default null
443 ,p_pcp_num_chgs_uom in varchar2 default null
444 ,p_pcp_attribute_category in varchar2 default null
445 ,p_pcp_attribute1 in varchar2 default null
446 ,p_pcp_attribute2 in varchar2 default null
447 ,p_pcp_attribute3 in varchar2 default null
448 ,p_pcp_attribute4 in varchar2 default null
449 ,p_pcp_attribute5 in varchar2 default null
450 ,p_pcp_attribute6 in varchar2 default null
451 ,p_pcp_attribute7 in varchar2 default null
452 ,p_pcp_attribute8 in varchar2 default null
453 ,p_pcp_attribute9 in varchar2 default null
454 ,p_pcp_attribute10 in varchar2 default null
455 ,p_pcp_attribute11 in varchar2 default null
456 ,p_pcp_attribute12 in varchar2 default null
457 ,p_pcp_attribute13 in varchar2 default null
458 ,p_pcp_attribute14 in varchar2 default null
459 ,p_pcp_attribute15 in varchar2 default null
460 ,p_pcp_attribute16 in varchar2 default null
461 ,p_pcp_attribute17 in varchar2 default null
462 ,p_pcp_attribute18 in varchar2 default null
463 ,p_pcp_attribute19 in varchar2 default null
464 ,p_pcp_attribute20 in varchar2 default null
465 ,p_pcp_attribute21 in varchar2 default null
466 ,p_pcp_attribute22 in varchar2 default null
467 ,p_pcp_attribute23 in varchar2 default null
468 ,p_pcp_attribute24 in varchar2 default null
469 ,p_pcp_attribute25 in varchar2 default null
470 ,p_pcp_attribute26 in varchar2 default null
471 ,p_pcp_attribute27 in varchar2 default null
472 ,p_pcp_attribute28 in varchar2 default null
473 ,p_pcp_attribute29 in varchar2 default null
474 ,p_pcp_attribute30 in varchar2 default null
475 ,p_pl_pcp_id out nocopy number
476 ,p_object_version_number out nocopy number
477 ) is
478 --
479 l_rec ben_pcp_shd.g_rec_type;
480 l_proc varchar2(72) := g_package||'ins';
481 --
482 Begin
483 hr_utility.set_location('Entering:'||l_proc, 5);
484 --
485 -- Call conversion function to turn arguments into the
486 -- p_rec structure.
487 --
488 l_rec :=
489 ben_pcp_shd.convert_args
490 (null
491 ,p_pl_id
492 ,p_business_group_id
493 ,p_pcp_strt_dt_cd
494 ,p_pcp_dsgn_cd
495 ,p_pcp_dpnt_dsgn_cd
496 ,p_pcp_rpstry_flag
497 ,p_pcp_can_keep_flag
498 ,p_pcp_radius
499 ,p_pcp_radius_uom
500 ,p_pcp_radius_warn_flag
501 ,p_pcp_num_chgs
502 ,p_pcp_num_chgs_uom
503 ,p_pcp_attribute_category
504 ,p_pcp_attribute1
505 ,p_pcp_attribute2
506 ,p_pcp_attribute3
507 ,p_pcp_attribute4
508 ,p_pcp_attribute5
509 ,p_pcp_attribute6
510 ,p_pcp_attribute7
511 ,p_pcp_attribute8
512 ,p_pcp_attribute9
513 ,p_pcp_attribute10
514 ,p_pcp_attribute11
515 ,p_pcp_attribute12
516 ,p_pcp_attribute13
517 ,p_pcp_attribute14
518 ,p_pcp_attribute15
519 ,p_pcp_attribute16
520 ,p_pcp_attribute17
521 ,p_pcp_attribute18
522 ,p_pcp_attribute19
523 ,p_pcp_attribute20
524 ,p_pcp_attribute21
525 ,p_pcp_attribute22
526 ,p_pcp_attribute23
527 ,p_pcp_attribute24
528 ,p_pcp_attribute25
529 ,p_pcp_attribute26
530 ,p_pcp_attribute27
531 ,p_pcp_attribute28
532 ,p_pcp_attribute29
533 ,p_pcp_attribute30
534 ,null
535 );
536 --
537 -- Having converted the arguments into the ben_pcp_rec
538 -- plsql record structure we call the corresponding record business process.
539 --
540 ben_pcp_ins.ins
541 (p_effective_date, l_rec
542 );
543 --
544 -- As the primary key argument(s)
545 -- are specified as an OUT's we must set these values.
546 --
547 p_pl_pcp_id := l_rec.pl_pcp_id;
548 p_object_version_number := l_rec.object_version_number;
549 --
550 hr_utility.set_location(' Leaving:'||l_proc, 10);
551 End ins;
552 --
553 end ben_pcp_ins;