1 Package Body ben_eat_ins as
2 /* $Header: beeatrhi.pkb 115.11 2002/12/16 11:53:54 vsethi ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_eat_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_eat_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_eat_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ben_actn_typ
64 --
65 insert into ben_actn_typ
66 ( actn_typ_id,
67 business_group_id,
68 type_cd,
69 name,
70 description,
71 eat_attribute_category,
72 eat_attribute1,
73 eat_attribute2,
74 eat_attribute3,
75 eat_attribute4,
76 eat_attribute5,
77 eat_attribute6,
78 eat_attribute7,
79 eat_attribute8,
80 eat_attribute9,
81 eat_attribute10,
82 eat_attribute11,
83 eat_attribute12,
84 eat_attribute13,
85 eat_attribute14,
86 eat_attribute15,
87 eat_attribute16,
88 eat_attribute17,
89 eat_attribute18,
90 eat_attribute19,
91 eat_attribute20,
92 eat_attribute21,
93 eat_attribute22,
94 eat_attribute23,
95 eat_attribute24,
96 eat_attribute25,
97 eat_attribute26,
98 eat_attribute27,
99 eat_attribute28,
100 eat_attribute29,
101 eat_attribute30,
102 object_version_number
103 )
104 Values
105 ( p_rec.actn_typ_id,
106 p_rec.business_group_id,
107 p_rec.type_cd,
108 p_rec.name,
109 p_rec.description,
110 p_rec.eat_attribute_category,
111 p_rec.eat_attribute1,
112 p_rec.eat_attribute2,
113 p_rec.eat_attribute3,
114 p_rec.eat_attribute4,
115 p_rec.eat_attribute5,
116 p_rec.eat_attribute6,
117 p_rec.eat_attribute7,
118 p_rec.eat_attribute8,
119 p_rec.eat_attribute9,
120 p_rec.eat_attribute10,
121 p_rec.eat_attribute11,
122 p_rec.eat_attribute12,
123 p_rec.eat_attribute13,
124 p_rec.eat_attribute14,
125 p_rec.eat_attribute15,
126 p_rec.eat_attribute16,
127 p_rec.eat_attribute17,
128 p_rec.eat_attribute18,
129 p_rec.eat_attribute19,
130 p_rec.eat_attribute20,
131 p_rec.eat_attribute21,
132 p_rec.eat_attribute22,
133 p_rec.eat_attribute23,
134 p_rec.eat_attribute24,
135 p_rec.eat_attribute25,
136 p_rec.eat_attribute26,
137 p_rec.eat_attribute27,
138 p_rec.eat_attribute28,
139 p_rec.eat_attribute29,
140 p_rec.eat_attribute30,
141 p_rec.object_version_number
142 );
143 --
144 -- Insert into MLS table.
145 --
146 insert into ben_actn_typ_tl (
147 actn_typ_id,
148 name,
149 description,
150 language,
151 type_cd,
152 source_lang,
153 last_update_date,
154 last_updated_by,
155 last_update_login,
156 created_by,
157 creation_date
158 )
159 select
160 p_rec.actn_typ_id,
161 p_rec.name,
162 p_rec.description,
163 l.language_code,
164 p_rec.type_cd,
165 userenv('LANG'),
166 null,
167 null,
168 null,
169 fnd_global.user_id,
170 sysdate
171 from fnd_languages l
172 where l.installed_flag in ('I', 'B')
173 and not exists
174 (select null
175 from ben_actn_typ_tl t
176 where t.actn_typ_id = p_rec.actn_typ_id
177 and t.language = l.language_code);
178 --
179 ben_eat_shd.g_api_dml := false; -- Unset the api dml status
180 --
181 hr_utility.set_location(' Leaving:'||l_proc, 10);
182 Exception
183 When hr_api.check_integrity_violated Then
184 -- A check constraint has been violated
185 ben_eat_shd.g_api_dml := false; -- Unset the api dml status
186 ben_eat_shd.constraint_error
187 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
188 When hr_api.parent_integrity_violated Then
189 -- Parent integrity has been violated
190 ben_eat_shd.g_api_dml := false; -- Unset the api dml status
191 ben_eat_shd.constraint_error
192 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
193 When hr_api.unique_integrity_violated Then
194 -- Unique integrity has been violated
195 ben_eat_shd.g_api_dml := false; -- Unset the api dml status
196 ben_eat_shd.constraint_error
197 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
198 When Others Then
199 ben_eat_shd.g_api_dml := false; -- Unset the api dml status
200 Raise;
201 End insert_dml;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |------------------------------< pre_insert >------------------------------|
205 -- ----------------------------------------------------------------------------
206 -- {Start Of Comments}
207 --
208 -- Description:
209 -- This private procedure contains any processing which is required before
210 -- the insert dml. Presently, if the entity has a corresponding primary
211 -- key which is maintained by an associating sequence, the primary key for
212 -- the entity will be populated with the next sequence value in
213 -- preparation for the insert dml.
214 --
215 -- Prerequisites:
216 -- This is an internal procedure which is called from the ins procedure.
217 --
218 -- In Parameters:
219 -- A Pl/Sql record structre.
220 --
221 -- Post Success:
222 -- Processing continues.
223 --
224 -- Post Failure:
225 -- If an error has occurred, an error message and exception will be raised
226 -- but not handled.
227 --
228 -- Developer Implementation Notes:
229 -- Any pre-processing required before the insert dml is issued should be
230 -- coded within this procedure. As stated above, a good example is the
231 -- generation of a primary key number via a corresponding sequence.
232 -- It is important to note that any 3rd party maintenance should be reviewed
233 -- before placing in this procedure.
234 --
235 -- Access Status:
236 -- Internal Row Handler Use Only.
237 --
238 -- {End Of Comments}
239 -- ----------------------------------------------------------------------------
240 Procedure pre_insert(p_rec in out nocopy ben_eat_shd.g_rec_type) is
241 --
242 l_proc varchar2(72) := g_package||'pre_insert';
243 cursor c1 is select ben_actn_typ_s.nextval
244 from sys.dual;
245 --
246 --
247 --
248 Begin
249 hr_utility.set_location('Entering:'||l_proc, 5);
250 --
251 open c1;
252 fetch c1 into p_rec.actn_typ_id;
253 close c1;
254 --
255 --
256 hr_utility.set_location(' Leaving:'||l_proc, 10);
257 End pre_insert;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |-----------------------------< post_insert >------------------------------|
261 -- ----------------------------------------------------------------------------
262 -- {Start Of Comments}
263 --
264 -- Description:
265 -- This private procedure contains any processing which is required after the
266 -- insert dml.
267 --
268 -- Prerequisites:
269 -- This is an internal procedure which is called from the ins procedure.
270 --
271 -- In Parameters:
272 -- A Pl/Sql record structre.
273 --
274 -- Post Success:
275 -- Processing continues.
276 --
277 -- Post Failure:
278 -- If an error has occurred, an error message and exception will be raised
279 -- but not handled.
280 --
281 -- Developer Implementation Notes:
282 -- Any post-processing required after the insert dml is issued should be
283 -- coded within this procedure. It is important to note that any 3rd party
284 -- maintenance should be reviewed before placing in this procedure.
285 --
286 -- Access Status:
287 -- Internal Row Handler Use Only.
288 --
289 -- {End Of Comments}
290 -- ----------------------------------------------------------------------------
291 Procedure post_insert(
292 p_effective_date in date,p_rec in ben_eat_shd.g_rec_type) is
293 --
294 l_proc varchar2(72) := g_package||'post_insert';
295 --
296 Begin
297 hr_utility.set_location('Entering:'||l_proc, 5);
298 --
299 --
300 -- Start of API User Hook for post_insert.
301 --
302 begin
303 --
304 ben_eat_rki.after_insert
305 (
306 p_actn_typ_id =>p_rec.actn_typ_id
307 ,p_business_group_id =>p_rec.business_group_id
308 ,p_type_cd =>p_rec.type_cd
309 ,p_name =>p_rec.name
310 ,p_description =>p_rec.description
311 ,p_eat_attribute_category =>p_rec.eat_attribute_category
312 ,p_eat_attribute1 =>p_rec.eat_attribute1
313 ,p_eat_attribute2 =>p_rec.eat_attribute2
314 ,p_eat_attribute3 =>p_rec.eat_attribute3
315 ,p_eat_attribute4 =>p_rec.eat_attribute4
316 ,p_eat_attribute5 =>p_rec.eat_attribute5
317 ,p_eat_attribute6 =>p_rec.eat_attribute6
318 ,p_eat_attribute7 =>p_rec.eat_attribute7
319 ,p_eat_attribute8 =>p_rec.eat_attribute8
320 ,p_eat_attribute9 =>p_rec.eat_attribute9
321 ,p_eat_attribute10 =>p_rec.eat_attribute10
322 ,p_eat_attribute11 =>p_rec.eat_attribute11
323 ,p_eat_attribute12 =>p_rec.eat_attribute12
324 ,p_eat_attribute13 =>p_rec.eat_attribute13
325 ,p_eat_attribute14 =>p_rec.eat_attribute14
326 ,p_eat_attribute15 =>p_rec.eat_attribute15
327 ,p_eat_attribute16 =>p_rec.eat_attribute16
328 ,p_eat_attribute17 =>p_rec.eat_attribute17
329 ,p_eat_attribute18 =>p_rec.eat_attribute18
330 ,p_eat_attribute19 =>p_rec.eat_attribute19
331 ,p_eat_attribute20 =>p_rec.eat_attribute20
332 ,p_eat_attribute21 =>p_rec.eat_attribute21
333 ,p_eat_attribute22 =>p_rec.eat_attribute22
334 ,p_eat_attribute23 =>p_rec.eat_attribute23
335 ,p_eat_attribute24 =>p_rec.eat_attribute24
336 ,p_eat_attribute25 =>p_rec.eat_attribute25
337 ,p_eat_attribute26 =>p_rec.eat_attribute26
338 ,p_eat_attribute27 =>p_rec.eat_attribute27
339 ,p_eat_attribute28 =>p_rec.eat_attribute28
340 ,p_eat_attribute29 =>p_rec.eat_attribute29
341 ,p_eat_attribute30 =>p_rec.eat_attribute30
342 ,p_object_version_number =>p_rec.object_version_number
343 ,p_effective_date =>p_effective_date
344 );
345 --
346 exception
347 --
348 when hr_api.cannot_find_prog_unit then
349 --
350 hr_api.cannot_find_prog_unit_error
351 (p_module_name => 'ben_actn_typ'
352 ,p_hook_type => 'AI');
353 --
354 end;
355 --
356 -- End of API User Hook for post_insert.
357 --
358 --
359 hr_utility.set_location(' Leaving:'||l_proc, 10);
360 End post_insert;
361 --
362 -- ----------------------------------------------------------------------------
363 -- |---------------------------------< ins >----------------------------------|
364 -- ----------------------------------------------------------------------------
365 Procedure ins
366 (
367 p_effective_date in date,
368 p_rec in out nocopy ben_eat_shd.g_rec_type
369 ) is
370 --
371 l_proc varchar2(72) := g_package||'ins';
372 --
373 Begin
374 hr_utility.set_location('Entering:'||l_proc, 5);
375 --
376 -- Call the supporting insert validate operations
377 --
378 ben_eat_bus.insert_validate(p_rec
379 ,p_effective_date);
380 --
381 -- Call the supporting pre-insert operation
382 --
383 pre_insert(p_rec);
384 --
385 -- Insert the row
386 --
387 insert_dml(p_rec);
388 --
389 -- Call the supporting post-insert operation
390 --
391 post_insert(
392 p_effective_date,p_rec);
393 end ins;
394 --
395 -- ----------------------------------------------------------------------------
396 -- |---------------------------------< ins >----------------------------------|
397 -- ----------------------------------------------------------------------------
398 Procedure ins
399 (
400 p_effective_date in date,
401 p_actn_typ_id out nocopy number,
402 p_business_group_id in number,
403 p_type_cd in varchar2,
404 p_name in varchar2,
405 p_description in varchar2,
406 p_eat_attribute_category in varchar2 default null,
407 p_eat_attribute1 in varchar2 default null,
408 p_eat_attribute2 in varchar2 default null,
409 p_eat_attribute3 in varchar2 default null,
410 p_eat_attribute4 in varchar2 default null,
411 p_eat_attribute5 in varchar2 default null,
412 p_eat_attribute6 in varchar2 default null,
413 p_eat_attribute7 in varchar2 default null,
414 p_eat_attribute8 in varchar2 default null,
415 p_eat_attribute9 in varchar2 default null,
416 p_eat_attribute10 in varchar2 default null,
417 p_eat_attribute11 in varchar2 default null,
418 p_eat_attribute12 in varchar2 default null,
419 p_eat_attribute13 in varchar2 default null,
420 p_eat_attribute14 in varchar2 default null,
421 p_eat_attribute15 in varchar2 default null,
422 p_eat_attribute16 in varchar2 default null,
423 p_eat_attribute17 in varchar2 default null,
424 p_eat_attribute18 in varchar2 default null,
425 p_eat_attribute19 in varchar2 default null,
426 p_eat_attribute20 in varchar2 default null,
427 p_eat_attribute21 in varchar2 default null,
428 p_eat_attribute22 in varchar2 default null,
429 p_eat_attribute23 in varchar2 default null,
430 p_eat_attribute24 in varchar2 default null,
431 p_eat_attribute25 in varchar2 default null,
432 p_eat_attribute26 in varchar2 default null,
433 p_eat_attribute27 in varchar2 default null,
434 p_eat_attribute28 in varchar2 default null,
435 p_eat_attribute29 in varchar2 default null,
436 p_eat_attribute30 in varchar2 default null,
437 p_object_version_number out nocopy number
438 ) is
439 --
440 l_rec ben_eat_shd.g_rec_type;
441 l_proc varchar2(72) := g_package||'ins';
442 --
443 Begin
444 hr_utility.set_location('Entering:'||l_proc, 5);
445 --
446 -- Call conversion function to turn arguments into the
447 -- p_rec structure.
448 --
449 l_rec :=
450 ben_eat_shd.convert_args
451 (
452 null,
453 p_business_group_id,
454 p_type_cd,
455 p_name,
456 p_description,
457 p_eat_attribute_category,
458 p_eat_attribute1,
459 p_eat_attribute2,
460 p_eat_attribute3,
461 p_eat_attribute4,
462 p_eat_attribute5,
463 p_eat_attribute6,
464 p_eat_attribute7,
465 p_eat_attribute8,
466 p_eat_attribute9,
467 p_eat_attribute10,
468 p_eat_attribute11,
469 p_eat_attribute12,
470 p_eat_attribute13,
471 p_eat_attribute14,
472 p_eat_attribute15,
473 p_eat_attribute16,
474 p_eat_attribute17,
475 p_eat_attribute18,
476 p_eat_attribute19,
477 p_eat_attribute20,
478 p_eat_attribute21,
479 p_eat_attribute22,
480 p_eat_attribute23,
481 p_eat_attribute24,
482 p_eat_attribute25,
483 p_eat_attribute26,
484 p_eat_attribute27,
485 p_eat_attribute28,
486 p_eat_attribute29,
487 p_eat_attribute30,
488 null
489 );
490 --
491 -- Having converted the arguments into the ben_eat_rec
492 -- plsql record structure we call the corresponding record business process.
493 --
494 ins(
495 p_effective_date,l_rec);
496 --
497 -- As the primary key argument(s)
498 -- are specified as an OUT's we must set these values.
499 --
500 p_actn_typ_id := l_rec.actn_typ_id;
501 p_object_version_number := l_rec.object_version_number;
502 --
503 hr_utility.set_location(' Leaving:'||l_proc, 10);
504 End ins;
505 --
506 end ben_eat_ins;