DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XRC_SHD

Source


4 -- ----------------------------------------------------------------------------
1 Package Body ben_xrc_shd as
2 /* $Header: bexrcrhi.pkb 120.0 2005/05/28 12:37:58 appldev noship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_xrc_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   cursor c1 is
34    select xfi.name
35    from ben_ext_file xfi,
36         ben_ext_rcd_in_file xrf
37    where xrf.ext_rcd_id = g_old_rec.ext_rcd_id
38    and  xrf.ext_file_id = xfi.ext_file_id;
39 
40   l_name ben_ext_file.name%type ;
41 --
42 Begin
43   hr_utility.set_location('Entering:'||l_proc, 5);
44   --
45   If (p_constraint_name = 'BEN_EXT_RCD_FK1') Then
46     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
47     fnd_message.set_token('PROCEDURE', l_proc);
48     fnd_message.set_token('STEP','5');
49     fnd_message.raise_error;
50   ElsIf (p_constraint_name = 'BEN_EXT_RCD_PK') Then
51     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
52     fnd_message.set_token('PROCEDURE', l_proc);
53     fnd_message.set_token('STEP','10');
54     fnd_message.raise_error;
55   ElsIf (p_constraint_name = 'BEN_EXT_DATA_ELMT_IN_RCD_FK2') Then
56     fnd_message.set_name('BEN', 'BEN_92482_XER_EXISTS');
57     fnd_message.raise_error;
58   ElsIf (p_constraint_name = 'BEN_EXT_RSLT_DTL_FK3') Then
59     fnd_message.set_name('BEN', 'BEN_92483_XRD_EXISTS');
60     fnd_message.raise_error;
61   ElsIf (p_constraint_name = 'BEN_EXT_RCD_IN_FILE_FK2') Then
62     open c1;
63     fetch c1 into l_name;
64     close c1;
65     fnd_message.set_name('BEN', 'BEN_92481_XRF_EXISTS');
66     fnd_message.set_token('FILE_NAME', l_name);
67     fnd_message.raise_error;
68   Else
69     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
70     fnd_message.set_token('PROCEDURE', l_proc);
71     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
72     fnd_message.raise_error;
73   End If;
74   --
75   hr_utility.set_location(' Leaving:'||l_proc, 10);
76 End constraint_error;
77 --
78 -- ----------------------------------------------------------------------------
79 -- |-----------------------------< api_updating >-----------------------------|
80 -- ----------------------------------------------------------------------------
81 Function api_updating
82   (
83   p_ext_rcd_id                         in number,
84   p_object_version_number              in number
85   )      Return Boolean Is
86 --
87   --
88   -- Cursor selects the 'current' row from the HR Schema
89   --
90   Cursor C_Sel1 is
91     select
92 		ext_rcd_id,
93 	name,
94 	xml_tag_name,
95 	rcd_type_cd,
96 	low_lvl_cd,
97 	business_group_id,
98 	legislation_code,
99 	xrc_attribute_category,
100 	xrc_attribute1,
101 	xrc_attribute2,
102 	xrc_attribute3,
103 	xrc_attribute4,
104 	xrc_attribute5,
105 	xrc_attribute6,
106 	xrc_attribute7,
107 	xrc_attribute8,
111 	xrc_attribute12,
108 	xrc_attribute9,
109 	xrc_attribute10,
110 	xrc_attribute11,
112 	xrc_attribute13,
113 	xrc_attribute14,
114 	xrc_attribute15,
115 	xrc_attribute16,
116 	xrc_attribute17,
117 	xrc_attribute18,
118 	xrc_attribute19,
119 	xrc_attribute20,
120 	xrc_attribute21,
121 	xrc_attribute22,
122 	xrc_attribute23,
123 	xrc_attribute24,
124 	xrc_attribute25,
125 	xrc_attribute26,
126 	xrc_attribute27,
127 	xrc_attribute28,
128 	xrc_attribute29,
129 	xrc_attribute30,
130         last_update_date,
131         creation_date,
132         last_updated_by,
133         last_update_login,
134         created_by ,
135 	object_version_number
136     from	ben_ext_rcd
137     where	ext_rcd_id = p_ext_rcd_id;
138 --
139   l_proc	varchar2(72)	:= g_package||'api_updating';
140   l_fct_ret	boolean;
141 --
142 Begin
143   hr_utility.set_location('Entering:'||l_proc, 5);
144   --
145   If (
146 	p_ext_rcd_id is null and
147 	p_object_version_number is null
148      ) Then
149     --
150     -- One of the primary key arguments is null therefore we must
151     -- set the returning function value to false
152     --
153     l_fct_ret := false;
154   Else
155     If (
156 	p_ext_rcd_id = g_old_rec.ext_rcd_id and
157 	p_object_version_number = g_old_rec.object_version_number
158        ) Then
159       hr_utility.set_location(l_proc, 10);
160       --
161       -- The g_old_rec is current therefore we must
162       -- set the returning function to true
163       --
164       l_fct_ret := true;
165     Else
166       --
167       -- Select the current row into g_old_rec
168       --
169       Open C_Sel1;
170       Fetch C_Sel1 Into g_old_rec;
171       If C_Sel1%notfound Then
172         Close C_Sel1;
173         --
174         -- The primary key is invalid therefore we must error
175         --
176         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
177         fnd_message.raise_error;
178       End If;
179       Close C_Sel1;
180       If (p_object_version_number <> g_old_rec.object_version_number) Then
181         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
182         fnd_message.raise_error;
183       End If;
184       hr_utility.set_location(l_proc, 15);
185       l_fct_ret := true;
186     End If;
187   End If;
188   hr_utility.set_location(' Leaving:'||l_proc, 20);
189   Return (l_fct_ret);
190 --
191 End api_updating;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |---------------------------------< lck >----------------------------------|
195 -- ----------------------------------------------------------------------------
196 Procedure lck
197   (
198   p_ext_rcd_id                         in number,
199   p_object_version_number              in number
200   ) is
201 --
202 -- Cursor selects the 'current' row from the HR Schema
203 --
204   Cursor C_Sel1 is
205     select 	ext_rcd_id,
206 	name,
207 	xml_tag_name,
208 	rcd_type_cd,
209 	low_lvl_cd,
210 	business_group_id,
211 	legislation_code,
212 	xrc_attribute_category,
213 	xrc_attribute1,
214 	xrc_attribute2,
215 	xrc_attribute3,
216 	xrc_attribute4,
217 	xrc_attribute5,
218 	xrc_attribute6,
219 	xrc_attribute7,
220 	xrc_attribute8,
221 	xrc_attribute9,
222 	xrc_attribute10,
223 	xrc_attribute11,
224 	xrc_attribute12,
225 	xrc_attribute13,
226 	xrc_attribute14,
227 	xrc_attribute15,
228 	xrc_attribute16,
229 	xrc_attribute17,
230 	xrc_attribute18,
231 	xrc_attribute19,
232 	xrc_attribute20,
233 	xrc_attribute21,
234 	xrc_attribute22,
235 	xrc_attribute23,
236 	xrc_attribute24,
237 	xrc_attribute25,
238 	xrc_attribute26,
239 	xrc_attribute27,
240 	xrc_attribute28,
241 	xrc_attribute29,
242 	xrc_attribute30,
243         last_update_date,
244         creation_date,
245         last_updated_by,
246         last_update_login,
247         created_by ,
248 	object_version_number
249     from	ben_ext_rcd
250     where	ext_rcd_id = p_ext_rcd_id
251     for	update nowait;
252 --
253   l_proc	varchar2(72) := g_package||'lck';
254 --
255 Begin
256   hr_utility.set_location('Entering:'||l_proc, 5);
257   --
258   -- Add any mandatory argument checking here:
259   -- Example:
260   -- hr_api.mandatory_arg_error
261   --   (p_api_name       => l_proc,
262   --    p_argument       => 'object_version_number',
263   --    p_argument_value => p_object_version_number);
264   --
265   Open  C_Sel1;
266   Fetch C_Sel1 Into g_old_rec;
267   If C_Sel1%notfound then
268     Close C_Sel1;
269     --
270     -- The primary key is invalid therefore we must error
271     --
272     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
273     fnd_message.raise_error;
274   End If;
275   Close C_Sel1;
276   If (p_object_version_number <> g_old_rec.object_version_number) Then
277         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
278         fnd_message.raise_error;
279       End If;
280 --
281   hr_utility.set_location(' Leaving:'||l_proc, 10);
282 --
283 -- We need to trap the ORA LOCK exception
284 --
285 Exception
286   When HR_Api.Object_Locked then
287     --
288     -- The object is locked therefore we need to supply a meaningful
289     -- error message.
290     --
294 End lck;
291     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
292     fnd_message.set_token('TABLE_NAME', 'ben_ext_rcd');
293     fnd_message.raise_error;
295 --
296 -- ----------------------------------------------------------------------------
297 -- |-----------------------------< convert_args >-----------------------------|
298 -- ----------------------------------------------------------------------------
299 Function convert_args
300 	(
301 	p_ext_rcd_id                    in number,
302 	p_name                          in varchar2,
303 	p_xml_tag_name                  in varchar2,
304 	p_rcd_type_cd                   in varchar2,
305 	p_low_lvl_cd                    in varchar2,
306 	p_business_group_id             in number,
307 	p_legislation_code              in varchar2,
308 	p_xrc_attribute_category        in varchar2,
309 	p_xrc_attribute1                in varchar2,
310 	p_xrc_attribute2                in varchar2,
311 	p_xrc_attribute3                in varchar2,
312 	p_xrc_attribute4                in varchar2,
313 	p_xrc_attribute5                in varchar2,
314 	p_xrc_attribute6                in varchar2,
315 	p_xrc_attribute7                in varchar2,
316 	p_xrc_attribute8                in varchar2,
317 	p_xrc_attribute9                in varchar2,
318 	p_xrc_attribute10               in varchar2,
319 	p_xrc_attribute11               in varchar2,
320 	p_xrc_attribute12               in varchar2,
321 	p_xrc_attribute13               in varchar2,
322 	p_xrc_attribute14               in varchar2,
323 	p_xrc_attribute15               in varchar2,
324 	p_xrc_attribute16               in varchar2,
325 	p_xrc_attribute17               in varchar2,
326 	p_xrc_attribute18               in varchar2,
327 	p_xrc_attribute19               in varchar2,
328 	p_xrc_attribute20               in varchar2,
329 	p_xrc_attribute21               in varchar2,
330 	p_xrc_attribute22               in varchar2,
331 	p_xrc_attribute23               in varchar2,
332 	p_xrc_attribute24               in varchar2,
333 	p_xrc_attribute25               in varchar2,
334 	p_xrc_attribute26               in varchar2,
335 	p_xrc_attribute27               in varchar2,
336 	p_xrc_attribute28               in varchar2,
337 	p_xrc_attribute29               in varchar2,
338 	p_xrc_attribute30               in varchar2,
339         p_last_update_date              in date,
340         p_creation_date                 in date,
341         p_last_updated_by               in number,
342         p_last_update_login             in number,
343         p_created_by                    in number,
344 	p_object_version_number         in number
345 	)
346 	Return g_rec_type is
347 --
348   l_rec	  g_rec_type;
349   l_proc  varchar2(72) := g_package||'convert_args';
350 --
351 Begin
352   --
353   hr_utility.set_location('Entering:'||l_proc, 5);
354   --
355   -- Convert arguments into local l_rec structure.
356   --
357   l_rec.ext_rcd_id                       := p_ext_rcd_id;
358   l_rec.name                             := p_name;
359   l_rec.xml_tag_name                     := p_xml_tag_name;
360   l_rec.rcd_type_cd                      := p_rcd_type_cd;
361   l_rec.low_lvl_cd                       := p_low_lvl_cd;
362   l_rec.business_group_id                := p_business_group_id;
363   l_rec.legislation_code                 := p_legislation_code;
364   l_rec.xrc_attribute_category           := p_xrc_attribute_category;
365   l_rec.xrc_attribute1                   := p_xrc_attribute1;
366   l_rec.xrc_attribute2                   := p_xrc_attribute2;
367   l_rec.xrc_attribute3                   := p_xrc_attribute3;
368   l_rec.xrc_attribute4                   := p_xrc_attribute4;
369   l_rec.xrc_attribute5                   := p_xrc_attribute5;
370   l_rec.xrc_attribute6                   := p_xrc_attribute6;
371   l_rec.xrc_attribute7                   := p_xrc_attribute7;
372   l_rec.xrc_attribute8                   := p_xrc_attribute8;
373   l_rec.xrc_attribute9                   := p_xrc_attribute9;
374   l_rec.xrc_attribute10                  := p_xrc_attribute10;
375   l_rec.xrc_attribute11                  := p_xrc_attribute11;
376   l_rec.xrc_attribute12                  := p_xrc_attribute12;
377   l_rec.xrc_attribute13                  := p_xrc_attribute13;
378   l_rec.xrc_attribute14                  := p_xrc_attribute14;
379   l_rec.xrc_attribute15                  := p_xrc_attribute15;
380   l_rec.xrc_attribute16                  := p_xrc_attribute16;
381   l_rec.xrc_attribute17                  := p_xrc_attribute17;
382   l_rec.xrc_attribute18                  := p_xrc_attribute18;
383   l_rec.xrc_attribute19                  := p_xrc_attribute19;
384   l_rec.xrc_attribute20                  := p_xrc_attribute20;
385   l_rec.xrc_attribute21                  := p_xrc_attribute21;
386   l_rec.xrc_attribute22                  := p_xrc_attribute22;
387   l_rec.xrc_attribute23                  := p_xrc_attribute23;
388   l_rec.xrc_attribute24                  := p_xrc_attribute24;
389   l_rec.xrc_attribute25                  := p_xrc_attribute25;
390   l_rec.xrc_attribute26                  := p_xrc_attribute26;
391   l_rec.xrc_attribute27                  := p_xrc_attribute27;
392   l_rec.xrc_attribute28                  := p_xrc_attribute28;
393   l_rec.xrc_attribute29                  := p_xrc_attribute29;
394   l_rec.xrc_attribute30                  := p_xrc_attribute30;
395   l_rec.last_update_date                 := p_last_update_date;
396   l_rec.creation_date                    := p_creation_date;
397   l_rec.last_updated_by                  := p_last_updated_by;
398   l_rec.last_update_login                := p_last_update_login;
399   l_rec.created_by                       := p_created_by;
400   l_rec.object_version_number            := p_object_version_number;
401   --
402   -- Return the plsql record structure.
403   --
404   hr_utility.set_location(' Leaving:'||l_proc, 10);
408 --
405   Return(l_rec);
406 --
407 End convert_args;
409 end ben_xrc_shd;