DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_DE_OPERATIONS_API

Source


1 Package Body PQH_DE_OPERATIONS_API as
2 /* $Header: pqoplapi.pkb 115.1 2002/12/03 00:09:25 rpasapul noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'PQH_DE_OPERATIONS_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< Insert_OPERATIONS >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure Insert_OPERATIONS
13   (p_validate                      in  boolean  default false
14   ,p_effective_date                in  date
15   ,p_OPERATION_NUMBER              In  Varchar2 Default NULL
16   ,P_DESCRIPTION                   In  Varchar2
17   ,P_OPERATION_ID                  out nocopy Number
18   ,p_object_version_number         out nocopy number) is
19   --
20   -- Declare cursors and local variables
21   --
22 
23   l_proc  varchar2(72)    := g_package||'Insert_OPERATIONS';
24   l_object_Version_Number PQH_DE_OPERATIONS.OBJECT_VERSION_NUMBER%TYPE;
25   L_Effective_Date        Date;
26   l_OPERATION_ID          PQH_DE_OPERATIONS.OPERATION_ID%TYPE;
27 
28   l_operation_Number      PQH_DE_OPERATIONS.OPERATION_NUMBER%TYPE;
29 
30 begin
31   hr_utility.set_location('Entering:'|| l_proc, 10);
32   --
33   -- Issue a savepoint
34   --
35   savepoint Insert_OPERATIONS;
36   --
37   -- Truncate the time portion from all IN date parameters
38   --
39      l_effective_date := Trunc(p_effective_Date);
40   --
41   -- Call Before Process User Hook
42   --
43 
44   begin
45    PQH_DE_OPERATIONS_BK1.Insert_OPERATIONS_b
46    (p_effective_date             => L_Effective_Date
47    ,p_OPERATION_NUMBER           => l_OPERATION_NUMBER
48    ,P_DESCRIPTION                => P_DESCRIPTION );
49 
50 
51   exception
52     when hr_api.cannot_find_prog_unit then
53       hr_api.cannot_find_prog_unit_error
54         (p_module_name => 'CREATE_OPERATIONS'
55         ,p_hook_type   => 'BP'
56         );
57   end;
58   --
59   -- Validation in addition to Row Handlers
60   --
61   --
62   -- Process Logic
63      pqh_opl_ins.ins
64     (p_effective_date               => l_Effective_date
65     ,p_OPERATION_number             => p_OPERATION_number
66     ,p_description                  => P_DESCRIPTION
67     ,p_OPERATION_id                 => l_OPERATION_id
68     ,p_object_version_number        => l_OBJECT_VERSION_NUMBER
69     );
70 
71   --
72   -- Call After Process User Hook
73   --
74   begin
75 
76 
77         PQH_DE_OPERATIONS_BK1.Insert_OPERATIONS_a
78            (p_effective_date             => L_Effective_Date
79            ,p_OPERATION_NUMBER           => l_OPERATION_NUMBER
80            ,P_DESCRIPTION                => P_DESCRIPTION
81            ,P_OPERATION_ID               => l_OPERATION_ID
82            ,p_object_version_number      => l_object_version_number);
83 
84 
85   exception
86     when hr_api.cannot_find_prog_unit then
87       hr_api.cannot_find_prog_unit_error
88         (p_module_name => 'INSERT_OPERATIONS'
89         ,p_hook_type   => 'AP'
90         );
91   end;
92   --
93   -- When in validation only mode raise the Validate_Enabled exception
94   --
95   if p_validate then
96     raise hr_api.validate_enabled;
97   end if;
98   --
99   -- Set all output arguments
100   --
101   P_OPERATION_ID            := l_OPERATION_ID;
102   p_object_version_number   := l_object_version_number;
103 
104   --
105   hr_utility.set_location(' Leaving:'||l_proc, 70);
106 exception
107   when hr_api.validate_enabled then
108     --
109     -- As the Validate_Enabled exception has been raised
110     -- we must rollback to the savepoint
111     --
112     rollback to Insert_OPERATIONS;
113     --
114     -- Only set output warning arguments
115     -- (Any key or derived arguments must be set to null
116     -- when validation only mode is being used.)
117     --
118     p_OPERATION_ID    := null;
119     p_object_version_number  := null;
120     hr_utility.set_location(' Leaving:'||l_proc, 80);
121 
122   when others then
123     p_OPERATION_ID    := null;
124     p_object_version_number  := null;
125     --
126     -- A validation or unexpected error has occured
127     --
128     rollback to Insert_OPERATIONS;
129     hr_utility.set_location(' Leaving:'||l_proc, 90);
130     raise;
131 end Insert_OPERATIONS;
132 
133 --
134 -- ----------------------------------------------------------------------------
135 -- |--------------------------< Update_OPERATIONS >--------------------------|
136 -- ----------------------------------------------------------------------------
137 
138 procedure Update_OPERATIONS
139   (p_validate                      in  boolean  default false
140   ,p_effective_date                in  date
141   ,p_OPERATION_NUMBER              In  Varchar2 Default hr_api.g_Varchar2
142   ,P_DESCRIPTION                   In  Varchar2 Default hr_api.g_Varchar2
143   ,P_OPERATION_ID                  In  Number
144   ,p_object_version_number         in  out nocopy number) Is
145 
146   l_proc  varchar2(72)      := g_package||'Update_OPERATIONS';
147   l_object_Version_Number   PQH_DE_OPERATIONS.OBJECT_VERSION_NUMBER%TYPE := P_Object_version_Number;
148   L_Effective_Date          Date;
149 
150 Begin
151   hr_utility.set_location('Entering:'|| l_proc, 10);
152   --
153   -- Issue a savepoint
154   --
155   savepoint Update_OPERATIONS;
156   --
157   -- Truncate the time portion from all IN date parameters
158   --
159      l_effective_date := Trunc(p_effective_Date);
160   --
161   -- Call Before Process User Hook
162   --
163   begin
164 
165 
166 PQH_DE_OPERATIONS_BK2.Update_OPERATIONS_b
167            (p_effective_date             => L_Effective_Date
168            ,p_OPERATION_NUMBER           => p_OPERATION_NUMBER
169            ,P_DESCRIPTION                => P_DESCRIPTION
170            ,P_OPERATION_ID               => p_OPERATION_ID
171            ,p_object_version_number      => l_object_version_number);
172 
173 
174  exception
175     when hr_api.cannot_find_prog_unit then
176       hr_api.cannot_find_prog_unit_error
177         (p_module_name => 'UPDATE_OPERATIONS'
178         ,p_hook_type   => 'BP'
179         );
180   end;
181 
182 pqh_opl_upd.upd
183   (p_effective_date               => l_Effective_Date
184   ,p_OPERATION_id                 => p_OPERATION_ID
185   ,p_object_version_number        => l_object_version_number
186   ,p_OPERATION_number             => p_OPERATION_NUMBER
187   ,p_description                  => P_DESCRIPTION  ) ;
188 
189 --
190 --
191   -- Call After Process User Hook
192   --
193   begin
194 
195 
196  PQH_DE_OPERATIONS_BK2.Update_OPERATIONS_a
197            (p_effective_date             => L_Effective_Date
198            ,p_OPERATION_NUMBER           => p_OPERATION_NUMBER
199            ,P_DESCRIPTION                => P_DESCRIPTION
200            ,P_OPERATION_ID               => p_OPERATION_ID
201            ,p_object_version_number      => l_object_version_number);
202 
203   exception
204     when hr_api.cannot_find_prog_unit then
205       hr_api.cannot_find_prog_unit_error
206         (p_module_name => 'UPDATE_OPERATIONS'
207         ,p_hook_type   => 'AP'
208         );
209   end;
210   --
211   -- When in validation only mode raise the Validate_Enabled exception
212   --
213   if p_validate then
214     raise hr_api.validate_enabled;
215   end if;
216   --
217   -- Set all output arguments
218   --
219 
220   p_object_version_number  := l_object_version_number;
221 
222   --
223   hr_utility.set_location(' Leaving:'||l_proc, 70);
224 exception
225   when hr_api.validate_enabled then
226     --
227     -- As the Validate_Enabled exception has been raised
228     -- we must rollback to the savepoint
229     --
230     rollback to Update_OPERATIONS;
231     --
232     -- Only set output warning arguments
233     -- (Any key or derived arguments must be set to null
234     -- when validation only mode is being used.)
235     --
236     hr_utility.set_location(' Leaving:'||l_proc, 80);
237 
238   when others then
239   p_object_version_number := l_object_version_number;
240     --
241     -- A validation or unexpected error has occured
242     --
243     rollback to Update_OPERATIONS;
244     hr_utility.set_location(' Leaving:'||l_proc, 90);
245     raise;
246 end Update_OPERATIONS;
247 
248 --
249 -- ----------------------------------------------------------------------------
250 -- |-------------------< delete_OPERATIONS>------------------------------|
251 -- ----------------------------------------------------------------------------
252 procedure delete_OPERATIONS
253   (p_validate                      in     boolean  default false
254   ,p_OPERATION_ID                  In     Number
255   ,p_object_version_number         In     number) Is   --
256 
257   -- Declare cursors and local variables
258   --
259   l_proc           varchar2(72) := g_package||'delete_OPERATIONS';
260   --
261 begin
262   hr_utility.set_location('Entering:'|| l_proc, 10);
263   --
264   -- Issue a savepoint
265   --
266   savepoint delete_OPERATIONS;
267   --
268   -- Call Before Process User Hook
269   --
270   begin
271   PQH_DE_OPERATIONS_BK3.Delete_OPERATIONS_b
272   (p_OPERATION_Id                  =>   p_OPERATION_Id
273   ,p_object_version_number         =>   p_object_version_number);
274   exception
275     when hr_api.cannot_find_prog_unit then
276       hr_api.cannot_find_prog_unit_error
277         (p_module_name => 'DELETE_OPERATIONS'
278         ,p_hook_type   => 'BP');
279   end;
280   --
281   -- Process Logic
282   --
283   pqh_opl_del.del
284   (p_OPERATION_id                           =>   p_OPERATION_Id
285   ,p_object_version_number                  =>   p_object_version_number
286   );
287   --
288   -- Call After Process User Hook
289   --
290   begin
291 
292   PQH_DE_OPERATIONS_BK3.Delete_OPERATIONS_a
293   (p_OPERATION_Id                  =>   p_OPERATION_Id
294   ,p_object_version_number         =>   p_object_version_number);
295 
296   exception
297     when hr_api.cannot_find_prog_unit then
298       hr_api.cannot_find_prog_unit_error
299         (p_module_name => 'DELETE_OPERATIONS'
300         ,p_hook_type   => 'AP');
301   end;
302   --
303   -- When in validation only mode raise the Validate_Enabled exception
304   --
305   if p_validate then
306     raise hr_api.validate_enabled;
307   end if;
308   --
309   -- Set all output arguments
310   --
311   hr_utility.set_location(' Leaving:'||l_proc, 70);
312 exception
313   when hr_api.validate_enabled then
314     --
315     -- As the Validate_Enabled exception has been raised
316     -- we must rollback to the savepoint
317     --
318     rollback to delete_OPERATIONS;
319     --
320     -- Only set output warning arguments
321     -- (Any key or derived arguments must be set to null
322     -- when validation only mode is being used.)
323     --
324     hr_utility.set_location(' Leaving:'||l_proc, 80);
325   when others then
326     --
327     -- A validation or unexpected error has occured
328     --
329     rollback to delete_OPERATIONS;
330     hr_utility.set_location(' Leaving:'||l_proc, 90);
331     raise;
332 end delete_OPERATIONS;
333 
334 end PQH_DE_OPERATIONS_API;