DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PMA_INS

Source


1 Package Body pay_pma_ins as
2 /* $Header: pypmarhi.pkb 115.2 2002/12/11 11:12:57 ssivasu2 noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_pma_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_pma_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   --
60   p_rec.object_version_number := 1;  -- Initialise the object version
61   --
62   pay_pma_shd.g_api_dml := true;  -- Set the api dml status
63   --
64   -- Insert the row into: pay_ca_pmed_accounts
65   --
66   insert into pay_ca_pmed_accounts
67   (	organization_id,
68 	source_id,
69 	account_number,
70 	enabled,
71 	description,
72 	business_group_id,
73 	attribute_category,
74 	attribute1,
75 	attribute2,
76 	attribute3,
77 	attribute4,
78 	attribute5,
79 	attribute6,
80 	attribute7,
81 	attribute8,
82 	attribute9,
83 	attribute10,
84 	attribute11,
85 	attribute12,
86 	attribute13,
87 	attribute14,
88 	attribute15,
89 	attribute16,
90 	attribute17,
91 	attribute18,
92 	attribute19,
93 	attribute20,
94 	attribute21,
95 	attribute22,
96 	attribute23,
97 	attribute24,
98 	attribute25,
99 	attribute26,
100 	attribute27,
101 	attribute28,
102 	attribute29,
103 	attribute30,
104 	object_version_number
105   )
106   Values
107   (	p_rec.organization_id,
108 	p_rec.source_id,
109 	p_rec.account_number,
110 	p_rec.enabled,
111 	p_rec.description,
112 	p_rec.business_group_id,
113 	p_rec.attribute_category,
114 	p_rec.attribute1,
115 	p_rec.attribute2,
116 	p_rec.attribute3,
117 	p_rec.attribute4,
118 	p_rec.attribute5,
119 	p_rec.attribute6,
120 	p_rec.attribute7,
121 	p_rec.attribute8,
122 	p_rec.attribute9,
123 	p_rec.attribute10,
124 	p_rec.attribute11,
125 	p_rec.attribute12,
126 	p_rec.attribute13,
127 	p_rec.attribute14,
128 	p_rec.attribute15,
129 	p_rec.attribute16,
130 	p_rec.attribute17,
131 	p_rec.attribute18,
132 	p_rec.attribute19,
133 	p_rec.attribute20,
134 	p_rec.attribute21,
135 	p_rec.attribute22,
136 	p_rec.attribute23,
137 	p_rec.attribute24,
138 	p_rec.attribute25,
139 	p_rec.attribute26,
140 	p_rec.attribute27,
141 	p_rec.attribute28,
142 	p_rec.attribute29,
143 	p_rec.attribute30,
144 	p_rec.object_version_number
145   );
146   --
147   pay_pma_shd.g_api_dml := false;   -- Unset the api dml status
148   --
149   hr_utility.set_location(' Leaving:'||l_proc, 10);
150 Exception
151   When hr_api.check_integrity_violated Then
152     -- A check constraint has been violated
153     pay_pma_shd.g_api_dml := false;   -- Unset the api dml status
154     pay_pma_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     pay_pma_shd.g_api_dml := false;   -- Unset the api dml status
159     pay_pma_shd.constraint_error
160       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
161   When hr_api.unique_integrity_violated Then
162     -- Unique integrity has been violated
163     pay_pma_shd.g_api_dml := false;   -- Unset the api dml status
164     pay_pma_shd.constraint_error
165       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
166   When Others Then
167     pay_pma_shd.g_api_dml := false;   -- Unset the api dml status
168     Raise;
169 End insert_dml;
170 --
171 -- ----------------------------------------------------------------------------
172 -- |------------------------------< pre_insert >------------------------------|
173 -- ----------------------------------------------------------------------------
174 -- {Start Of Comments}
175 --
176 -- Description:
177 --   This private procedure contains any processing which is required before
178 --   the insert dml. Presently, if the entity has a corresponding primary
179 --   key which is maintained by an associating sequence, the primary key for
180 --   the entity will be populated with the next sequence value in
181 --   preparation for the insert dml.
182 --
183 -- Prerequisites:
184 --   This is an internal procedure which is called from the ins procedure.
185 --
186 -- In Parameters:
187 --   A Pl/Sql record structre.
188 --
189 -- Post Success:
190 --   Processing continues.
191 --
192 -- Post Failure:
193 --   If an error has occurred, an error message and exception will be raised
194 --   but not handled.
195 --
196 -- Developer Implementation Notes:
197 --   Any pre-processing required before the insert dml is issued should be
198 --   coded within this procedure. As stated above, a good example is the
199 --   generation of a primary key number via a corresponding sequence.
200 --   It is important to note that any 3rd party maintenance should be reviewed
201 --   before placing in this procedure.
202 --
203 -- Access Status:
204 --   Internal Row Handler Use Only.
205 --
206 -- {End Of Comments}
207 -- ----------------------------------------------------------------------------
208 Procedure pre_insert(p_rec  in out nocopy pay_pma_shd.g_rec_type) is
209 --
210   l_proc  varchar2(72) := g_package||'pre_insert';
211 --
212   Cursor C_Sel1 is select pay_wci_rates_s.nextval from sys.dual;
213 --
214 Begin
215   hr_utility.set_location('Entering:'||l_proc, 5);
216   --
217   --
218   -- Select the next sequence number
219   --
220   Open C_Sel1;
221   Fetch C_Sel1 Into p_rec.source_id;
222   Close C_Sel1;
223   --
224   hr_utility.set_location(' Leaving:'||l_proc, 10);
225 End pre_insert;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |-----------------------------< post_insert >------------------------------|
229 -- ----------------------------------------------------------------------------
230 -- {Start Of Comments}
231 --
232 -- Description:
233 --   This private procedure contains any processing which is required after the
234 --   insert dml.
235 --
236 -- Prerequisites:
237 --   This is an internal procedure which is called from the ins procedure.
238 --
239 -- In Parameters:
240 --   A Pl/Sql record structre.
241 --
242 -- Post Success:
243 --   Processing continues.
244 --
245 -- Post Failure:
246 --   If an error has occurred, an error message and exception will be raised
247 --   but not handled.
248 --
249 -- Developer Implementation Notes:
250 --   Any post-processing required after the insert dml is issued should be
251 --   coded within this procedure. It is important to note that any 3rd party
252 --   maintenance should be reviewed before placing in this procedure.
253 --
254 -- Access Status:
255 --   Internal Row Handler Use Only.
256 --
257 -- {End Of Comments}
258 -- ----------------------------------------------------------------------------
259 Procedure post_insert(p_rec in pay_pma_shd.g_rec_type) is
260 --
261   l_proc  varchar2(72) := g_package||'post_insert';
262 --
263 Begin
264   hr_utility.set_location('Entering:'||l_proc, 5);
265 --
266   --
267   -- Start of API User Hook for post_insert.
268   --
269   begin
270     --
271     pay_pma_rki.after_insert
272       (
273   p_organization_id               =>p_rec.organization_id
274  ,p_source_id                     =>p_rec.source_id
275  ,p_account_number                =>p_rec.account_number
276  ,p_enabled                       =>p_rec.enabled
277  ,p_description                   =>p_rec.description
278  ,p_business_group_id             =>p_rec.business_group_id
279  ,p_attribute_category            =>p_rec.attribute_category
280  ,p_attribute1                    =>p_rec.attribute1
281  ,p_attribute2                    =>p_rec.attribute2
282  ,p_attribute3                    =>p_rec.attribute3
283  ,p_attribute4                    =>p_rec.attribute4
284  ,p_attribute5                    =>p_rec.attribute5
285  ,p_attribute6                    =>p_rec.attribute6
286  ,p_attribute7                    =>p_rec.attribute7
287  ,p_attribute8                    =>p_rec.attribute8
288  ,p_attribute9                    =>p_rec.attribute9
289  ,p_attribute10                   =>p_rec.attribute10
290  ,p_attribute11                   =>p_rec.attribute11
291  ,p_attribute12                   =>p_rec.attribute12
292  ,p_attribute13                   =>p_rec.attribute13
293  ,p_attribute14                   =>p_rec.attribute14
294  ,p_attribute15                   =>p_rec.attribute15
295  ,p_attribute16                   =>p_rec.attribute16
296  ,p_attribute17                   =>p_rec.attribute17
297  ,p_attribute18                   =>p_rec.attribute18
298  ,p_attribute19                   =>p_rec.attribute19
299  ,p_attribute20                   =>p_rec.attribute20
300  ,p_attribute21                   =>p_rec.attribute21
301  ,p_attribute22                   =>p_rec.attribute22
302  ,p_attribute23                   =>p_rec.attribute23
303  ,p_attribute24                   =>p_rec.attribute24
304  ,p_attribute25                   =>p_rec.attribute25
305  ,p_attribute26                   =>p_rec.attribute26
306  ,p_attribute27                   =>p_rec.attribute27
307  ,p_attribute28                   =>p_rec.attribute28
308  ,p_attribute29                   =>p_rec.attribute29
309  ,p_attribute30                   =>p_rec.attribute30
310  ,p_object_version_number         =>p_rec.object_version_number
311       );
312     --
313   exception
314     --
315     when hr_api.cannot_find_prog_unit then
316       --
317       hr_api.cannot_find_prog_unit_error
318         (p_module_name => 'pay_ca_pmed_accounts'
319         ,p_hook_type   => 'AI');
320       --
321   end;
322   --
323   -- End of API User Hook for post_insert.
324   --
325   --
326   hr_utility.set_location(' Leaving:'||l_proc, 10);
327 End post_insert;
328 --
329 -- ----------------------------------------------------------------------------
330 -- |---------------------------------< ins >----------------------------------|
331 -- ----------------------------------------------------------------------------
332 Procedure ins
333   (
334   p_rec        in out nocopy pay_pma_shd.g_rec_type
335   ) is
336 --
337   l_proc  varchar2(72) := g_package||'ins';
338 --
339 Begin
340   hr_utility.set_location('Entering:'||l_proc, 5);
341   --
342   -- Call the supporting insert validate operations
343   --
344   pay_pma_bus.insert_validate(p_rec);
345   --
346   -- Call the supporting pre-insert operation
347   --
348   pre_insert(p_rec);
349   --
350   -- Insert the row
351   --
352   insert_dml(p_rec);
353   --
354   -- Call the supporting post-insert operation
355   --
356   post_insert(p_rec);
357 end ins;
358 --
359 -- ----------------------------------------------------------------------------
360 -- |---------------------------------< ins >----------------------------------|
361 -- ----------------------------------------------------------------------------
362 Procedure ins
363   (
364   p_organization_id              in          number,
365   p_source_id                    out nocopy  number,
366   p_account_number               in          varchar2,
367   p_enabled                      in          varchar2,
368   p_description                  in          varchar2         default null,
369   p_business_group_id            in          number           default null,
370   p_attribute_category           in          varchar2         default null,
371   p_attribute1                   in          varchar2         default null,
372   p_attribute2                   in          varchar2         default null,
373   p_attribute3                   in          varchar2         default null,
374   p_attribute4                   in          varchar2         default null,
375   p_attribute5                   in          varchar2         default null,
376   p_attribute6                   in          varchar2         default null,
377   p_attribute7                   in          varchar2         default null,
378   p_attribute8                   in          varchar2         default null,
379   p_attribute9                   in          varchar2         default null,
380   p_attribute10                  in          varchar2         default null,
381   p_attribute11                  in          varchar2         default null,
382   p_attribute12                  in          varchar2         default null,
383   p_attribute13                  in          varchar2         default null,
384   p_attribute14                  in          varchar2         default null,
385   p_attribute15                  in          varchar2         default null,
386   p_attribute16                  in          varchar2         default null,
387   p_attribute17                  in          varchar2         default null,
388   p_attribute18                  in          varchar2         default null,
389   p_attribute19                  in          varchar2         default null,
390   p_attribute20                  in          varchar2         default null,
391   p_attribute21                  in          varchar2         default null,
392   p_attribute22                  in          varchar2         default null,
393   p_attribute23                  in          varchar2         default null,
394   p_attribute24                  in          varchar2         default null,
395   p_attribute25                  in          varchar2         default null,
396   p_attribute26                  in          varchar2         default null,
397   p_attribute27                  in          varchar2         default null,
398   p_attribute28                  in          varchar2         default null,
399   p_attribute29                  in          varchar2         default null,
400   p_attribute30                  in          varchar2         default null,
401   p_object_version_number        out nocopy  number
402   ) is
403 --
404   l_rec	  pay_pma_shd.g_rec_type;
405   l_proc  varchar2(72) := g_package||'ins';
406 --
407 Begin
408   hr_utility.set_location('Entering:'||l_proc, 5);
409   --
410   -- Call conversion function to turn arguments into the
411   -- p_rec structure.
412   --
413   l_rec :=
414   pay_pma_shd.convert_args
415   (
416   p_organization_id,
417   null,
418   p_account_number,
419   p_enabled,
420   p_description,
421   p_business_group_id,
422   p_attribute_category,
423   p_attribute1,
424   p_attribute2,
425   p_attribute3,
426   p_attribute4,
427   p_attribute5,
428   p_attribute6,
429   p_attribute7,
430   p_attribute8,
431   p_attribute9,
432   p_attribute10,
433   p_attribute11,
434   p_attribute12,
435   p_attribute13,
436   p_attribute14,
437   p_attribute15,
438   p_attribute16,
439   p_attribute17,
440   p_attribute18,
441   p_attribute19,
442   p_attribute20,
443   p_attribute21,
444   p_attribute22,
445   p_attribute23,
446   p_attribute24,
447   p_attribute25,
448   p_attribute26,
449   p_attribute27,
450   p_attribute28,
451   p_attribute29,
452   p_attribute30,
453   null
454   );
455   --
456   -- Having converted the arguments into the pay_pma_rec
457   -- plsql record structure we call the corresponding record business process.
458   --
459   ins(l_rec);
460   --
461   -- As the primary key argument(s)
462   -- are specified as an OUT's we must set these values.
463   --
464   p_source_id := l_rec.source_id;
465   p_object_version_number := l_rec.object_version_number;
466   --
467   hr_utility.set_location(' Leaving:'||l_proc, 10);
468 End ins;
469 --
470 end pay_pma_ins;