DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CLF_INS

Source


1 Package Body ben_clf_ins as
2 /* $Header: beclfrhi.pkb 120.0 2005/05/28 01:04:10 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_clf_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(p_rec in out nocopy ben_clf_shd.g_rec_type) is
54 --
55   l_proc  varchar2(72) := g_package||'insert_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59   p_rec.object_version_number := 1;  -- Initialise the object version
60   --
61   ben_clf_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_comp_lvl_fctr
64   --
65   insert into ben_comp_lvl_fctr
66   (	comp_lvl_fctr_id,
67 	business_group_id,
68 	name,
69         comp_lvl_det_cd,
70         comp_lvl_det_rl,
71 	comp_lvl_uom,
72 	comp_src_cd,
73 	defined_balance_id,
74 	no_mn_comp_flag,
75 	no_mx_comp_flag,
76 	mx_comp_val,
77 	mn_comp_val,
78 	rndg_cd,
79 	rndg_rl,
80         bnfts_bal_id,
81         comp_alt_val_to_use_cd,
82         comp_calc_rl,
83   proration_flag,
84   start_day_mo,
85   end_day_mo,
86   start_year,
87   end_year,
88 	clf_attribute_category,
89 	clf_attribute1,
90 	clf_attribute2,
91 	clf_attribute3,
92 	clf_attribute4,
93 	clf_attribute5,
94 	clf_attribute6,
95 	clf_attribute7,
96 	clf_attribute8,
97 	clf_attribute9,
98 	clf_attribute10,
99 	clf_attribute11,
100 	clf_attribute12,
101 	clf_attribute13,
102 	clf_attribute14,
103 	clf_attribute15,
104 	clf_attribute16,
105 	clf_attribute17,
106 	clf_attribute18,
107 	clf_attribute19,
108 	clf_attribute20,
109 	clf_attribute21,
113 	clf_attribute25,
110 	clf_attribute22,
111 	clf_attribute23,
112 	clf_attribute24,
114 	clf_attribute26,
115 	clf_attribute27,
116 	clf_attribute28,
117 	clf_attribute29,
118 	clf_attribute30,
119 	object_version_number,
120     sttd_sal_prdcty_cd
121   )
122   Values
123   (	p_rec.comp_lvl_fctr_id,
124 	p_rec.business_group_id,
125 	p_rec.name,
126         p_rec.comp_lvl_det_cd,
127         p_rec.comp_lvl_det_rl,
128 	p_rec.comp_lvl_uom,
129 	p_rec.comp_src_cd,
130 	p_rec.defined_balance_id,
131 	p_rec.no_mn_comp_flag,
132 	p_rec.no_mx_comp_flag,
133 	p_rec.mx_comp_val,
134 	p_rec.mn_comp_val,
135 	p_rec.rndg_cd,
136 	p_rec.rndg_rl,
137         p_rec.bnfts_bal_id,
138         p_rec.comp_alt_val_to_use_cd,
139         p_rec.comp_calc_rl,
140   p_rec.proration_flag,
141   p_rec.start_day_mo,
142   p_rec.end_day_mo,
143   p_rec.start_year,
144   p_rec.end_year,
145 	p_rec.clf_attribute_category,
146 	p_rec.clf_attribute1,
147 	p_rec.clf_attribute2,
148 	p_rec.clf_attribute3,
149 	p_rec.clf_attribute4,
150 	p_rec.clf_attribute5,
151 	p_rec.clf_attribute6,
152 	p_rec.clf_attribute7,
153 	p_rec.clf_attribute8,
154 	p_rec.clf_attribute9,
155 	p_rec.clf_attribute10,
156 	p_rec.clf_attribute11,
157 	p_rec.clf_attribute12,
158 	p_rec.clf_attribute13,
159 	p_rec.clf_attribute14,
160 	p_rec.clf_attribute15,
161 	p_rec.clf_attribute16,
162 	p_rec.clf_attribute17,
163 	p_rec.clf_attribute18,
164 	p_rec.clf_attribute19,
165 	p_rec.clf_attribute20,
166 	p_rec.clf_attribute21,
167 	p_rec.clf_attribute22,
168 	p_rec.clf_attribute23,
169 	p_rec.clf_attribute24,
170 	p_rec.clf_attribute25,
171 	p_rec.clf_attribute26,
172 	p_rec.clf_attribute27,
173 	p_rec.clf_attribute28,
174 	p_rec.clf_attribute29,
175 	p_rec.clf_attribute30,
176 	p_rec.object_version_number,
177     p_rec.sttd_sal_prdcty_cd
178   );
179   --
180   ben_clf_shd.g_api_dml := false;   -- Unset the api dml status
181   --
182   hr_utility.set_location(' Leaving:'||l_proc, 10);
183 Exception
184   When hr_api.check_integrity_violated Then
185     -- A check constraint has been violated
186     ben_clf_shd.g_api_dml := false;   -- Unset the api dml status
187     ben_clf_shd.constraint_error
188       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
189   When hr_api.parent_integrity_violated Then
190     -- Parent integrity has been violated
191     ben_clf_shd.g_api_dml := false;   -- Unset the api dml status
192     ben_clf_shd.constraint_error
193       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
194   When hr_api.unique_integrity_violated Then
195     -- Unique integrity has been violated
196     ben_clf_shd.g_api_dml := false;   -- Unset the api dml status
197     ben_clf_shd.constraint_error
198       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
199   When Others Then
200     ben_clf_shd.g_api_dml := false;   -- Unset the api dml status
201     Raise;
202 End insert_dml;
203 --
204 -- ----------------------------------------------------------------------------
205 -- |------------------------------< pre_insert >------------------------------|
206 -- ----------------------------------------------------------------------------
207 -- {Start Of Comments}
208 --
209 -- Description:
210 --   This private procedure contains any processing which is required before
211 --   the insert dml. Presently, if the entity has a corresponding primary
212 --   key which is maintained by an associating sequence, the primary key for
213 --   the entity will be populated with the next sequence value in
214 --   preparation for the insert dml.
215 --
216 -- Prerequisites:
217 --   This is an internal procedure which is called from the ins procedure.
218 --
219 -- In Parameters:
220 --   A Pl/Sql record structre.
221 --
222 -- Post Success:
223 --   Processing continues.
224 --
225 -- Post Failure:
226 --   If an error has occurred, an error message and exception will be raised
227 --   but not handled.
228 --
229 -- Developer Implementation Notes:
230 --   Any pre-processing required before the insert dml is issued should be
231 --   coded within this procedure. As stated above, a good example is the
232 --   generation of a primary key number via a corresponding sequence.
233 --   It is important to note that any 3rd party maintenance should be reviewed
234 --   before placing in this procedure.
235 --
236 -- Access Status:
237 --   Internal Row Handler Use Only.
238 --
239 -- {End Of Comments}
240 -- ----------------------------------------------------------------------------
241 Procedure pre_insert(p_rec  in out nocopy ben_clf_shd.g_rec_type) is
242 --
243   l_proc  varchar2(72) := g_package||'pre_insert';
244 --
245   Cursor C_Sel1 is select ben_comp_lvl_fctr_s.nextval from sys.dual;
246 --
247 Begin
248   hr_utility.set_location('Entering:'||l_proc, 5);
249   --
250   --
251   -- Select the next sequence number
252   --
253   Open C_Sel1;
254   Fetch C_Sel1 Into p_rec.comp_lvl_fctr_id;
255   Close C_Sel1;
256   --
257   hr_utility.set_location(' Leaving:'||l_proc, 10);
258 End pre_insert;
259 --
260 -- ----------------------------------------------------------------------------
261 -- |-----------------------------< post_insert >------------------------------|
262 -- ----------------------------------------------------------------------------
263 -- {Start Of Comments}
264 --
265 -- Description:
266 --   This private procedure contains any processing which is required after the
267 --   insert dml.
268 --
269 -- Prerequisites:
273 --   A Pl/Sql record structre.
270 --   This is an internal procedure which is called from the ins procedure.
271 --
272 -- In Parameters:
274 --
275 -- Post Success:
276 --   Processing continues.
277 --
278 -- Post Failure:
279 --   If an error has occurred, an error message and exception will be raised
280 --   but not handled.
281 --
282 -- Developer Implementation Notes:
283 --   Any post-processing required after the insert dml is issued should be
284 --   coded within this procedure. It is important to note that any 3rd party
285 --   maintenance should be reviewed before placing in this procedure.
286 --
287 -- Access Status:
288 --   Internal Row Handler Use Only.
289 --
290 -- {End Of Comments}
291 -- ----------------------------------------------------------------------------
292 Procedure post_insert(
293 p_effective_date in date,p_rec in ben_clf_shd.g_rec_type) is
294 --
295   l_proc  varchar2(72) := g_package||'post_insert';
296 --
297 Begin
298   hr_utility.set_location('Entering:'||l_proc, 5);
299 --
300   --
301   -- Start of API User Hook for post_insert.
302   --
303   begin
304     --
305     ben_clf_rki.after_insert
306       (
307   p_comp_lvl_fctr_id              =>p_rec.comp_lvl_fctr_id
308  ,p_business_group_id             =>p_rec.business_group_id
309  ,p_name                          =>p_rec.name
310  ,p_comp_lvl_det_cd               =>p_rec.comp_lvl_det_cd
311  ,p_comp_lvl_det_rl               =>p_rec.comp_lvl_det_rl
312  ,p_comp_lvl_uom                  =>p_rec.comp_lvl_uom
313  ,p_comp_src_cd                   =>p_rec.comp_src_cd
314  ,p_defined_balance_id            =>p_rec.defined_balance_id
315  ,p_no_mn_comp_flag               =>p_rec.no_mn_comp_flag
316  ,p_no_mx_comp_flag               =>p_rec.no_mx_comp_flag
317  ,p_mx_comp_val                   =>p_rec.mx_comp_val
318  ,p_mn_comp_val                   =>p_rec.mn_comp_val
319  ,p_rndg_cd                       =>p_rec.rndg_cd
320  ,p_rndg_rl                       =>p_rec.rndg_rl
321  ,p_bnfts_bal_id                  =>p_rec.bnfts_bal_id
322  ,p_comp_alt_val_to_use_cd        =>p_rec.comp_alt_val_to_use_cd
323  ,p_comp_calc_rl                  =>p_rec.comp_calc_rl
324  ,p_proration_flag                =>p_rec.proration_flag
325  , p_start_day_mo                 =>p_rec.start_day_mo
326  , p_end_day_mo                   =>p_rec.end_day_mo
327  , p_start_year                   =>p_rec.start_year
328  , p_end_year                     =>p_rec.end_year
329  ,p_clf_attribute_category        =>p_rec.clf_attribute_category
330  ,p_clf_attribute1                =>p_rec.clf_attribute1
331  ,p_clf_attribute2                =>p_rec.clf_attribute2
332  ,p_clf_attribute3                =>p_rec.clf_attribute3
333  ,p_clf_attribute4                =>p_rec.clf_attribute4
334  ,p_clf_attribute5                =>p_rec.clf_attribute5
335  ,p_clf_attribute6                =>p_rec.clf_attribute6
336  ,p_clf_attribute7                =>p_rec.clf_attribute7
337  ,p_clf_attribute8                =>p_rec.clf_attribute8
338  ,p_clf_attribute9                =>p_rec.clf_attribute9
339  ,p_clf_attribute10               =>p_rec.clf_attribute10
340  ,p_clf_attribute11               =>p_rec.clf_attribute11
341  ,p_clf_attribute12               =>p_rec.clf_attribute12
342  ,p_clf_attribute13               =>p_rec.clf_attribute13
343  ,p_clf_attribute14               =>p_rec.clf_attribute14
344  ,p_clf_attribute15               =>p_rec.clf_attribute15
345  ,p_clf_attribute16               =>p_rec.clf_attribute16
346  ,p_clf_attribute17               =>p_rec.clf_attribute17
347  ,p_clf_attribute18               =>p_rec.clf_attribute18
348  ,p_clf_attribute19               =>p_rec.clf_attribute19
349  ,p_clf_attribute20               =>p_rec.clf_attribute20
350  ,p_clf_attribute21               =>p_rec.clf_attribute21
351  ,p_clf_attribute22               =>p_rec.clf_attribute22
352  ,p_clf_attribute23               =>p_rec.clf_attribute23
353  ,p_clf_attribute24               =>p_rec.clf_attribute24
354  ,p_clf_attribute25               =>p_rec.clf_attribute25
355  ,p_clf_attribute26               =>p_rec.clf_attribute26
356  ,p_clf_attribute27               =>p_rec.clf_attribute27
357  ,p_clf_attribute28               =>p_rec.clf_attribute28
358  ,p_clf_attribute29               =>p_rec.clf_attribute29
359  ,p_clf_attribute30               =>p_rec.clf_attribute30
360  ,p_object_version_number         =>p_rec.object_version_number
361  ,p_effective_date                =>p_effective_date
362  ,p_sttd_sal_prdcty_cd            =>p_rec.sttd_sal_prdcty_cd
363       );
364     --
365   exception
366     --
367     when hr_api.cannot_find_prog_unit then
368       --
369       hr_api.cannot_find_prog_unit_error
370         (p_module_name => 'ben_comp_lvl_fctr'
371         ,p_hook_type   => 'AI');
372       --
373   end;
374   --
375   -- End of API User Hook for post_insert.
376   --
377   --
378   hr_utility.set_location(' Leaving:'||l_proc, 10);
379 End post_insert;
380 --
381 -- ----------------------------------------------------------------------------
382 -- |---------------------------------< ins >----------------------------------|
383 -- ----------------------------------------------------------------------------
384 Procedure ins
385   (
386   p_effective_date in date,
387   p_rec        in out nocopy ben_clf_shd.g_rec_type
388   ) is
389 --
390   l_proc  varchar2(72) := g_package||'ins';
391 --
392 Begin
393   hr_utility.set_location('Entering:'||l_proc, 5);
394   --
395   -- Call the supporting insert validate operations
396   --
397   ben_clf_bus.insert_validate(p_rec
398   ,p_effective_date);
399   --
400   -- Call the supporting pre-insert operation
401   --
402   pre_insert(p_rec);
403   --
404   -- Insert the row
408   -- Call the supporting post-insert operation
405   --
406   insert_dml(p_rec);
407   --
409   --
410   post_insert(
411 p_effective_date,p_rec);
412 end ins;
413 --
414 -- ----------------------------------------------------------------------------
415 -- |---------------------------------< ins >----------------------------------|
416 -- ----------------------------------------------------------------------------
417 Procedure ins
418   (
419   p_effective_date in date,
420   p_comp_lvl_fctr_id             out nocopy number,
421   p_business_group_id            in number,
422   p_name                         in varchar2,
423   p_comp_lvl_det_cd              in varchar2         default null,
424   p_comp_lvl_det_rl              in number           default null,
425   p_comp_lvl_uom                 in varchar2         default null,
426   p_comp_src_cd                  in varchar2         default null,
427   p_defined_balance_id              in number           default null,
428   p_no_mn_comp_flag              in varchar2         default null,
429   p_no_mx_comp_flag              in varchar2         default null,
430   p_mx_comp_val                  in number           default null,
431   p_mn_comp_val                  in number           default null,
432   p_rndg_cd                      in varchar2         default null,
433   p_rndg_rl                      in number           default null,
434   p_bnfts_bal_id                 in number           default null,
435   p_comp_alt_val_to_use_cd       in varchar2         default null,
436   p_comp_calc_rl                 in number           default null,
437   p_proration_flag               in Varchar2         default 'N',
438   p_start_day_mo                 in Varchar2         default null,
439   p_end_day_mo                   in Varchar2         default null,
440   p_start_year                   in Varchar2         default null,
441   p_end_year                     in Varchar2         default null,
442   p_clf_attribute_category       in varchar2         default null,
443   p_clf_attribute1               in varchar2         default null,
444   p_clf_attribute2               in varchar2         default null,
445   p_clf_attribute3               in varchar2         default null,
446   p_clf_attribute4               in varchar2         default null,
447   p_clf_attribute5               in varchar2         default null,
448   p_clf_attribute6               in varchar2         default null,
449   p_clf_attribute7               in varchar2         default null,
450   p_clf_attribute8               in varchar2         default null,
451   p_clf_attribute9               in varchar2         default null,
452   p_clf_attribute10              in varchar2         default null,
453   p_clf_attribute11              in varchar2         default null,
454   p_clf_attribute12              in varchar2         default null,
455   p_clf_attribute13              in varchar2         default null,
456   p_clf_attribute14              in varchar2         default null,
457   p_clf_attribute15              in varchar2         default null,
458   p_clf_attribute16              in varchar2         default null,
459   p_clf_attribute17              in varchar2         default null,
460   p_clf_attribute18              in varchar2         default null,
461   p_clf_attribute19              in varchar2         default null,
462   p_clf_attribute20              in varchar2         default null,
463   p_clf_attribute21              in varchar2         default null,
464   p_clf_attribute22              in varchar2         default null,
465   p_clf_attribute23              in varchar2         default null,
466   p_clf_attribute24              in varchar2         default null,
467   p_clf_attribute25              in varchar2         default null,
468   p_clf_attribute26              in varchar2         default null,
469   p_clf_attribute27              in varchar2         default null,
470   p_clf_attribute28              in varchar2         default null,
471   p_clf_attribute29              in varchar2         default null,
472   p_clf_attribute30              in varchar2         default null,
473   p_object_version_number        out nocopy number,
474   p_sttd_sal_prdcty_cd           in varchar2         default null
475 
476   ) is
477 --
478   l_rec	  ben_clf_shd.g_rec_type;
479   l_proc  varchar2(72) := g_package||'ins';
480 --
481 Begin
482   hr_utility.set_location('Entering:'||l_proc, 5);
483   --
484   -- Call conversion function to turn arguments into the
485   -- p_rec structure.
486   --
487   l_rec :=
488   ben_clf_shd.convert_args
489   (
490   null,
491   p_business_group_id,
492   p_name,
493   p_comp_lvl_det_cd,
494   p_comp_lvl_det_rl,
495   p_comp_lvl_uom,
496   p_comp_src_cd,
497   p_defined_balance_id,
498   p_no_mn_comp_flag,
499   p_no_mx_comp_flag,
500   p_mx_comp_val,
501   p_mn_comp_val,
502   p_rndg_cd,
503   p_rndg_rl,
504   p_bnfts_bal_id,
505   p_comp_alt_val_to_use_cd,
506   p_comp_calc_rl,
507   p_proration_flag ,
508   p_start_day_mo ,
509   p_end_day_mo ,
510   p_start_year ,
511   p_end_year ,
512   p_clf_attribute_category,
513   p_clf_attribute1,
514   p_clf_attribute2,
515   p_clf_attribute3,
516   p_clf_attribute4,
517   p_clf_attribute5,
518   p_clf_attribute6,
519   p_clf_attribute7,
520   p_clf_attribute8,
521   p_clf_attribute9,
522   p_clf_attribute10,
523   p_clf_attribute11,
524   p_clf_attribute12,
525   p_clf_attribute13,
526   p_clf_attribute14,
527   p_clf_attribute15,
528   p_clf_attribute16,
529   p_clf_attribute17,
530   p_clf_attribute18,
531   p_clf_attribute19,
532   p_clf_attribute20,
533   p_clf_attribute21,
534   p_clf_attribute22,
535   p_clf_attribute23,
536   p_clf_attribute24,
537   p_clf_attribute25,
541   p_clf_attribute29,
538   p_clf_attribute26,
539   p_clf_attribute27,
540   p_clf_attribute28,
542   p_clf_attribute30,
543   null,
544   p_sttd_sal_prdcty_cd
545   );
546   --
547   -- Having converted the arguments into the ben_clf_rec
548   -- plsql record structure we call the corresponding record business process.
549   --
550   ins(
551     p_effective_date,l_rec);
552   --
553   -- As the primary key argument(s)
554   -- are specified as an OUT's we must set these values.
555   --
556   p_comp_lvl_fctr_id := l_rec.comp_lvl_fctr_id;
557   p_object_version_number := l_rec.object_version_number;
558   --
559   hr_utility.set_location(' Leaving:'||l_proc, 10);
560 End ins;
561 --
562 end ben_clf_ins;