DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_BPD_INS

Source


1 Package Body per_bpd_ins as
2 /* $Header: pebpdrhi.pkb 115.6 2002/12/02 13:52:43 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_bpd_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.
23 --   4) To trap any constraint violations that may have occurred.
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.
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 per_bpd_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   --
62   -- Insert the row into: per_bf_payment_details
63   --
64   insert into per_bf_payment_details
65   (      payment_detail_id,
66       processed_assignment_id,
67       personal_payment_method_id,
68       business_group_id,
69       check_number,
70       payment_date,
71       amount,
72       check_type,
73       object_version_number,
74       bpd_attribute_category,
75       bpd_attribute1,
76       bpd_attribute2,
77       bpd_attribute3,
78       bpd_attribute4,
79       bpd_attribute5,
80       bpd_attribute6,
81       bpd_attribute7,
82       bpd_attribute8,
83       bpd_attribute9,
84       bpd_attribute10,
85       bpd_attribute11,
86       bpd_attribute12,
87       bpd_attribute13,
88       bpd_attribute14,
89       bpd_attribute15,
90       bpd_attribute16,
91       bpd_attribute17,
92       bpd_attribute18,
93       bpd_attribute19,
94       bpd_attribute20,
95       bpd_attribute21,
96       bpd_attribute22,
97       bpd_attribute23,
98       bpd_attribute24,
99       bpd_attribute25,
100       bpd_attribute26,
101       bpd_attribute27,
102       bpd_attribute28,
103       bpd_attribute29,
104       bpd_attribute30
105   )
106   Values
107   (   p_rec.payment_detail_id,
108       p_rec.processed_assignment_id,
109       p_rec.personal_payment_method_id,
110       p_rec.business_group_id,
111       p_rec.check_number,
112       p_rec.payment_date,
113       p_rec.amount,
114       p_rec.check_type,
115       p_rec.object_version_number,
116       p_rec.bpd_attribute_category,
117       p_rec.bpd_attribute1,
118       p_rec.bpd_attribute2,
119       p_rec.bpd_attribute3,
120       p_rec.bpd_attribute4,
121       p_rec.bpd_attribute5,
122       p_rec.bpd_attribute6,
123       p_rec.bpd_attribute7,
124       p_rec.bpd_attribute8,
125       p_rec.bpd_attribute9,
126       p_rec.bpd_attribute10,
127       p_rec.bpd_attribute11,
128       p_rec.bpd_attribute12,
129       p_rec.bpd_attribute13,
130       p_rec.bpd_attribute14,
131       p_rec.bpd_attribute15,
132       p_rec.bpd_attribute16,
133       p_rec.bpd_attribute17,
134       p_rec.bpd_attribute18,
135       p_rec.bpd_attribute19,
136       p_rec.bpd_attribute20,
137       p_rec.bpd_attribute21,
138       p_rec.bpd_attribute22,
139       p_rec.bpd_attribute23,
140       p_rec.bpd_attribute24,
141       p_rec.bpd_attribute25,
142       p_rec.bpd_attribute26,
143       p_rec.bpd_attribute27,
144       p_rec.bpd_attribute28,
145       p_rec.bpd_attribute29,
146       p_rec.bpd_attribute30
147   );
148   --
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     per_bpd_shd.constraint_error
155       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
156   When hr_api.parent_integrity_violated Then
157     -- Parent integrity has been violated
158     per_bpd_shd.constraint_error
159       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
160   When hr_api.unique_integrity_violated Then
161     -- Unique integrity has been violated
162     per_bpd_shd.constraint_error
163       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
164   When Others Then
165     Raise;
166 End insert_dml;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |------------------------------< pre_insert >------------------------------|
170 -- ----------------------------------------------------------------------------
171 -- {Start Of Comments}
172 --
173 -- Description:
174 --   This private procedure contains any processing which is required before
175 --   the insert dml. Presently, if the entity has a corresponding primary
176 --   key which is maintained by an associating sequence, the primary key for
177 --   the entity will be populated with the next sequence value in
178 --   preparation for the insert dml.
179 --
180 -- Prerequisites:
181 --   This is an internal procedure which is called from the ins procedure.
182 --
183 -- In Parameters:
184 --   A Pl/Sql record structre.
185 --
186 -- Post Success:
187 --   Processing continues.
188 --
189 -- Post Failure:
190 --   If an error has occurred, an error message and exception will be raised
191 --   but not handled.
192 --
193 -- Developer Implementation Notes:
194 --   Any pre-processing required before the insert dml is issued should be
195 --   coded within this procedure. As stated above, a good example is the
196 --   generation of a primary key number via a corresponding sequence.
197 --   It is important to note that any 3rd party maintenance should be reviewed
198 --   before placing in this procedure.
199 --
200 -- Access Status:
201 --   Internal Row Handler Use Only.
202 --
203 -- {End Of Comments}
204 -- ----------------------------------------------------------------------------
205 Procedure pre_insert(p_rec  in out nocopy per_bpd_shd.g_rec_type) is
206 --
207   l_proc  varchar2(72) := g_package||'pre_insert';
208 --
209 Cursor C_Sel1 is select per_bf_payment_details_s.nextval from sys.dual;
210 --
211 Begin
212   hr_utility.set_location('Entering:'||l_proc, 5);
213   --
214   Open C_Sel1;
215   Fetch C_Sel1 Into p_rec.payment_detail_id;
216   Close C_Sel1;
217   --
218   hr_utility.set_location(' Leaving:'||l_proc, 10);
219 End pre_insert;
220 --
221 -- ----------------------------------------------------------------------------
222 -- |-----------------------------< post_insert >------------------------------|
223 -- ----------------------------------------------------------------------------
224 -- {Start Of Comments}
225 --
226 -- Description:
227 --   This private procedure contains any processing which is required after the
228 --   insert dml.
229 --
230 -- Prerequisites:
231 --   This is an internal procedure which is called from the ins procedure.
232 --
233 -- In Parameters:
234 --   A Pl/Sql record structre.
235 --
236 -- Post Success:
237 --   Processing continues.
238 --
239 -- Post Failure:
240 --   If an error has occurred, an error message and exception will be raised
241 --   but not handled.
242 --
243 -- Developer Implementation Notes:
244 --   Any post-processing required after the insert dml is issued should be
245 --   coded within this procedure. It is important to note that any 3rd party
246 --   maintenance should be reviewed before placing in this procedure.
247 --
248 -- Access Status:
249 --   Internal Row Handler Use Only.
250 --
251 -- {End Of Comments}
252 -- ----------------------------------------------------------------------------
256   l_proc  varchar2(72) := g_package||'post_insert';
253 Procedure post_insert(p_effective_date   in  date,
254                       p_rec in per_bpd_shd.g_rec_type) is
255 --
257 --
258 Begin
259   hr_utility.set_location('Entering:'||l_proc, 5);
260   begin
261     --
262     per_bpd_rki.after_insert
263       (p_effective_date              => p_effective_date,
264       p_payment_detail_id          => p_rec.payment_detail_id,
265       p_processed_assignment_id    => p_rec.processed_assignment_id,
266       p_personal_payment_method_id => p_rec.personal_payment_method_id,
267       p_business_group_id          => p_rec.business_group_id,
268       p_check_number               => p_rec.check_number,
269       p_payment_date                 => p_rec.payment_date,
270       p_amount                     => p_rec.amount,
271       p_check_type                 => p_rec.check_type,
272       p_object_version_number      => p_rec.object_version_number,
273       p_bpd_attribute_category     => p_rec.bpd_attribute_category,
274       p_bpd_attribute1             => p_rec.bpd_attribute1,
275       p_bpd_attribute2             => p_rec.bpd_attribute2,
276       p_bpd_attribute3             => p_rec.bpd_attribute3,
277       p_bpd_attribute4             => p_rec.bpd_attribute4,
278       p_bpd_attribute5             => p_rec.bpd_attribute5,
279       p_bpd_attribute6             => p_rec.bpd_attribute6,
280       p_bpd_attribute7             => p_rec.bpd_attribute7,
281       p_bpd_attribute8             => p_rec.bpd_attribute8,
282       p_bpd_attribute9             => p_rec.bpd_attribute9,
283       p_bpd_attribute10            => p_rec.bpd_attribute10,
284       p_bpd_attribute11            => p_rec.bpd_attribute11,
285       p_bpd_attribute12            => p_rec.bpd_attribute12,
286       p_bpd_attribute13            => p_rec.bpd_attribute13,
287       p_bpd_attribute14            => p_rec.bpd_attribute14,
288       p_bpd_attribute15            => p_rec.bpd_attribute15,
289       p_bpd_attribute16            => p_rec.bpd_attribute16,
290       p_bpd_attribute17            => p_rec.bpd_attribute17,
291       p_bpd_attribute18            => p_rec.bpd_attribute18,
292       p_bpd_attribute19            => p_rec.bpd_attribute19,
293       p_bpd_attribute20            => p_rec.bpd_attribute20,
294       p_bpd_attribute21            => p_rec.bpd_attribute21,
295       p_bpd_attribute22            => p_rec.bpd_attribute22,
296       p_bpd_attribute23            => p_rec.bpd_attribute23,
297       p_bpd_attribute24            => p_rec.bpd_attribute24,
298       p_bpd_attribute25            => p_rec.bpd_attribute25,
299       p_bpd_attribute26            => p_rec.bpd_attribute26,
300       p_bpd_attribute27            => p_rec.bpd_attribute27,
301       p_bpd_attribute28            => p_rec.bpd_attribute28,
302       p_bpd_attribute29            => p_rec.bpd_attribute29,
303       p_bpd_attribute30            => p_rec.bpd_attribute30
304       );
305 --
306   exception
307 --
308     when hr_api.cannot_find_prog_unit then
309 --
310       hr_api.cannot_find_prog_unit_error
311         (p_module_name => 'PER_BF_PAYMENT_DETAILS'
312         ,p_hook_type   => 'AI');
313 --
314   end;
315   --
316   hr_utility.set_location(' Leaving:'||l_proc, 10);
317 End post_insert;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |---------------------------------< ins >----------------------------------|
321 -- ----------------------------------------------------------------------------
322 Procedure ins
323   (
324   p_effective_date   in  date,
325   p_rec        in out nocopy per_bpd_shd.g_rec_type
326   ) is
327 --
328   l_proc  varchar2(72) := g_package||'ins';
329 --
330 Begin
331   hr_utility.set_location('Entering:'||l_proc, 5);
332   --
333   -- Call the supporting insert validate operations
334   --
335   per_bpd_bus.insert_validate(p_effective_date,
336                              p_rec
337                              );
338   --
339   -- Call the supporting pre-insert operation
340   --
341   pre_insert(p_rec);
342   --
343   -- Insert the row
344   --
345   insert_dml(p_rec);
346   --
347   -- Call the supporting post-insert operation
348   --
349   post_insert(p_effective_date,
350                              p_rec);
351   --
352   hr_utility.set_location('Leaving:'||l_proc, 20);
353 end ins;
354 --
355 -- ----------------------------------------------------------------------------
356 -- |---------------------------------< ins >----------------------------------|
357 -- ----------------------------------------------------------------------------
358 Procedure ins
359   (
360   p_effective_date   in  date,
361   p_payment_detail_id            out nocopy number,
362   p_processed_assignment_id      in number,
363   p_personal_payment_method_id   in number,
364   p_business_group_id            in number,
365   p_check_number                 in number           default null,
366   p_payment_date                   in date             default null,
367   p_amount                       in number           default null,
368   p_check_type                   in varchar2         default null,
369   p_object_version_number        out nocopy number,
370   p_bpd_attribute_category           in varchar2         default null,
371   p_bpd_attribute1                  in varchar2         default null,
372   p_bpd_attribute2                  in varchar2         default null,
373   p_bpd_attribute3                  in varchar2         default null,
374   p_bpd_attribute4                  in varchar2         default null,
375   p_bpd_attribute5                  in varchar2         default null,
376   p_bpd_attribute6                  in varchar2         default null,
377   p_bpd_attribute7                  in varchar2         default null,
378   p_bpd_attribute8                  in varchar2         default null,
379   p_bpd_attribute9                  in varchar2         default null,
380   p_bpd_attribute10                 in varchar2         default null,
381   p_bpd_attribute11                 in varchar2         default null,
382   p_bpd_attribute12                 in varchar2         default null,
383   p_bpd_attribute13                 in varchar2         default null,
384   p_bpd_attribute14                 in varchar2         default null,
385   p_bpd_attribute15                 in varchar2         default null,
386   p_bpd_attribute16                 in varchar2         default null,
387   p_bpd_attribute17                 in varchar2         default null,
388   p_bpd_attribute18                 in varchar2         default null,
389   p_bpd_attribute19                 in varchar2         default null,
390   p_bpd_attribute20                 in varchar2         default null,
391   p_bpd_attribute21                 in varchar2         default null,
392   p_bpd_attribute22                 in varchar2         default null,
393   p_bpd_attribute23                 in varchar2         default null,
394   p_bpd_attribute24                 in varchar2         default null,
395   p_bpd_attribute25                 in varchar2         default null,
396   p_bpd_attribute26                 in varchar2         default null,
397   p_bpd_attribute27                 in varchar2         default null,
398   p_bpd_attribute28                 in varchar2         default null,
399   p_bpd_attribute29                 in varchar2         default null,
400   p_bpd_attribute30                 in varchar2         default null
401   ) is
402 --
403   l_rec	  per_bpd_shd.g_rec_type;
404   l_proc  varchar2(72) := g_package||'ins';
405 --
406 Begin
407   hr_utility.set_location('Entering:'||l_proc, 5);
408 --
409 -- Call conversion function to turn arguments into the
410 -- p_rec structure.
411 --
412   l_rec :=
413   per_bpd_shd.convert_args
414   (
415   null,
416   p_processed_assignment_id,
417   p_personal_payment_method_id,
418   p_business_group_id,
419   p_check_number,
420   p_payment_date,
421   p_amount,
422   p_check_type,
423   null,
424   p_bpd_attribute_category,
425   p_bpd_attribute1,
426   p_bpd_attribute2,
427   p_bpd_attribute3,
428   p_bpd_attribute4,
429   p_bpd_attribute5,
430   p_bpd_attribute6,
431   p_bpd_attribute7,
432   p_bpd_attribute8,
433   p_bpd_attribute9,
434   p_bpd_attribute10,
435   p_bpd_attribute11,
436   p_bpd_attribute12,
437   p_bpd_attribute13,
438   p_bpd_attribute14,
439   p_bpd_attribute15,
440   p_bpd_attribute16,
441   p_bpd_attribute17,
442   p_bpd_attribute18,
443   p_bpd_attribute19,
444   p_bpd_attribute20,
445   p_bpd_attribute21,
446   p_bpd_attribute22,
447   p_bpd_attribute23,
448   p_bpd_attribute24,
449   p_bpd_attribute25,
450   p_bpd_attribute26,
451   p_bpd_attribute27,
452   p_bpd_attribute28,
453   p_bpd_attribute29,
454   p_bpd_attribute30
455   );
456   --
457   -- Having converted the arguments into the per_bpd_rec
458   -- plsql record structure we call the corresponding record business process.
459   --
460   ins(p_effective_date,
461       l_rec
462      );
463   --
464   -- As the primary key argument(s)
465   -- are specified as an OUT's we must set these values.
466   --
467   p_payment_detail_id := l_rec.payment_detail_id;
468   p_object_version_number := l_rec.object_version_number;
469   --
470   hr_utility.set_location(' Leaving:'||l_proc, 10);
471 End ins;
472 --
473 end per_bpd_ins;