DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_REI_INS

Source


1 Package Body ghr_rei_ins as
2 /* $Header: ghreirhi.pkb 120.2.12010000.2 2008/09/02 07:19:59 vmididho ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ghr_rei_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). Not required, changed by DARORA
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 -- Pre Conditions:
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. Not required, changed by DARORA.
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. Not required, Changed by DARORA
44 --
45 -- Developer Implementation Notes:
46 --   None.
47 --
48 -- Access Status:
49 --   Internal Table Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out nocopy  ghr_rei_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   -- Insert the row into: ghr_pa_request_extra_info
62   --
63   insert into ghr_pa_request_extra_info
64   (	pa_request_extra_info_id,
65 	pa_request_id,
66 	information_type,
67 	rei_attribute_category,
68 	rei_attribute1,
69 	rei_attribute2,
70 	rei_attribute3,
71 	rei_attribute4,
72 	rei_attribute5,
73 	rei_attribute6,
74 	rei_attribute7,
75 	rei_attribute8,
76 	rei_attribute9,
77 	rei_attribute10,
78 	rei_attribute11,
79 	rei_attribute12,
80 	rei_attribute13,
81 	rei_attribute14,
82 	rei_attribute15,
83 	rei_attribute16,
84 	rei_attribute17,
85 	rei_attribute18,
86 	rei_attribute19,
87 	rei_attribute20,
88 	rei_information_category,
89 	rei_information1,
90 	rei_information2,
91 	rei_information3,
92 	rei_information4,
93 	rei_information5,
94 	rei_information6,
95 	rei_information7,
96 	rei_information8,
97 	rei_information9,
98 	rei_information10,
99 	rei_information11,
100 	rei_information12,
101 	rei_information13,
102 	rei_information14,
103 	rei_information15,
104 	rei_information16,
105 	rei_information17,
106 	rei_information18,
107 	rei_information19,
108 	rei_information20,
109 	rei_information21,
110 	rei_information22,
111 	rei_information28,
112 	rei_information29,
113 	rei_information23,
114 	rei_information24,
115 	rei_information25,
116 	rei_information26,
117 	rei_information27,
118 	rei_information30,
119 	object_version_number,
120 	request_id,
121 	program_application_id,
122 	program_id,
123 	program_update_date
124   )
125   Values
126   (	p_rec.pa_request_extra_info_id,
127 	p_rec.pa_request_id,
128 	p_rec.information_type,
129 	p_rec.rei_attribute_category,
130 	p_rec.rei_attribute1,
131 	p_rec.rei_attribute2,
132 	p_rec.rei_attribute3,
133 	p_rec.rei_attribute4,
134 	p_rec.rei_attribute5,
135 	p_rec.rei_attribute6,
136 	p_rec.rei_attribute7,
137 	p_rec.rei_attribute8,
138 	p_rec.rei_attribute9,
139 	p_rec.rei_attribute10,
140 	p_rec.rei_attribute11,
141 	p_rec.rei_attribute12,
142 	p_rec.rei_attribute13,
143 	p_rec.rei_attribute14,
144 	p_rec.rei_attribute15,
145 	p_rec.rei_attribute16,
146 	p_rec.rei_attribute17,
147 	p_rec.rei_attribute18,
148 	p_rec.rei_attribute19,
149 	p_rec.rei_attribute20,
150 	p_rec.rei_information_category,
151 	p_rec.rei_information1,
152 	p_rec.rei_information2,
153 	p_rec.rei_information3,
154 	p_rec.rei_information4,
155 	p_rec.rei_information5,
156 	p_rec.rei_information6,
157 	p_rec.rei_information7,
158 	p_rec.rei_information8,
159 	p_rec.rei_information9,
160 	p_rec.rei_information10,
161 	p_rec.rei_information11,
162 	p_rec.rei_information12,
163 	p_rec.rei_information13,
164 	p_rec.rei_information14,
165 	p_rec.rei_information15,
166 	p_rec.rei_information16,
167 	p_rec.rei_information17,
168 	p_rec.rei_information18,
169 	p_rec.rei_information19,
170 	p_rec.rei_information20,
171 	p_rec.rei_information21,
172 	p_rec.rei_information22,
173 	p_rec.rei_information28,
174 	p_rec.rei_information29,
175 	p_rec.rei_information23,
176 	p_rec.rei_information24,
177 	p_rec.rei_information25,
178 	p_rec.rei_information26,
179 	p_rec.rei_information27,
180 	p_rec.rei_information30,
181 	p_rec.object_version_number,
182 	p_rec.request_id,
183 	p_rec.program_application_id,
184 	p_rec.program_id,
185 	p_rec.program_update_date
186   );
187   --
188   hr_utility.set_location(' Leaving:'||l_proc, 10);
189 Exception
190   When hr_api.check_integrity_violated Then
191     -- A check constraint has been violated
192     ghr_rei_shd.constraint_error
193       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
194   When hr_api.parent_integrity_violated Then
195     -- Parent integrity has been violated
196     ghr_rei_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     ghr_rei_shd.constraint_error
201       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
202   When Others Then
203     Raise;
204 End insert_dml;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |------------------------------< pre_insert >------------------------------|
208 -- ----------------------------------------------------------------------------
209 -- {Start Of Comments}
210 --
211 -- Description:
212 --   This private procedure contains any processing which is required before
213 --   the insert dml. Presently, if the entity has a corresponding primary
214 --   key which is maintained by an associating sequence, the primary key for
215 --   the entity will be populated with the next sequence value in
216 --   preparation for the insert dml.
217 --
218 -- Pre Conditions:
219 --   This is an internal procedure which is called from the ins procedure.
220 --
221 -- In Parameters:
222 --   A Pl/Sql record structre.
223 --
224 -- Post Success:
225 --   Processing continues.
226 --
227 -- Post Failure:
228 --   If an error has occurred, an error message and exception will be raised
229 --   but not handled.
230 --
231 -- Developer Implementation Notes:
232 --   Any pre-processing required before the insert dml is issued should be
233 --   coded within this procedure. As stated above, a good example is the
234 --   generation of a primary key number via a corresponding sequence.
235 --   It is important to note that any 3rd party maintenance should be reviewed
236 --   before placing in this procedure.
237 --
238 -- Access Status:
239 --   Internal Table Handler Use Only.
240 --
241 -- {End Of Comments}
242 -- ----------------------------------------------------------------------------
243 Procedure pre_insert(p_rec  in out nocopy  ghr_rei_shd.g_rec_type) is
244 --
245   l_proc  varchar2(72) := g_package||'pre_insert';
246   Cursor C_Sel1 is select ghr_pa_request_extra_info_s.nextval from sys.dual;
247 --
248 --
249 --
250 Begin
251   hr_utility.set_location('Entering:'||l_proc, 5);
252   --
253   --
254   -- Select the next sequence number
255   --
256   Open C_Sel1;
257   Fetch C_Sel1 Into p_rec.pa_request_extra_info_id;
258   Close C_Sel1;
259   --
260   hr_utility.set_location(' Leaving:'||l_proc, 10);
261 End pre_insert;
262 --
263 -- ----------------------------------------------------------------------------
264 -- |-----------------------------< post_insert >------------------------------|
265 -- ----------------------------------------------------------------------------
266 -- {Start Of Comments}
267 --
268 -- Description:
269 --   This private procedure contains any processing which is required after the
270 --   insert dml.
271 --
272 -- Pre Conditions:
273 --   This is an internal procedure which is called from the ins procedure.
274 --
275 -- In Parameters:
276 --   A Pl/Sql record structre.
277 --
278 -- Post Success:
279 --   Processing continues.
280 --
281 -- Post Failure:
282 --   If an error has occurred, an error message and exception will be raised
283 --   but not handled.
284 --
285 -- Developer Implementation Notes:
286 --   Any post-processing required after the insert dml is issued should be
287 --   coded within this procedure. It is important to note that any 3rd party
288 --   maintenance should be reviewed before placing in this procedure.
289 --
290 -- Access Status:
291 --   Internal Table Handler Use Only.
292 --
293 -- {End Of Comments}
294 -- ----------------------------------------------------------------------------
295 Procedure post_insert(p_rec in ghr_rei_shd.g_rec_type) is
296 --
297   l_proc  varchar2(72) := g_package||'post_insert';
298 --
299 Begin
300   hr_utility.set_location('Entering:'||l_proc, 5);
301   --
302   -- This is a hook point and the user hook for post_insert is called here.
303   --
304   begin
305      ghr_rei_rki.after_insert	(
306 		p_pa_request_extra_info_id 	=>	p_rec.pa_request_extra_info_id,
307 		p_pa_request_id 			=>	p_rec.pa_request_id 		,
308 		p_information_type 		=>	p_rec.information_type 		,
309 		p_rei_attribute_category	=>	p_rec.rei_attribute_category 	,
310 		p_rei_attribute1 			=>	p_rec.rei_attribute1	 	,
311 		p_rei_attribute2 			=>	p_rec.rei_attribute2 		,
312 		p_rei_attribute3 			=>	p_rec.rei_attribute3 		,
313 		p_rei_attribute4 			=>	p_rec.rei_attribute4 		,
314 		p_rei_attribute5 			=>	p_rec.rei_attribute5 		,
315 		p_rei_attribute6 			=>	p_rec.rei_attribute6 		,
316 		p_rei_attribute7 			=>	p_rec.rei_attribute7 		,
317 		p_rei_attribute8 			=>	p_rec.rei_attribute8 		,
318 		p_rei_attribute9 			=>	p_rec.rei_attribute9 		,
319 		p_rei_attribute10 		=>	p_rec.rei_attribute10 		,
320 		p_rei_attribute11 		=>	p_rec.rei_attribute11 		,
321 		p_rei_attribute12 		=>	p_rec.rei_attribute12 		,
322 		p_rei_attribute13 		=>	p_rec.rei_attribute13 		,
323 		p_rei_attribute14 		=>	p_rec.rei_attribute14 		,
324 		p_rei_attribute15 		=>	p_rec.rei_attribute15 		,
325 		p_rei_attribute16 		=>	p_rec.rei_attribute16 		,
326 		p_rei_attribute17 		=>	p_rec.rei_attribute17 		,
327 		p_rei_attribute18 		=>	p_rec.rei_attribute18 		,
328 		p_rei_attribute19		 	=>	p_rec.rei_attribute19 		,
329 		p_rei_attribute20	 		=>	p_rec.rei_attribute20 		,
330 		p_rei_information_category 	=>	p_rec.rei_information_category,
331 		p_rei_information1	 	=>	p_rec.rei_information1 		,
332 		p_rei_information2 		=>	p_rec.rei_information2 		,
333 		p_rei_information3 		=>	p_rec.rei_information3 		,
334 		p_rei_information4 		=>	p_rec.rei_information4 		,
335 		p_rei_information5 		=>	p_rec.rei_information5 		,
336 		p_rei_information6 		=>	p_rec.rei_information6 		,
337 		p_rei_information7 		=>	p_rec.rei_information7 		,
338 		p_rei_information8 		=>	p_rec.rei_information8 		,
339 		p_rei_information9 		=>	p_rec.rei_information9 		,
340 		p_rei_information10 		=>	p_rec.rei_information10 	,
341 		p_rei_information11 		=>	p_rec.rei_information11 	,
342 		p_rei_information12 		=>	p_rec.rei_information12 	,
343 		p_rei_information13 		=>	p_rec.rei_information13 	,
344 		p_rei_information14 		=>	p_rec.rei_information14 	,
345 		p_rei_information15	 	=>	p_rec.rei_information15 	,
346 		p_rei_information16 		=>	p_rec.rei_information16 	,
347 		p_rei_information17	 	=>	p_rec.rei_information17 	,
348 		p_rei_information18 		=>	p_rec.rei_information18 	,
349 		p_rei_information19 		=>	p_rec.rei_information19 	,
350 		p_rei_information20 		=>	p_rec.rei_information20 	,
351 		p_rei_information21 		=>	p_rec.rei_information21 	,
352 		p_rei_information22 		=>	p_rec.rei_information22 	,
353 		p_rei_information28 		=>	p_rec.rei_information28 	,
354 		p_rei_information29 		=>	p_rec.rei_information29 	,
355 		p_rei_information23 		=>	p_rec.rei_information23 	,
356 		p_rei_information24 		=>	p_rec.rei_information24 	,
357 		p_rei_information25 		=>	p_rec.rei_information25 	,
358 		p_rei_information26 		=>	p_rec.rei_information26 	,
359 		p_rei_information27 		=>	p_rec.rei_information27 	,
360 		p_rei_information30 		=>	p_rec.rei_information30 	,
361 		p_request_id 			=>	p_rec.request_id 			,
362 		p_program_application_id 	=>	p_rec.program_application_id 	,
363 		p_program_id 			=>	p_rec.program_id 			,
364 		p_program_update_date 		=>	p_rec.program_update_date
365 	);
366      exception
367         when hr_api.cannot_find_prog_unit then
368              hr_api.cannot_find_prog_unit_error
369 		 (	p_module_name => 'GHR_PA_REQUEST_EXTRA_INFO'
370 			,p_hook_type  => 'AI'
371 	        );
372   end;
373   -- End of API User Hook for post_insert.
374   hr_utility.set_location(' Leaving:'||l_proc, 10);
375 End post_insert;
376 --
377 -- ----------------------------------------------------------------------------
378 -- |---------------------------------< ins >----------------------------------|
379 -- ----------------------------------------------------------------------------
380 Procedure ins
381   (
382   p_rec        in out nocopy  ghr_rei_shd.g_rec_type,
383   p_validate   in     boolean default false
384   ) is
385 --
386   l_proc  varchar2(72) := g_package||'ins';
387 --
388 Begin
389   hr_utility.set_location('Entering:'||l_proc, 5);
390   --
391   -- Determine if the business process is to be validated.
392   --
393   If p_validate then
394     --
395     -- Issue the savepoint.
396     --
397     SAVEPOINT ins_ghr_rei;
398   End If;
399   --
400   -- Call the supporting insert validate operations
401   --
402   ghr_rei_bus.insert_validate(p_rec);
403   --
404   -- Call the supporting pre-insert operation
405   --
406   pre_insert(p_rec);
407   --
408   -- Insert the row
409   --
410   insert_dml(p_rec);
411   --
412   -- Call the supporting post-insert operation
413   --
414   post_insert(p_rec);
415   --
416   -- If we are validating then raise the Validate_Enabled exception
417   --
418   If p_validate then
419     Raise HR_Api.Validate_Enabled;
420   End If;
421   --
422   hr_utility.set_location(' Leaving:'||l_proc, 10);
423 Exception
424   When HR_Api.Validate_Enabled Then
425     --
426     -- As the Validate_Enabled exception has been raised
427     -- we must rollback to the savepoint
428     --
429     ROLLBACK TO ins_ghr_rei;
430 end ins;
431 --
432 -- ----------------------------------------------------------------------------
433 -- |---------------------------------< ins >----------------------------------|
434 -- ----------------------------------------------------------------------------
435 Procedure ins
436   (
437   p_pa_request_extra_info_id     out nocopy  number,
438   p_pa_request_id                in number,
439   p_information_type             in varchar2,
440   p_rei_attribute_category       in varchar2         default null,
441   p_rei_attribute1               in varchar2         default null,
442   p_rei_attribute2               in varchar2         default null,
443   p_rei_attribute3               in varchar2         default null,
444   p_rei_attribute4               in varchar2         default null,
445   p_rei_attribute5               in varchar2         default null,
446   p_rei_attribute6               in varchar2         default null,
447   p_rei_attribute7               in varchar2         default null,
448   p_rei_attribute8               in varchar2         default null,
449   p_rei_attribute9               in varchar2         default null,
450   p_rei_attribute10              in varchar2         default null,
451   p_rei_attribute11              in varchar2         default null,
452   p_rei_attribute12              in varchar2         default null,
453   p_rei_attribute13              in varchar2         default null,
454   p_rei_attribute14              in varchar2         default null,
455   p_rei_attribute15              in varchar2         default null,
456   p_rei_attribute16              in varchar2         default null,
457   p_rei_attribute17              in varchar2         default null,
458   p_rei_attribute18              in varchar2         default null,
459   p_rei_attribute19              in varchar2         default null,
460   p_rei_attribute20              in varchar2         default null,
461   p_rei_information_category     in varchar2         default null,
462   p_rei_information1             in varchar2         default null,
463   p_rei_information2             in varchar2         default null,
464   p_rei_information3             in varchar2         default null,
465   p_rei_information4             in varchar2         default null,
466   p_rei_information5             in varchar2         default null,
467   p_rei_information6             in varchar2         default null,
468   p_rei_information7             in varchar2         default null,
469   p_rei_information8             in varchar2         default null,
470   p_rei_information9             in varchar2         default null,
471   p_rei_information10            in varchar2         default null,
472   p_rei_information11            in varchar2         default null,
473   p_rei_information12            in varchar2         default null,
474   p_rei_information13            in varchar2         default null,
475   p_rei_information14            in varchar2         default null,
476   p_rei_information15            in varchar2         default null,
477   p_rei_information16            in varchar2         default null,
478   p_rei_information17            in varchar2         default null,
479   p_rei_information18            in varchar2         default null,
480   p_rei_information19            in varchar2         default null,
481   p_rei_information20            in varchar2         default null,
482   p_rei_information21            in varchar2         default null,
483   p_rei_information22            in varchar2         default null,
484   p_rei_information28            in varchar2         default null,
485   p_rei_information29            in varchar2         default null,
486   p_rei_information23            in varchar2         default null,
487   p_rei_information24            in varchar2         default null,
488   p_rei_information25            in varchar2         default null,
489   p_rei_information26            in varchar2         default null,
490   p_rei_information27            in varchar2         default null,
491   p_rei_information30            in varchar2         default null,
492   p_object_version_number        out nocopy  number,
493   p_request_id                   in number           default null,
494   p_program_application_id       in number           default null,
495   p_program_id                   in number           default null,
496   p_program_update_date          in date             default null,
497   p_validate                     in boolean   default false
498   ) is
499 --
500   l_rec	  ghr_rei_shd.g_rec_type;
501   l_proc  varchar2(72) := g_package||'ins';
502 --
503 Begin
504   hr_utility.set_location('Entering:'||l_proc, 5);
505   --
506   -- Call conversion function to turn arguments into the
507   -- p_rec structure.
508   --
509   l_rec :=
510   ghr_rei_shd.convert_args
511   (
512   null,
513   p_pa_request_id,
514   p_information_type,
515   p_rei_attribute_category,
516   p_rei_attribute1,
517   p_rei_attribute2,
518   p_rei_attribute3,
519   p_rei_attribute4,
520   p_rei_attribute5,
521   p_rei_attribute6,
522   p_rei_attribute7,
523   p_rei_attribute8,
524   p_rei_attribute9,
525   p_rei_attribute10,
526   p_rei_attribute11,
527   p_rei_attribute12,
528   p_rei_attribute13,
529   p_rei_attribute14,
530   p_rei_attribute15,
531   p_rei_attribute16,
532   p_rei_attribute17,
533   p_rei_attribute18,
534   p_rei_attribute19,
535   p_rei_attribute20,
536   p_rei_information_category,
537   p_rei_information1,
538   p_rei_information2,
539   p_rei_information3,
540   p_rei_information4,
541   p_rei_information5,
542   p_rei_information6,
543   p_rei_information7,
544   p_rei_information8,
545   p_rei_information9,
546   p_rei_information10,
547   p_rei_information11,
548   p_rei_information12,
549   p_rei_information13,
550   p_rei_information14,
551   p_rei_information15,
552   p_rei_information16,
553   p_rei_information17,
554   p_rei_information18,
555   p_rei_information19,
556   p_rei_information20,
557   p_rei_information21,
558   p_rei_information22,
559   p_rei_information28,
560   p_rei_information29,
561   p_rei_information23,
562   p_rei_information24,
563   p_rei_information25,
564   p_rei_information26,
565   p_rei_information27,
566   p_rei_information30,
567   null,
568   p_request_id,
569   p_program_application_id,
570   p_program_id,
571   p_program_update_date
572   );
573   --
574   -- Having converted the arguments into the ghr_rei_rec
575   -- plsql record structure we call the corresponding record business process.
576   --
577   ins(l_rec, p_validate);
578   --
579   -- As the primary key argument(s)
580   -- are specified as an OUT's we must set these values.
581   --
582   p_pa_request_extra_info_id := l_rec.pa_request_extra_info_id;
583   p_object_version_number := l_rec.object_version_number;
584   --
585   hr_utility.set_location(' Leaving:'||l_proc, 10);
586 End ins;
587 --
588 end ghr_rei_ins;