[Home] [Help]
PACKAGE BODY: APPS.BEN_YRP_SHD
Source
1 Package Body ben_yrp_shd as
2 /* $Header: beyrprhi.pkb 120.0 2005/05/28 12:44:45 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_yrp_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'BEN_YR_PERDS_FK3') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41
42 ElsIf (p_constraint_name = 'BEN_ENRT_PERD_FK2') Then
43 hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
44 hr_utility.set_message_token('TABLE_NAME','BEN_YR_PERD');
45 --hr_utility.set_message_token('PROCEDURE', l_proc);
46 -- hr_utility.set_message_token('STEP','5');
47 hr_utility.raise_error;
48
49 ElsIf (p_constraint_name = 'BEN_YR_PERDS_PK') Then
50 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
51 hr_utility.set_message_token('PROCEDURE', l_proc);
52 hr_utility.set_message_token('STEP','10');
53 hr_utility.raise_error;
54 Else
55 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
56 hr_utility.set_message_token('PROCEDURE', l_proc);
57 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
58 hr_utility.raise_error;
59 End If;
60 --
61 hr_utility.set_location(' Leaving:'||l_proc, 10);
62 End constraint_error;
63
64 --
65 -- ----------------------------------------------------------------------------
66 -- |-----------------------------< api_updating >-----------------------------|
67 -- ----------------------------------------------------------------------------
68 Function api_updating
69 (
70 p_yr_perd_id in number,
71 p_object_version_number in number
72 ) Return Boolean Is
73 --
74 --
75 -- Cursor selects the 'current' row from the HR Schema
76 --
77 Cursor C_Sel1 is
78 select
79 yr_perd_id,
80 perds_in_yr_num,
81 perd_tm_uom_cd,
82 perd_typ_cd,
83 end_date,
84 start_date,
85 lmtn_yr_strt_dt,
86 lmtn_yr_end_dt,
87 business_group_id,
88 yrp_attribute_category,
89 yrp_attribute1,
90 yrp_attribute2,
91 yrp_attribute3,
92 yrp_attribute4,
93 yrp_attribute5,
94 yrp_attribute6,
95 yrp_attribute7,
96 yrp_attribute8,
97 yrp_attribute9,
98 yrp_attribute10,
99 yrp_attribute11,
100 yrp_attribute12,
101 yrp_attribute13,
102 yrp_attribute14,
103 yrp_attribute15,
104 yrp_attribute16,
105 yrp_attribute17,
106 yrp_attribute18,
107 yrp_attribute19,
108 yrp_attribute20,
109 yrp_attribute21,
110 yrp_attribute22,
111 yrp_attribute23,
112 yrp_attribute24,
113 yrp_attribute25,
114 yrp_attribute26,
115 yrp_attribute27,
116 yrp_attribute28,
117 yrp_attribute29,
118 yrp_attribute30,
119 object_version_number
120 from ben_yr_perd
121 where yr_perd_id = p_yr_perd_id;
122 --
123 l_proc varchar2(72) := g_package||'api_updating';
124 l_fct_ret boolean;
125 --
126 Begin
127 hr_utility.set_location('Entering:'||l_proc, 5);
128 --
129 If (
130 p_yr_perd_id is null and
131 p_object_version_number is null
132 ) Then
133 --
134 -- One of the primary key arguments is null therefore we must
135 -- set the returning function value to false
136 --
137 l_fct_ret := false;
138 Else
139 If (
140 p_yr_perd_id = g_old_rec.yr_perd_id and
141 p_object_version_number = g_old_rec.object_version_number
142 ) Then
143 hr_utility.set_location(l_proc, 10);
144 --
145 -- The g_old_rec is current therefore we must
146 -- set the returning function to true
147 --
148 l_fct_ret := true;
149 Else
150 --
151 -- Select the current row into g_old_rec
152 --
153 Open C_Sel1;
154 Fetch C_Sel1 Into g_old_rec;
155 If C_Sel1%notfound Then
156 Close C_Sel1;
157 --
158 -- The primary key is invalid therefore we must error
159 --
160 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
161 hr_utility.raise_error;
162 End If;
163 Close C_Sel1;
164 If (p_object_version_number <> g_old_rec.object_version_number) Then
165 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
166 hr_utility.raise_error;
167 End If;
168 hr_utility.set_location(l_proc, 15);
169 l_fct_ret := true;
170 End If;
171 End If;
172 hr_utility.set_location(' Leaving:'||l_proc, 20);
173 Return (l_fct_ret);
174 --
175 End api_updating;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |---------------------------------< lck >----------------------------------|
179 -- ----------------------------------------------------------------------------
180 Procedure lck
181 (
182 p_yr_perd_id in number,
183 p_object_version_number in number
184 ) is
185 --
186 -- Cursor selects the 'current' row from the HR Schema
187 --
188 Cursor C_Sel1 is
189 select yr_perd_id,
190 perds_in_yr_num,
191 perd_tm_uom_cd,
192 perd_typ_cd,
193 end_date,
194 start_date,
195 lmtn_yr_strt_dt,
196 lmtn_yr_end_dt,
197 business_group_id,
198 yrp_attribute_category,
199 yrp_attribute1,
200 yrp_attribute2,
201 yrp_attribute3,
202 yrp_attribute4,
203 yrp_attribute5,
204 yrp_attribute6,
205 yrp_attribute7,
206 yrp_attribute8,
207 yrp_attribute9,
208 yrp_attribute10,
209 yrp_attribute11,
210 yrp_attribute12,
211 yrp_attribute13,
212 yrp_attribute14,
213 yrp_attribute15,
214 yrp_attribute16,
215 yrp_attribute17,
216 yrp_attribute18,
217 yrp_attribute19,
218 yrp_attribute20,
219 yrp_attribute21,
220 yrp_attribute22,
221 yrp_attribute23,
222 yrp_attribute24,
223 yrp_attribute25,
224 yrp_attribute26,
225 yrp_attribute27,
226 yrp_attribute28,
227 yrp_attribute29,
228 yrp_attribute30,
229 object_version_number
230 from ben_yr_perd
231 where yr_perd_id = p_yr_perd_id
232 for update nowait;
233 --
234 l_proc varchar2(72) := g_package||'lck';
235 --
236 Begin
237 hr_utility.set_location('Entering:'||l_proc, 5);
238 --
239 -- Add any mandatory argument checking here:
240 -- Example:
241 -- hr_api.mandatory_arg_error
242 -- (p_api_name => l_proc,
243 -- p_argument => 'object_version_number',
244 -- p_argument_value => p_object_version_number);
245 --
246 Open C_Sel1;
247 Fetch C_Sel1 Into g_old_rec;
248 If C_Sel1%notfound then
249 Close C_Sel1;
250 --
251 -- The primary key is invalid therefore we must error
252 --
253 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
254 hr_utility.raise_error;
255 End If;
256 Close C_Sel1;
257 If (p_object_version_number <> g_old_rec.object_version_number) Then
258 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
259 hr_utility.raise_error;
260 End If;
261 --
262 hr_utility.set_location(' Leaving:'||l_proc, 10);
263 --
264 -- We need to trap the ORA LOCK exception
265 --
266 Exception
267 When HR_Api.Object_Locked then
268 --
269 -- The object is locked therefore we need to supply a meaningful
270 -- error message.
271 --
272 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
273 hr_utility.set_message_token('TABLE_NAME', 'ben_yr_perd');
274 hr_utility.raise_error;
275 End lck;
276 --
277 -- ----------------------------------------------------------------------------
278 -- |-----------------------------< convert_args >-----------------------------|
279 -- ----------------------------------------------------------------------------
280 Function convert_args
281 (
282 p_yr_perd_id in number,
283 p_perds_in_yr_num in number,
284 p_perd_tm_uom_cd in varchar2,
285 p_perd_typ_cd in varchar2,
286 p_end_date in date,
287 p_start_date in date,
288 p_lmtn_yr_strt_dt in date,
289 p_lmtn_yr_end_dt in date,
290 p_business_group_id in number,
291 p_yrp_attribute_category in varchar2,
292 p_yrp_attribute1 in varchar2,
293 p_yrp_attribute2 in varchar2,
294 p_yrp_attribute3 in varchar2,
295 p_yrp_attribute4 in varchar2,
296 p_yrp_attribute5 in varchar2,
297 p_yrp_attribute6 in varchar2,
298 p_yrp_attribute7 in varchar2,
299 p_yrp_attribute8 in varchar2,
300 p_yrp_attribute9 in varchar2,
301 p_yrp_attribute10 in varchar2,
302 p_yrp_attribute11 in varchar2,
303 p_yrp_attribute12 in varchar2,
304 p_yrp_attribute13 in varchar2,
305 p_yrp_attribute14 in varchar2,
306 p_yrp_attribute15 in varchar2,
307 p_yrp_attribute16 in varchar2,
308 p_yrp_attribute17 in varchar2,
309 p_yrp_attribute18 in varchar2,
310 p_yrp_attribute19 in varchar2,
311 p_yrp_attribute20 in varchar2,
312 p_yrp_attribute21 in varchar2,
313 p_yrp_attribute22 in varchar2,
314 p_yrp_attribute23 in varchar2,
315 p_yrp_attribute24 in varchar2,
316 p_yrp_attribute25 in varchar2,
317 p_yrp_attribute26 in varchar2,
318 p_yrp_attribute27 in varchar2,
319 p_yrp_attribute28 in varchar2,
320 p_yrp_attribute29 in varchar2,
321 p_yrp_attribute30 in varchar2,
322 p_object_version_number in number
323 )
324 Return g_rec_type is
325 --
326 l_rec g_rec_type;
327 l_proc varchar2(72) := g_package||'convert_args';
328 --
329 Begin
330 --
331 hr_utility.set_location('Entering:'||l_proc, 5);
332 --
333 -- Convert arguments into local l_rec structure.
334 --
335 l_rec.yr_perd_id := p_yr_perd_id;
336 l_rec.perds_in_yr_num := p_perds_in_yr_num;
337 l_rec.perd_tm_uom_cd := p_perd_tm_uom_cd;
338 l_rec.perd_typ_cd := p_perd_typ_cd;
339 l_rec.end_date := p_end_date;
340 l_rec.start_date := p_start_date;
341 l_rec.lmtn_yr_strt_dt := p_lmtn_yr_strt_dt;
342 l_rec.lmtn_yr_end_dt := p_lmtn_yr_end_dt;
343 l_rec.business_group_id := p_business_group_id;
344 l_rec.yrp_attribute_category := p_yrp_attribute_category;
345 l_rec.yrp_attribute1 := p_yrp_attribute1;
346 l_rec.yrp_attribute2 := p_yrp_attribute2;
347 l_rec.yrp_attribute3 := p_yrp_attribute3;
348 l_rec.yrp_attribute4 := p_yrp_attribute4;
349 l_rec.yrp_attribute5 := p_yrp_attribute5;
350 l_rec.yrp_attribute6 := p_yrp_attribute6;
351 l_rec.yrp_attribute7 := p_yrp_attribute7;
352 l_rec.yrp_attribute8 := p_yrp_attribute8;
353 l_rec.yrp_attribute9 := p_yrp_attribute9;
354 l_rec.yrp_attribute10 := p_yrp_attribute10;
355 l_rec.yrp_attribute11 := p_yrp_attribute11;
356 l_rec.yrp_attribute12 := p_yrp_attribute12;
357 l_rec.yrp_attribute13 := p_yrp_attribute13;
358 l_rec.yrp_attribute14 := p_yrp_attribute14;
359 l_rec.yrp_attribute15 := p_yrp_attribute15;
360 l_rec.yrp_attribute16 := p_yrp_attribute16;
361 l_rec.yrp_attribute17 := p_yrp_attribute17;
362 l_rec.yrp_attribute18 := p_yrp_attribute18;
363 l_rec.yrp_attribute19 := p_yrp_attribute19;
364 l_rec.yrp_attribute20 := p_yrp_attribute20;
365 l_rec.yrp_attribute21 := p_yrp_attribute21;
366 l_rec.yrp_attribute22 := p_yrp_attribute22;
367 l_rec.yrp_attribute23 := p_yrp_attribute23;
368 l_rec.yrp_attribute24 := p_yrp_attribute24;
369 l_rec.yrp_attribute25 := p_yrp_attribute25;
370 l_rec.yrp_attribute26 := p_yrp_attribute26;
371 l_rec.yrp_attribute27 := p_yrp_attribute27;
372 l_rec.yrp_attribute28 := p_yrp_attribute28;
373 l_rec.yrp_attribute29 := p_yrp_attribute29;
374 l_rec.yrp_attribute30 := p_yrp_attribute30;
375 l_rec.object_version_number := p_object_version_number;
376 --
377 -- Return the plsql record structure.
378 --
379 hr_utility.set_location(' Leaving:'||l_proc, 10);
380 Return(l_rec);
381 --
382 End convert_args;
383 --
384 end ben_yrp_shd;