DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_DPNT_EGD_INS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body ben_dpnt_egd_ins as
2 
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_dpnt_egd_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_dpnt_egd_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_dpnt_egd_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_eligy_criteria
64   --
65   insert into ben_eligy_criteria_dpnt
66   (
67     eligy_criteria_dpnt_id,
68     name,
69     short_code,
70     description,
71     criteria_type,
72     crit_col1_val_type_cd,
73     crit_col1_datatype,
74     col1_lookup_type,
75     col1_value_set_id,
76     access_table_name1,
77     access_column_name1,
78     time_entry_access_table_name1,
79     time_entry_access_col_name1,
80     crit_col2_val_type_cd,
81     crit_col2_datatype,
82     col2_lookup_type,
83     col2_value_set_id,
84     access_table_name2,
85     access_column_name2,
86     time_entry_access_table_name2,
87     time_entry_access_col_name2,
88     allow_range_validation_flag,
89     user_defined_flag,
90     business_group_id,
91     egd_attribute_category,
92     egd_attribute1,
93     egd_attribute2,
94     egd_attribute3,
98     egd_attribute7,
95     egd_attribute4,
96     egd_attribute5,
97     egd_attribute6,
99     egd_attribute8,
100     egd_attribute9,
101     egd_attribute10,
102     egd_attribute11,
103     egd_attribute12,
104     egd_attribute13,
105     egd_attribute14,
106     egd_attribute15,
107     egd_attribute16,
108     egd_attribute17,
109     egd_attribute18,
110     egd_attribute19,
111     egd_attribute20,
112     egd_attribute21,
113     egd_attribute22,
114     egd_attribute23,
115     egd_attribute24,
116     egd_attribute25,
117     egd_attribute26,
118     egd_attribute27,
119     egd_attribute28,
120     egd_attribute29,
121     egd_attribute30,
122     object_version_number,
123     allow_range_validation_flag2,
124     time_access_calc_rule1,
125     time_access_calc_rule2
126   )
127   Values
128   (	p_rec.eligy_criteria_dpnt_id,
129 	p_rec.name,
130 	p_rec.short_code,
131 	p_rec.description,
132 	p_rec.criteria_type,
133 	p_rec.crit_col1_val_type_cd,
134 	p_rec.crit_col1_datatype,
135 	p_rec.col1_lookup_type,
136 	p_rec.col1_value_set_id,
137 	p_rec.access_table_name1,
138 	p_rec.access_column_name1,
139 	p_rec.time_entry_access_tab_nam1,
140 	p_rec.time_entry_access_col_nam1,
141 	p_rec.crit_col2_val_type_cd,
142 	p_rec.crit_col2_datatype,
143 	p_rec.col2_lookup_type,
144 	p_rec.col2_value_set_id,
145 	p_rec.access_table_name2,
146 	p_rec.access_column_name2,
147 	p_rec.time_entry_access_tab_nam2,
148 	p_rec.time_entry_access_col_nam2,
149 	p_rec.allow_range_validation_flg,
150 	p_rec.user_defined_flag,
151 	p_rec.business_group_id,
152 	p_rec.egd_attribute_category,
153 	p_rec.egd_attribute1,
154 	p_rec.egd_attribute2,
155 	p_rec.egd_attribute3,
156 	p_rec.egd_attribute4,
157 	p_rec.egd_attribute5,
158 	p_rec.egd_attribute6,
159 	p_rec.egd_attribute7,
160 	p_rec.egd_attribute8,
161 	p_rec.egd_attribute9,
162 	p_rec.egd_attribute10,
163 	p_rec.egd_attribute11,
164 	p_rec.egd_attribute12,
165 	p_rec.egd_attribute13,
166 	p_rec.egd_attribute14,
167 	p_rec.egd_attribute15,
168 	p_rec.egd_attribute16,
169 	p_rec.egd_attribute17,
170 	p_rec.egd_attribute18,
171 	p_rec.egd_attribute19,
172 	p_rec.egd_attribute20,
173 	p_rec.egd_attribute21,
174 	p_rec.egd_attribute22,
175 	p_rec.egd_attribute23,
176 	p_rec.egd_attribute24,
177 	p_rec.egd_attribute25,
178 	p_rec.egd_attribute26,
179 	p_rec.egd_attribute27,
180 	p_rec.egd_attribute28,
181 	p_rec.egd_attribute29,
182 	p_rec.egd_attribute30,
183 	p_rec.object_version_number,
184         p_Rec.allow_range_validation_flag2,
185         p_rec.time_access_calc_rule1,
186         p_Rec.time_access_calc_rule2
187   );
188   --
189   ben_dpnt_egd_shd.g_api_dml := false;   -- Unset the api dml status
190   --
191   hr_utility.set_location(' Leaving:'||l_proc, 10);
192 Exception
193   When hr_api.check_integrity_violated Then
194     -- A check constraint has been violated
195     ben_dpnt_egd_shd.g_api_dml := false;   -- Unset the api dml status
196     ben_dpnt_egd_shd.constraint_error
197       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
198   When hr_api.parent_integrity_violated Then
199     -- Parent integrity has been violated
200     ben_dpnt_egd_shd.g_api_dml := false;   -- Unset the api dml status
201     ben_dpnt_egd_shd.constraint_error
202       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
203   When hr_api.unique_integrity_violated Then
204     -- Unique integrity has been violated
205     ben_dpnt_egd_shd.g_api_dml := false;   -- Unset the api dml status
206     ben_dpnt_egd_shd.constraint_error
207       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
208   When Others Then
209     ben_dpnt_egd_shd.g_api_dml := false;   -- Unset the api dml status
210     Raise;
211 End insert_dml;
212 --
213 -- ----------------------------------------------------------------------------
214 -- |------------------------------< pre_insert >------------------------------|
215 -- ----------------------------------------------------------------------------
216 -- {Start Of Comments}
217 --
218 -- Description:
219 --   This private procedure contains any processing which is required before
220 --   the insert dml. Presently, if the entity has a corresponding primary
221 --   key which is maintained by an associating sequence, the primary key for
222 --   the entity will be populated with the next sequence value in
223 --   preparation for the insert dml.
224 --
225 -- Prerequisites:
226 --   This is an internal procedure which is called from the ins procedure.
227 --
228 -- In Parameters:
229 --   A Pl/Sql record structre.
230 --
231 -- Post Success:
232 --   Processing continues.
233 --
234 -- Post Failure:
235 --   If an error has occurred, an error message and exception will be raised
236 --   but not handled.
237 --
238 -- Developer Implementation Notes:
239 --   Any pre-processing required before the insert dml is issued should be
240 --   coded within this procedure. As stated above, a good example is the
241 --   generation of a primary key number via a corresponding sequence.
242 --   It is important to note that any 3rd party maintenance should be reviewed
243 --   before placing in this procedure.
244 --
245 -- Access Status:
246 --   Internal Row Handler Use Only.
247 --
248 -- {End Of Comments}
249 -- ----------------------------------------------------------------------------
250 Procedure pre_insert(p_rec  in out nocopy ben_dpnt_egd_shd.g_rec_type) is
251 --
255 --
252   l_proc  varchar2(72) := g_package||'pre_insert';
253 --
254   Cursor C_Sel1 is select ben_eligy_criteria_dpnt_s.nextval from sys.dual;
256 Begin
257   hr_utility.set_location('Entering:'||l_proc, 5);
258   --
259   --
260   -- Select the next sequence number
261   --
262   Open C_Sel1;
263   Fetch C_Sel1 Into p_rec.eligy_criteria_dpnt_id;
264   Close C_Sel1;
265   --
266   hr_utility.set_location(' Leaving:'||l_proc, 10);
267 End pre_insert;
268 --
269 -- ----------------------------------------------------------------------------
270 -- |-----------------------------< post_insert >------------------------------|
271 -- ----------------------------------------------------------------------------
272 -- {Start Of Comments}
273 --
274 -- Description:
275 --   This private procedure contains any processing which is required after the
276 --   insert dml.
277 --
278 -- Prerequisites:
279 --   This is an internal procedure which is called from the ins procedure.
280 --
281 -- In Parameters:
282 --   A Pl/Sql record structre.
283 --
284 -- Post Success:
285 --   Processing continues.
286 --
287 -- Post Failure:
288 --   If an error has occurred, an error message and exception will be raised
289 --   but not handled.
290 --
291 -- Developer Implementation Notes:
292 --   Any post-processing required after the insert dml is issued should be
293 --   coded within this procedure. It is important to note that any 3rd party
294 --   maintenance should be reviewed before placing in this procedure.
295 --
296 -- Access Status:
297 --   Internal Row Handler Use Only.
298 --
299 -- {End Of Comments}
300 -- ----------------------------------------------------------------------------
301 Procedure post_insert(p_rec in ben_dpnt_egd_shd.g_rec_type
302 		      ,p_effective_date in date) is
303 --
304   l_proc  varchar2(72)      := g_package||'post_insert';
305   l_eligy_criteria_dpnt_id       ben_eligy_criteria_dpnt.eligy_criteria_dpnt_id%TYPE;
306 --
307 Begin
308 
309 hr_utility.set_location('Entering:'||l_proc, 5);
310 --
311   --
312   -- Start of API User Hook for post_insert.
313   --
314   begin
315     --
316     ben_dpnt_egd_rki.after_insert
317       (
318          p_eligy_criteria_dpnt_id                =>   p_rec.eligy_criteria_dpnt_id
319         ,p_name                             => 	 p_rec.name
320         ,p_short_code                       => 	 p_rec.short_code
321         ,p_description                      => 	 p_rec.description
322         ,p_criteria_type		    => 	 p_rec.criteria_type
323         ,p_crit_col1_val_type_cd	    => 	 p_rec.crit_col1_val_type_cd
324         ,p_crit_col1_datatype	      	    => 	 p_rec.crit_col1_datatype
325         ,p_col1_lookup_type		    => 	 p_rec.col1_lookup_type
326         ,p_col1_value_set_id          	    => 	 p_rec.col1_value_set_id
327         ,p_access_table_name1         	    => 	 p_rec.access_table_name1
328         ,p_access_column_name1	      	    => 	 p_rec.access_column_name1
329         ,p_time_entry_access_tab_nam1 	    => 	 p_rec.time_entry_access_tab_nam1
330         ,p_time_entry_access_col_nam1 	    => 	 p_rec.time_entry_access_col_nam1
331         ,p_crit_col2_val_type_cd	    => 	 p_rec.crit_col2_val_type_cd
332         ,p_crit_col2_datatype	      	    => 	 p_rec.crit_col2_datatype
333         ,p_col2_lookup_type		    => 	 p_rec.col2_lookup_type
334         ,p_col2_value_set_id          	    => 	 p_rec.col2_value_set_id
335         ,p_access_table_name2	      	    => 	 p_rec.access_table_name2
336         ,p_access_column_name2	      	    => 	 p_rec.access_column_name2
337         ,p_time_entry_access_tab_nam2 	    => 	 p_rec.time_entry_access_tab_nam2
338         ,p_time_entry_access_col_nam2 	    => 	 p_rec.time_entry_access_col_nam2
339         ,p_allow_range_validation_flg 	    => 	 p_rec.allow_range_validation_flg
340         ,p_user_defined_flag          	    => 	 p_rec.user_defined_flag
341         ,p_business_group_id 	      	    => 	 p_rec.business_group_id
342         ,p_egd_attribute_category           => 	 p_rec.egd_attribute_category
343         ,p_egd_attribute1                   => 	 p_rec.egd_attribute1
344         ,p_egd_attribute2                   => 	 p_rec.egd_attribute2
345         ,p_egd_attribute3                   => 	 p_rec.egd_attribute3
346         ,p_egd_attribute4                   => 	 p_rec.egd_attribute4
347         ,p_egd_attribute5                   => 	 p_rec.egd_attribute5
348         ,p_egd_attribute6                   => 	 p_rec.egd_attribute6
349         ,p_egd_attribute7                   => 	 p_rec.egd_attribute7
350         ,p_egd_attribute8                   => 	 p_rec.egd_attribute8
351         ,p_egd_attribute9                   => 	 p_rec.egd_attribute9
352         ,p_egd_attribute10                  => 	 p_rec.egd_attribute10
353         ,p_egd_attribute11                  => 	 p_rec.egd_attribute11
354         ,p_egd_attribute12                  => 	 p_rec.egd_attribute12
355         ,p_egd_attribute13                  => 	 p_rec.egd_attribute13
356         ,p_egd_attribute14                  => 	 p_rec.egd_attribute14
357         ,p_egd_attribute15                  => 	 p_rec.egd_attribute15
358         ,p_egd_attribute16                  => 	 p_rec.egd_attribute16
359         ,p_egd_attribute17                  => 	 p_rec.egd_attribute17
360         ,p_egd_attribute18                  => 	 p_rec.egd_attribute18
361         ,p_egd_attribute19                  => 	 p_rec.egd_attribute19
362         ,p_egd_attribute20                  => 	 p_rec.egd_attribute20
363         ,p_egd_attribute21                  => 	 p_rec.egd_attribute21
364         ,p_egd_attribute22                  => 	 p_rec.egd_attribute22
365         ,p_egd_attribute23                  => 	 p_rec.egd_attribute23
369         ,p_egd_attribute27                  =>	 p_rec.egd_attribute27
366         ,p_egd_attribute24                  => 	 p_rec.egd_attribute24
367         ,p_egd_attribute25                  => 	 p_rec.egd_attribute25
368         ,p_egd_attribute26                  => 	 p_rec.egd_attribute26
370         ,p_egd_attribute28                  =>	 p_rec.egd_attribute28
371         ,p_egd_attribute29                  =>	 p_rec.egd_attribute29
372         ,p_egd_attribute30                  =>	 p_rec.egd_attribute30
373         ,p_object_version_number            =>	 p_rec.object_version_number
374 	,p_effective_date     		    =>   p_effective_date
375         ,p_allow_range_validation_flag2     =>   p_rec.allow_range_validation_flag2
376         ,p_time_access_calc_rule1	    => 	 p_rec.time_access_calc_rule1
377         ,p_time_access_calc_rule2	    => 	 p_rec.time_access_calc_rule2
378      );
379     --
380   exception
381     --
382     when hr_api.cannot_find_prog_unit then
383       --
384       hr_api.cannot_find_prog_unit_error
385         (p_module_name => 'ben_eligy_criteria_dpnt'
386         ,p_hook_type   => 'AI');
387       --
388   end;
389   --
390   -- End of API User Hook for post_insert.
391   --
392   --
393   hr_utility.set_location(' Leaving:'||l_proc, 10);
394 End post_insert;
395 --
396 -- ----------------------------------------------------------------------------
397 -- |---------------------------------< ins >----------------------------------|
398 -- ----------------------------------------------------------------------------
399 Procedure ins
400   (
401   p_rec        in out nocopy ben_dpnt_egd_shd.g_rec_type
402   ,p_effective_date in date
403   ) is
404 --
405   l_proc  varchar2(72) := g_package||'ins';
406 --
407 Begin
408   hr_utility.set_location('Entering:'||l_proc, 5);
409   --
410   -- Call the supporting insert validate operations
411   --
412   ben_dpnt_egd_bus.insert_validate(p_rec
413   			      ,p_effective_date);
414   --
415   -- Call the supporting pre-insert operation
416   --
417   pre_insert(p_rec);
418   --
419   -- Insert the row
420   --
421   insert_dml(p_rec);
422   --
423   -- Call the supporting post-insert operation
424   --
425   post_insert(p_rec
426   	     ,p_effective_date);
427 end ins;
428 --
429 -- ----------------------------------------------------------------------------
430 -- |---------------------------------< ins >----------------------------------|
431 -- ----------------------------------------------------------------------------
432 Procedure ins
433   (
434     p_eligy_criteria_dpnt_id              out nocopy number
435    ,p_name                           in  varchar2     default null
436    ,p_short_code                     in  varchar2     default null
437    ,p_description                    in  varchar2     default null
438    ,p_criteria_type		     in  varchar2     default null
439    ,p_crit_col1_val_type_cd	     in  varchar2     default null
440    ,p_crit_col1_datatype	     in  varchar2     default null
441    ,p_col1_lookup_type		     in  varchar2     default null
442    ,p_col1_value_set_id              in  number       default null
443    ,p_access_table_name1             in  varchar2     default null
444    ,p_access_column_name1	     in  varchar2     default null
445    ,p_time_entry_access_tab_nam1     in  varchar2     default null
446    ,p_time_entry_access_col_nam1     in  varchar2     default null
447    ,p_crit_col2_val_type_cd	     in  varchar2     default null
448    ,p_crit_col2_datatype	     in  varchar2     default null
449    ,p_col2_lookup_type		     in  varchar2     default null
450    ,p_col2_value_set_id              in  number       default null
451    ,p_access_table_name2	     in  varchar2     default null
452    ,p_access_column_name2	     in  varchar2     default null
453    ,p_time_entry_access_tab_nam2     in  varchar2     default null
454    ,p_time_entry_access_col_nam2     in  varchar2     default null
455    ,p_allow_range_validation_flg     in  varchar2     default null
456    ,p_user_defined_flag              in  varchar2     default null
457    ,p_business_group_id 	     in  number       default null
458    ,p_egd_attribute_category         in  varchar2     default null
459    ,p_egd_attribute1                 in  varchar2     default null
460    ,p_egd_attribute2                 in  varchar2     default null
461    ,p_egd_attribute3                 in  varchar2     default null
462    ,p_egd_attribute4                 in  varchar2     default null
463    ,p_egd_attribute5                 in  varchar2     default null
464    ,p_egd_attribute6                 in  varchar2     default null
465    ,p_egd_attribute7                 in  varchar2     default null
466    ,p_egd_attribute8                 in  varchar2     default null
467    ,p_egd_attribute9                 in  varchar2     default null
468    ,p_egd_attribute10                in  varchar2     default null
469    ,p_egd_attribute11                in  varchar2     default null
470    ,p_egd_attribute12                in  varchar2     default null
471    ,p_egd_attribute13                in  varchar2     default null
472    ,p_egd_attribute14                in  varchar2     default null
473    ,p_egd_attribute15                in  varchar2     default null
474    ,p_egd_attribute16                in  varchar2     default null
475    ,p_egd_attribute17                in  varchar2     default null
476    ,p_egd_attribute18                in  varchar2     default null
477    ,p_egd_attribute19                in  varchar2     default null
478    ,p_egd_attribute20                in  varchar2     default null
479    ,p_egd_attribute21                in  varchar2     default null
483    ,p_egd_attribute25                in  varchar2     default null
480    ,p_egd_attribute22                in  varchar2     default null
481    ,p_egd_attribute23                in  varchar2     default null
482    ,p_egd_attribute24                in  varchar2     default null
484    ,p_egd_attribute26                in  varchar2     default null
485    ,p_egd_attribute27                in  varchar2     default null
486    ,p_egd_attribute28                in  varchar2     default null
487    ,p_egd_attribute29                in  varchar2     default null
488    ,p_egd_attribute30                in  varchar2     default null
489    ,p_object_version_number          out nocopy number
490    ,p_effective_date                 in date
491    ,p_allow_range_validation_flag2   in  varchar2     default null
492    ,p_time_access_calc_rule1	     in  number       default null
493    ,p_time_access_calc_rule2	     in  number       default null
494   ) is
495 --
496   l_rec	  ben_dpnt_egd_shd.g_rec_type;
497   l_proc  varchar2(72) := g_package||'ins';
498 --
499 Begin
500   hr_utility.set_location('Entering:'||l_proc, 5);
501     --
502     -- Call conversion function to turn arguments into the
503     -- p_rec structure.
504     --
505     l_rec :=
506     ben_dpnt_egd_shd.convert_args
507     (
508      null
509     ,p_name
510     ,p_short_code
511     ,p_description
512     ,p_criteria_type
513     ,p_crit_col1_val_type_cd
514     ,p_crit_col1_datatype
515     ,p_col1_lookup_type
516     ,p_col1_value_set_id
517     ,p_access_table_name1
518     ,p_access_column_name1
519     ,p_time_entry_access_tab_nam1
520     ,p_time_entry_access_col_nam1
521     ,p_crit_col2_val_type_cd
522     ,p_crit_col2_datatype
523     ,p_col2_lookup_type
524     ,p_col2_value_set_id
525     ,p_access_table_name2
526     ,p_access_column_name2
527     ,p_time_entry_access_tab_nam2
528     ,p_time_entry_access_col_nam2
529     ,p_allow_range_validation_flg
530     ,p_user_defined_flag
531     ,p_business_group_id
532     ,p_egd_attribute_category
533     ,p_egd_attribute1
534     ,p_egd_attribute2
535     ,p_egd_attribute3
536     ,p_egd_attribute4
537     ,p_egd_attribute5
538     ,p_egd_attribute6
539     ,p_egd_attribute7
540     ,p_egd_attribute8
541     ,p_egd_attribute9
542     ,p_egd_attribute10
543     ,p_egd_attribute11
544     ,p_egd_attribute12
545     ,p_egd_attribute13
546     ,p_egd_attribute14
547     ,p_egd_attribute15
548     ,p_egd_attribute16
549     ,p_egd_attribute17
550     ,p_egd_attribute18
551     ,p_egd_attribute19
552     ,p_egd_attribute20
553     ,p_egd_attribute21
554     ,p_egd_attribute22
555     ,p_egd_attribute23
556     ,p_egd_attribute24
557     ,p_egd_attribute25
558     ,p_egd_attribute26
559     ,p_egd_attribute27
560     ,p_egd_attribute28
561     ,p_egd_attribute29
562     ,p_egd_attribute30
563     ,null
564     ,p_allow_range_validation_flag2
565     ,p_time_access_calc_rule1
566     ,p_time_access_calc_rule2
567     );
568     --
569     -- Having converted the arguments into the ben_egd_rec
570     -- plsql record structure we call the corresponding record business process.
571     --
572     ins(l_rec
573        ,p_effective_date);
574     --
575     -- As the primary key argument(s)
576     -- are specified as an OUT's we must set these values.
577     --
578     p_eligy_criteria_dpnt_id     := l_rec.eligy_criteria_dpnt_id;
579     p_object_version_number := l_rec.object_version_number;
580     --
581   hr_utility.set_location(' Leaving:'||l_proc, 10);
582 End ins;
583 --
584 end ben_dpnt_egd_ins;