DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_RFP_INS

Source


1 Package Body pay_rfp_ins as
2 /* $Header: pyrfprhi.pkb 120.0 2005/05/29 08:21 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_rfp_ins.';  -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_report_format_mapping_id_i  number   default null;
14 g_parameter_name_i  number   default null;
15 --
16 -- ----------------------------------------------------------------------------
17 -- |------------------------< set_base_key_value >----------------------------|
18 -- ----------------------------------------------------------------------------
19 procedure set_base_key_value
20   (p_report_format_mapping_id  in  number
21   ,p_parameter_name  in  number) is
22 --
23   l_proc       varchar2(72) := g_package||'set_base_key_value';
24 --
25 Begin
26   hr_utility.set_location('Entering:'||l_proc, 10);
27   --
28   pay_rfp_ins.g_report_format_mapping_id_i := p_report_format_mapping_id;
29   pay_rfp_ins.g_parameter_name_i := p_parameter_name;
30   --
31   hr_utility.set_location(' Leaving:'||l_proc, 20);
32 End set_base_key_value;
33 --
34 --
35 -- ----------------------------------------------------------------------------
36 -- |------------------------------< insert_dml >------------------------------|
37 -- ----------------------------------------------------------------------------
38 -- {Start Of Comments}
39 --
40 -- Description:
41 --   This procedure controls the actual dml insert logic. The processing of
42 --   this procedure are as follows:
43 --   1) Initialise the object_version_number to 1 if the object_version_number
44 --      is defined as an attribute for this entity.
45 --   2) To set and unset the g_api_dml status as required (as we are about to
46 --      perform dml).
47 --   3) To insert the row into the schema.
48 --   4) To trap any constraint violations that may have occurred.
49 --   5) To raise any other errors.
50 --
51 -- Prerequisites:
52 --   This is an internal private procedure which must be called from the ins
53 --   procedure and must have all mandatory attributes set (except the
54 --   object_version_number which is initialised within this procedure).
55 --
56 -- In Parameters:
57 --   A Pl/Sql record structre.
58 --
59 -- Post Success:
60 --   The specified row will be inserted into the schema.
61 --
62 -- Post Failure:
63 --   On the insert dml failure it is important to note that we always reset the
64 --   g_api_dml status to false.
65 --   If a check, unique or parent integrity constraint violation is raised the
66 --   constraint_error procedure will be called.
67 --   If any other error is reported, the error will be raised after the
68 --   g_api_dml status is reset.
69 --
70 -- Developer Implementation Notes:
71 --   None.
72 --
73 -- Access Status:
74 --   Internal Row Handler Use Only.
75 --
76 -- {End Of Comments}
77 -- ----------------------------------------------------------------------------
78 Procedure insert_dml
79   (p_rec in out nocopy pay_rfp_shd.g_rec_type
80   ) is
81 --
82   l_proc  varchar2(72) := g_package||'insert_dml';
83 --
84 Begin
85   hr_utility.set_location('Entering:'||l_proc, 5);
86   p_rec.object_version_number := 1;  -- Initialise the object version
87   --
88   pay_rfp_shd.g_api_dml := true;  -- Set the api dml status
89   --
90   -- Insert the row into: pay_report_format_parameters
91   --
92   insert into pay_report_format_parameters
93       (report_format_mapping_id
94       ,parameter_name
95       ,parameter_value
96       ,object_version_number
97       )
98   Values
99     (p_rec.report_format_mapping_id
100     ,p_rec.parameter_name
101     ,p_rec.parameter_value
102     ,p_rec.object_version_number
103     );
104   --
105   pay_rfp_shd.g_api_dml := false;   -- Unset the api dml status
106   --
107   hr_utility.set_location(' Leaving:'||l_proc, 10);
108 Exception
109   When hr_api.check_integrity_violated Then
110     -- A check constraint has been violated
111     pay_rfp_shd.g_api_dml := false;   -- Unset the api dml status
112     pay_rfp_shd.constraint_error
113       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
114   When hr_api.parent_integrity_violated Then
115     -- Parent integrity has been violated
116     pay_rfp_shd.g_api_dml := false;   -- Unset the api dml status
117     pay_rfp_shd.constraint_error
118       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
119   When hr_api.unique_integrity_violated Then
120     -- Unique integrity has been violated
121     pay_rfp_shd.g_api_dml := false;   -- Unset the api dml status
122     pay_rfp_shd.constraint_error
123       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
124   When Others Then
125     pay_rfp_shd.g_api_dml := false;   -- Unset the api dml status
126     Raise;
127 End insert_dml;
128 --
129 -- ----------------------------------------------------------------------------
130 -- |------------------------------< pre_insert >------------------------------|
131 -- ----------------------------------------------------------------------------
132 -- {Start Of Comments}
133 --
134 -- Description:
135 --   This private procedure contains any processing which is required before
136 --   the insert dml. Presently, if the entity has a corresponding primary
137 --   key which is maintained by an associating sequence, the primary key for
138 --   the entity will be populated with the next sequence value in
139 --   preparation for the insert dml.
140 --
141 -- Prerequisites:
142 --   This is an internal procedure which is called from the ins procedure.
143 --
144 -- In Parameters:
145 --   A Pl/Sql record structure.
146 --
147 -- Post Success:
148 --   Processing continues.
149 --
150 -- Post Failure:
151 --   If an error has occurred, an error message and exception will be raised
152 --   but not handled.
153 --
154 -- Developer Implementation Notes:
155 --   Any pre-processing required before the insert dml is issued should be
156 --   coded within this procedure. As stated above, a good example is the
157 --   generation of a primary key number via a corresponding sequence.
158 --   It is important to note that any 3rd party maintenance should be reviewed
159 --   before placing in this procedure.
160 --
161 -- Access Status:
162 --   Internal Row Handler Use Only.
163 --
164 -- {End Of Comments}
165 -- ----------------------------------------------------------------------------
166 Procedure pre_insert
167   (p_rec  in out nocopy pay_rfp_shd.g_rec_type
168   ) is
169 --
170   l_proc   varchar2(72) := g_package||'pre_insert';
171 --
172 Begin
173   hr_utility.set_location('Entering:'||l_proc, 5);
174   --
175   -- Removed the code generated in pre_insert  by the api generator
176   -- since it is not required for this table owing to its structure.
177   --
178   hr_utility.set_location(' Leaving:'||l_proc, 10);
179 End pre_insert;
180 --
181 -- ----------------------------------------------------------------------------
182 -- |-----------------------------< post_insert >------------------------------|
183 -- ----------------------------------------------------------------------------
184 -- {Start Of Comments}
185 --
186 -- Description:
187 --   This private procedure contains any processing which is required after
188 --   the insert dml.
189 --
190 -- Prerequisites:
191 --   This is an internal procedure which is called from the ins procedure.
192 --
193 -- In Parameters:
194 --   A Pl/Sql record structre.
195 --
196 -- Post Success:
197 --   Processing continues.
198 --
199 -- Post Failure:
200 --   If an error has occurred, an error message and exception will be raised
201 --   but not handled.
202 --
203 -- Developer Implementation Notes:
204 --   Any post-processing required after the insert dml is issued should be
205 --   coded within this procedure. It is important to note that any 3rd party
206 --   maintenance should be reviewed before placing in this procedure.
207 --
208 -- Access Status:
209 --   Internal Row Handler Use Only.
210 --
211 -- {End Of Comments}
212 -- ----------------------------------------------------------------------------
213 Procedure post_insert
214   (p_rec                          in pay_rfp_shd.g_rec_type
215   ) is
216 --
217   l_proc  varchar2(72) := g_package||'post_insert';
218 --
219 Begin
220   hr_utility.set_location('Entering:'||l_proc, 5);
221   --
222   hr_utility.set_location(' Leaving:'||l_proc, 10);
223 End post_insert;
224 --
225 -- ----------------------------------------------------------------------------
226 -- |---------------------------------< ins >----------------------------------|
227 -- ----------------------------------------------------------------------------
228 Procedure ins
229   (p_rec                          in out nocopy pay_rfp_shd.g_rec_type
230   ) is
231 --
232   l_proc  varchar2(72) := g_package||'ins';
233 --
234 Begin
235   hr_utility.set_location('Entering:'||l_proc, 5);
236   --
237   -- Call the supporting insert validate operations
238   --
239   pay_rfp_bus.insert_validate
240      (p_rec
241      );
242   --
243   -- Call to raise any errors on multi-message list
244   hr_multi_message.end_validation_set;
245   --
246   -- Call the supporting pre-insert operation
247   --
248   pay_rfp_ins.pre_insert(p_rec);
249   --
250   -- Insert the row
251   --
252   pay_rfp_ins.insert_dml(p_rec);
253   --
254   -- Call the supporting post-insert operation
255   --
256   pay_rfp_ins.post_insert
257      (p_rec
258      );
259   --
260   -- Call to raise any errors on multi-message list
261   hr_multi_message.end_validation_set;
262   --
263   hr_utility.set_location('Leaving:'||l_proc, 20);
264 end ins;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |---------------------------------< ins >----------------------------------|
268 -- ----------------------------------------------------------------------------
269 Procedure ins
270   (p_report_format_mapping_id       in     number
271   ,p_parameter_name                 in     varchar2
272   ,p_parameter_value                in     varchar2
273   ,p_object_version_number             out nocopy number
274   ) is
275 --
276   l_rec   pay_rfp_shd.g_rec_type;
277   l_proc  varchar2(72) := g_package||'ins';
278 --
279 Begin
280   hr_utility.set_location('Entering:'||l_proc, 5);
281   --
282   -- Call conversion function to turn arguments into the
283   -- p_rec structure.
284   --
285   l_rec :=
286   pay_rfp_shd.convert_args
287     (p_report_format_mapping_id
288     ,p_parameter_name
289     ,p_parameter_value
290     ,null
291     );
292   --
293   -- Having converted the arguments into the pay_rfp_rec
294   -- plsql record structure we call the corresponding record business process.
295   --
296   pay_rfp_ins.ins
297      (l_rec
298      );
299   --
300 
301   p_object_version_number := l_rec.object_version_number;
302   --
303   hr_utility.set_location(' Leaving:'||l_proc, 10);
304 End ins;
305 --
306 end pay_rfp_ins;