DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_TCT_INS

Source


1 Package Body pqh_tct_ins as
2 /* $Header: pqtctrhi.pkb 120.4.12000000.2 2007/04/19 12:48:04 brsinha noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_tct_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 insert the row into the schema.
21 --   3) To trap any constraint violations that may have occurred.
22 --   4) To raise any other errors.
23 --
24 -- Prerequisites:
25 --   This is an internal private procedure which must be called from the ins
26 --   procedure and must have all mandatory attributes set (except the
27 --   object_version_number which is initialised within this procedure).
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be inserted into the schema.
34 --
35 -- Post Failure:
36 --   If a check, unique or parent integrity constraint violation is raised the
37 --   constraint_error procedure will be called.
38 --
39 -- Developer Implementation Notes:
40 --   None.
41 --
42 -- Access Status:
43 --   Internal Row Handler Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure insert_dml(p_rec in out nocopy pqh_tct_shd.g_rec_type) is
48 --
49   l_proc  varchar2(72) := g_package||'insert_dml';
50 --
51 Begin
52   hr_utility.set_location('Entering:'||l_proc, 5);
53   p_rec.object_version_number := 1;  -- Initialise the object version
54   --
55   --
56   -- Insert the row into: pqh_transaction_categories
57   --
58   insert into pqh_transaction_categories
59   (	transaction_category_id,
60 	custom_wf_process_name,
61 	custom_workflow_name,
62 	form_name,
63 	freeze_status_cd,
64 	future_action_cd,
65 	member_cd,
66 	name,
67         short_name,
68 	post_style_cd,
69 	post_txn_function,
70 	route_validated_txn_flag,
71 	prevent_approver_skip,
72         workflow_enable_flag,
73         enable_flag,
74 	timeout_days,
75 	object_version_number,
76 	consolidated_table_route_id ,
77         business_group_id,
78         setup_type_cd,
79 	Master_table_route_id
80   )
81   Values
82   (	p_rec.transaction_category_id,
83 	p_rec.custom_wf_process_name,
84 	p_rec.custom_workflow_name,
85 	p_rec.form_name,
86 	p_rec.freeze_status_cd,
87 	p_rec.future_action_cd,
88 	p_rec.member_cd,
89 	p_rec.name,
90         p_rec.short_name,
91 	p_rec.post_style_cd,
92 	p_rec.post_txn_function,
93 	p_rec.route_validated_txn_flag,
94 	p_rec.prevent_approver_skip,
95         p_rec.workflow_enable_flag,
96         p_rec.enable_flag,
97 	p_rec.timeout_days,
98 	p_rec.object_version_number,
99 	p_rec.consolidated_table_route_id ,
100         p_rec.business_group_id,
101         p_rec.setup_type_cd,
102 	p_rec.master_table_route_id
103   );
104   --
105   --
106   hr_utility.set_location(' Leaving:'||l_proc, 10);
107 Exception
108   When hr_api.check_integrity_violated Then
109     -- A check constraint has been violated
110     pqh_tct_shd.constraint_error
111       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
112   When hr_api.parent_integrity_violated Then
113     -- Parent integrity has been violated
114     pqh_tct_shd.constraint_error
115       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
116   When hr_api.unique_integrity_violated Then
117     -- Unique integrity has been violated
118     pqh_tct_shd.constraint_error
119       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
120   When Others Then
121     Raise;
122 End insert_dml;
123 --
124 -- ----------------------------------------------------------------------------
125 -- |------------------------------< pre_insert >------------------------------|
126 -- ----------------------------------------------------------------------------
127 -- {Start Of Comments}
128 --
129 -- Description:
130 --   This private procedure contains any processing which is required before
131 --   the insert dml. Presently, if the entity has a corresponding primary
132 --   key which is maintained by an associating sequence, the primary key for
133 --   the entity will be populated with the next sequence value in
134 --   preparation for the insert dml.
135 --
136 -- Prerequisites:
137 --   This is an internal procedure which is called from the ins procedure.
138 --
139 -- In Parameters:
140 --   A Pl/Sql record structre.
141 --
142 -- Post Success:
143 --   Processing continues.
144 --
145 -- Post Failure:
146 --   If an error has occurred, an error message and exception will be raised
147 --   but not handled.
148 --
149 -- Developer Implementation Notes:
150 --   Any pre-processing required before the insert dml is issued should be
151 --   coded within this procedure. As stated above, a good example is the
152 --   generation of a primary key number via a corresponding sequence.
153 --   It is important to note that any 3rd party maintenance should be reviewed
154 --   before placing in this procedure.
155 --
156 -- Access Status:
157 --   Internal Row Handler Use Only.
158 --
159 -- {End Of Comments}
160 -- ----------------------------------------------------------------------------
161 Procedure pre_insert(p_rec  in out nocopy pqh_tct_shd.g_rec_type) is
162 --
163   l_proc  varchar2(72) := g_package||'pre_insert';
164 --
165   Cursor C_Sel1 is select pqh_transaction_categories_s.nextval from sys.dual;
166 --
167 Begin
168   hr_utility.set_location('Entering:'||l_proc, 5);
169   --
170   --
171   -- Select the next sequence number
172   --
173   Open C_Sel1;
174   Fetch C_Sel1 Into p_rec.transaction_category_id;
175   Close C_Sel1;
176   --
177   hr_utility.set_location(' Leaving:'||l_proc, 10);
178 End pre_insert;
179 --
180 -- ----------------------------------------------------------------------------
181 -- |-----------------------------< post_insert >------------------------------|
182 -- ----------------------------------------------------------------------------
183 -- {Start Of Comments}
184 --
185 -- Description:
186 --   This private procedure contains any processing which is required after the
187 --   insert dml.
188 --
189 -- Prerequisites:
190 --   This is an internal procedure which is called from the ins procedure.
191 --
192 -- In Parameters:
193 --   A Pl/Sql record structre.
194 --
195 -- Post Success:
196 --   Processing continues.
197 --
198 -- Post Failure:
199 --   If an error has occurred, an error message and exception will be raised
200 --   but not handled.
201 --
202 -- Developer Implementation Notes:
203 --   Any post-processing required after the insert dml is issued should be
204 --   coded within this procedure. It is important to note that any 3rd party
205 --   maintenance should be reviewed before placing in this procedure.
206 --
207 -- Access Status:
208 --   Internal Row Handler Use Only.
209 --
210 -- {End Of Comments}
211 -- ----------------------------------------------------------------------------
212 Procedure post_insert(
213 p_effective_date in date,p_rec in pqh_tct_shd.g_rec_type) is
214 --
215   l_proc  varchar2(72) := g_package||'post_insert';
216 --
217 Begin
218   hr_utility.set_location('Entering:'||l_proc, 5);
219 --
220   --
221   -- Start of API User Hook for post_insert.
222   --
223   begin
224     --
225     pqh_tct_rki.after_insert
226       (
227   p_transaction_category_id       =>p_rec.transaction_category_id
228  ,p_custom_wf_process_name        =>p_rec.custom_wf_process_name
229  ,p_custom_workflow_name          =>p_rec.custom_workflow_name
230  ,p_form_name                     =>p_rec.form_name
231  ,p_freeze_status_cd              =>p_rec.freeze_status_cd
232  ,p_future_action_cd              =>p_rec.future_action_cd
233  ,p_member_cd                     =>p_rec.member_cd
234  ,p_name                          =>p_rec.name
235  ,p_short_name                          =>p_rec.short_name
236  ,p_post_style_cd                 =>p_rec.post_style_cd
237  ,p_post_txn_function             =>p_rec.post_txn_function
238  ,p_route_validated_txn_flag      =>p_rec.route_validated_txn_flag
239  ,p_prevent_approver_skip         =>p_rec.prevent_approver_skip
240  ,p_workflow_enable_flag      =>p_rec.workflow_enable_flag
241  ,p_enable_flag      =>p_rec.enable_flag
242  ,p_timeout_days                  =>p_rec.timeout_days
243  ,p_object_version_number         =>p_rec.object_version_number
244  ,p_consolidated_table_route_id   =>p_rec.consolidated_table_route_id
245  ,p_business_group_id             => p_rec.business_group_id
246  ,p_setup_type_cd                 => p_rec.setup_type_cd
247  ,p_master_table_route_id   =>p_rec.master_table_route_id
248  ,p_effective_date                =>p_effective_date
249       );
250     --
251   exception
252     --
253     when hr_api.cannot_find_prog_unit then
254       --
255       hr_api.cannot_find_prog_unit_error
256         (p_module_name => 'pqh_transaction_categories'
257         ,p_hook_type   => 'AI');
258       --
259   end;
260   --
261   -- End of API User Hook for post_insert.
262   --
263   --
264   hr_utility.set_location(' Leaving:'||l_proc, 10);
265 End post_insert;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |---------------------------------< ins >----------------------------------|
269 -- ----------------------------------------------------------------------------
270 Procedure ins
271   (
272   p_effective_date in date,
273   p_rec        in out nocopy pqh_tct_shd.g_rec_type
274   ) is
275 --
276   l_proc  varchar2(72) := g_package||'ins';
277 --
278 Begin
279   hr_utility.set_location('Entering:'||l_proc, 5);
280   --
281   -- Call the supporting insert validate operations
282   --
283   pqh_tct_bus.insert_validate(p_rec
284   ,p_effective_date);
285   --
286   -- Call the supporting pre-insert operation
287   --
288   pre_insert(p_rec);
289   --
290   -- Insert the row
291   --
292   insert_dml(p_rec);
293   --
294   -- Call the supporting post-insert operation
295   --
296   post_insert(
297 p_effective_date,p_rec);
298 end ins;
299 --
300 -- ----------------------------------------------------------------------------
301 -- |---------------------------------< ins >----------------------------------|
302 -- ----------------------------------------------------------------------------
303 Procedure ins
304   (
305   p_effective_date in date,
306   p_transaction_category_id      out nocopy number,
307   p_custom_wf_process_name       in varchar2         default null,
308   p_custom_workflow_name         in varchar2         default null,
309   p_form_name                    in varchar2,
310   p_freeze_status_cd             in varchar2         default null,
311   p_future_action_cd             in varchar2,
312   p_member_cd                    in varchar2,
313   p_name                         in varchar2,
314   p_short_name                   in varchar2,
315   p_post_style_cd                in varchar2,
316   p_post_txn_function            in varchar2,
317   p_route_validated_txn_flag     in varchar2,
318   p_prevent_approver_skip        in varchar2,
319   p_workflow_enable_flag         in varchar2,
320   p_enable_flag         in varchar2,
321   p_timeout_days                 in number           default null,
322   p_object_version_number        out nocopy number,
323   p_consolidated_table_route_id  in number,
324   p_business_group_id            in number           ,
325   p_setup_type_cd                in varchar2         ,
326   p_master_table_route_id  in number
327   ) is
328 --
329   l_rec	  pqh_tct_shd.g_rec_type;
330   l_proc  varchar2(72) := g_package||'ins';
331 --
332 Begin
333   hr_utility.set_location('Entering:'||l_proc, 5);
334   --
335   -- Call conversion function to turn arguments into the
336   -- p_rec structure.
337   --
338   l_rec :=
339   pqh_tct_shd.convert_args
340   (
341   null,
342   p_custom_wf_process_name,
343   p_custom_workflow_name,
344   p_form_name,
345   p_freeze_status_cd,
346   p_future_action_cd,
347   p_member_cd,
348   p_name,
349   p_short_name,
350   p_post_style_cd,
351   p_post_txn_function,
352   p_route_validated_txn_flag,
353   p_prevent_approver_skip,
354   p_workflow_enable_flag,
355   p_enable_flag,
356   p_timeout_days,
357   null,
358   p_consolidated_table_route_id,
359   p_business_group_id,
360   p_setup_type_cd,
361   p_master_table_route_id
362   );
363   --
364   -- Having converted the arguments into the pqh_tct_rec
365   -- plsql record structure we call the corresponding record business process.
366   --
367   ins(
368     p_effective_date,l_rec);
369   --
370   -- As the primary key argument(s)
371   -- are specified as an OUT's we must set these values.
372   --
373   p_transaction_category_id := l_rec.transaction_category_id;
374   p_object_version_number := l_rec.object_version_number;
375   --
376   hr_utility.set_location(' Leaving:'||l_proc, 10);
377 End ins;
378 --
379 end pqh_tct_ins;