DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PAP_INS

Source


1 Package Body pay_pap_ins as
2 /* $Header: pypaprhi.pkb 120.0 2005/05/29 07:14:24 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_pap_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 pay_pap_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   pay_pap_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: pay_accrual_plans
64   --
65   insert into pay_accrual_plans
66   (	accrual_plan_id,
67 	business_group_id,
68 	accrual_plan_element_type_id,
69 	pto_input_value_id,
70 	co_input_value_id,
71 	residual_input_value_id,
72 	accrual_category,
73 	accrual_plan_name,
74 	accrual_start,
75 	accrual_units_of_measure,
76 	ineligible_period_length,
77 	ineligible_period_type,
78 	accrual_formula_id,
79 	co_formula_id,
80 	co_date_input_value_id,
81 	co_exp_date_input_value_id,
82 	residual_date_input_value_id,
83 	description,
84         ineligibility_formula_id,
85         payroll_formula_id,
86         defined_balance_id,
87         tagging_element_type_id,
88         balance_element_type_id,
89 	object_version_number,
90         information_category,
91         information1,
92         information2,
93         information3,
94         information4,
95         information5,
96         information6,
97         information7,
98         information8,
99         information9,
100         information10,
101 	information11,
102         information12,
103         information13,
104         information14,
105         information15,
106         information16,
107         information17,
108         information18,
109         information19,
110         information20,
111         information21,
112         information22,
113         information23,
114         information24,
115         information25,
116         information26,
117         information27,
118         information28,
119         information29,
120         information30
121 
122   )
123   Values
124   (	p_rec.accrual_plan_id,
125 	p_rec.business_group_id,
126 	p_rec.accrual_plan_element_type_id,
127 	p_rec.pto_input_value_id,
128 	p_rec.co_input_value_id,
129 	p_rec.residual_input_value_id,
130 	p_rec.accrual_category,
131 	p_rec.accrual_plan_name,
132 	p_rec.accrual_start,
133 	p_rec.accrual_units_of_measure,
134 	p_rec.ineligible_period_length,
135 	p_rec.ineligible_period_type,
136 	p_rec.accrual_formula_id,
137 	p_rec.co_formula_id,
138 	p_rec.co_date_input_value_id,
139 	p_rec.co_exp_date_input_value_id,
140 	p_rec.residual_date_input_value_id,
141 	p_rec.description,
142         p_rec.ineligibility_formula_id,
143         p_rec.payroll_formula_id,
144         p_rec.defined_balance_id,
145         p_rec.tagging_element_type_id,
146         p_rec.balance_element_type_id,
147 	p_rec.object_version_number,
148         p_rec.information_category,
149         p_rec.information1,
150         p_rec.information2,
151         p_rec.information3,
152         p_rec.information4,
153         p_rec.information5,
154         p_rec.information6,
155         p_rec.information7,
156         p_rec.information8,
157         p_rec.information9,
158         p_rec.information10,
159         p_rec.information11,
160         p_rec.information12,
161         p_rec.information13,
162         p_rec.information14,
163         p_rec.information15,
164         p_rec.information16,
165         p_rec.information17,
166         p_rec.information18,
167         p_rec.information19,
168         p_rec.information20,
169         p_rec.information21,
170         p_rec.information22,
171         p_rec.information23,
172         p_rec.information24,
173         p_rec.information25,
174         p_rec.information26,
175         p_rec.information27,
176         p_rec.information28,
177         p_rec.information29,
178         p_rec.information30
179 
180   );
181   --
182   pay_pap_shd.g_api_dml := false;   -- Unset the api dml status
183   --
184   hr_utility.set_location(' Leaving:'||l_proc, 10);
185 Exception
186   When hr_api.check_integrity_violated Then
187     -- A check constraint has been violated
188     pay_pap_shd.g_api_dml := false;   -- Unset the api dml status
189     pay_pap_shd.constraint_error
190       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
191   When hr_api.parent_integrity_violated Then
192     -- Parent integrity has been violated
193     pay_pap_shd.g_api_dml := false;   -- Unset the api dml status
194     pay_pap_shd.constraint_error
195       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
196   When hr_api.unique_integrity_violated Then
197     -- Unique integrity has been violated
198     pay_pap_shd.g_api_dml := false;   -- Unset the api dml status
199     pay_pap_shd.constraint_error
200       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
201   When Others Then
202     pay_pap_shd.g_api_dml := false;   -- Unset the api dml status
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 -- Prerequisites:
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 Row Handler Use Only.
240 --
241 -- {End Of Comments}
242 -- ----------------------------------------------------------------------------
243 Procedure pre_insert(p_rec  in out nocopy pay_pap_shd.g_rec_type) is
244 --
245   l_proc                      varchar2(72) := g_package||'pre_insert';
246 
247   Cursor C_Sel1 is select pay_accrual_plans_s.nextval from sys.dual;
248 --
249 Begin
250   hr_utility.set_location('Entering:'||l_proc, 5);
251 
252   --
253   -- Select the next sequence number
254   --
255   Open C_Sel1;
256   Fetch C_Sel1 Into p_rec.accrual_plan_id;
257   Close C_Sel1;
258   --
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 -- Prerequisites:
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 Row Handler Use Only.
292 --
293 -- {End Of Comments}
294 -- ----------------------------------------------------------------------------
295 Procedure post_insert(p_rec             in pay_pap_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   --
303   -- Start of API User Hook for post_insert.
304   --
305   begin
306     --
307     pay_pap_rki.after_insert
308       (
309   p_accrual_plan_id               =>p_rec.accrual_plan_id
310  ,p_business_group_id             =>p_rec.business_group_id
311  ,p_accrual_plan_element_type_id  =>p_rec.accrual_plan_element_type_id
312  ,p_pto_input_value_id            =>p_rec.pto_input_value_id
313  ,p_co_input_value_id             =>p_rec.co_input_value_id
314  ,p_residual_input_value_id       =>p_rec.residual_input_value_id
315  ,p_accrual_category              =>p_rec.accrual_category
316  ,p_accrual_plan_name             =>p_rec.accrual_plan_name
317  ,p_accrual_start                 =>p_rec.accrual_start
318  ,p_accrual_units_of_measure      =>p_rec.accrual_units_of_measure
319  ,p_ineligible_period_length      =>p_rec.ineligible_period_length
320  ,p_ineligible_period_type        =>p_rec.ineligible_period_type
321  ,p_accrual_formula_id            =>p_rec.accrual_formula_id
322  ,p_co_formula_id                 =>p_rec.co_formula_id
323  ,p_co_date_input_value_id        =>p_rec.co_date_input_value_id
324  ,p_co_exp_date_input_value_id    =>p_rec.co_exp_date_input_value_id
325  ,p_residual_date_input_value_id  =>p_rec.residual_date_input_value_id
326  ,p_description                   =>p_rec.description
327  ,p_ineligibility_formula_id      =>p_rec.ineligibility_formula_id
328  ,p_payroll_formula_id            =>p_rec.payroll_formula_id
329  ,p_defined_balance_id            =>p_rec.defined_balance_id
330  ,p_tagging_element_type_id       =>p_rec.tagging_element_type_id
331  ,p_balance_element_type_id       =>p_rec.balance_element_type_id
332  ,p_object_version_number         =>p_rec.object_version_number
333  ,p_information_category	  =>p_rec.information_category
334  ,p_information1		  =>p_rec.information1
335  ,p_information2                  =>p_rec.information2
336  ,p_information3                  =>p_rec.information3
337  ,p_information4                  =>p_rec.information4
338  ,p_information5                  =>p_rec.information5
339  ,p_information6                  =>p_rec.information6
340  ,p_information7                  =>p_rec.information7
341  ,p_information8                  =>p_rec.information8
342  ,p_information9                  =>p_rec.information9
343  ,p_information10                 =>p_rec.information10
344  ,p_information11                 =>p_rec.information11
345  ,p_information12                 =>p_rec.information12
346  ,p_information13                 =>p_rec.information13
347  ,p_information14                 =>p_rec.information14
348  ,p_information15                 =>p_rec.information15
349  ,p_information16                 =>p_rec.information16
350  ,p_information17                 =>p_rec.information17
351  ,p_information18                 =>p_rec.information18
352  ,p_information19                 =>p_rec.information19
353  ,p_information20                 =>p_rec.information20
354  ,p_information21                 =>p_rec.information21
355  ,p_information22                 =>p_rec.information22
356  ,p_information23                 =>p_rec.information23
357  ,p_information24                 =>p_rec.information24
358  ,p_information25                 =>p_rec.information25
359  ,p_information26                 =>p_rec.information26
360  ,p_information27                 =>p_rec.information27
361  ,p_information28                 =>p_rec.information28
362  ,p_information29                 =>p_rec.information29
363  ,p_information30                 =>p_rec.information30
364       );
365     --
366   exception
367     --
368     when hr_api.cannot_find_prog_unit then
369       --
370       hr_api.cannot_find_prog_unit_error
371         (p_module_name => 'pay_accrual_plans'
372         ,p_hook_type   => 'AI');
373       --
374   end;
375   --
376   -- End of API User Hook for post_insert.
377   --
378   --
379   hr_utility.set_location(' Leaving:'||l_proc, 10);
380 End post_insert;
381 --
382 -- ----------------------------------------------------------------------------
383 -- |---------------------------------< ins >----------------------------------|
384 -- ----------------------------------------------------------------------------
385 PROCEDURE ins
386   (p_effective_date   IN     DATE
387   ,p_rec              IN OUT NOCOPY pay_pap_shd.g_rec_type
388   ,p_check_accrual_ff    OUT NOCOPY BOOLEAN)
389 IS
390 
391   l_proc  varchar2(72) := g_package||'ins';
392 
393 BEGIN
394 
395   hr_utility.set_location('Entering:'||l_proc, 10);
396 
397   --
398   -- Call the supporting insert validate operations
399   --
400   pay_pap_bus.insert_validate
401     (p_effective_date   => p_effective_date
402     ,p_rec              => p_rec
403     ,p_check_accrual_ff => p_check_accrual_ff);
404 
405   hr_utility.set_location(l_proc, 20);
406 
407   --
408   -- Call the supporting pre-insert operation
409   --
410   pre_insert(p_rec);
411 
412   hr_utility.set_location(l_proc, 30);
413 
414   --
415   -- Insert the row
416   --
417   insert_dml(p_rec);
418 
419   hr_utility.set_location(l_proc, 40);
420 
421   --
422   -- Call the supporting post-insert operation
423   --
424   post_insert(p_rec);
425 
426   hr_utility.set_location('Leaving:'||l_proc, 50);
427 
428 END ins;
429 --
430 -- ----------------------------------------------------------------------------
431 -- |---------------------------------< ins >----------------------------------|
432 -- ----------------------------------------------------------------------------
433 PROCEDURE ins
434   (p_effective_date               IN  DATE
435   ,p_business_group_id            IN  NUMBER
436   ,p_accrual_plan_element_type_id IN  NUMBER
437   ,p_pto_input_value_id           IN  NUMBER
438   ,p_co_input_value_id            IN  NUMBER
439   ,p_residual_input_value_id      IN  NUMBER
440   ,p_accrual_category             IN  VARCHAR2
441   ,p_accrual_plan_name            IN  VARCHAR2
442   ,p_accrual_units_of_measure     IN  VARCHAR2
443   ,p_accrual_start                IN  VARCHAR2 DEFAULT NULL
444   ,p_ineligible_period_length     IN  NUMBER   DEFAULT NULL
445   ,p_ineligible_period_type       IN  VARCHAR2 DEFAULT NULL
446   ,p_accrual_formula_id           IN  NUMBER   DEFAULT NULL
447   ,p_co_formula_id                IN  NUMBER   DEFAULT NULL
448   ,p_co_date_input_value_id       IN  NUMBER   DEFAULT NULL
449   ,p_co_exp_date_input_value_id   IN  NUMBER   DEFAULT NULL
450   ,p_residual_date_input_value_id IN  NUMBER   DEFAULT NULL
451   ,p_description                  IN  VARCHAR2 DEFAULT NULL
452   ,p_ineligibility_formula_id     IN  NUMBER   DEFAULT NULL
453   ,p_payroll_formula_id           IN  NUMBER   DEFAULT NULL
454   ,p_defined_balance_id           IN  NUMBER   DEFAULT NULL
455   ,p_tagging_element_type_id      IN  NUMBER   DEFAULT NULL
456   ,p_balance_element_type_id      IN  NUMBER   DEFAULT NULL
457   ,p_information_category         IN  VARCHAR2 DEFAULT NULL
458   ,p_information1                 IN  VARCHAR2 DEFAULT NULL
459   ,p_information2                 IN  VARCHAR2 DEFAULT NULL
460   ,p_information3                 IN  VARCHAR2 DEFAULT NULL
461   ,p_information4                 IN  VARCHAR2 DEFAULT NULL
462   ,p_information5                 IN  VARCHAR2 DEFAULT NULL
463   ,p_information6                 IN  VARCHAR2 DEFAULT NULL
464   ,p_information7                 IN  VARCHAR2 DEFAULT NULL
465   ,p_information8                 IN  VARCHAR2 DEFAULT NULL
466   ,p_information9                 IN  VARCHAR2 DEFAULT NULL
467   ,p_information10                IN  VARCHAR2 DEFAULT NULL
468   ,p_information11                IN  VARCHAR2 DEFAULT NULL
469   ,p_information12                IN  VARCHAR2 DEFAULT NULL
470   ,p_information13                IN  VARCHAR2 DEFAULT NULL
471   ,p_information14                IN  VARCHAR2 DEFAULT NULL
472   ,p_information15                IN  VARCHAR2 DEFAULT NULL
473   ,p_information16                IN  VARCHAR2 DEFAULT NULL
474   ,p_information17                IN  VARCHAR2 DEFAULT NULL
475   ,p_information18                IN  VARCHAR2 DEFAULT NULL
476   ,p_information19                IN  VARCHAR2 DEFAULT NULL
477   ,p_information20                IN  VARCHAR2 DEFAULT NULL
478   ,p_information21                IN  VARCHAR2 DEFAULT NULL
479   ,p_information22                IN  VARCHAR2 DEFAULT NULL
480   ,p_information23                IN  VARCHAR2 DEFAULT NULL
481   ,p_information24                IN  VARCHAR2 DEFAULT NULL
482   ,p_information25                IN  VARCHAR2 DEFAULT NULL
483   ,p_information26                IN  VARCHAR2 DEFAULT NULL
484   ,p_information27                IN  VARCHAR2 DEFAULT NULL
485   ,p_information28                IN  VARCHAR2 DEFAULT NULL
486   ,p_information29                IN  VARCHAR2 DEFAULT NULL
487   ,p_information30                IN  VARCHAR2 DEFAULT NULL
488   ,p_accrual_plan_id              OUT NOCOPY NUMBER
489   ,p_object_version_number        OUT NOCOPY NUMBER
490   ,p_check_accrual_ff             OUT NOCOPY BOOLEAN)
491 IS
492 
493   l_rec	  pay_pap_shd.g_rec_type;
494   l_proc  varchar2(72) := g_package||'ins';
495 
496 BEGIN
497 
498   hr_utility.set_location('Entering:'||l_proc, 10);
499 
500   --
501   -- Call conversion function to turn arguments into the
502   -- p_rec structure.
503   --
504   l_rec :=
505   pay_pap_shd.convert_args
506   (
507   null,
508   p_business_group_id,
509   p_accrual_plan_element_type_id,
510   p_pto_input_value_id,
511   p_co_input_value_id,
512   p_residual_input_value_id,
513   p_accrual_category,
514   p_accrual_plan_name,
515   p_accrual_start,
516   p_accrual_units_of_measure,
517   p_ineligible_period_length,
518   p_ineligible_period_type,
519   p_accrual_formula_id,
520   p_co_formula_id,
521   p_co_date_input_value_id,
522   p_co_exp_date_input_value_id,
523   p_residual_date_input_value_id,
524   p_description,
525   p_ineligibility_formula_id,
526   p_payroll_formula_id,
527   p_defined_balance_id,
528   p_tagging_element_type_id,
529   p_balance_element_type_id,
530   null,
531   p_information_category,
532   p_information1,
533   p_information2,
534   p_information3,
535   p_information4,
536   p_information5,
537   p_information6,
538   p_information7,
539   p_information8,
540   p_information9,
541   p_information10,
542   p_information11,
543   p_information12,
544   p_information13,
545   p_information14,
546   p_information15,
547   p_information16,
548   p_information17,
549   p_information18,
550   p_information19,
551   p_information20,
552   p_information21,
553   p_information22,
554   p_information23,
555   p_information24,
556   p_information25,
557   p_information26,
558   p_information27,
559   p_information28,
560   p_information29,
561   p_information30
562   );
563 
564   --
565   -- Having converted the arguments into the pay_pap_rec
566   -- plsql record structure we call the corresponding record business process.
567   --
568   ins
569     (p_effective_date   => p_effective_date
570     ,p_rec              => l_rec
571     ,p_check_accrual_ff => p_check_accrual_ff);
572 
573   --
574   -- As the primary key argument(s)
575   -- are specified as an OUT's we must set these values.
576   --
577   p_accrual_plan_id := l_rec.accrual_plan_id;
578   p_object_version_number := l_rec.object_version_number;
579 
580   hr_utility.set_location('PK = '||to_char(p_accrual_plan_id), 9);
581 
582   hr_utility.set_location(' Leaving:'||l_proc, 10);
583 
584 END ins;
585 
586 END pay_pap_ins;