DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XCR_SHD

Source


1 Package Body ben_xcr_shd as
2 /* $Header: bexcrrhi.pkb 120.0 2005/05/28 12:25:40 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_xcr_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_EXT_CRIT_PRFL_FK1') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','5');
40     fnd_message.raise_error;
41   ElsIf (p_constraint_name = 'BEN_EXT_CRIT_PRFL_PK') Then
42     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('STEP','10');
45     fnd_message.raise_error;
46   ElsIf (p_constraint_name = 'BEN_EXT_CRIT_TYP_FK1') Then
47     ben_utility.child_exists_error(p_table_name => 'BEN_EXT_CRIT_TYP');
48   ElsIf (p_constraint_name = 'BEN_EXT_DFN_FK1') Then
49     ben_utility.child_exists_error(p_table_name => 'BEN_EXT_DFN');
50   Else
51     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
52     fnd_message.set_token('PROCEDURE', l_proc);
53     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
54     fnd_message.raise_error;
55   End If;
56   --
57   hr_utility.set_location(' Leaving:'||l_proc, 10);
58 End constraint_error;
59 --
60 -- ----------------------------------------------------------------------------
61 -- |-----------------------------< api_updating >-----------------------------|
62 -- ----------------------------------------------------------------------------
63 Function api_updating
64   (
65   p_ext_crit_prfl_id                   in number,
66   p_object_version_number              in number
67   )      Return Boolean Is
68 --
69   --
70   -- Cursor selects the 'current' row from the HR Schema
71   --
72   Cursor C_Sel1 is
73     select
74 	ext_crit_prfl_id,
75 	name,
76 	business_group_id,
77 	legislation_code,
78 	xcr_attribute_category,
79 	xcr_attribute1,
80 	xcr_attribute2,
81 	xcr_attribute3,
82 	xcr_attribute4,
83 	xcr_attribute5,
84 	xcr_attribute6,
85 	xcr_attribute7,
86 	xcr_attribute8,
87 	xcr_attribute9,
88 	xcr_attribute10,
89 	xcr_attribute11,
90 	xcr_attribute12,
91 	xcr_attribute13,
92 	xcr_attribute14,
93 	xcr_attribute15,
94 	xcr_attribute16,
95 	xcr_attribute17,
96 	xcr_attribute18,
97 	xcr_attribute19,
98 	xcr_attribute20,
99 	xcr_attribute21,
100 	xcr_attribute22,
101 	xcr_attribute23,
102 	xcr_attribute24,
103 	xcr_attribute25,
104 	xcr_attribute26,
105 	xcr_attribute27,
106 	xcr_attribute28,
107 	xcr_attribute29,
108 	xcr_attribute30,
109 	ext_global_flag,
110         last_update_date,
111         creation_date,
112         last_updated_by,
113         last_update_login,
114         created_by ,
115 	object_version_number
116     from	ben_ext_crit_prfl
117     where	ext_crit_prfl_id = p_ext_crit_prfl_id;
118 --
119   l_proc	varchar2(72)	:= g_package||'api_updating';
120   l_fct_ret	boolean;
121 --
122 Begin
123   hr_utility.set_location('Entering:'||l_proc, 5);
124   --
125   If (
126 	p_ext_crit_prfl_id is null and
127 	p_object_version_number is null
128      ) Then
129     --
130     -- One of the primary key arguments is null therefore we must
131     -- set the returning function value to false
132     --
133     l_fct_ret := false;
134   Else
135     If (
136 	p_ext_crit_prfl_id = g_old_rec.ext_crit_prfl_id and
137 	p_object_version_number = g_old_rec.object_version_number
138        ) Then
139       hr_utility.set_location(l_proc, 10);
140       --
141       -- The g_old_rec is current therefore we must
142       -- set the returning function to true
143       --
144       l_fct_ret := true;
145     Else
146       --
147       -- Select the current row into g_old_rec
148       --
149       Open C_Sel1;
150       Fetch C_Sel1 Into g_old_rec;
151       If C_Sel1%notfound Then
152         Close C_Sel1;
153         --
154         -- The primary key is invalid therefore we must error
155         --
156         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
157         fnd_message.raise_error;
158       End If;
159       Close C_Sel1;
160       If (p_object_version_number <> g_old_rec.object_version_number) Then
161         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
162         fnd_message.raise_error;
163       End If;
164       hr_utility.set_location(l_proc, 15);
165       l_fct_ret := true;
166     End If;
167   End If;
168   hr_utility.set_location(' Leaving:'||l_proc, 20);
169   Return (l_fct_ret);
170 --
171 End api_updating;
172 --
173 -- ----------------------------------------------------------------------------
174 -- |---------------------------------< lck >----------------------------------|
175 -- ----------------------------------------------------------------------------
176 Procedure lck
177   (
178   p_ext_crit_prfl_id                   in number,
179   p_object_version_number              in number
180   ) is
181 --
182 -- Cursor selects the 'current' row from the HR Schema
183 --
184   Cursor C_Sel1 is
185     select
186     	ext_crit_prfl_id,
187 	name,
188 	business_group_id,
189 	legislation_code,
190 	xcr_attribute_category,
191 	xcr_attribute1,
192 	xcr_attribute2,
193 	xcr_attribute3,
194 	xcr_attribute4,
195 	xcr_attribute5,
196 	xcr_attribute6,
197 	xcr_attribute7,
198 	xcr_attribute8,
199 	xcr_attribute9,
200 	xcr_attribute10,
201 	xcr_attribute11,
202 	xcr_attribute12,
203 	xcr_attribute13,
204 	xcr_attribute14,
205 	xcr_attribute15,
206 	xcr_attribute16,
207 	xcr_attribute17,
208 	xcr_attribute18,
209 	xcr_attribute19,
210 	xcr_attribute20,
211 	xcr_attribute21,
212 	xcr_attribute22,
213 	xcr_attribute23,
214 	xcr_attribute24,
215 	xcr_attribute25,
216 	xcr_attribute26,
217 	xcr_attribute27,
218 	xcr_attribute28,
219 	xcr_attribute29,
220 	xcr_attribute30,
221 	ext_global_flag,
222         last_update_date,
223         creation_date,
224         last_updated_by,
225         last_update_login,
226         created_by ,
227 	object_version_number
228     from	ben_ext_crit_prfl
229     where	ext_crit_prfl_id = p_ext_crit_prfl_id
230     for	update nowait;
231 --
232   l_proc	varchar2(72) := g_package||'lck';
233 --
234 Begin
235   hr_utility.set_location('Entering:'||l_proc, 5);
236   --
237   -- Add any mandatory argument checking here:
238   -- Example:
239   -- hr_api.mandatory_arg_error
240   --   (p_api_name       => l_proc,
241   --    p_argument       => 'object_version_number',
242   --    p_argument_value => p_object_version_number);
243   --
244   Open  C_Sel1;
245   Fetch C_Sel1 Into g_old_rec;
246   If C_Sel1%notfound then
247     Close C_Sel1;
248     --
249     -- The primary key is invalid therefore we must error
250     --
251     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
252     fnd_message.raise_error;
253   End If;
254   Close C_Sel1;
255   If (p_object_version_number <> g_old_rec.object_version_number) Then
256         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
257         fnd_message.raise_error;
258       End If;
259 --
260   hr_utility.set_location(' Leaving:'||l_proc, 10);
261 --
262 -- We need to trap the ORA LOCK exception
263 --
264 Exception
265   When HR_Api.Object_Locked then
266     --
267     -- The object is locked therefore we need to supply a meaningful
268     -- error message.
269     --
270     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
271     fnd_message.set_token('TABLE_NAME', 'ben_ext_crit_prfl');
272     fnd_message.raise_error;
273 End lck;
274 --
275 -- ----------------------------------------------------------------------------
276 -- |-----------------------------< convert_args >-----------------------------|
277 -- ----------------------------------------------------------------------------
278 Function convert_args
279 	(
280 	p_ext_crit_prfl_id              in number,
281 	p_name                          in varchar2,
282 	p_business_group_id             in number,
283         p_legislation_code              in varchar2,
284 	p_xcr_attribute_category        in varchar2,
285 	p_xcr_attribute1                in varchar2,
286 	p_xcr_attribute2                in varchar2,
287 	p_xcr_attribute3                in varchar2,
288 	p_xcr_attribute4                in varchar2,
289 	p_xcr_attribute5                in varchar2,
290 	p_xcr_attribute6                in varchar2,
291 	p_xcr_attribute7                in varchar2,
292 	p_xcr_attribute8                in varchar2,
293 	p_xcr_attribute9                in varchar2,
294 	p_xcr_attribute10               in varchar2,
295 	p_xcr_attribute11               in varchar2,
296 	p_xcr_attribute12               in varchar2,
297 	p_xcr_attribute13               in varchar2,
298 	p_xcr_attribute14               in varchar2,
299 	p_xcr_attribute15               in varchar2,
300 	p_xcr_attribute16               in varchar2,
301 	p_xcr_attribute17               in varchar2,
302 	p_xcr_attribute18               in varchar2,
303 	p_xcr_attribute19               in varchar2,
304 	p_xcr_attribute20               in varchar2,
305 	p_xcr_attribute21               in varchar2,
306 	p_xcr_attribute22               in varchar2,
307 	p_xcr_attribute23               in varchar2,
308 	p_xcr_attribute24               in varchar2,
309 	p_xcr_attribute25               in varchar2,
310 	p_xcr_attribute26               in varchar2,
311 	p_xcr_attribute27               in varchar2,
312 	p_xcr_attribute28               in varchar2,
313 	p_xcr_attribute29               in varchar2,
314 	p_xcr_attribute30               in varchar2,
315 	p_ext_global_flag               in varchar2,
316         p_last_update_date              in date,
317         p_creation_date                 in date,
318         p_last_updated_by               in number,
319         p_last_update_login             in number,
320         p_created_by                    in number,
321 	p_object_version_number         in number
322 	)
323 	Return g_rec_type is
324 --
325   l_rec	  g_rec_type;
326   l_proc  varchar2(72) := g_package||'convert_args';
327 --
328 Begin
329   --
330   hr_utility.set_location('Entering:'||l_proc, 5);
331   --
332   -- Convert arguments into local l_rec structure.
333   --
334   l_rec.ext_crit_prfl_id                 := p_ext_crit_prfl_id;
335   l_rec.name                             := p_name;
336   l_rec.business_group_id                := p_business_group_id;
337   l_rec.legislation_code                 := p_legislation_code;
338   l_rec.xcr_attribute_category           := p_xcr_attribute_category;
339   l_rec.xcr_attribute1                   := p_xcr_attribute1;
340   l_rec.xcr_attribute2                   := p_xcr_attribute2;
341   l_rec.xcr_attribute3                   := p_xcr_attribute3;
342   l_rec.xcr_attribute4                   := p_xcr_attribute4;
343   l_rec.xcr_attribute5                   := p_xcr_attribute5;
344   l_rec.xcr_attribute6                   := p_xcr_attribute6;
345   l_rec.xcr_attribute7                   := p_xcr_attribute7;
346   l_rec.xcr_attribute8                   := p_xcr_attribute8;
347   l_rec.xcr_attribute9                   := p_xcr_attribute9;
348   l_rec.xcr_attribute10                  := p_xcr_attribute10;
349   l_rec.xcr_attribute11                  := p_xcr_attribute11;
350   l_rec.xcr_attribute12                  := p_xcr_attribute12;
351   l_rec.xcr_attribute13                  := p_xcr_attribute13;
352   l_rec.xcr_attribute14                  := p_xcr_attribute14;
353   l_rec.xcr_attribute15                  := p_xcr_attribute15;
354   l_rec.xcr_attribute16                  := p_xcr_attribute16;
355   l_rec.xcr_attribute17                  := p_xcr_attribute17;
356   l_rec.xcr_attribute18                  := p_xcr_attribute18;
357   l_rec.xcr_attribute19                  := p_xcr_attribute19;
358   l_rec.xcr_attribute20                  := p_xcr_attribute20;
359   l_rec.xcr_attribute21                  := p_xcr_attribute21;
360   l_rec.xcr_attribute22                  := p_xcr_attribute22;
361   l_rec.xcr_attribute23                  := p_xcr_attribute23;
362   l_rec.xcr_attribute24                  := p_xcr_attribute24;
363   l_rec.xcr_attribute25                  := p_xcr_attribute25;
364   l_rec.xcr_attribute26                  := p_xcr_attribute26;
365   l_rec.xcr_attribute27                  := p_xcr_attribute27;
366   l_rec.xcr_attribute28                  := p_xcr_attribute28;
367   l_rec.xcr_attribute29                  := p_xcr_attribute29;
368   l_rec.xcr_attribute30                  := p_xcr_attribute30;
369   l_rec.ext_global_flag                  := p_ext_global_flag;
370   l_rec.last_update_date                 := p_last_update_date;
371   l_rec.creation_date                    := p_creation_date;
372   l_rec.last_updated_by                  := p_last_updated_by;
373   l_rec.last_update_login                := p_last_update_login;
374   l_rec.created_by                       := p_created_by;
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_xcr_shd;