[Home] [Help]
PACKAGE BODY: APPS.PAY_PYR_SHD
Source
1 PACKAGE BODY pay_pyr_shd AS
2 /* $Header: pypyrrhi.pkb 115.3 2003/09/15 04:18:59 adhunter noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package VARCHAR2(33) := ' pay_pyr_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 FUNCTION return_api_dml_status RETURN BOOLEAN IS
14 --
15 BEGIN
16 --
17 RETURN (NVL(g_api_dml, FALSE));
18 --
19 END return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 PROCEDURE constraint_error
25 (p_constraint_name IN all_constraints.constraint_name%TYPE
26 ) IS
27 --
28 l_proc VARCHAR2(72) := g_package||'constraint_error';
29 --
30 BEGIN
31 --
32 IF (p_constraint_name = 'PAY_RATESH_RATE_TYPE_CHK') THEN
33 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34 fnd_message.set_token('PROCEDURE', l_proc);
35 fnd_message.set_token('STEP','5');
36 fnd_message.raise_error;
37 ELSIF (p_constraint_name = 'PAY_RATESH_RATE_UOM_CHK') THEN
38 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39 fnd_message.set_token('PROCEDURE', l_proc);
40 fnd_message.set_token('STEP','10');
41 fnd_message.raise_error;
42 ELSIF (p_constraint_name = 'PAY_RATES_FK1') THEN
43 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44 fnd_message.set_token('PROCEDURE', l_proc);
45 fnd_message.set_token('STEP','15');
46 fnd_message.raise_error;
47 ELSIF (p_constraint_name = 'PAY_RATES_FK2') THEN
48 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
49 fnd_message.set_token('PROCEDURE', l_proc);
50 fnd_message.set_token('STEP','20');
51 fnd_message.raise_error;
52 ELSIF (p_constraint_name = 'PAY_RATES_PK') THEN
53 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
54 fnd_message.set_token('PROCEDURE', l_proc);
55 fnd_message.set_token('STEP','25');
56 fnd_message.raise_error;
57 ELSE
58 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
59 fnd_message.set_token('PROCEDURE', l_proc);
60 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
61 fnd_message.raise_error;
62 END IF;
63 --
64 END constraint_error;
65 --
66 -- ----------------------------------------------------------------------------
67 -- |-----------------------------< api_updating >-----------------------------|
68 -- ----------------------------------------------------------------------------
69 FUNCTION api_updating
70 (p_rate_id IN NUMBER
71 ,p_object_version_number IN NUMBER
72 )
73 RETURN Boolean IS
74 --
75 --
76 -- Cursor selects the 'current' row FROM the HR Schema
77 --
78 CURSOR C_Sel1 IS
79 SELECT
80 rate_id
81 ,business_group_id
82 ,parent_spine_id
83 ,name
84 ,rate_type
85 ,rate_uom
86 ,comments
87 ,request_id
88 ,program_application_id
89 ,program_id
90 ,program_update_date
91 ,attribute_category
92 ,attribute1
93 ,attribute2
94 ,attribute3
95 ,attribute4
96 ,attribute5
97 ,attribute6
98 ,attribute7
99 ,attribute8
100 ,attribute9
101 ,attribute10
102 ,attribute11
103 ,attribute12
104 ,attribute13
105 ,attribute14
106 ,attribute15
107 ,attribute16
108 ,attribute17
109 ,attribute18
110 ,attribute19
111 ,attribute20
112 ,rate_basis
113 ,asg_rate_type
114 ,object_version_number
115 FROM pay_rates
116 WHERE rate_id = p_rate_id;
117 --
118 l_fct_ret BOOLEAN;
119 --
120 BEGIN
121 --
122 IF (p_rate_id IS NULL AND
123 p_object_version_number IS NULL
124 ) THEN
125 --
126 -- One of the primary key arguments IS NULL therefore we must
127 -- set the returning function value to FALSE
128 --
129 l_fct_ret := FALSE;
130 ELSE
131 IF (p_rate_id
132 = pay_pyr_shd.g_old_rec.rate_id AND
133 p_object_version_number
134 = pay_pyr_shd.g_old_rec.object_version_number
135 ) THEN
136 --
137 -- The g_old_rec IS current therefore we must
138 -- set the returning function to TRUE
139 --
140 l_fct_ret := TRUE;
141 ELSE
142 --
143 -- Select the current row INTO g_old_rec
144 --
145 OPEN C_Sel1;
146 FETCH C_Sel1 INTO pay_pyr_shd.g_old_rec;
147 IF C_Sel1%notfound THEN
148 CLOSE C_Sel1;
149 --
150 -- The primary key IS invalid therefore we must error
151 --
152 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
153 fnd_message.raise_error;
154 END IF;
155 CLOSE C_Sel1;
156 IF (p_object_version_number
157 <> pay_pyr_shd.g_old_rec.object_version_number) THEN
158 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
159 fnd_message.raise_error;
160 END IF;
161 l_fct_ret := TRUE;
162 END IF;
163 END IF;
164 RETURN (l_fct_ret);
165 --
166 END api_updating;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |---------------------------------< lck >----------------------------------|
170 -- ----------------------------------------------------------------------------
171 PROCEDURE lck
172 (p_rate_id IN NUMBER
173 ,p_object_version_number IN NUMBER
174 ) IS
175 --
176 -- CURSOR selects the 'current' row FROM the HR Schema
177 --
178 CURSOR C_Sel1 IS
179 SELECT
180 rate_id
181 ,business_group_id
182 ,parent_spine_id
183 ,name
184 ,rate_type
185 ,rate_uom
186 ,comments
187 ,request_id
188 ,program_application_id
189 ,program_id
190 ,program_update_date
191 ,attribute_category
192 ,attribute1
193 ,attribute2
194 ,attribute3
195 ,attribute4
196 ,attribute5
197 ,attribute6
198 ,attribute7
199 ,attribute8
200 ,attribute9
201 ,attribute10
202 ,attribute11
203 ,attribute12
204 ,attribute13
205 ,attribute14
206 ,attribute15
207 ,attribute16
208 ,attribute17
209 ,attribute18
210 ,attribute19
211 ,attribute20
212 ,rate_basis
213 ,asg_rate_type
214 ,object_version_number
215 FROM pay_rates
216 WHERE rate_id = p_rate_id
217 FOR UPDATE NOWAIT;
218 --
219 l_proc VARCHAR2(72) := g_package||'lck';
220 --
221 BEGIN
222 hr_utility.set_location('Entering:'||l_proc, 5);
223 --
224 hr_api.mandatory_arg_error
225 (p_api_name => l_proc
226 ,p_argument => 'RATE_ID'
227 ,p_argument_value => p_rate_id
228 );
229 hr_utility.set_location(l_proc,6);
230 hr_api.mandatory_arg_error
231 (p_api_name => l_proc
232 ,p_argument => 'OBJECT_VERSION_NUMBER'
233 ,p_argument_value => p_object_version_number
234 );
235 --
236 OPEN C_Sel1;
237 FETCH C_Sel1 INTO pay_pyr_shd.g_old_rec;
238 IF C_Sel1%notfound THEN
239 CLOSE C_Sel1;
240 --
241 -- The primary key IS invalid therefore we must error
242 --
243 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
244 fnd_message.raise_error;
245 END IF;
246 CLOSE C_Sel1;
247 IF (p_object_version_number
248 <> pay_pyr_shd.g_old_rec.object_version_number) THEN
249 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
250 fnd_message.raise_error;
251 END IF;
252 --
253 hr_utility.set_location(' Leaving:'||l_proc, 10);
254 --
255 -- We need to trap the ORA LOCK exception
256 --
257 EXCEPTION
258 WHEN HR_Api.Object_Locked THEN
259 --
260 -- The object IS locked therefore we need to supply a meaningful
261 -- error message.
262 --
263 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
264 fnd_message.set_token('TABLE_NAME', 'pay_rates');
265 fnd_message.raise_error;
266 END lck;
267 --
268 -- ----------------------------------------------------------------------------
269 -- |-----------------------------< convert_args >-----------------------------|
270 -- ----------------------------------------------------------------------------
271 FUNCTION convert_args
272 (p_rate_id IN NUMBER
273 ,p_business_group_id IN NUMBER
274 ,p_parent_spine_id IN NUMBER
275 ,p_name IN VARCHAR2
276 ,p_rate_type IN VARCHAR2
277 ,p_rate_uom IN VARCHAR2
278 ,p_comments IN VARCHAR2
279 ,p_attribute_category IN VARCHAR2
280 ,p_attribute1 IN VARCHAR2
281 ,p_attribute2 IN VARCHAR2
282 ,p_attribute3 IN VARCHAR2
283 ,p_attribute4 IN VARCHAR2
284 ,p_attribute5 IN VARCHAR2
285 ,p_attribute6 IN VARCHAR2
286 ,p_attribute7 IN VARCHAR2
287 ,p_attribute8 IN VARCHAR2
288 ,p_attribute9 IN VARCHAR2
289 ,p_attribute10 IN VARCHAR2
290 ,p_attribute11 IN VARCHAR2
291 ,p_attribute12 IN VARCHAR2
292 ,p_attribute13 IN VARCHAR2
293 ,p_attribute14 IN VARCHAR2
294 ,p_attribute15 IN VARCHAR2
295 ,p_attribute16 IN VARCHAR2
296 ,p_attribute17 IN VARCHAR2
297 ,p_attribute18 IN VARCHAR2
298 ,p_attribute19 IN VARCHAR2
299 ,p_attribute20 IN VARCHAR2
300 ,p_rate_basis IN VARCHAR2
301 ,p_asg_rate_type IN VARCHAR2
302 ,p_object_version_number IN NUMBER
303 )
304 RETURN g_rec_type IS
305 --
306 l_rec g_rec_type;
307 --
308 BEGIN
309 --
310 -- Convert arguments INTO local l_rec structure.
311 --
312 l_rec.rate_id := p_rate_id;
313 l_rec.business_group_id := p_business_group_id;
314 l_rec.parent_spine_id := p_parent_spine_id;
315 l_rec.name := p_name;
316 l_rec.rate_type := p_rate_type;
317 l_rec.rate_uom := p_rate_uom;
318 l_rec.comments := p_comments;
319 l_rec.attribute_category := p_attribute_category;
320 l_rec.attribute1 := p_attribute1;
321 l_rec.attribute2 := p_attribute2;
322 l_rec.attribute3 := p_attribute3;
323 l_rec.attribute4 := p_attribute4;
324 l_rec.attribute5 := p_attribute5;
325 l_rec.attribute6 := p_attribute6;
326 l_rec.attribute7 := p_attribute7;
327 l_rec.attribute8 := p_attribute8;
328 l_rec.attribute9 := p_attribute9;
329 l_rec.attribute10 := p_attribute10;
330 l_rec.attribute11 := p_attribute11;
331 l_rec.attribute12 := p_attribute12;
332 l_rec.attribute13 := p_attribute13;
333 l_rec.attribute14 := p_attribute14;
334 l_rec.attribute15 := p_attribute15;
335 l_rec.attribute16 := p_attribute16;
336 l_rec.attribute17 := p_attribute17;
337 l_rec.attribute18 := p_attribute18;
338 l_rec.attribute19 := p_attribute19;
339 l_rec.attribute20 := p_attribute20;
340 l_rec.rate_basis := p_rate_basis;
341 l_rec.asg_rate_type := p_asg_rate_type;
342 l_rec.object_version_number := p_object_version_number;
343 --
344 -- RETURN the plsql record structure.
345 --
346 RETURN(l_rec);
347 --
348 END convert_args;
349 --
350 END pay_pyr_shd;