DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_BATCH_MESSAGE_LINE_API

Source


1 Package Body hr_batch_message_line_api as
2 /* $Header: hrabmapi.pkb 120.0 2006/04/11 00:14:36 vkaduban noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  hr_batch_message_line_api.';
7 g_debug    boolean; -- debug flag
8 --
9 -- ----------------------------------------------------------------------------
10 -- |-------------------------< create_message_line >--------------------------|
11 -- ----------------------------------------------------------------------------
12 --
13 procedure create_message_line
14   (p_validate                      in     boolean  default false
15   ,p_batch_run_number              in     number
16   ,p_api_name                      in     varchar2
17   ,p_status                        in     varchar2
18   ,p_error_number                  in     number   default null
19   ,p_error_message                 in     varchar2 default null
20   ,p_extended_error_message        in     varchar2 default null
21   ,p_source_row_information        in     varchar2 default null
22   ,p_line_id                          out nocopy number) is
23   --
24   l_proc      varchar2(72) := g_package||'create_message_line';
25   l_line_id   hr_api_batch_message_lines.line_id%type;
26   --
27 begin
28   g_debug := hr_utility.debug_enabled; -- get debug status
29   IF g_debug THEN
30     hr_utility.set_location('Entering:'|| l_proc, 5);
31   END IF;
32   --
33   -- Issue a savepoint
34   --
35   savepoint create_message_line;
36   --
37   IF g_debug THEN
38     hr_utility.set_location(l_proc, 7);
39   END IF;
40   --
41   -- Process Logic
42   --
43   hr_abm_ins.ins
44     (p_line_id                => l_line_id
45     ,p_batch_run_number       => p_batch_run_number
46     ,p_api_name               => p_api_name
47     ,p_status                 => p_status
48     ,p_error_number           => p_error_number
49     ,p_error_message          => p_error_message
50     ,p_extended_error_message => p_extended_error_message
51     ,p_source_row_information => p_source_row_information
52     ,p_validate               => false);
53   --
54   IF g_debug THEN
55     hr_utility.set_location(l_proc, 8);
56   END IF;
57   --
58   -- When in validation only mode raise the Validate_Enabled exception
59   --
60   if p_validate then
61     raise hr_api.validate_enabled;
62   end if;
63   --
64   -- Set all output arguments
65   --
66   p_line_id := l_line_id;
67   --
68   IF g_debug THEN
69     hr_utility.set_location(' Leaving:'||l_proc, 11);
70   END IF;
71 exception
72   when hr_api.validate_enabled then
73     --
74     -- As the Validate_Enabled exception has been raised
75     -- we must rollback to the savepoint
76     --
77     ROLLBACK TO create_message_line;
78     --
79     -- Only set output warning arguments
80     -- (Any key or derived arguments must be set to null
81     -- when validation only mode is being used.)
82     --
83     p_line_id := null;
84   when others then
85   --
86   -- A validation or unexpected error has occurred
87   --
88   -- Added as part of the fix to bug 632479
89   --
90   ROLLBACK TO create_message_line;
91   -- set the p_line_id to NULL for NOCOPY
92   p_line_id := NULL;
93   --
94   raise;
95   --
96 end create_message_line;
97 --
98 -- ----------------------------------------------------------------------------
99 -- |-------------------------< delete_message_line >--------------------------|
100 -- ----------------------------------------------------------------------------
101 --
102 procedure delete_message_line
103   (p_validate                      in     boolean  default false
104   ,p_line_id                       in     number) is
105   --
106   l_proc                varchar2(72) := g_package||'delete_message_line';
107   --
108 begin
109   g_debug := hr_utility.debug_enabled; -- get debug status
110   IF g_debug THEN
111     hr_utility.set_location('Entering:'|| l_proc, 5);
112   END IF;
113   --
114   -- Issue a savepoint
115   --
116   savepoint delete_message_line;
117   --
118   IF g_debug THEN
119     hr_utility.set_location(l_proc, 7);
120   END IF;
121   --
122   -- Process Logic
123   --
124   hr_abm_del.del
125     (p_line_id  => p_line_id
126     ,p_validate => false);
127   --
128   IF g_debug THEN
129     hr_utility.set_location(l_proc, 8);
130   END IF;
131   --
132   -- When in validation only mode raise the Validate_Enabled exception
133   --
134   if p_validate then
135     raise hr_api.validate_enabled;
136   end if;
137   --
138   IF g_debug THEN
139     hr_utility.set_location(' Leaving:'||l_proc, 11);
140   END IF;
141 exception
142   when hr_api.validate_enabled then
143     --
144     -- As the Validate_Enabled exception has been raised
145     -- we must rollback to the savepoint
146     --
147     ROLLBACK TO delete_message_line;
148   --
149   when others then
150   --
151   -- A validation or unexpected error has occurred
152   --
153   -- Added as part of the fix to bug 632479
154   --
155   ROLLBACK TO delete_message_line;
156   --
157   raise;
158   --
159 end delete_message_line;
160 --
161 -- ----------------------------------------------------------------------------
162 -- |--------------------------< delete_batch_lines >--------------------------|
163 -- ----------------------------------------------------------------------------
164 --
165 procedure delete_batch_lines
166   (p_validate                      in     boolean  default false
167   ,p_batch_run_number              in     number) is
168   --
169   l_proc                varchar2(72) := g_package||'delete_batch_lines';
170   --
171   -- select all the lines to be deleted for the specified batch run number
172   --
173   cursor csr_get_line_id is
174     select abm.line_id
175     from   hr_api_batch_message_lines abm
176     where  abm.batch_run_number = p_batch_run_number
177     order by 1;
178   --
179 begin
180   g_debug := hr_utility.debug_enabled; -- get debug status
181   IF g_debug THEN
182     hr_utility.set_location('Entering:'|| l_proc, 5);
183   END IF;
184   --
185   -- Issue a savepoint
186   --
187   savepoint delete_batch_lines;
188   --
189   IF g_debug THEN
190     hr_utility.set_location(l_proc, 6);
191   END IF;
192   --
193   hr_api.mandatory_arg_error
194     (p_api_name       => l_proc,
195      p_argument       => 'batch_run_number',
196      p_argument_value => p_batch_run_number);
197   --
198   for csr_sel in csr_get_line_id loop
199     --
200     -- delete the batch line selected
201     --
202     delete_message_line
203       (p_validate => false
204       ,p_line_id  => csr_sel.line_id);
205     --
206   end loop;
207   --
208   IF g_debug THEN
209     hr_utility.set_location(l_proc, 7);
210   END IF;
211   --
212   -- When in validation only mode raise the Validate_Enabled exception
213   --
214   if p_validate then
215     raise hr_api.validate_enabled;
216   end if;
217   --
218   IF g_debug THEN
219     hr_utility.set_location(' Leaving:'||l_proc, 11);
220   END IF;
221 exception
222   when hr_api.validate_enabled then
223     --
224     -- As the Validate_Enabled exception has been raised
225     -- we must rollback to the savepoint
226     --
227     ROLLBACK TO delete_batch_lines;
228   --
229   when others then
230   --
231   -- A validation or unexpected error has occurred
232   --
233   -- Added as part of the fix to bug 632479
234   --
235   ROLLBACK TO delete_batch_lines;
236   --
237   raise;
238   --
239 end delete_batch_lines;
240 --
241 end hr_batch_message_line_api;