DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CRP_INS

Source


1 Package Body ben_crp_ins as
2 /* $Header: becrprhi.pkb 115.4 2002/12/16 11:04:00 rpgupta ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_crp_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_crp_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_crp_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_cbr_per_in_ler
64   --
65   insert into ben_cbr_per_in_ler
66   (	cbr_per_in_ler_id,
67 	init_evt_flag,
68 	cnt_num,
69 	per_in_ler_id,
70 	cbr_quald_bnf_id,
71 	prvs_elig_perd_end_dt,
72 	business_group_id,
73 	crp_attribute_category,
74 	crp_attribute1,
75 	crp_attribute2,
76 	crp_attribute3,
77 	crp_attribute4,
78 	crp_attribute5,
79 	crp_attribute6,
80 	crp_attribute7,
81 	crp_attribute8,
82 	crp_attribute9,
83 	crp_attribute10,
84 	crp_attribute11,
85 	crp_attribute12,
86 	crp_attribute13,
87 	crp_attribute14,
88 	crp_attribute15,
89 	crp_attribute16,
90 	crp_attribute17,
91 	crp_attribute18,
92 	crp_attribute19,
93 	crp_attribute20,
94 	crp_attribute21,
95 	crp_attribute22,
96 	crp_attribute23,
97 	crp_attribute24,
98 	crp_attribute25,
99 	crp_attribute26,
100 	crp_attribute27,
101 	crp_attribute28,
102 	crp_attribute29,
103 	crp_attribute30,
104 	object_version_number
105   )
106   Values
107   (	p_rec.cbr_per_in_ler_id,
108 	p_rec.init_evt_flag,
109 	p_rec.cnt_num,
110 	p_rec.per_in_ler_id,
111 	p_rec.cbr_quald_bnf_id,
112 	p_rec.prvs_elig_perd_end_dt,
113 	p_rec.business_group_id,
114 	p_rec.crp_attribute_category,
115 	p_rec.crp_attribute1,
116 	p_rec.crp_attribute2,
117 	p_rec.crp_attribute3,
118 	p_rec.crp_attribute4,
119 	p_rec.crp_attribute5,
120 	p_rec.crp_attribute6,
121 	p_rec.crp_attribute7,
122 	p_rec.crp_attribute8,
123 	p_rec.crp_attribute9,
124 	p_rec.crp_attribute10,
125 	p_rec.crp_attribute11,
126 	p_rec.crp_attribute12,
127 	p_rec.crp_attribute13,
128 	p_rec.crp_attribute14,
129 	p_rec.crp_attribute15,
130 	p_rec.crp_attribute16,
131 	p_rec.crp_attribute17,
132 	p_rec.crp_attribute18,
133 	p_rec.crp_attribute19,
134 	p_rec.crp_attribute20,
135 	p_rec.crp_attribute21,
136 	p_rec.crp_attribute22,
137 	p_rec.crp_attribute23,
138 	p_rec.crp_attribute24,
139 	p_rec.crp_attribute25,
140 	p_rec.crp_attribute26,
141 	p_rec.crp_attribute27,
142 	p_rec.crp_attribute28,
143 	p_rec.crp_attribute29,
144 	p_rec.crp_attribute30,
145 	p_rec.object_version_number
146   );
147   --
148   ben_crp_shd.g_api_dml := false;   -- Unset the api dml status
149   --
150   hr_utility.set_location(' Leaving:'||l_proc, 10);
151 Exception
152   When hr_api.check_integrity_violated Then
153     -- A check constraint has been violated
154     ben_crp_shd.g_api_dml := false;   -- Unset the api dml status
155     ben_crp_shd.constraint_error
156       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
157   When hr_api.parent_integrity_violated Then
158     -- Parent integrity has been violated
159     ben_crp_shd.g_api_dml := false;   -- Unset the api dml status
160     ben_crp_shd.constraint_error
161       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
162   When hr_api.unique_integrity_violated Then
163     -- Unique integrity has been violated
164     ben_crp_shd.g_api_dml := false;   -- Unset the api dml status
165     ben_crp_shd.constraint_error
166       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
167   When Others Then
168     ben_crp_shd.g_api_dml := false;   -- Unset the api dml status
169     Raise;
170 End insert_dml;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |------------------------------< pre_insert >------------------------------|
174 -- ----------------------------------------------------------------------------
175 -- {Start Of Comments}
176 --
177 -- Description:
178 --   This private procedure contains any processing which is required before
179 --   the insert dml. Presently, if the entity has a corresponding primary
180 --   key which is maintained by an associating sequence, the primary key for
181 --   the entity will be populated with the next sequence value in
182 --   preparation for the insert dml.
183 --
184 -- Prerequisites:
185 --   This is an internal procedure which is called from the ins procedure.
186 --
187 -- In Parameters:
188 --   A Pl/Sql record structre.
189 --
190 -- Post Success:
191 --   Processing continues.
192 --
193 -- Post Failure:
194 --   If an error has occurred, an error message and exception will be raised
195 --   but not handled.
196 --
197 -- Developer Implementation Notes:
198 --   Any pre-processing required before the insert dml is issued should be
199 --   coded within this procedure. As stated above, a good example is the
200 --   generation of a primary key number via a corresponding sequence.
201 --   It is important to note that any 3rd party maintenance should be reviewed
202 --   before placing in this procedure.
203 --
204 -- Access Status:
205 --   Internal Row Handler Use Only.
206 --
207 -- {End Of Comments}
208 -- ----------------------------------------------------------------------------
209 Procedure pre_insert(p_rec  in out nocopy ben_crp_shd.g_rec_type) is
210 --
211   l_proc  varchar2(72) := g_package||'pre_insert';
212 --
213   Cursor C_Sel1 is select ben_cbr_per_in_ler_s.nextval from sys.dual;
214 --
215 Begin
216   hr_utility.set_location('Entering:'||l_proc, 5);
217   --
218   --
219   -- Select the next sequence number
220   --
221   Open C_Sel1;
222   Fetch C_Sel1 Into p_rec.cbr_per_in_ler_id;
223   Close C_Sel1;
224   --
225   hr_utility.set_location(' Leaving:'||l_proc, 10);
226 End pre_insert;
227 --
228 -- ----------------------------------------------------------------------------
229 -- |-----------------------------< post_insert >------------------------------|
230 -- ----------------------------------------------------------------------------
231 -- {Start Of Comments}
232 --
233 -- Description:
234 --   This private procedure contains any processing which is required after the
235 --   insert dml.
236 --
237 -- Prerequisites:
238 --   This is an internal procedure which is called from the ins procedure.
239 --
240 -- In Parameters:
241 --   A Pl/Sql record structre.
242 --
243 -- Post Success:
244 --   Processing continues.
245 --
246 -- Post Failure:
247 --   If an error has occurred, an error message and exception will be raised
248 --   but not handled.
249 --
250 -- Developer Implementation Notes:
251 --   Any post-processing required after the insert dml is issued should be
252 --   coded within this procedure. It is important to note that any 3rd party
253 --   maintenance should be reviewed before placing in this procedure.
254 --
255 -- Access Status:
256 --   Internal Row Handler Use Only.
257 --
258 -- {End Of Comments}
259 -- ----------------------------------------------------------------------------
260 Procedure post_insert(
261 p_effective_date in date,p_rec in ben_crp_shd.g_rec_type) is
262 --
263   l_proc  varchar2(72) := g_package||'post_insert';
264 --
265 Begin
266   hr_utility.set_location('Entering:'||l_proc, 5);
267 --
268   --
269   -- Start of API User Hook for post_insert.
270   --
271   begin
272     --
273     ben_crp_rki.after_insert
274       (
275   p_cbr_per_in_ler_id             =>p_rec.cbr_per_in_ler_id
276  ,p_init_evt_flag                 =>p_rec.init_evt_flag
277  ,p_cnt_num                       =>p_rec.cnt_num
278  ,p_per_in_ler_id                 =>p_rec.per_in_ler_id
279  ,p_cbr_quald_bnf_id              =>p_rec.cbr_quald_bnf_id
280  ,p_prvs_elig_perd_end_dt         =>p_rec.prvs_elig_perd_end_dt
281  ,p_business_group_id             =>p_rec.business_group_id
282  ,p_crp_attribute_category        =>p_rec.crp_attribute_category
283  ,p_crp_attribute1                =>p_rec.crp_attribute1
284  ,p_crp_attribute2                =>p_rec.crp_attribute2
285  ,p_crp_attribute3                =>p_rec.crp_attribute3
286  ,p_crp_attribute4                =>p_rec.crp_attribute4
287  ,p_crp_attribute5                =>p_rec.crp_attribute5
288  ,p_crp_attribute6                =>p_rec.crp_attribute6
289  ,p_crp_attribute7                =>p_rec.crp_attribute7
290  ,p_crp_attribute8                =>p_rec.crp_attribute8
291  ,p_crp_attribute9                =>p_rec.crp_attribute9
292  ,p_crp_attribute10               =>p_rec.crp_attribute10
293  ,p_crp_attribute11               =>p_rec.crp_attribute11
294  ,p_crp_attribute12               =>p_rec.crp_attribute12
295  ,p_crp_attribute13               =>p_rec.crp_attribute13
296  ,p_crp_attribute14               =>p_rec.crp_attribute14
297  ,p_crp_attribute15               =>p_rec.crp_attribute15
298  ,p_crp_attribute16               =>p_rec.crp_attribute16
299  ,p_crp_attribute17               =>p_rec.crp_attribute17
300  ,p_crp_attribute18               =>p_rec.crp_attribute18
301  ,p_crp_attribute19               =>p_rec.crp_attribute19
302  ,p_crp_attribute20               =>p_rec.crp_attribute20
303  ,p_crp_attribute21               =>p_rec.crp_attribute21
304  ,p_crp_attribute22               =>p_rec.crp_attribute22
305  ,p_crp_attribute23               =>p_rec.crp_attribute23
306  ,p_crp_attribute24               =>p_rec.crp_attribute24
307  ,p_crp_attribute25               =>p_rec.crp_attribute25
308  ,p_crp_attribute26               =>p_rec.crp_attribute26
309  ,p_crp_attribute27               =>p_rec.crp_attribute27
310  ,p_crp_attribute28               =>p_rec.crp_attribute28
311  ,p_crp_attribute29               =>p_rec.crp_attribute29
312  ,p_crp_attribute30               =>p_rec.crp_attribute30
313  ,p_object_version_number         =>p_rec.object_version_number
314  ,p_effective_date                =>p_effective_date
315       );
316     --
317   exception
318     --
319     when hr_api.cannot_find_prog_unit then
320       --
321       hr_api.cannot_find_prog_unit_error
322         (p_module_name => 'ben_cbr_per_in_ler'
323         ,p_hook_type   => 'AI');
324       --
325   end;
326   --
327   -- End of API User Hook for post_insert.
328   --
329   --
330   hr_utility.set_location(' Leaving:'||l_proc, 10);
331 End post_insert;
332 --
333 -- ----------------------------------------------------------------------------
334 -- |---------------------------------< ins >----------------------------------|
335 -- ----------------------------------------------------------------------------
336 Procedure ins
337   (
338   p_effective_date in date,
339   p_rec        in out nocopy ben_crp_shd.g_rec_type
340   ) is
341 --
342   l_proc  varchar2(72) := g_package||'ins';
343 --
344 Begin
345   hr_utility.set_location('Entering:'||l_proc, 5);
346   --
347   -- Call the supporting insert validate operations
348   --
349   ben_crp_bus.insert_validate(p_rec
350   ,p_effective_date);
351   --
352   -- Call the supporting pre-insert operation
353   --
354   pre_insert(p_rec);
355   --
356   -- Insert the row
357   --
358   insert_dml(p_rec);
359   --
360   -- Call the supporting post-insert operation
361   --
362   post_insert(
363 p_effective_date,p_rec);
364 end ins;
365 --
366 -- ----------------------------------------------------------------------------
367 -- |---------------------------------< ins >----------------------------------|
368 -- ----------------------------------------------------------------------------
369 Procedure ins
370   (
371   p_effective_date in date,
372   p_cbr_per_in_ler_id            out nocopy number,
373   p_init_evt_flag                in varchar2,
374   p_cnt_num                      in number           default null,
375   p_per_in_ler_id                in number,
376   p_cbr_quald_bnf_id             in number,
377   p_prvs_elig_perd_end_dt        in date             default null,
378   p_business_group_id            in number,
379   p_crp_attribute_category       in varchar2         default null,
380   p_crp_attribute1               in varchar2         default null,
381   p_crp_attribute2               in varchar2         default null,
382   p_crp_attribute3               in varchar2         default null,
383   p_crp_attribute4               in varchar2         default null,
384   p_crp_attribute5               in varchar2         default null,
385   p_crp_attribute6               in varchar2         default null,
386   p_crp_attribute7               in varchar2         default null,
387   p_crp_attribute8               in varchar2         default null,
388   p_crp_attribute9               in varchar2         default null,
389   p_crp_attribute10              in varchar2         default null,
390   p_crp_attribute11              in varchar2         default null,
391   p_crp_attribute12              in varchar2         default null,
392   p_crp_attribute13              in varchar2         default null,
393   p_crp_attribute14              in varchar2         default null,
394   p_crp_attribute15              in varchar2         default null,
395   p_crp_attribute16              in varchar2         default null,
396   p_crp_attribute17              in varchar2         default null,
397   p_crp_attribute18              in varchar2         default null,
398   p_crp_attribute19              in varchar2         default null,
399   p_crp_attribute20              in varchar2         default null,
400   p_crp_attribute21              in varchar2         default null,
401   p_crp_attribute22              in varchar2         default null,
402   p_crp_attribute23              in varchar2         default null,
403   p_crp_attribute24              in varchar2         default null,
404   p_crp_attribute25              in varchar2         default null,
405   p_crp_attribute26              in varchar2         default null,
406   p_crp_attribute27              in varchar2         default null,
407   p_crp_attribute28              in varchar2         default null,
408   p_crp_attribute29              in varchar2         default null,
409   p_crp_attribute30              in varchar2         default null,
410   p_object_version_number        out nocopy number
411   ) is
412 --
413   l_rec	  ben_crp_shd.g_rec_type;
414   l_proc  varchar2(72) := g_package||'ins';
415 --
416 Begin
417   hr_utility.set_location('Entering:'||l_proc, 5);
418   --
419   -- Call conversion function to turn arguments into the
420   -- p_rec structure.
421   --
422   l_rec :=
423   ben_crp_shd.convert_args
424   (
425   null,
426   p_init_evt_flag,
427   p_cnt_num,
428   p_per_in_ler_id,
429   p_cbr_quald_bnf_id,
430   p_prvs_elig_perd_end_dt,
431   p_business_group_id,
432   p_crp_attribute_category,
433   p_crp_attribute1,
434   p_crp_attribute2,
435   p_crp_attribute3,
436   p_crp_attribute4,
437   p_crp_attribute5,
438   p_crp_attribute6,
439   p_crp_attribute7,
440   p_crp_attribute8,
441   p_crp_attribute9,
442   p_crp_attribute10,
443   p_crp_attribute11,
444   p_crp_attribute12,
445   p_crp_attribute13,
446   p_crp_attribute14,
447   p_crp_attribute15,
448   p_crp_attribute16,
449   p_crp_attribute17,
450   p_crp_attribute18,
451   p_crp_attribute19,
452   p_crp_attribute20,
453   p_crp_attribute21,
454   p_crp_attribute22,
455   p_crp_attribute23,
456   p_crp_attribute24,
457   p_crp_attribute25,
458   p_crp_attribute26,
459   p_crp_attribute27,
460   p_crp_attribute28,
461   p_crp_attribute29,
462   p_crp_attribute30,
463   null
464   );
465   --
466   -- Having converted the arguments into the ben_crp_rec
467   -- plsql record structure we call the corresponding record business process.
468   --
469   ins(
470     p_effective_date,l_rec);
471   --
472   -- As the primary key argument(s)
473   -- are specified as an OUT's we must set these values.
474   --
475   p_cbr_per_in_ler_id := l_rec.cbr_per_in_ler_id;
476   p_object_version_number := l_rec.object_version_number;
477   --
478   hr_utility.set_location(' Leaving:'||l_proc, 10);
479 End ins;
480 --
481 end ben_crp_ins;