DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PIL_INS

Source


1 Package Body ben_pil_ins as
2 /* $Header: bepilrhi.pkb 120.4 2011/09/02 10:55:27 pvelvano ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pil_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_pil_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_pil_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_per_in_ler
64   --
65   insert into ben_per_in_ler
66   (	per_in_ler_id,
67 	per_in_ler_stat_cd,
68 	prvs_stat_cd,
69 	lf_evt_ocrd_dt,
70         trgr_table_pk_id,
71 	procd_dt,
72 	strtd_dt,
73 	voidd_dt,
74 	bckt_dt,
75 	clsd_dt,
76 	ntfn_dt,
77 	ptnl_ler_for_per_id,
78 	bckt_per_in_ler_id,
79 	ler_id,
80 	person_id,
81 	business_group_id,
82         ASSIGNMENT_ID,
83         WS_MGR_ID,
84         GROUP_PL_ID,
85         MGR_OVRID_PERSON_ID,
86         MGR_OVRID_DT,
87 	pil_attribute_category,
88 	pil_attribute1,
89 	pil_attribute2,
90 	pil_attribute3,
91 	pil_attribute4,
92 	pil_attribute5,
93 	pil_attribute6,
94 	pil_attribute7,
95 	pil_attribute8,
96 	pil_attribute9,
97 	pil_attribute10,
98 	pil_attribute11,
99 	pil_attribute12,
100 	pil_attribute13,
101 	pil_attribute14,
102 	pil_attribute15,
103 	pil_attribute16,
104 	pil_attribute17,
105 	pil_attribute18,
106 	pil_attribute19,
107 	pil_attribute20,
108 	pil_attribute21,
109 	pil_attribute22,
110 	pil_attribute23,
111 	pil_attribute24,
112 	pil_attribute25,
113 	pil_attribute26,
114 	pil_attribute27,
115 	pil_attribute28,
116 	pil_attribute29,
117 	pil_attribute30,
118 	request_id,
119 	program_application_id,
120 	program_id,
121 	program_update_date,
122 	object_version_number
123   )
124   Values
125   (	p_rec.per_in_ler_id,
126 	p_rec.per_in_ler_stat_cd,
127 	p_rec.prvs_stat_cd,
128 	p_rec.lf_evt_ocrd_dt,
129         p_rec.trgr_table_pk_id,
130 	p_rec.procd_dt,
131 	p_rec.strtd_dt,
132 	p_rec.voidd_dt,
133 	p_rec.bckt_dt,
134 	p_rec.clsd_dt,
135 	p_rec.ntfn_dt,
136 	p_rec.ptnl_ler_for_per_id,
137 	p_rec.bckt_per_in_ler_id,
138 	p_rec.ler_id,
139 	p_rec.person_id,
140 	p_rec.business_group_id,
141         p_rec.ASSIGNMENT_ID,
142         p_rec.WS_MGR_ID,
143         p_rec.GROUP_PL_ID,
144         p_rec.MGR_OVRID_PERSON_ID,
145         p_rec.MGR_OVRID_DT,
146 	p_rec.pil_attribute_category,
147 	p_rec.pil_attribute1,
148 	p_rec.pil_attribute2,
149 	p_rec.pil_attribute3,
150 	p_rec.pil_attribute4,
151 	p_rec.pil_attribute5,
152 	p_rec.pil_attribute6,
153 	p_rec.pil_attribute7,
154 	p_rec.pil_attribute8,
155 	p_rec.pil_attribute9,
156 	p_rec.pil_attribute10,
157 	p_rec.pil_attribute11,
158 	p_rec.pil_attribute12,
159 	p_rec.pil_attribute13,
160 	p_rec.pil_attribute14,
161 	p_rec.pil_attribute15,
162 	p_rec.pil_attribute16,
163 	p_rec.pil_attribute17,
164 	p_rec.pil_attribute18,
165 	p_rec.pil_attribute19,
166 	p_rec.pil_attribute20,
167 	p_rec.pil_attribute21,
168 	p_rec.pil_attribute22,
169 	p_rec.pil_attribute23,
170 	p_rec.pil_attribute24,
171 	p_rec.pil_attribute25,
172 	p_rec.pil_attribute26,
173 	p_rec.pil_attribute27,
174 	p_rec.pil_attribute28,
175 	p_rec.pil_attribute29,
176 	p_rec.pil_attribute30,
177 	p_rec.request_id,
178 	p_rec.program_application_id,
179 	p_rec.program_id,
180 	p_rec.program_update_date,
181 	p_rec.object_version_number
182   );
183   --
184   ben_pil_shd.g_api_dml := false;   -- Unset the api dml status
185   --
186   hr_utility.set_location(' Leaving:'||l_proc, 10);
187 Exception
188   When hr_api.check_integrity_violated Then
189     -- A check constraint has been violated
190     ben_pil_shd.g_api_dml := false;   -- Unset the api dml status
191     ben_pil_shd.constraint_error
192       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
193   When hr_api.parent_integrity_violated Then
194     -- Parent integrity has been violated
195     ben_pil_shd.g_api_dml := false;   -- Unset the api dml status
196     ben_pil_shd.constraint_error
197       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
198   When hr_api.unique_integrity_violated Then
199     -- Unique integrity has been violated
200     ben_pil_shd.g_api_dml := false;   -- Unset the api dml status
201     ben_pil_shd.constraint_error
202       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
203   When Others Then
204     ben_pil_shd.g_api_dml := false;   -- Unset the api dml status
205     Raise;
206 End insert_dml;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |------------------------------< pre_insert >------------------------------|
210 -- ----------------------------------------------------------------------------
211 -- {Start Of Comments}
212 --
213 -- Description:
214 --   This private procedure contains any processing which is required before
215 --   the insert dml. Presently, if the entity has a corresponding primary
216 --   key which is maintained by an associating sequence, the primary key for
217 --   the entity will be populated with the next sequence value in
218 --   preparation for the insert dml.
219 --
220 -- Prerequisites:
221 --   This is an internal procedure which is called from the ins procedure.
222 --
223 -- In Parameters:
224 --   A Pl/Sql record structre.
225 --
226 -- Post Success:
227 --   Processing continues.
228 --
229 -- Post Failure:
230 --   If an error has occurred, an error message and exception will be raised
231 --   but not handled.
232 --
233 -- Developer Implementation Notes:
234 --   Any pre-processing required before the insert dml is issued should be
235 --   coded within this procedure. As stated above, a good example is the
236 --   generation of a primary key number via a corresponding sequence.
237 --   It is important to note that any 3rd party maintenance should be reviewed
238 --   before placing in this procedure.
239 --
240 -- Access Status:
241 --   Internal Row Handler Use Only.
242 --
243 -- {End Of Comments}
244 -- ----------------------------------------------------------------------------
245 Procedure pre_insert(p_rec  in out nocopy ben_pil_shd.g_rec_type) is
246 --
247   l_proc  varchar2(72) := g_package||'pre_insert';
248 --
249   Cursor C_Sel1 is select ben_per_in_ler_s.nextval from sys.dual;
250 --
251 Begin
252   hr_utility.set_location('Entering:'||l_proc, 5);
253   --
254   --
255   -- Select the next sequence number
256   --
257   Open C_Sel1;
258   Fetch C_Sel1 Into p_rec.per_in_ler_id;
259   Close C_Sel1;
260   --
261   hr_utility.set_location(' Leaving:'||l_proc, 10);
262 End pre_insert;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |-----------------------------< post_insert >------------------------------|
266 -- ----------------------------------------------------------------------------
267 -- {Start Of Comments}
268 --
269 -- Description:
270 --   This private procedure contains any processing which is required after the
271 --   insert dml.
272 --
273 -- Prerequisites:
274 --   This is an internal procedure which is called from the ins procedure.
275 --
276 -- In Parameters:
277 --   A Pl/Sql record structre.
278 --
279 -- Post Success:
280 --   Processing continues.
281 --
282 -- Post Failure:
283 --   If an error has occurred, an error message and exception will be raised
284 --   but not handled.
285 --
286 -- Developer Implementation Notes:
287 --   Any post-processing required after the insert dml is issued should be
288 --   coded within this procedure. It is important to note that any 3rd party
289 --   maintenance should be reviewed before placing in this procedure.
290 --
291 -- Access Status:
292 --   Internal Row Handler Use Only.
293 --
294 -- {End Of Comments}
295 -- ----------------------------------------------------------------------------
296 Procedure post_insert(
297 p_effective_date in date,p_rec in ben_pil_shd.g_rec_type) is
298 --
299   l_proc  varchar2(72) := g_package||'post_insert';
300 --
301 Begin
302   hr_utility.set_location('Entering:'||l_proc, 5);
303 --
304   --
305   -- Start of API User Hook for post_insert.
306   --
307   begin
308     --
309     ben_pil_rki.after_insert
310       (
311   p_per_in_ler_id                 =>p_rec.per_in_ler_id
312  ,p_per_in_ler_stat_cd            =>p_rec.per_in_ler_stat_cd
313  ,p_prvs_stat_cd                  =>p_rec.prvs_stat_cd
314  ,p_lf_evt_ocrd_dt                =>p_rec.lf_evt_ocrd_dt
315  ,p_trgr_table_pk_id              =>p_rec.trgr_table_pk_id
316  ,p_procd_dt                      =>p_rec.procd_dt
317  ,p_strtd_dt                      =>p_rec.strtd_dt
318  ,p_voidd_dt                      =>p_rec.voidd_dt
319  ,p_bckt_dt                       =>p_rec.bckt_dt
320  ,p_clsd_dt                       =>p_rec.clsd_dt
321  ,p_ntfn_dt                       =>p_rec.ntfn_dt
322  ,p_ptnl_ler_for_per_id           =>p_rec.ptnl_ler_for_per_id
323  ,p_bckt_per_in_ler_id            =>p_rec.bckt_per_in_ler_id
324  ,p_ler_id                        =>p_rec.ler_id
325  ,p_person_id                     =>p_rec.person_id
326  ,p_business_group_id             =>p_rec.business_group_id
327  ,p_ASSIGNMENT_ID                 =>  p_rec.ASSIGNMENT_ID
328  ,p_WS_MGR_ID                     =>  p_rec.WS_MGR_ID
329  ,p_GROUP_PL_ID                   =>  p_rec.GROUP_PL_ID
330  ,p_MGR_OVRID_PERSON_ID           =>  p_rec.MGR_OVRID_PERSON_ID
331  ,p_MGR_OVRID_DT                  =>  p_rec.MGR_OVRID_DT
332  ,p_pil_attribute_category        =>p_rec.pil_attribute_category
333  ,p_pil_attribute1                =>p_rec.pil_attribute1
334  ,p_pil_attribute2                =>p_rec.pil_attribute2
335  ,p_pil_attribute3                =>p_rec.pil_attribute3
336  ,p_pil_attribute4                =>p_rec.pil_attribute4
337  ,p_pil_attribute5                =>p_rec.pil_attribute5
338  ,p_pil_attribute6                =>p_rec.pil_attribute6
339  ,p_pil_attribute7                =>p_rec.pil_attribute7
340  ,p_pil_attribute8                =>p_rec.pil_attribute8
341  ,p_pil_attribute9                =>p_rec.pil_attribute9
342  ,p_pil_attribute10               =>p_rec.pil_attribute10
343  ,p_pil_attribute11               =>p_rec.pil_attribute11
344  ,p_pil_attribute12               =>p_rec.pil_attribute12
345  ,p_pil_attribute13               =>p_rec.pil_attribute13
346  ,p_pil_attribute14               =>p_rec.pil_attribute14
347  ,p_pil_attribute15               =>p_rec.pil_attribute15
348  ,p_pil_attribute16               =>p_rec.pil_attribute16
349  ,p_pil_attribute17               =>p_rec.pil_attribute17
350  ,p_pil_attribute18               =>p_rec.pil_attribute18
351  ,p_pil_attribute19               =>p_rec.pil_attribute19
352  ,p_pil_attribute20               =>p_rec.pil_attribute20
353  ,p_pil_attribute21               =>p_rec.pil_attribute21
354  ,p_pil_attribute22               =>p_rec.pil_attribute22
355  ,p_pil_attribute23               =>p_rec.pil_attribute23
356  ,p_pil_attribute24               =>p_rec.pil_attribute24
357  ,p_pil_attribute25               =>p_rec.pil_attribute25
358  ,p_pil_attribute26               =>p_rec.pil_attribute26
359  ,p_pil_attribute27               =>p_rec.pil_attribute27
360  ,p_pil_attribute28               =>p_rec.pil_attribute28
361  ,p_pil_attribute29               =>p_rec.pil_attribute29
362  ,p_pil_attribute30               =>p_rec.pil_attribute30
363  ,p_request_id                    =>p_rec.request_id
364  ,p_program_application_id        =>p_rec.program_application_id
365  ,p_program_id                    =>p_rec.program_id
366  ,p_program_update_date           =>p_rec.program_update_date
367  ,p_object_version_number         =>p_rec.object_version_number
368  ,p_effective_date                =>p_effective_date
369       );
370     --
371   exception
372     --
373     when hr_api.cannot_find_prog_unit then
374       --
375       hr_api.cannot_find_prog_unit_error
376         (p_module_name => 'ben_per_in_ler'
377         ,p_hook_type   => 'AI');
378       --
379   end;
380   --
381   -- End of API User Hook for post_insert.
382   --
383   --
384   hr_utility.set_location(' Leaving:'||l_proc, 10);
385 End post_insert;
386 --
387 -- ----------------------------------------------------------------------------
388 -- |---------------------------------< ins >----------------------------------|
389 -- ----------------------------------------------------------------------------
390 Procedure ins
391   (
392   p_effective_date in date,
393   p_rec        in out nocopy ben_pil_shd.g_rec_type
394   ) is
395 --
396   l_proc  varchar2(72) := g_package||'ins';
397 --
398 Begin
399   hr_utility.set_location('Entering:'||l_proc, 5);
400   --
401   -- Call the supporting insert validate operations
402   --
403   ben_pil_bus.insert_validate(p_rec
404   ,p_effective_date);
405   --
406   -- Call the supporting pre-insert operation
407   --
408   pre_insert(p_rec);
409   --
410   -- Insert the row
411   --
412   insert_dml(p_rec);
413   --
414   -- Call the supporting post-insert operation
415   --
416   post_insert(
417 p_effective_date,p_rec);
418 end ins;
419 --
420 -- ----------------------------------------------------------------------------
421 -- |---------------------------------< ins >----------------------------------|
422 -- ----------------------------------------------------------------------------
423 Procedure ins
424   (
425   p_effective_date in date,
426   p_per_in_ler_id                out nocopy number,
427   p_per_in_ler_stat_cd           in varchar2         default null,
428   p_prvs_stat_cd                 in varchar2         default null,
429   p_lf_evt_ocrd_dt               in date,
430   p_trgr_table_pk_id             in number           default null,
431   p_procd_dt                     in date             default null,
432   p_strtd_dt                     in date             default null,
433   p_voidd_dt                     in date             default null,
434   p_bckt_dt                      in date             default null,
435   p_clsd_dt                      in date             default null,
436   p_ntfn_dt                      in date             default null,
437   p_ptnl_ler_for_per_id          in number,
438   p_bckt_per_in_ler_id           in number,
439   p_ler_id                       in number,
440   p_person_id                    in number,
441   p_business_group_id            in number,
442   p_ASSIGNMENT_ID                  in  number    default null,
443   p_WS_MGR_ID                      in  number    default null,
444   p_GROUP_PL_ID                    in  number    default null,
445   p_MGR_OVRID_PERSON_ID            in  number    default null,
446   p_MGR_OVRID_DT                   in  date      default null,
447   p_pil_attribute_category       in varchar2         default null,
448   p_pil_attribute1               in varchar2         default null,
449   p_pil_attribute2               in varchar2         default null,
450   p_pil_attribute3               in varchar2         default null,
451   p_pil_attribute4               in varchar2         default null,
452   p_pil_attribute5               in varchar2         default null,
453   p_pil_attribute6               in varchar2         default null,
454   p_pil_attribute7               in varchar2         default null,
455   p_pil_attribute8               in varchar2         default null,
456   p_pil_attribute9               in varchar2         default null,
457   p_pil_attribute10              in varchar2         default null,
458   p_pil_attribute11              in varchar2         default null,
459   p_pil_attribute12              in varchar2         default null,
460   p_pil_attribute13              in varchar2         default null,
461   p_pil_attribute14              in varchar2         default null,
462   p_pil_attribute15              in varchar2         default null,
463   p_pil_attribute16              in varchar2         default null,
464   p_pil_attribute17              in varchar2         default null,
465   p_pil_attribute18              in varchar2         default null,
466   p_pil_attribute19              in varchar2         default null,
467   p_pil_attribute20              in varchar2         default null,
468   p_pil_attribute21              in varchar2         default null,
469   p_pil_attribute22              in varchar2         default null,
470   p_pil_attribute23              in varchar2         default null,
471   p_pil_attribute24              in varchar2         default null,
472   p_pil_attribute25              in varchar2         default null,
473   p_pil_attribute26              in varchar2         default null,
474   p_pil_attribute27              in varchar2         default null,
475   p_pil_attribute28              in varchar2         default null,
476   p_pil_attribute29              in varchar2         default null,
477   p_pil_attribute30              in varchar2         default null,
478   p_request_id                   in number           default null,
479   p_program_application_id       in number           default null,
480   p_program_id                   in number           default null,
481   p_program_update_date          in date             default null,
482   p_object_version_number        out nocopy number
483   ) is
484 --
485   l_rec	  ben_pil_shd.g_rec_type;
486   l_proc  varchar2(72) := g_package||'ins';
487 --
488 Begin
489   hr_utility.set_location('Entering:'||l_proc, 5);
490   --
491   -- Call conversion function to turn arguments into the
492   -- p_rec structure.
493   --
494   l_rec :=
495   ben_pil_shd.convert_args
496   (
497   null,
498   p_per_in_ler_stat_cd,
499   p_prvs_stat_cd,
500   p_lf_evt_ocrd_dt,
501   p_trgr_table_pk_id,
502   p_procd_dt,
503   p_strtd_dt,
504   p_voidd_dt,
505   p_bckt_dt,
506   p_clsd_dt,
507   p_ntfn_dt,
508   p_ptnl_ler_for_per_id,
509   p_bckt_per_in_ler_id ,
510   p_ler_id,
511   p_person_id,
512   p_business_group_id,
513     p_ASSIGNMENT_ID,
514     p_WS_MGR_ID,
515     p_GROUP_PL_ID,
516     p_MGR_OVRID_PERSON_ID,
517     p_MGR_OVRID_DT,
518   p_pil_attribute_category,
519   p_pil_attribute1,
520   p_pil_attribute2,
521   p_pil_attribute3,
522   p_pil_attribute4,
523   p_pil_attribute5,
524   p_pil_attribute6,
525   p_pil_attribute7,
526   p_pil_attribute8,
527   p_pil_attribute9,
528   p_pil_attribute10,
529   p_pil_attribute11,
530   p_pil_attribute12,
531   p_pil_attribute13,
532   p_pil_attribute14,
533   p_pil_attribute15,
534   p_pil_attribute16,
535   p_pil_attribute17,
536   p_pil_attribute18,
537   p_pil_attribute19,
538   p_pil_attribute20,
539   p_pil_attribute21,
540   p_pil_attribute22,
541   p_pil_attribute23,
542   p_pil_attribute24,
543   p_pil_attribute25,
544   p_pil_attribute26,
545   p_pil_attribute27,
546   p_pil_attribute28,
547   p_pil_attribute29,
548   p_pil_attribute30,
549   p_request_id,
550   p_program_application_id,
551   p_program_id,
552   p_program_update_date,
553   null
554   );
555   --
556   -- Having converted the arguments into the ben_pil_rec
557   -- plsql record structure we call the corresponding record business process.
558   --
559   ins(
560     p_effective_date,l_rec);
561   --
562   -- As the primary key argument(s)
563   -- are specified as an OUT's we must set these values.
564   --
565   p_per_in_ler_id := l_rec.per_in_ler_id;
566   p_object_version_number := l_rec.object_version_number;
567   --
568   hr_utility.set_location(' Leaving:'||l_proc, 10);
569 End ins;
570 --
571 end ben_pil_ins;