DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CRD_SHD

Source


1 Package Body ben_crd_shd as
2 /* $Header: becrdrhi.pkb 115.4 2002/12/16 11:03:52 rpgupta ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_crd_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_CRT_ORDR_CVRD_PER_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_CRT_ORDR_CVRD_PER_FK2') 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_CRT_ORDR_CVRD_PER_PK') Then
47     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
48     fnd_message.set_token('PROCEDURE', l_proc);
49     fnd_message.set_token('STEP','15');
50     fnd_message.raise_error;
51   Else
52     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
53     fnd_message.set_token('PROCEDURE', l_proc);
54     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
55     fnd_message.raise_error;
56   End If;
57   --
58   hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65   (
66   p_crt_ordr_cvrd_per_id               in number,
67   p_object_version_number              in number
68   )      Return Boolean Is
69 --
70   --
71   -- Cursor selects the 'current' row from the HR Schema
72   --
73   Cursor C_Sel1 is
74     select
75 		crt_ordr_cvrd_per_id,
76 	crt_ordr_id,
77 	person_id,
78 	business_group_id,
79 	crd_attribute_category,
80 	crd_attribute1,
81 	crd_attribute2,
82 	crd_attribute3,
83 	crd_attribute4,
84 	crd_attribute5,
85 	crd_attribute6,
86 	crd_attribute7,
87 	crd_attribute8,
88 	crd_attribute9,
89 	crd_attribute10,
90 	crd_attribute11,
91 	crd_attribute12,
92 	crd_attribute13,
93 	crd_attribute14,
94 	crd_attribute15,
95 	crd_attribute16,
96 	crd_attribute17,
97 	crd_attribute18,
98 	crd_attribute19,
99 	crd_attribute20,
100 	crd_attribute21,
101 	crd_attribute22,
102 	crd_attribute23,
103 	crd_attribute24,
104 	crd_attribute25,
105 	crd_attribute26,
106 	crd_attribute27,
107 	crd_attribute28,
108 	crd_attribute29,
109 	crd_attribute30,
110 	object_version_number
111     from	ben_crt_ordr_cvrd_per
112     where	crt_ordr_cvrd_per_id = p_crt_ordr_cvrd_per_id;
113 --
114   l_proc	varchar2(72)	:= g_package||'api_updating';
115   l_fct_ret	boolean;
116 --
117 Begin
118   hr_utility.set_location('Entering:'||l_proc, 5);
119   --
120   If (
121 	p_crt_ordr_cvrd_per_id is null and
122 	p_object_version_number is null
123      ) Then
124     --
125     -- One of the primary key arguments is null therefore we must
126     -- set the returning function value to false
127     --
128     l_fct_ret := false;
129   Else
130     If (
131 	p_crt_ordr_cvrd_per_id = g_old_rec.crt_ordr_cvrd_per_id and
132 	p_object_version_number = g_old_rec.object_version_number
133        ) Then
134       hr_utility.set_location(l_proc, 10);
135       --
136       -- The g_old_rec is current therefore we must
137       -- set the returning function to true
138       --
139       l_fct_ret := true;
140     Else
141       --
142       -- Select the current row into g_old_rec
143       --
144       Open C_Sel1;
145       Fetch C_Sel1 Into g_old_rec;
146       If C_Sel1%notfound Then
147         Close C_Sel1;
148         --
149         -- The primary key is invalid therefore we must error
150         --
151         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
152         fnd_message.raise_error;
153       End If;
154       Close C_Sel1;
155       If (p_object_version_number <> g_old_rec.object_version_number) Then
156         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
157         fnd_message.raise_error;
158       End If;
159       hr_utility.set_location(l_proc, 15);
160       l_fct_ret := true;
161     End If;
162   End If;
163   hr_utility.set_location(' Leaving:'||l_proc, 20);
164   Return (l_fct_ret);
165 --
166 End api_updating;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |---------------------------------< lck >----------------------------------|
170 -- ----------------------------------------------------------------------------
171 Procedure lck
172   (
173   p_crt_ordr_cvrd_per_id               in number,
174   p_object_version_number              in number
175   ) is
176 --
177 -- Cursor selects the 'current' row from the HR Schema
178 --
179   Cursor C_Sel1 is
180     select 	crt_ordr_cvrd_per_id,
181 	crt_ordr_id,
182 	person_id,
183 	business_group_id,
184 	crd_attribute_category,
185 	crd_attribute1,
186 	crd_attribute2,
187 	crd_attribute3,
188 	crd_attribute4,
189 	crd_attribute5,
190 	crd_attribute6,
191 	crd_attribute7,
192 	crd_attribute8,
193 	crd_attribute9,
194 	crd_attribute10,
195 	crd_attribute11,
196 	crd_attribute12,
197 	crd_attribute13,
198 	crd_attribute14,
199 	crd_attribute15,
200 	crd_attribute16,
201 	crd_attribute17,
202 	crd_attribute18,
203 	crd_attribute19,
204 	crd_attribute20,
205 	crd_attribute21,
206 	crd_attribute22,
207 	crd_attribute23,
208 	crd_attribute24,
209 	crd_attribute25,
210 	crd_attribute26,
211 	crd_attribute27,
212 	crd_attribute28,
213 	crd_attribute29,
214 	crd_attribute30,
215 	object_version_number
216     from	ben_crt_ordr_cvrd_per
217     where	crt_ordr_cvrd_per_id = p_crt_ordr_cvrd_per_id
218     for	update nowait;
219 --
220   l_proc	varchar2(72) := g_package||'lck';
221 --
222 Begin
223   hr_utility.set_location('Entering:'||l_proc, 5);
224   --
225   -- Add any mandatory argument checking here:
226   -- Example:
227   -- hr_api.mandatory_arg_error
228   --   (p_api_name       => l_proc,
229   --    p_argument       => 'object_version_number',
230   --    p_argument_value => p_object_version_number);
231   --
232   Open  C_Sel1;
233   Fetch C_Sel1 Into g_old_rec;
234   If C_Sel1%notfound then
235     Close C_Sel1;
236     --
237     -- The primary key is invalid therefore we must error
238     --
239     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
240     fnd_message.raise_error;
241   End If;
242   Close C_Sel1;
243   If (p_object_version_number <> g_old_rec.object_version_number) Then
244         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
245         fnd_message.raise_error;
246       End If;
247 --
248   hr_utility.set_location(' Leaving:'||l_proc, 10);
249 --
250 -- We need to trap the ORA LOCK exception
251 --
252 Exception
253   When HR_Api.Object_Locked then
254     --
255     -- The object is locked therefore we need to supply a meaningful
256     -- error message.
257     --
258     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
259     fnd_message.set_token('TABLE_NAME', 'ben_crt_ordr_cvrd_per');
260     fnd_message.raise_error;
261 End lck;
262 --
263 -- ----------------------------------------------------------------------------
264 -- |-----------------------------< convert_args >-----------------------------|
265 -- ----------------------------------------------------------------------------
266 Function convert_args
267 	(
268 	p_crt_ordr_cvrd_per_id          in number,
269 	p_crt_ordr_id                   in number,
270 	p_person_id                     in number,
271 	p_business_group_id             in number,
272 	p_crd_attribute_category        in varchar2,
273 	p_crd_attribute1                in varchar2,
274 	p_crd_attribute2                in varchar2,
275 	p_crd_attribute3                in varchar2,
276 	p_crd_attribute4                in varchar2,
277 	p_crd_attribute5                in varchar2,
278 	p_crd_attribute6                in varchar2,
279 	p_crd_attribute7                in varchar2,
280 	p_crd_attribute8                in varchar2,
281 	p_crd_attribute9                in varchar2,
282 	p_crd_attribute10               in varchar2,
283 	p_crd_attribute11               in varchar2,
284 	p_crd_attribute12               in varchar2,
285 	p_crd_attribute13               in varchar2,
286 	p_crd_attribute14               in varchar2,
287 	p_crd_attribute15               in varchar2,
288 	p_crd_attribute16               in varchar2,
289 	p_crd_attribute17               in varchar2,
290 	p_crd_attribute18               in varchar2,
291 	p_crd_attribute19               in varchar2,
292 	p_crd_attribute20               in varchar2,
293 	p_crd_attribute21               in varchar2,
294 	p_crd_attribute22               in varchar2,
295 	p_crd_attribute23               in varchar2,
296 	p_crd_attribute24               in varchar2,
297 	p_crd_attribute25               in varchar2,
298 	p_crd_attribute26               in varchar2,
299 	p_crd_attribute27               in varchar2,
300 	p_crd_attribute28               in varchar2,
301 	p_crd_attribute29               in varchar2,
302 	p_crd_attribute30               in varchar2,
303 	p_object_version_number         in number
304 	)
305 	Return g_rec_type is
306 --
307   l_rec	  g_rec_type;
308   l_proc  varchar2(72) := g_package||'convert_args';
309 --
310 Begin
311   --
312   hr_utility.set_location('Entering:'||l_proc, 5);
313   --
314   -- Convert arguments into local l_rec structure.
315   --
316   l_rec.crt_ordr_cvrd_per_id             := p_crt_ordr_cvrd_per_id;
317   l_rec.crt_ordr_id                      := p_crt_ordr_id;
318   l_rec.person_id                        := p_person_id;
319   l_rec.business_group_id                := p_business_group_id;
320   l_rec.crd_attribute_category           := p_crd_attribute_category;
321   l_rec.crd_attribute1                   := p_crd_attribute1;
322   l_rec.crd_attribute2                   := p_crd_attribute2;
323   l_rec.crd_attribute3                   := p_crd_attribute3;
324   l_rec.crd_attribute4                   := p_crd_attribute4;
325   l_rec.crd_attribute5                   := p_crd_attribute5;
326   l_rec.crd_attribute6                   := p_crd_attribute6;
327   l_rec.crd_attribute7                   := p_crd_attribute7;
328   l_rec.crd_attribute8                   := p_crd_attribute8;
329   l_rec.crd_attribute9                   := p_crd_attribute9;
330   l_rec.crd_attribute10                  := p_crd_attribute10;
331   l_rec.crd_attribute11                  := p_crd_attribute11;
332   l_rec.crd_attribute12                  := p_crd_attribute12;
333   l_rec.crd_attribute13                  := p_crd_attribute13;
334   l_rec.crd_attribute14                  := p_crd_attribute14;
335   l_rec.crd_attribute15                  := p_crd_attribute15;
336   l_rec.crd_attribute16                  := p_crd_attribute16;
337   l_rec.crd_attribute17                  := p_crd_attribute17;
338   l_rec.crd_attribute18                  := p_crd_attribute18;
339   l_rec.crd_attribute19                  := p_crd_attribute19;
340   l_rec.crd_attribute20                  := p_crd_attribute20;
341   l_rec.crd_attribute21                  := p_crd_attribute21;
342   l_rec.crd_attribute22                  := p_crd_attribute22;
343   l_rec.crd_attribute23                  := p_crd_attribute23;
344   l_rec.crd_attribute24                  := p_crd_attribute24;
345   l_rec.crd_attribute25                  := p_crd_attribute25;
346   l_rec.crd_attribute26                  := p_crd_attribute26;
347   l_rec.crd_attribute27                  := p_crd_attribute27;
348   l_rec.crd_attribute28                  := p_crd_attribute28;
349   l_rec.crd_attribute29                  := p_crd_attribute29;
350   l_rec.crd_attribute30                  := p_crd_attribute30;
351   l_rec.object_version_number            := p_object_version_number;
352   --
353   -- Return the plsql record structure.
354   --
355   hr_utility.set_location(' Leaving:'||l_proc, 10);
356   Return(l_rec);
357 --
358 End convert_args;
359 --
360 end ben_crd_shd;