DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_GOS_SHD

Source


1 Package Body ben_gos_shd as
2 /* $Header: begosrhi.pkb 120.0 2005/05/28 03:08:26 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_gos_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_GD_OR_SVC_TYP_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_GD_OR_SVC_TYP_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_GD_OR_SVC_TYP_UK1') Then
47     fnd_message.set_name('BEN', 'BEN_91009_NAME_NOT_UNIQUE');
48     fnd_message.raise_error;
49   Else
50     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
51     fnd_message.set_token('PROCEDURE', l_proc);
52     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
53     fnd_message.raise_error;
54   End If;
55   --
56   hr_utility.set_location(' Leaving:'||l_proc, 10);
57 End constraint_error;
58 --
59 -- ----------------------------------------------------------------------------
60 -- |-----------------------------< api_updating >-----------------------------|
61 -- ----------------------------------------------------------------------------
62 Function api_updating
63   (
64   p_gd_or_svc_typ_id                   in number,
65   p_object_version_number              in number
66   )      Return Boolean Is
67 --
68   --
69   -- Cursor selects the 'current' row from the HR Schema
70   --
71   Cursor C_Sel1 is
72     select
73 		gd_or_svc_typ_id,
74 	business_group_id,
75 	name,
76 	typ_cd,
77 	description,
78 	gos_attribute_category,
79 	gos_attribute1,
80 	gos_attribute2,
81 	gos_attribute3,
82 	gos_attribute4,
83 	gos_attribute5,
84 	gos_attribute6,
85 	gos_attribute7,
86 	gos_attribute8,
87 	gos_attribute9,
88 	gos_attribute10,
89 	gos_attribute11,
90 	gos_attribute12,
91 	gos_attribute13,
92 	gos_attribute14,
93 	gos_attribute15,
94 	gos_attribute16,
95 	gos_attribute17,
96 	gos_attribute18,
97 	gos_attribute19,
98 	gos_attribute20,
99 	gos_attribute21,
100 	gos_attribute22,
101 	gos_attribute23,
102 	gos_attribute24,
103 	gos_attribute25,
104 	gos_attribute26,
105 	gos_attribute27,
106 	gos_attribute28,
107 	gos_attribute29,
108 	gos_attribute30,
109 	object_version_number
110     from	ben_gd_or_svc_typ
111     where	gd_or_svc_typ_id = p_gd_or_svc_typ_id;
112 --
113   l_proc	varchar2(72)	:= g_package||'api_updating';
114   l_fct_ret	boolean;
115 --
116 Begin
117   hr_utility.set_location('Entering:'||l_proc, 5);
118   --
119   If (
120 	p_gd_or_svc_typ_id is null and
121 	p_object_version_number is null
122      ) Then
123     --
124     -- One of the primary key arguments is null therefore we must
125     -- set the returning function value to false
126     --
127     l_fct_ret := false;
128   Else
129     If (
130 	p_gd_or_svc_typ_id = g_old_rec.gd_or_svc_typ_id and
131 	p_object_version_number = g_old_rec.object_version_number
132        ) Then
133       hr_utility.set_location(l_proc, 10);
134       --
135       -- The g_old_rec is current therefore we must
136       -- set the returning function to true
137       --
138       l_fct_ret := true;
139     Else
140       --
141       -- Select the current row into g_old_rec
142       --
143       Open C_Sel1;
144       Fetch C_Sel1 Into g_old_rec;
145       If C_Sel1%notfound Then
146         Close C_Sel1;
147         --
148         -- The primary key is invalid therefore we must error
149         --
150         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
151         fnd_message.raise_error;
152       End If;
153       Close C_Sel1;
154       If (p_object_version_number <> g_old_rec.object_version_number) Then
155         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
156         fnd_message.raise_error;
157       End If;
158       hr_utility.set_location(l_proc, 15);
159       l_fct_ret := true;
160     End If;
161   End If;
162   hr_utility.set_location(' Leaving:'||l_proc, 20);
163   Return (l_fct_ret);
164 --
165 End api_updating;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |---------------------------------< lck >----------------------------------|
169 -- ----------------------------------------------------------------------------
170 Procedure lck
171   (
172   p_gd_or_svc_typ_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 	gd_or_svc_typ_id,
180 	business_group_id,
181 	name,
182 	typ_cd,
183 	description,
184 	gos_attribute_category,
185 	gos_attribute1,
186 	gos_attribute2,
187 	gos_attribute3,
188 	gos_attribute4,
189 	gos_attribute5,
190 	gos_attribute6,
191 	gos_attribute7,
192 	gos_attribute8,
193 	gos_attribute9,
194 	gos_attribute10,
195 	gos_attribute11,
196 	gos_attribute12,
197 	gos_attribute13,
198 	gos_attribute14,
199 	gos_attribute15,
200 	gos_attribute16,
201 	gos_attribute17,
202 	gos_attribute18,
203 	gos_attribute19,
204 	gos_attribute20,
205 	gos_attribute21,
206 	gos_attribute22,
207 	gos_attribute23,
208 	gos_attribute24,
209 	gos_attribute25,
210 	gos_attribute26,
211 	gos_attribute27,
212 	gos_attribute28,
213 	gos_attribute29,
214 	gos_attribute30,
215 	object_version_number
216     from	ben_gd_or_svc_typ
217     where	gd_or_svc_typ_id = p_gd_or_svc_typ_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_gd_or_svc_typ');
260     fnd_message.raise_error;
261 End lck;
262 --
263 -- ----------------------------------------------------------------------------
264 -- |-----------------------------< convert_args >-----------------------------|
265 -- ----------------------------------------------------------------------------
266 Function convert_args
267 	(
268 	p_gd_or_svc_typ_id              in number,
269 	p_business_group_id             in number,
270 	p_name                          in varchar2,
271 	p_typ_cd                        in varchar2,
272 	p_description                   in varchar2,
273 	p_gos_attribute_category        in varchar2,
274 	p_gos_attribute1                in varchar2,
275 	p_gos_attribute2                in varchar2,
276 	p_gos_attribute3                in varchar2,
277 	p_gos_attribute4                in varchar2,
278 	p_gos_attribute5                in varchar2,
279 	p_gos_attribute6                in varchar2,
280 	p_gos_attribute7                in varchar2,
281 	p_gos_attribute8                in varchar2,
282 	p_gos_attribute9                in varchar2,
283 	p_gos_attribute10               in varchar2,
284 	p_gos_attribute11               in varchar2,
285 	p_gos_attribute12               in varchar2,
286 	p_gos_attribute13               in varchar2,
287 	p_gos_attribute14               in varchar2,
288 	p_gos_attribute15               in varchar2,
289 	p_gos_attribute16               in varchar2,
290 	p_gos_attribute17               in varchar2,
291 	p_gos_attribute18               in varchar2,
292 	p_gos_attribute19               in varchar2,
293 	p_gos_attribute20               in varchar2,
294 	p_gos_attribute21               in varchar2,
295 	p_gos_attribute22               in varchar2,
296 	p_gos_attribute23               in varchar2,
297 	p_gos_attribute24               in varchar2,
298 	p_gos_attribute25               in varchar2,
299 	p_gos_attribute26               in varchar2,
300 	p_gos_attribute27               in varchar2,
301 	p_gos_attribute28               in varchar2,
302 	p_gos_attribute29               in varchar2,
303 	p_gos_attribute30               in varchar2,
304 	p_object_version_number         in number
305 	)
306 	Return g_rec_type is
307 --
308   l_rec	  g_rec_type;
309   l_proc  varchar2(72) := g_package||'convert_args';
310 --
311 Begin
312   --
313   hr_utility.set_location('Entering:'||l_proc, 5);
314   --
315   -- Convert arguments into local l_rec structure.
316   --
317   l_rec.gd_or_svc_typ_id                 := p_gd_or_svc_typ_id;
318   l_rec.business_group_id                := p_business_group_id;
319   l_rec.name                             := p_name;
320   l_rec.typ_cd                           := p_typ_cd;
321   l_rec.description                      := p_description;
322   l_rec.gos_attribute_category           := p_gos_attribute_category;
323   l_rec.gos_attribute1                   := p_gos_attribute1;
324   l_rec.gos_attribute2                   := p_gos_attribute2;
325   l_rec.gos_attribute3                   := p_gos_attribute3;
326   l_rec.gos_attribute4                   := p_gos_attribute4;
327   l_rec.gos_attribute5                   := p_gos_attribute5;
328   l_rec.gos_attribute6                   := p_gos_attribute6;
329   l_rec.gos_attribute7                   := p_gos_attribute7;
330   l_rec.gos_attribute8                   := p_gos_attribute8;
331   l_rec.gos_attribute9                   := p_gos_attribute9;
332   l_rec.gos_attribute10                  := p_gos_attribute10;
333   l_rec.gos_attribute11                  := p_gos_attribute11;
334   l_rec.gos_attribute12                  := p_gos_attribute12;
335   l_rec.gos_attribute13                  := p_gos_attribute13;
336   l_rec.gos_attribute14                  := p_gos_attribute14;
337   l_rec.gos_attribute15                  := p_gos_attribute15;
338   l_rec.gos_attribute16                  := p_gos_attribute16;
339   l_rec.gos_attribute17                  := p_gos_attribute17;
340   l_rec.gos_attribute18                  := p_gos_attribute18;
341   l_rec.gos_attribute19                  := p_gos_attribute19;
342   l_rec.gos_attribute20                  := p_gos_attribute20;
343   l_rec.gos_attribute21                  := p_gos_attribute21;
344   l_rec.gos_attribute22                  := p_gos_attribute22;
345   l_rec.gos_attribute23                  := p_gos_attribute23;
346   l_rec.gos_attribute24                  := p_gos_attribute24;
347   l_rec.gos_attribute25                  := p_gos_attribute25;
348   l_rec.gos_attribute26                  := p_gos_attribute26;
349   l_rec.gos_attribute27                  := p_gos_attribute27;
350   l_rec.gos_attribute28                  := p_gos_attribute28;
351   l_rec.gos_attribute29                  := p_gos_attribute29;
352   l_rec.gos_attribute30                  := p_gos_attribute30;
353   l_rec.object_version_number            := p_object_version_number;
354   --
355   -- Return the plsql record structure.
356   --
357   hr_utility.set_location(' Leaving:'||l_proc, 10);
358   Return(l_rec);
359 --
360 End convert_args;
361 --
362 end ben_gos_shd;