DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_RTT_INS

Source


1 Package Body pay_rtt_ins as
2 /* $Header: pyrttrhi.pkb 115.4 2003/02/06 17:21:56 rthirlby noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_rtt_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
54   (p_rec in out nocopy pay_rtt_shd.g_rec_type
55   ) is
56 --
57   l_proc  varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60   hr_utility.set_location('Entering:'||l_proc, 5);
61   --
62   --
63   --
64   --
65   -- Insert the row into: pay_run_types_f_tl
66   --
67   insert into pay_run_types_f_tl
68       (run_type_id
69       ,language
70       ,source_lang
71       ,run_type_name
72       ,shortname
73       )
74   Values
75     (p_rec.run_type_id
76     ,p_rec.language
77     ,p_rec.source_lang
78     ,p_rec.run_type_name
79     ,p_rec.shortname
80     );
81   --
82   --
83   --
84   hr_utility.set_location(' Leaving:'||l_proc, 10);
85 Exception
86   When hr_api.check_integrity_violated Then
87     -- A check constraint has been violated
88     --
89     pay_rtt_shd.constraint_error
90       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
91   When hr_api.parent_integrity_violated Then
92     -- Parent integrity has been violated
93     --
94     pay_rtt_shd.constraint_error
95       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
96   When hr_api.unique_integrity_violated Then
97     -- Unique integrity has been violated
98     --
99     pay_rtt_shd.constraint_error
100       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
101   When Others Then
102     --
103     Raise;
104 End insert_dml;
105 --
106 -- ----------------------------------------------------------------------------
107 -- |------------------------------< pre_insert >------------------------------|
108 -- ----------------------------------------------------------------------------
109 -- {Start Of Comments}
110 --
111 -- Description:
112 --   This private procedure contains any processing which is required before
113 --   the insert dml. Presently, if the entity has a corresponding primary
114 --   key which is maintained by an associating sequence, the primary key for
115 --   the entity will be populated with the next sequence value in
116 --   preparation for the insert dml.
117 --
118 -- Prerequisites:
119 --   This is an internal procedure which is called from the ins procedure.
120 --
121 -- In Parameters:
122 --   A Pl/Sql record structre.
123 --
124 -- Post Success:
125 --   Processing continues.
126 --
127 -- Post Failure:
128 --   If an error has occurred, an error message and exception will be raised
129 --   but not handled.
130 --
131 -- Developer Implementation Notes:
132 --   Any pre-processing required before the insert dml is issued should be
133 --   coded within this procedure. As stated above, a good example is the
134 --   generation of a primary key number via a corresponding sequence.
135 --   It is important to note that any 3rd party maintenance should be reviewed
136 --   before placing in this procedure.
137 --
138 -- Access Status:
139 --   Internal Row Handler Use Only.
140 --
141 -- {End Of Comments}
142 -- ----------------------------------------------------------------------------
143 Procedure pre_insert
144   (p_rec                          in out nocopy pay_rtt_shd.g_rec_type
145   ,p_run_type_id                  in number
146   ) is
147 --
148   l_proc  varchar2(72) := g_package||'pre_insert';
149 --
150 Begin
151   hr_utility.set_location('Entering:'||l_proc, 5);
152   --
153   p_rec.run_type_id                      := p_run_type_id;
154   --
155   hr_utility.set_location(' Leaving:'||l_proc, 10);
156 End pre_insert;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |-----------------------------< post_insert >------------------------------|
160 -- ----------------------------------------------------------------------------
161 -- {Start Of Comments}
162 --
163 -- Description:
164 --   This private procedure contains any processing which is required after the
165 --   insert dml.
166 --
167 -- Prerequisites:
168 --   This is an internal procedure which is called from the ins procedure.
169 --
173 -- Post Success:
170 -- In Parameters:
171 --   A Pl/Sql record structre.
172 --
174 --   Processing continues.
175 --
179 --
176 -- Post Failure:
177 --   If an error has occurred, an error message and exception will be raised
178 --   but not handled.
180 -- Developer Implementation Notes:
181 --   Any post-processing required after the insert dml is issued should be
182 --   coded within this procedure. It is important to note that any 3rd party
183 --   maintenance should be reviewed before placing in this procedure.
184 --
185 -- Access Status:
186 --   Internal Row Handler Use Only.
187 --
188 -- {End Of Comments}
189 -- ----------------------------------------------------------------------------
190 Procedure post_insert
191   (p_rec                          in pay_rtt_shd.g_rec_type
192   ) is
193 --
194   l_proc  varchar2(72) := g_package||'post_insert';
195 --
196 Begin
197   hr_utility.set_location('Entering:'||l_proc, 5);
198   begin
199     --
200     pay_rtt_rki.after_insert
201       (p_run_type_id
202       => p_rec.run_type_id
203       ,p_language
204       => p_rec.language
205       ,p_source_lang
206       => p_rec.source_lang
207       ,p_run_type_name
208       => p_rec.run_type_name
209       ,p_shortname
210       => p_rec.shortname
211       );
212     --
213   exception
214     --
215     when hr_api.cannot_find_prog_unit then
216       --
217       hr_api.cannot_find_prog_unit_error
218         (p_module_name => 'PAY_RUN_TYPES_F_TL'
219         ,p_hook_type   => 'AI');
220       --
221   end;
222   --
223   hr_utility.set_location(' Leaving:'||l_proc, 10);
224 End post_insert;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |---------------------------------< ins >----------------------------------|
228 -- ----------------------------------------------------------------------------
229 Procedure ins
230   (p_rec                          in out nocopy pay_rtt_shd.g_rec_type
231   ,p_run_type_id                  in number
232   ) is
233 --
234   l_proc  varchar2(72) := g_package||'ins';
235 --
236 Begin
237   hr_utility.set_location('Entering:'||l_proc, 5);
238   --
239   -- Call the supporting insert validate operations
240   --
241   pay_rtt_bus.insert_validate
242      (p_rec
243      ,p_run_type_id
244      );
245   --
246   -- Call the supporting pre-insert operation
247   --
248   pay_rtt_ins.pre_insert
249     (p_rec                         => p_rec
250     ,p_run_type_id                 => p_run_type_id
251     );
252   --
253   -- Insert the row
254   --
255   pay_rtt_ins.insert_dml(p_rec);
256   --
257   -- Call the supporting post-insert operation
258   --
259   pay_rtt_ins.post_insert
260      (p_rec
261      );
262   --
263   hr_utility.set_location('Leaving:'||l_proc, 20);
264 end ins;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |---------------------------------< ins >----------------------------------|
268 -- ----------------------------------------------------------------------------
269 Procedure ins
270   (p_run_type_id                    in     number
271   ,p_language                       in     varchar2
272   ,p_source_lang                    in     varchar2
273   ,p_run_type_name                  in     varchar2
274   ,p_shortname                      in     varchar2
275   ) is
276 --
277   l_rec	  pay_rtt_shd.g_rec_type;
278   l_proc  varchar2(72) := g_package||'ins';
279 --
280 Begin
281   hr_utility.set_location('Entering:'||l_proc, 5);
282   --
283   -- Call conversion function to turn arguments into the
284   -- p_rec structure.
285   --
286   l_rec :=
287   pay_rtt_shd.convert_args
288     (null
289     ,p_language
290     ,p_source_lang
291     ,p_run_type_name
292     ,p_shortname
293     );
294   --
295   -- Having converted the arguments into the pay_rtt_rec
296   -- plsql record structure we call the corresponding record business process.
297   --
298   pay_rtt_ins.ins
299      (p_rec                         => l_rec
300      ,p_run_type_id                 => p_run_type_id
301      );
302   --
303   -- As the primary key argument(s)
304   -- are specified as an OUT's we must set these values.
305   --
306   --
307   --
308   hr_utility.set_location(' Leaving:'||l_proc, 10);
312 -- |------------------------------< ins_tl >----------------------------------|
309 End ins;
310 --
311 -- ----------------------------------------------------------------------------
313 -- ----------------------------------------------------------------------------
314 Procedure ins_tl
315   (p_language_code               in varchar2
316   ,p_run_type_id                  in number
317   ,p_run_type_name                in varchar2
318   ,p_shortname                    in varchar2 default null
319   ) is
320   --
321   -- Cursor to obtain the list of base and installed languages
322   --
323   cursor csr_ins_langs is
324     select l.language_code
325       from fnd_languages l
326      where l.installed_flag in ('I','B')
327        and not exists (select null
328                          from pay_run_types_f_tl rtt
329                         where rtt.run_type_id = p_run_type_id
330                           and rtt.language = l.language_code);
331   --
332   l_proc  varchar2(72)  := g_package || 'ins_tl';
333   --
334 Begin
335   hr_utility.set_location('Entering:'||l_proc,10);
336   --
337   -- Insert a row for the base language and every installed language.
338   --
339   for l_lang in csr_ins_langs loop
340     pay_rtt_ins.ins
341       (p_run_type_id                 => p_run_type_id
342       ,p_language                    => l_lang.language_code
343       ,p_source_lang                 => p_language_code
344       ,p_run_type_name               => p_run_type_name
345       ,p_shortname                   => p_shortname
346       );
347   end loop;
348   --
349   hr_utility.set_location('Leaving:'||l_proc,20);
350 End ins_tl;
351 --
352 end pay_rtt_ins;