DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_TXN_CAT_DOCUMENTS_API

Source


1 Package Body pqh_txn_cat_documents_api as
2 /* $Header: pqtcdapi.pkb 120.0 2005/05/29 02:46:04 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  pqh_txn_cat_documents_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< create_txn_cat_document >-----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_txn_cat_document
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_document_id                   in     number
16   ,p_transaction_category_id       in     number
17   ,p_type_code                     in     varchar2
18   ,p_object_version_number            out nocopy   number
19   ) is
20   --
21   -- Declare cursors and local variables
22   --
23   l_effective_date      date;
24   l_proc                varchar2(72) := g_package||'create_txn_cat_document';
25 begin
26   hr_utility.set_location('Entering:'|| l_proc, 10);
27   --
28   -- Issue a savepoint
29   --
30   savepoint create_txn_cat_document;
31   --
32   -- Truncate the time portion from all IN date parameters
33   --
34   l_effective_date := trunc(p_effective_date);
35   --
36   -- Call Before Process User Hook
37   --
38   begin
39     pqh_txn_cat_documents_bk1.create_txn_cat_document_b
40       (p_effective_date                => l_effective_date
41       ,p_document_id                   => p_document_id
42       ,p_transaction_category_id       => p_transaction_category_id
43       ,p_type_code                     => p_type_code
44       );
45   exception
46     when hr_api.cannot_find_prog_unit then
47       hr_api.cannot_find_prog_unit_error
48         (p_module_name => 'create_txn_cat_document'
49         ,p_hook_type   => 'BP'
50         );
51   end;
52   --
53   -- Validation in addition to Row Handlers
54   --
55 
56 
57 
58   --
59   -- Process Logic
60   --
61 
62   pqh_tcd_ins.ins
63     (p_effective_date                => l_effective_date
64     ,p_document_id                   => p_document_id
65     ,p_transaction_category_id       => p_transaction_category_id
66     ,p_type_code                     => p_type_code
67     ,p_object_version_number         => p_object_version_number
68     );
69   --
70   -- Call After Process User Hook
71   --
72   begin
73     pqh_txn_cat_documents_bk1.create_txn_cat_document_a
74       (p_effective_date                => l_effective_date
75       ,p_document_id                   => p_document_id
76       ,p_transaction_category_id       => p_transaction_category_id
77       ,p_type_code                     => p_type_code
78       ,p_object_version_number         => p_object_version_number
79       );
80   exception
81     when hr_api.cannot_find_prog_unit then
82       hr_api.cannot_find_prog_unit_error
83         (p_module_name => 'create_txn_cat_document'
84         ,p_hook_type   => 'AP'
85         );
86   end;
87   --
88   -- When in validation only mode raise the Validate_Enabled exception
89   --
90   if p_validate then
91     raise hr_api.validate_enabled;
92   end if;
93   --
94   -- Set all IN OUT and OUT parameters with out values
95   --
96   p_object_version_number  := p_object_version_number;
97   --
98   hr_utility.set_location(' Leaving:'||l_proc, 70);
99 exception
100   when hr_api.validate_enabled then
101     --
102     -- As the Validate_Enabled exception has been raised
103     -- we must rollback to the savepoint
104     --
105     rollback to create_txn_cat_document;
106     --
107     -- Reset IN OUT parameters and set OUT parameters
108     -- (Any key or derived arguments must be set to null
109     -- when validation only mode is being used.)
110     --
111     p_object_version_number  := null;
112     hr_utility.set_location(' Leaving:'||l_proc, 80);
113   when others then
114     --
115     -- A validation or unexpected error has occured
116     --
117     rollback to create_txn_cat_document;
118     --
119     -- Reset IN OUT parameters and set all
120     -- OUT parameters, including warnings, to null
121     --
122     p_object_version_number  := null;
123     hr_utility.set_location(' Leaving:'||l_proc, 90);
124     raise;
125 end create_txn_cat_document;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |------------------------< update_txn_cat_document >-----------------------|
129 -- ----------------------------------------------------------------------------
130 --
131 procedure update_txn_cat_document
132   (p_validate                      in     boolean  default false
133   ,p_effective_date                in     date
134   ,p_document_id                   in     number
135   ,p_transaction_category_id       in     number
136   ,p_type_code                     in     varchar2 default hr_api.g_varchar2
137   ,p_object_version_number         in out nocopy   number
138   ) is
139   --
140   -- Declare cursors and local variables
141   --
142   l_effective_date      date;
143   l_proc                varchar2(72) := g_package||'update_txn_cat_document';
144   l_object_version_number number;
145 begin
146   hr_utility.set_location('Entering:'|| l_proc, 10);
147   --
148   -- Issue a savepoint
149   --
150   savepoint update_txn_cat_document;
151   --
152   -- Remember IN OUT parameter IN values
153   --
154   l_object_version_number := p_object_version_number;
155   --
156   -- Truncate the time portion from all IN date parameters
157   --
158   l_effective_date := trunc(p_effective_date);
159   --
160   -- Call Before Process User Hook
161   --
162   begin
163     pqh_txn_cat_documents_bk2.update_txn_cat_document_b
164       (p_effective_date                => l_effective_date
165       ,p_document_id                   => p_document_id
166       ,p_transaction_category_id       => p_transaction_category_id
167       ,p_type_code                     => p_type_code
168       ,p_object_version_number         => p_object_version_number
169       );
170   exception
171     when hr_api.cannot_find_prog_unit then
172       hr_api.cannot_find_prog_unit_error
173         (p_module_name => 'update_txn_cat_document'
174         ,p_hook_type   => 'BP'
175         );
176   end;
177   --
178   -- Validation in addition to Row Handlers
179   --
180   --
181   -- Process Logic
182   --
183   pqh_tcd_upd.upd
184     (p_effective_date                => l_effective_date
185     ,p_document_id                   => p_document_id
186     ,p_transaction_category_id       => p_transaction_category_id
187     ,p_type_code                     => p_type_code
188     ,p_object_version_number         => l_object_version_number
189     );
190   --
191   -- Call After Process User Hook
192   --
193   begin
194     pqh_txn_cat_documents_bk2.update_txn_cat_document_a
195       (p_effective_date                => l_effective_date
196       ,p_document_id                   => p_document_id
197       ,p_transaction_category_id       => p_transaction_category_id
198       ,p_type_code                     => p_type_code
199       ,p_object_version_number         => l_object_version_number
200       );
201   exception
202     when hr_api.cannot_find_prog_unit then
203       hr_api.cannot_find_prog_unit_error
204         (p_module_name => 'update_txn_cat_document'
205         ,p_hook_type   => 'AP'
206         );
207   end;
208   --
209   -- When in validation only mode raise the Validate_Enabled exception
210   --
211   if p_validate then
212     raise hr_api.validate_enabled;
213   end if;
214   --
215   -- Set all IN OUT and OUT parameters with out values
216   --
217   p_object_version_number  := l_object_version_number;
218   --
219   hr_utility.set_location(' Leaving:'||l_proc, 70);
220 exception
221   when hr_api.validate_enabled then
222     --
223     -- As the Validate_Enabled exception has been raised
224     -- we must rollback to the savepoint
225     --
226     rollback to update_txn_cat_document;
227     --
228     -- Reset IN OUT parameters and set OUT parameters
229     -- (Any key or derived arguments must be set to null
230     -- when validation only mode is being used.)
231     --
232     p_object_version_number  := l_object_version_number;
233     hr_utility.set_location(' Leaving:'||l_proc, 80);
234   when others then
235     --
236     -- A validation or unexpected error has occured
237     --
238     rollback to update_txn_cat_document;
239     --
240     -- Reset IN OUT parameters and set all
241     -- OUT parameters, including warnings, to null
242     --
243     p_object_version_number  := l_object_version_number;
244     hr_utility.set_location(' Leaving:'||l_proc, 90);
245     raise;
246 end update_txn_cat_document;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |------------------------< delete_txn_cat_document >-----------------------|
250 -- ----------------------------------------------------------------------------
251 --
252 procedure delete_txn_cat_document
253   (p_validate                      in     boolean  default false
254   ,p_document_id                   in     number
255   ,p_transaction_category_id       in     number
256   ,p_object_version_number         in     number
257   ) is
258   --
259   -- Declare cursors and local variables
260   --
261   l_proc                varchar2(72) := g_package||'delete_txn_cat_document';
262 begin
263   hr_utility.set_location('Entering:'|| l_proc, 10);
264   --
265   -- Issue a savepoint
266   --
267   savepoint delete_txn_cat_document;
268   --
269   -- Truncate the time portion from all IN date parameters
270   --
271   --
272   -- Call Before Process User Hook
273   --
274   begin
275     pqh_txn_cat_documents_bk3.delete_txn_cat_document_b
276       (p_document_id                   => p_document_id
277       ,p_transaction_category_id       => p_transaction_category_id
278       ,p_object_version_number         => p_object_version_number
279       );
280   exception
281     when hr_api.cannot_find_prog_unit then
282       hr_api.cannot_find_prog_unit_error
283         (p_module_name => 'delete_txn_cat_document'
284         ,p_hook_type   => 'BP'
285         );
286   end;
287   --
288   -- Validation in addition to Row Handlers
289   --
290   --
291   -- Process Logic
292   --
293   pqh_tcd_del.del
294     (p_document_id                   => p_document_id
295     ,p_transaction_category_id       => p_transaction_category_id
296     ,p_object_version_number         => p_object_version_number
297     );
298   --
299   -- Call After Process User Hook
300   --
301   begin
302     pqh_txn_cat_documents_bk3.delete_txn_cat_document_a
303       (p_document_id                   => p_document_id
304       ,p_transaction_category_id       => p_transaction_category_id
305       ,p_object_version_number         => p_object_version_number
306       );
307   exception
308     when hr_api.cannot_find_prog_unit then
309       hr_api.cannot_find_prog_unit_error
310         (p_module_name => 'delete_txn_cat_document'
311         ,p_hook_type   => 'AP'
312         );
313   end;
314   --
315   -- When in validation only mode raise the Validate_Enabled exception
316   --
317   if p_validate then
318     raise hr_api.validate_enabled;
319   end if;
320   --
321   -- Set all IN OUT and OUT parameters with out values
322   --
323   --
324   hr_utility.set_location(' Leaving:'||l_proc, 70);
325 exception
326   when hr_api.validate_enabled then
327     --
328     -- As the Validate_Enabled exception has been raised
329     -- we must rollback to the savepoint
330     --
331     rollback to delete_txn_cat_document;
332     --
333     -- Reset IN OUT parameters and set OUT parameters
334     -- (Any key or derived arguments must be set to null
335     -- when validation only mode is being used.)
336     --
337     hr_utility.set_location(' Leaving:'||l_proc, 80);
338   when others then
339     --
340     -- A validation or unexpected error has occured
341     --
342     rollback to delete_txn_cat_document;
343     --
344     -- Reset IN OUT parameters and set all
345     -- OUT parameters, including warnings, to null
346     --
347     hr_utility.set_location(' Leaving:'||l_proc, 90);
348     raise;
349 end delete_txn_cat_document;
350 --
351 end pqh_txn_cat_documents_api;