DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_HWF_INS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body ben_hwf_ins as
2 /* $Header: behwfrhi.pkb 120.0 2005/05/28 03:12:16 appldev noship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_hwf_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_hwf_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_hwf_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_hrs_wkd_in_perd_fctr
64   --
65   insert into ben_hrs_wkd_in_perd_fctr
66   (	hrs_wkd_in_perd_fctr_id,
67 	name,
68 	business_group_id,
69 	hrs_src_cd,
70 	rndg_cd,
71 	rndg_rl,
72 	hrs_wkd_det_cd,
73 	hrs_wkd_det_rl,
74 	no_mn_hrs_wkd_flag,
75 	mx_hrs_num,
76 	no_mx_hrs_wkd_flag,
77 	once_r_cntug_cd,
78 	mn_hrs_num,
79         hrs_alt_val_to_use_cd,
80         pyrl_freq_cd,
81         hrs_wkd_calc_rl,
82         defined_balance_id,
83         bnfts_bal_id,
84 	hwf_attribute_category,
85 	hwf_attribute1,
86 	hwf_attribute2,
87 	hwf_attribute3,
88 	hwf_attribute4,
89 	hwf_attribute5,
90 	hwf_attribute6,
91 	hwf_attribute7,
92 	hwf_attribute8,
93 	hwf_attribute9,
94 	hwf_attribute10,
95 	hwf_attribute11,
96 	hwf_attribute12,
97 	hwf_attribute13,
98 	hwf_attribute14,
99 	hwf_attribute15,
100 	hwf_attribute16,
101 	hwf_attribute17,
102 	hwf_attribute18,
103 	hwf_attribute19,
104 	hwf_attribute20,
105 	hwf_attribute21,
106 	hwf_attribute22,
107 	hwf_attribute23,
108 	hwf_attribute24,
109 	hwf_attribute25,
110 	hwf_attribute26,
111 	hwf_attribute27,
112 	hwf_attribute28,
113 	hwf_attribute29,
114 	hwf_attribute30,
115 	object_version_number
116   )
117   Values
118   (	p_rec.hrs_wkd_in_perd_fctr_id,
119 	p_rec.name,
120 	p_rec.business_group_id,
121 	p_rec.hrs_src_cd,
122 	p_rec.rndg_cd,
123 	p_rec.rndg_rl,
124 	p_rec.hrs_wkd_det_cd,
125 	p_rec.hrs_wkd_det_rl,
126 	p_rec.no_mn_hrs_wkd_flag,
127 	p_rec.mx_hrs_num,
128 	p_rec.no_mx_hrs_wkd_flag,
129 	p_rec.once_r_cntug_cd,
130 	p_rec.mn_hrs_num,
131         p_rec.hrs_alt_val_to_use_cd,
132         p_rec.pyrl_freq_cd,
133         p_rec.hrs_wkd_calc_rl,
134         p_rec.defined_balance_id,
135         p_rec.bnfts_bal_id,
136 	p_rec.hwf_attribute_category,
137 	p_rec.hwf_attribute1,
138 	p_rec.hwf_attribute2,
139 	p_rec.hwf_attribute3,
140 	p_rec.hwf_attribute4,
141 	p_rec.hwf_attribute5,
142 	p_rec.hwf_attribute6,
143 	p_rec.hwf_attribute7,
144 	p_rec.hwf_attribute8,
145 	p_rec.hwf_attribute9,
146 	p_rec.hwf_attribute10,
147 	p_rec.hwf_attribute11,
148 	p_rec.hwf_attribute12,
149 	p_rec.hwf_attribute13,
150 	p_rec.hwf_attribute14,
151 	p_rec.hwf_attribute15,
152 	p_rec.hwf_attribute16,
153 	p_rec.hwf_attribute17,
154 	p_rec.hwf_attribute18,
158 	p_rec.hwf_attribute22,
155 	p_rec.hwf_attribute19,
156 	p_rec.hwf_attribute20,
157 	p_rec.hwf_attribute21,
159 	p_rec.hwf_attribute23,
160 	p_rec.hwf_attribute24,
161 	p_rec.hwf_attribute25,
162 	p_rec.hwf_attribute26,
163 	p_rec.hwf_attribute27,
164 	p_rec.hwf_attribute28,
165 	p_rec.hwf_attribute29,
166 	p_rec.hwf_attribute30,
167 	p_rec.object_version_number
168   );
169   --
170   ben_hwf_shd.g_api_dml := false;   -- Unset the api dml status
171   --
172   hr_utility.set_location(' Leaving:'||l_proc, 10);
173 Exception
174   When hr_api.check_integrity_violated Then
175     -- A check constraint has been violated
176     ben_hwf_shd.g_api_dml := false;   -- Unset the api dml status
177     ben_hwf_shd.constraint_error
178       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
179   When hr_api.parent_integrity_violated Then
180     -- Parent integrity has been violated
181     ben_hwf_shd.g_api_dml := false;   -- Unset the api dml status
182     ben_hwf_shd.constraint_error
183       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
184   When hr_api.unique_integrity_violated Then
185     -- Unique integrity has been violated
186     ben_hwf_shd.g_api_dml := false;   -- Unset the api dml status
187     ben_hwf_shd.constraint_error
188       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
189   When Others Then
190     ben_hwf_shd.g_api_dml := false;   -- Unset the api dml status
191     Raise;
192 End insert_dml;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |------------------------------< pre_insert >------------------------------|
196 -- ----------------------------------------------------------------------------
197 -- {Start Of Comments}
198 --
199 -- Description:
200 --   This private procedure contains any processing which is required before
201 --   the insert dml. Presently, if the entity has a corresponding primary
202 --   key which is maintained by an associating sequence, the primary key for
203 --   the entity will be populated with the next sequence value in
204 --   preparation for the insert dml.
205 --
206 -- Prerequisites:
207 --   This is an internal procedure which is called from the ins procedure.
208 --
209 -- In Parameters:
210 --   A Pl/Sql record structre.
211 --
212 -- Post Success:
213 --   Processing continues.
214 --
215 -- Post Failure:
216 --   If an error has occurred, an error message and exception will be raised
217 --   but not handled.
218 --
219 -- Developer Implementation Notes:
220 --   Any pre-processing required before the insert dml is issued should be
221 --   coded within this procedure. As stated above, a good example is the
222 --   generation of a primary key number via a corresponding sequence.
223 --   It is important to note that any 3rd party maintenance should be reviewed
224 --   before placing in this procedure.
225 --
226 -- Access Status:
227 --   Internal Row Handler Use Only.
228 --
229 -- {End Of Comments}
230 -- ----------------------------------------------------------------------------
231 Procedure pre_insert(p_rec  in out nocopy ben_hwf_shd.g_rec_type) is
232 --
233   l_proc  varchar2(72) := g_package||'pre_insert';
234 --
235   Cursor C_Sel1 is select ben_hrs_wkd_in_perd_fctr_s.nextval from sys.dual;
236 --
237 Begin
238   hr_utility.set_location('Entering:'||l_proc, 5);
239   --
240   --
241   -- Select the next sequence number
242   --
243   Open C_Sel1;
244   Fetch C_Sel1 Into p_rec.hrs_wkd_in_perd_fctr_id;
245   Close C_Sel1;
246   --
247   hr_utility.set_location(' Leaving:'||l_proc, 10);
248 End pre_insert;
249 --
250 -- ----------------------------------------------------------------------------
251 -- |-----------------------------< post_insert >------------------------------|
252 -- ----------------------------------------------------------------------------
253 -- {Start Of Comments}
254 --
255 -- Description:
256 --   This private procedure contains any processing which is required after the
257 --   insert dml.
258 --
259 -- Prerequisites:
260 --   This is an internal procedure which is called from the ins procedure.
261 --
262 -- In Parameters:
263 --   A Pl/Sql record structre.
264 --
265 -- Post Success:
266 --   Processing continues.
267 --
268 -- Post Failure:
269 --   If an error has occurred, an error message and exception will be raised
270 --   but not handled.
271 --
272 -- Developer Implementation Notes:
273 --   Any post-processing required after the insert dml is issued should be
274 --   coded within this procedure. It is important to note that any 3rd party
275 --   maintenance should be reviewed before placing in this procedure.
276 --
277 -- Access Status:
278 --   Internal Row Handler Use Only.
279 --
280 -- {End Of Comments}
281 -- ----------------------------------------------------------------------------
282 Procedure post_insert(
283 p_effective_date in date,p_rec in ben_hwf_shd.g_rec_type) is
284 --
285   l_proc  varchar2(72) := g_package||'post_insert';
286 --
287 Begin
288   hr_utility.set_location('Entering:'||l_proc, 5);
289 --
290   --
291   -- Start of API User Hook for post_insert.
292   --
293   begin
294     --
295     ben_hwf_rki.after_insert
296       (
297   p_hrs_wkd_in_perd_fctr_id       =>p_rec.hrs_wkd_in_perd_fctr_id
298  ,p_name                          =>p_rec.name
299  ,p_business_group_id             =>p_rec.business_group_id
300  ,p_hrs_src_cd                    =>p_rec.hrs_src_cd
301  ,p_rndg_cd                       =>p_rec.rndg_cd
302  ,p_rndg_rl                       =>p_rec.rndg_rl
303  ,p_hrs_wkd_det_cd                =>p_rec.hrs_wkd_det_cd
304  ,p_hrs_wkd_det_rl                =>p_rec.hrs_wkd_det_rl
305  ,p_no_mn_hrs_wkd_flag            =>p_rec.no_mn_hrs_wkd_flag
306  ,p_mx_hrs_num                    =>p_rec.mx_hrs_num
310  ,p_hrs_alt_val_to_use_cd         =>p_rec.hrs_alt_val_to_use_cd
307  ,p_no_mx_hrs_wkd_flag            =>p_rec.no_mx_hrs_wkd_flag
308  ,p_once_r_cntug_cd               =>p_rec.once_r_cntug_cd
309  ,p_mn_hrs_num                    =>p_rec.mn_hrs_num
311  ,p_pyrl_freq_cd                  =>p_rec.pyrl_freq_cd
312  ,p_hrs_wkd_calc_rl               =>p_rec.hrs_wkd_calc_rl
313  ,p_defined_balance_id            =>p_rec.defined_balance_id
314  ,p_bnfts_bal_id                  =>p_rec.bnfts_bal_id
315  ,p_hwf_attribute_category        =>p_rec.hwf_attribute_category
316  ,p_hwf_attribute1                =>p_rec.hwf_attribute1
317  ,p_hwf_attribute2                =>p_rec.hwf_attribute2
318  ,p_hwf_attribute3                =>p_rec.hwf_attribute3
319  ,p_hwf_attribute4                =>p_rec.hwf_attribute4
320  ,p_hwf_attribute5                =>p_rec.hwf_attribute5
321  ,p_hwf_attribute6                =>p_rec.hwf_attribute6
322  ,p_hwf_attribute7                =>p_rec.hwf_attribute7
323  ,p_hwf_attribute8                =>p_rec.hwf_attribute8
324  ,p_hwf_attribute9                =>p_rec.hwf_attribute9
325  ,p_hwf_attribute10               =>p_rec.hwf_attribute10
326  ,p_hwf_attribute11               =>p_rec.hwf_attribute11
327  ,p_hwf_attribute12               =>p_rec.hwf_attribute12
328  ,p_hwf_attribute13               =>p_rec.hwf_attribute13
329  ,p_hwf_attribute14               =>p_rec.hwf_attribute14
330  ,p_hwf_attribute15               =>p_rec.hwf_attribute15
331  ,p_hwf_attribute16               =>p_rec.hwf_attribute16
332  ,p_hwf_attribute17               =>p_rec.hwf_attribute17
333  ,p_hwf_attribute18               =>p_rec.hwf_attribute18
334  ,p_hwf_attribute19               =>p_rec.hwf_attribute19
335  ,p_hwf_attribute20               =>p_rec.hwf_attribute20
336  ,p_hwf_attribute21               =>p_rec.hwf_attribute21
337  ,p_hwf_attribute22               =>p_rec.hwf_attribute22
338  ,p_hwf_attribute23               =>p_rec.hwf_attribute23
339  ,p_hwf_attribute24               =>p_rec.hwf_attribute24
340  ,p_hwf_attribute25               =>p_rec.hwf_attribute25
341  ,p_hwf_attribute26               =>p_rec.hwf_attribute26
342  ,p_hwf_attribute27               =>p_rec.hwf_attribute27
343  ,p_hwf_attribute28               =>p_rec.hwf_attribute28
344  ,p_hwf_attribute29               =>p_rec.hwf_attribute29
345  ,p_hwf_attribute30               =>p_rec.hwf_attribute30
346  ,p_object_version_number         =>p_rec.object_version_number
347  ,p_effective_date                =>p_effective_date
348       );
349     --
350   exception
351     --
352     when hr_api.cannot_find_prog_unit then
353       --
354       hr_api.cannot_find_prog_unit_error
355         (p_module_name => 'ben_hrs_wkd_in_perd_fctr'
356         ,p_hook_type   => 'AI');
357       --
358   end;
359   --
360   -- End of API User Hook for post_insert.
361   --
362   --
363   hr_utility.set_location(' Leaving:'||l_proc, 10);
364 End post_insert;
365 --
366 -- ----------------------------------------------------------------------------
367 -- |---------------------------------< ins >----------------------------------|
368 -- ----------------------------------------------------------------------------
369 Procedure ins
370   (
371   p_effective_date in date,
372   p_rec        in out nocopy ben_hwf_shd.g_rec_type
373   ) is
374 --
375   l_proc  varchar2(72) := g_package||'ins';
376 --
377 Begin
378   hr_utility.set_location('Entering:'||l_proc, 5);
379   --
380   -- Call the supporting insert validate operations
381   --
382   ben_hwf_bus.insert_validate(p_rec
383   ,p_effective_date);
384   --
385   -- Call the supporting pre-insert operation
386   --
387   pre_insert(p_rec);
388   --
389   -- Insert the row
390   --
391   insert_dml(p_rec);
392   --
393   -- Call the supporting post-insert operation
394   --
395   post_insert(
396 p_effective_date,p_rec);
397 end ins;
398 --
399 -- ----------------------------------------------------------------------------
400 -- |---------------------------------< ins >----------------------------------|
401 -- ----------------------------------------------------------------------------
402 Procedure ins
403   (
404   p_effective_date in date,
405   p_hrs_wkd_in_perd_fctr_id      out nocopy number,
406   p_name                         in varchar2,
407   p_business_group_id            in number,
408   p_hrs_src_cd                   in varchar2         default null,
409   p_rndg_cd                      in varchar2         default null,
410   p_rndg_rl                      in number           default null,
411   p_hrs_wkd_det_cd               in varchar2         default null,
412   p_hrs_wkd_det_rl               in number           default null,
413   p_no_mn_hrs_wkd_flag           in varchar2         default null,
414   p_mx_hrs_num                   in number           default null,
415   p_no_mx_hrs_wkd_flag           in varchar2         default null,
416   p_once_r_cntug_cd              in varchar2         default null,
417   p_mn_hrs_num                   in number           default null,
418   p_hrs_alt_val_to_use_cd        in varchar2         default null,
419   p_pyrl_freq_cd                 in varchar2         default null,
420   p_hrs_wkd_calc_rl              in number           default null,
421   p_defined_balance_id           in number           default null,
422   p_bnfts_bal_id                 in number           default null,
423   p_hwf_attribute_category       in varchar2         default null,
424   p_hwf_attribute1               in varchar2         default null,
425   p_hwf_attribute2               in varchar2         default null,
426   p_hwf_attribute3               in varchar2         default null,
427   p_hwf_attribute4               in varchar2         default null,
428   p_hwf_attribute5               in varchar2         default null,
432   p_hwf_attribute9               in varchar2         default null,
429   p_hwf_attribute6               in varchar2         default null,
430   p_hwf_attribute7               in varchar2         default null,
431   p_hwf_attribute8               in varchar2         default null,
433   p_hwf_attribute10              in varchar2         default null,
434   p_hwf_attribute11              in varchar2         default null,
435   p_hwf_attribute12              in varchar2         default null,
436   p_hwf_attribute13              in varchar2         default null,
437   p_hwf_attribute14              in varchar2         default null,
438   p_hwf_attribute15              in varchar2         default null,
439   p_hwf_attribute16              in varchar2         default null,
440   p_hwf_attribute17              in varchar2         default null,
441   p_hwf_attribute18              in varchar2         default null,
442   p_hwf_attribute19              in varchar2         default null,
443   p_hwf_attribute20              in varchar2         default null,
444   p_hwf_attribute21              in varchar2         default null,
445   p_hwf_attribute22              in varchar2         default null,
446   p_hwf_attribute23              in varchar2         default null,
447   p_hwf_attribute24              in varchar2         default null,
448   p_hwf_attribute25              in varchar2         default null,
449   p_hwf_attribute26              in varchar2         default null,
450   p_hwf_attribute27              in varchar2         default null,
451   p_hwf_attribute28              in varchar2         default null,
452   p_hwf_attribute29              in varchar2         default null,
453   p_hwf_attribute30              in varchar2         default null,
454   p_object_version_number        out nocopy number
455   ) is
456 --
457   l_rec	  ben_hwf_shd.g_rec_type;
458   l_proc  varchar2(72) := g_package||'ins';
459 --
460 Begin
461   hr_utility.set_location('Entering:'||l_proc, 5);
462   --
463   -- Call conversion function to turn arguments into the
464   -- p_rec structure.
465   --
466   l_rec :=
467   ben_hwf_shd.convert_args
468   (
469   null,
470   p_name,
471   p_business_group_id,
472   p_hrs_src_cd,
473   p_rndg_cd,
474   p_rndg_rl,
475   p_hrs_wkd_det_cd,
476   p_hrs_wkd_det_rl,
477   p_no_mn_hrs_wkd_flag,
478   p_mx_hrs_num,
479   p_no_mx_hrs_wkd_flag,
480   p_once_r_cntug_cd,
481   p_mn_hrs_num,
482   p_hrs_alt_val_to_use_cd,
483   p_pyrl_freq_cd,
484   p_hrs_wkd_calc_rl,
485   p_defined_balance_id,
486   p_bnfts_bal_id,
487   p_hwf_attribute_category,
488   p_hwf_attribute1,
489   p_hwf_attribute2,
490   p_hwf_attribute3,
491   p_hwf_attribute4,
492   p_hwf_attribute5,
493   p_hwf_attribute6,
494   p_hwf_attribute7,
495   p_hwf_attribute8,
496   p_hwf_attribute9,
497   p_hwf_attribute10,
498   p_hwf_attribute11,
499   p_hwf_attribute12,
500   p_hwf_attribute13,
501   p_hwf_attribute14,
502   p_hwf_attribute15,
503   p_hwf_attribute16,
504   p_hwf_attribute17,
505   p_hwf_attribute18,
506   p_hwf_attribute19,
507   p_hwf_attribute20,
508   p_hwf_attribute21,
509   p_hwf_attribute22,
510   p_hwf_attribute23,
511   p_hwf_attribute24,
512   p_hwf_attribute25,
513   p_hwf_attribute26,
514   p_hwf_attribute27,
515   p_hwf_attribute28,
516   p_hwf_attribute29,
517   p_hwf_attribute30,
518   null
519   );
520   --
521   -- Having converted the arguments into the ben_hwf_rec
522   -- plsql record structure we call the corresponding record business process.
523   --
524   ins(
525     p_effective_date,l_rec);
526   --
527   -- As the primary key argument(s)
528   -- are specified as an OUT's we must set these values.
529   --
530   p_hrs_wkd_in_perd_fctr_id := l_rec.hrs_wkd_in_perd_fctr_id;
531   p_object_version_number := l_rec.object_version_number;
532   --
533   hr_utility.set_location(' Leaving:'||l_proc, 10);
534 End ins;
535 --
536 end ben_hwf_ins;