[Home] [Help]
PACKAGE BODY: APPS.PAY_TIME_DEF_USAGE_API
Source
1 Package Body PAY_TIME_DEF_USAGE_API as
2 /* $Header: pytduapi.pkb 120.1 2005/06/14 14:24:45 tvankayl noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' PAY_TIME_DEF_USAGE_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< CREATE_TIME_DEF_USAGE >-------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_time_def_usage
13 (p_validate in boolean default false
14 ,p_effective_date in date
15 ,p_time_definition_id in number
16 ,p_usage_type in varchar2
17 ,p_object_version_number out nocopy number
18 ) is
19 --
20 -- Declare cursors and local variables
21 --
22 l_effective_date date;
23 l_proc varchar2(72) := g_package||'create_time_def_usage';
24 l_object_version_number number;
25 begin
26 hr_utility.set_location('Entering:'|| l_proc, 10);
27 --
28 -- Issue a savepoint
29 --
30 savepoint create_time_def_usage;
31 --
32 -- Truncate the time portion from all IN date parameters
33 --
34 l_effective_date := trunc(p_effective_date);
35
36 --
37 -- Call Before Process User Hook
38 --
39 begin
40 PAY_TIME_DEF_USAGE_BK1.create_time_def_usage_b
41 (p_effective_date => l_effective_date
42 ,p_time_definition_id => p_time_definition_id
43 ,p_usage_type => p_usage_type
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_time_def_usage'
49 ,p_hook_type => 'BP'
50 );
51 end;
52
53 --
54 -- Process Logic
55 --
56 pay_tdu_ins.ins
57 (p_effective_date => l_effective_date
58 ,p_time_definition_id => p_time_definition_id
59 ,p_usage_type => p_usage_type
60 ,p_object_version_number => l_object_version_number
61 );
62
63 --
64 -- Call After Process User Hook
65 --
66 begin
67
68 PAY_TIME_DEF_USAGE_BK1.create_time_def_usage_a
69 (p_effective_date => l_effective_date
70 ,p_time_definition_id => p_time_definition_id
71 ,p_usage_type => p_usage_type
72 ,p_object_version_number => l_object_version_number
73 );
74
75 exception
76 when hr_api.cannot_find_prog_unit then
77 hr_api.cannot_find_prog_unit_error
78 (p_module_name => 'create_time_def_usage'
79 ,p_hook_type => 'AP'
80 );
81 end;
82 --
83 -- When in validation only mode raise the Validate_Enabled exception
84 --
85 if p_validate then
86 raise hr_api.validate_enabled;
87 end if;
88 --
89 -- Set all IN OUT and OUT parameters with out values
90 --
91 p_object_version_number := l_object_version_number;
92 --
93 hr_utility.set_location(' Leaving:'||l_proc, 70);
94
95 exception
96 when hr_api.validate_enabled then
97 --
98 -- As the Validate_Enabled exception has been raised
99 -- we must rollback to the savepoint
100 --
101 rollback to create_time_def_usage;
102 --
103 -- Reset IN OUT parameters and set OUT parameters
104 -- (Any key or derived arguments must be set to null
105 -- when validation only mode is being used.)
106 --
107 p_object_version_number := null;
108
109 hr_utility.set_location(' Leaving:'||l_proc, 80);
110 when others then
111 --
112 -- A validation or unexpected error has occured
113 --
114 rollback to create_time_def_usage;
115 --
116 -- Reset IN OUT parameters and set all
117 -- OUT parameters, including warnings, to null
118 --
119 p_object_version_number := null;
120 hr_utility.set_location(' Leaving:'||l_proc, 90);
121 raise;
122 end create_time_def_usage;
123 --
124 -- ----------------------------------------------------------------------------
125 -- |--------------------------< delete_time_def_usage >-----------------------|
126 -- ----------------------------------------------------------------------------
127 --
128 procedure delete_time_def_usage
129 (p_validate in boolean default false
130 ,p_effective_date in date
131 ,p_time_definition_id in number
132 ,p_usage_type in varchar2
133 ,p_object_version_number in number
134 )is
135 --
136 -- Declare cursors and local variables
137 --
138 l_effective_date date;
139 l_proc varchar2(72) := g_package||'delete_time_def_usage';
140 begin
141 hr_utility.set_location('Entering:'|| l_proc, 10);
142 --
143 -- Issue a savepoint
144 --
145 savepoint delete_time_def_usage;
146 --
147 --
148 -- Truncate the time portion from all IN date parameters
149 --
150 l_effective_date := trunc(p_effective_date);
151
152 --
153 -- Call Before Process User Hook
154 --
155 begin
156 pay_time_def_usage_bk3.delete_time_def_usage_b
157 (p_effective_date => l_effective_date
158 ,p_time_definition_id => p_time_definition_id
159 ,p_usage_type => p_usage_type
160 ,p_object_version_number => p_object_version_number
161 );
162 exception
163 when hr_api.cannot_find_prog_unit then
164 hr_api.cannot_find_prog_unit_error
165 (p_module_name => 'delete_time_def_usage'
166 ,p_hook_type => 'BP'
167 );
168 end;
169
170 --
171 -- Process Logic
172 --
173
174 pay_tdu_del.del
175 (p_time_definition_id => p_time_definition_id
176 ,p_usage_type => p_usage_type
177 ,p_object_version_number => p_object_version_number
178 );
179
180 --
181 -- Call After Process User Hook
182 --
183 begin
184 pay_time_def_usage_bk3.delete_time_def_usage_a
185 (p_effective_date => l_effective_date
186 ,p_time_definition_id => p_time_definition_id
187 ,p_usage_type => p_usage_type
188 ,p_object_version_number => p_object_version_number
189 );
190 exception
191 when hr_api.cannot_find_prog_unit then
192 hr_api.cannot_find_prog_unit_error
193 (p_module_name => 'delete_time_def_usage'
194 ,p_hook_type => 'AP'
195 );
196 end;
197 --
198 -- When in validation only mode raise the Validate_Enabled exception
199 --
200 if p_validate then
201 raise hr_api.validate_enabled;
202 end if;
203 --
204 hr_utility.set_location(' Leaving:'||l_proc, 70);
205 exception
206 when hr_api.validate_enabled then
207 --
208 -- As the Validate_Enabled exception has been raised
209 -- we must rollback to the savepoint
210 --
211 rollback to delete_time_def_usage;
212 --
213 hr_utility.set_location(' Leaving:'||l_proc, 80);
214 when others then
215 --
216 -- A validation or unexpected error has occured
217 --
218 rollback to delete_time_def_usage;
219 --
220 hr_utility.set_location(' Leaving:'||l_proc, 90);
221 raise;
222 end delete_time_def_usage;
223 --
224 end PAY_TIME_DEF_USAGE_API;