DBA Data[Home] [Help]
Skip to content

PACKAGE BODY: APPS.HR_SECURITY_PAYROLLS_API

Source


1 Package Body hr_security_payrolls_api as
2 /* $Header: hrsprapi.pkb 120.0 2005/11/18 02:19:08 pchowdav noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  hr_security_payrolls_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< create_pay_security_payroll >-----------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_pay_security_payroll
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_security_profile_id           in     number
16   ,p_payroll_id                    in     number
17   ,p_object_version_number         out nocopy number
18   ) is
19   --
20   -- Declare cursors and local variables
21   --
22 
23   l_proc               varchar2(72) :=
24   g_package||'create_pay_security_payroll';
25   l_effective_date          date;
26   --
27   -- Declare out parameters
28   --
29   l_object_version_number   number;
30 
31 begin
32   hr_utility.set_location('Entering:'|| l_proc, 10);
33   --
34   -- Issue a savepoint
35   --
36   savepoint create_pay_security_payroll;
37 
38   l_object_version_number    := p_object_version_number;
39   --
40   -- Truncate the time portion from all IN date parameters
41   --
42   l_effective_date         := trunc(p_effective_date);
43 
44   --
45   -- Call Before Process User Hook
46   --
47   begin
48     hr_security_payrolls_bk1.create_pay_security_payroll_b
49       (p_effective_date                 => l_effective_date
50       ,p_security_profile_id            => p_security_profile_id
51       ,p_payroll_id                     => p_payroll_id
52       );
53 
54 
55   exception
56     when hr_api.cannot_find_prog_unit then
57       hr_api.cannot_find_prog_unit_error
58         (p_module_name => 'CREATE_PAY_SECURITY_PAYROLL'
59         ,p_hook_type   => 'BP'
60         );
61   end;
62 
63    --hr_utility.set_location('Entering:'|| l_proc, 30);
64   --
65   -- Validation in addition to Row Handlers
66   --
67    pay_spr_ins.ins
68      (p_effective_date                 => l_effective_date
69       ,p_security_profile_id            => p_security_profile_id
70       ,p_payroll_id                     => p_payroll_id
71       ,p_object_version_number          => l_object_version_number
72        );
73   --
74   -- Asign out parameters
75   --
76   p_object_version_number     := l_object_version_number;
77 
78   hr_utility.set_location('Entering:'|| l_proc,40);
79 
80   --
81   -- Call After Process User Hook
82   --
83   begin
84       hr_security_payrolls_bk1.create_pay_security_payroll_a
85       (p_effective_date                 => l_effective_date
86       ,p_security_profile_id            => p_security_profile_id
87       ,p_payroll_id                     => p_payroll_id
88       ,p_object_version_number          => l_object_version_number
89       );
90 
91 
92 
93   exception
94     when hr_api.cannot_find_prog_unit then
95       hr_api.cannot_find_prog_unit_error
96         (p_module_name => 'CREATE_PAY_SECURITY_PAYROLL'
97         ,p_hook_type   => 'AP'
98         );
99   end;
100   --
101   -- When in validation only mode raise the Validate_Enabled exception
102   --
103   if p_validate then
104     raise hr_api.validate_enabled;
105   end if;
106   --
107   -- Set all output arguments
108   --
109   hr_utility.set_location(' Leaving:'||l_proc, 70);
110 exception
111   when hr_api.validate_enabled then
112     --
113     -- As the Validate_Enabled exception has been raised
114     -- we must rollback to the savepoint
115     --
116     rollback to create_pay_security_payroll;
117     --
118     -- Only set output warning arguments
119     -- (Any key or derived arguments must be set to null
120     -- when validation only mode is being used.)
121     --
122     p_object_version_number := null;
123     hr_utility.set_location(' Leaving:'||l_proc, 80);
124   when others then
125     --
126     -- A validation or unexpected error has occured
127     --
128     rollback to create_pay_security_payroll;
129     p_object_version_number := null;
130     hr_utility.set_location(' Leaving:'||l_proc, 90);
131     raise;
132 end create_pay_security_payroll;
133 --
134 -- --------------------------------------------------------------------------
135 -- |-----------------------< delete_pay_security_payroll >-----------------|
136 -- --------------------------------------------------------------------------
137 --
138 procedure delete_pay_security_payroll
139   (p_validate                      in     boolean  default false
140   ,p_security_profile_id           in     number
141   ,p_payroll_id                    in     number
142   ,p_object_version_number         in     number
143   ) is
144   --
145   -- Declare cursors and local variables
146   --
147 
148   l_proc               varchar2(72) :=
149   g_package||'create_pay_security_payroll';
150   --l_effective_date          date;
151   --
152   -- Declare out parameters
153   --
154 begin
155   hr_utility.set_location('Entering:'|| l_proc, 10);
156   --
157   -- Issue a savepoint
158  savepoint delete_pay_security_payroll;
159   --
160   -- Truncate the time portion from all IN date parameters
161   --
162   --l_effective_date         := trunc(p_effective_date);
163   --
164   -- Call Before Process User Hook
165   --
166   begin
167     hr_security_payrolls_bk2.delete_pay_security_payroll_b
168       (p_security_profile_id            => p_security_profile_id
169       ,p_payroll_id                     => p_payroll_id
170        );
171  exception
172     when hr_api.cannot_find_prog_unit then
173       hr_api.cannot_find_prog_unit_error
174         (p_module_name => 'DELETE_PAY_SECURITY_PAYROLL'
175         ,p_hook_type   => 'BP'
176         );
177   end;
178 
179   hr_utility.set_location('Entering:'|| l_proc, 30);
180   --
181   -- Validation in addition to Row Handlers
182   --
183    pay_spr_del.del
184      (p_security_profile_id            => p_security_profile_id
185      ,p_payroll_id                     => p_payroll_id
186      ,p_object_version_number          => p_object_version_number
187        );
188 
189   hr_utility.set_location('Entering:'|| l_proc,40);
190 
191   --
192   -- Call After Process User Hook
193   --
194   begin
195       hr_security_payrolls_bk2.delete_pay_security_payroll_a
196       (p_security_profile_id            => p_security_profile_id
197       ,p_payroll_id                     => p_payroll_id
198       ,p_object_version_number          => p_object_version_number
199       );
200 
201 
202 exception
203     when hr_api.cannot_find_prog_unit then
204       hr_api.cannot_find_prog_unit_error
205         (p_module_name => 'DELETE_PAY_SECURITY_PAYROLL'
206         ,p_hook_type   => 'AP'
207         );
208   end;
209   --
210   -- When in validation only mode raise the Validate_Enabled exception
211   --
212  if p_validate then
213     raise hr_api.validate_enabled;
214   end if;
215   --
216   -- Set all output arguments
217   --
218   hr_utility.set_location(' Leaving:'||l_proc, 70);
219 exception
220   when hr_api.validate_enabled then
221  --
222     -- As the Validate_Enabled exception has been raised
223     -- we must rollback to the savepoint
224     --
225     rollback to delete_pay_security_payroll;
226     --
227     -- Only set output warning arguments
228     -- (Any key or derived arguments must be set to null
229     -- when validation only mode is being used.)
230     --
231     hr_utility.set_location(' Leaving:'||l_proc, 80);
232 
233 when others then
234     --
235     -- A validation or unexpected error has occured
236     --
237     rollback to delete_pay_security_payroll;
238     hr_utility.set_location(' Leaving:'||l_proc, 90);
239     raise;
240 end delete_pay_security_payroll;
241 --
242 --
243 end hr_security_payrolls_api;