DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PTY_SHD

Source


1 Package Body ben_pty_shd as
2 /* $Header: beptyrhi.pkb 115.7 2002/12/10 15:22:41 bmanyam noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pty_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc 	varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'BEN_PL_PCP_TYP_FK2') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'BEN_PL_PCP_TYP_PK') Then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   Else
43     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
46     fnd_message.raise_error;
47   End If;
48   --
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55   (p_pl_pcp_typ_id                        in     number
56   ,p_object_version_number                in     number
57   )
58   Return Boolean Is
59 --
60   --
61   -- Cursor selects the 'current' row from the HR Schema
62   --
63   Cursor C_Sel1 is
64     select
65        pl_pcp_typ_id
66       ,pl_pcp_id
67       ,business_group_id
68       ,pcp_typ_cd
69       ,min_age
70       ,max_age
71       ,gndr_alwd_cd
72       ,pty_attribute_category
73       ,pty_attribute1
74       ,pty_attribute2
75       ,pty_attribute3
76       ,pty_attribute4
77       ,pty_attribute5
78       ,pty_attribute6
79       ,pty_attribute7
80       ,pty_attribute8
81       ,pty_attribute9
82       ,pty_attribute10
83       ,pty_attribute11
84       ,pty_attribute12
85       ,pty_attribute13
86       ,pty_attribute14
87       ,pty_attribute15
88       ,pty_attribute16
89       ,pty_attribute17
90       ,pty_attribute18
91       ,pty_attribute19
92       ,pty_attribute20
93       ,pty_attribute21
94       ,pty_attribute22
95       ,pty_attribute23
96       ,pty_attribute24
97       ,pty_attribute25
98       ,pty_attribute26
99       ,pty_attribute27
100       ,pty_attribute28
101       ,pty_attribute29
102       ,pty_attribute30
103       ,object_version_number
104     from	ben_pl_pcp_typ
105     where	pl_pcp_typ_id = p_pl_pcp_typ_id;
106 --
107   l_fct_ret	boolean;
108 --
109 Begin
110   --
111   If (p_pl_pcp_typ_id is null and
112       p_object_version_number is null
113      ) Then
114     --
115     -- One of the primary key arguments is null therefore we must
116     -- set the returning function value to false
117     --
118     l_fct_ret := false;
119   Else
120     If (p_pl_pcp_typ_id
121         = ben_pty_shd.g_old_rec.pl_pcp_typ_id and
122         p_object_version_number
123         = ben_pty_shd.g_old_rec.object_version_number
124        ) Then
125       --
126       -- The g_old_rec is current therefore we must
127       -- set the returning function to true
128       --
129       l_fct_ret := true;
130     Else
131       --
132       -- Select the current row into g_old_rec
133       --
134       Open C_Sel1;
135       Fetch C_Sel1 Into ben_pty_shd.g_old_rec;
136       If C_Sel1%notfound Then
137         Close C_Sel1;
138         --
139         -- The primary key is invalid therefore we must error
140         --
141         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
142         fnd_message.raise_error;
143       End If;
144       Close C_Sel1;
145       If (p_object_version_number
146           <> ben_pty_shd.g_old_rec.object_version_number) Then
147         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
148         fnd_message.raise_error;
149       End If;
150       l_fct_ret := true;
151     End If;
152   End If;
153   Return (l_fct_ret);
154 --
155 End api_updating;
156 --
157 -- ----------------------------------------------------------------------------
158 -- |---------------------------------< lck >----------------------------------|
159 -- ----------------------------------------------------------------------------
160 Procedure lck
161   (p_pl_pcp_typ_id                        in     number
162   ,p_object_version_number                in     number
163   ) is
164 --
165 -- Cursor selects the 'current' row from the HR Schema
166 --
167   Cursor C_Sel1 is
168     select
169        pl_pcp_typ_id
170       ,pl_pcp_id
171       ,business_group_id
172       ,pcp_typ_cd
173       ,min_age
174       ,max_age
175       ,gndr_alwd_cd
176       ,pty_attribute_category
177       ,pty_attribute1
178       ,pty_attribute2
179       ,pty_attribute3
180       ,pty_attribute4
181       ,pty_attribute5
182       ,pty_attribute6
183       ,pty_attribute7
184       ,pty_attribute8
185       ,pty_attribute9
186       ,pty_attribute10
187       ,pty_attribute11
188       ,pty_attribute12
189       ,pty_attribute13
190       ,pty_attribute14
191       ,pty_attribute15
192       ,pty_attribute16
193       ,pty_attribute17
194       ,pty_attribute18
195       ,pty_attribute19
196       ,pty_attribute20
197       ,pty_attribute21
198       ,pty_attribute22
199       ,pty_attribute23
200       ,pty_attribute24
201       ,pty_attribute25
202       ,pty_attribute26
203       ,pty_attribute27
204       ,pty_attribute28
205       ,pty_attribute29
206       ,pty_attribute30
207       ,object_version_number
208     from	ben_pl_pcp_typ
209     where	pl_pcp_typ_id = p_pl_pcp_typ_id
210     for	update nowait;
211 --
212   l_proc	varchar2(72) := g_package||'lck';
213 --
214 Begin
215   hr_utility.set_location('Entering:'||l_proc, 5);
216   --
217   hr_api.mandatory_arg_error
218     (p_api_name           => l_proc
219     ,p_argument           => 'PL_PCP_TYP_ID'
220     ,p_argument_value     => p_pl_pcp_typ_id
221     );
222   --
223   Open  C_Sel1;
224   Fetch C_Sel1 Into ben_pty_shd.g_old_rec;
225   If C_Sel1%notfound then
226     Close C_Sel1;
227     --
228     -- The primary key is invalid therefore we must error
229     --
230     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
231     fnd_message.raise_error;
232   End If;
233   Close C_Sel1;
234   If (p_object_version_number
235       <> ben_pty_shd.g_old_rec.object_version_number) Then
236         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
237         fnd_message.raise_error;
238   End If;
239   --
240   hr_utility.set_location(' Leaving:'||l_proc, 10);
241   --
242   -- We need to trap the ORA LOCK exception
243   --
244 Exception
245   When HR_Api.Object_Locked then
246     --
247     -- The object is locked therefore we need to supply a meaningful
248     -- error message.
249     --
250     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
251     fnd_message.set_token('TABLE_NAME', 'ben_pl_pcp_typ');
252     fnd_message.raise_error;
253 End lck;
254 --
255 -- ----------------------------------------------------------------------------
256 -- |-----------------------------< convert_args >-----------------------------|
257 -- ----------------------------------------------------------------------------
258 Function convert_args
259   (p_pl_pcp_typ_id                  in number
260   ,p_pl_pcp_id                      in number
261   ,p_business_group_id              in number
262   ,p_pcp_typ_cd                     in varchar2
263   ,p_min_age                        in number
264   ,p_max_age                        in number
265   ,p_gndr_alwd_cd                   in varchar2
266   ,p_pty_attribute_category         in varchar2
267   ,p_pty_attribute1                 in varchar2
268   ,p_pty_attribute2                 in varchar2
269   ,p_pty_attribute3                 in varchar2
270   ,p_pty_attribute4                 in varchar2
271   ,p_pty_attribute5                 in varchar2
272   ,p_pty_attribute6                 in varchar2
273   ,p_pty_attribute7                 in varchar2
274   ,p_pty_attribute8                 in varchar2
275   ,p_pty_attribute9                 in varchar2
276   ,p_pty_attribute10                in varchar2
277   ,p_pty_attribute11                in varchar2
278   ,p_pty_attribute12                in varchar2
279   ,p_pty_attribute13                in varchar2
280   ,p_pty_attribute14                in varchar2
281   ,p_pty_attribute15                in varchar2
282   ,p_pty_attribute16                in varchar2
283   ,p_pty_attribute17                in varchar2
284   ,p_pty_attribute18                in varchar2
285   ,p_pty_attribute19                in varchar2
286   ,p_pty_attribute20                in varchar2
287   ,p_pty_attribute21                in varchar2
288   ,p_pty_attribute22                in varchar2
289   ,p_pty_attribute23                in varchar2
290   ,p_pty_attribute24                in varchar2
291   ,p_pty_attribute25                in varchar2
292   ,p_pty_attribute26                in varchar2
293   ,p_pty_attribute27                in varchar2
294   ,p_pty_attribute28                in varchar2
295   ,p_pty_attribute29                in varchar2
296   ,p_pty_attribute30                in varchar2
297   ,p_object_version_number          in number
298   )
299   Return g_rec_type is
300 --
301   l_rec   g_rec_type;
302 --
303 Begin
304   --
305   -- Convert arguments into local l_rec structure.
306   --
307   l_rec.pl_pcp_typ_id                    := p_pl_pcp_typ_id;
308   l_rec.pl_pcp_id                        := p_pl_pcp_id;
309   l_rec.business_group_id                := p_business_group_id;
310   l_rec.pcp_typ_cd                       := p_pcp_typ_cd;
311   l_rec.min_age                          := p_min_age;
312   l_rec.max_age                          := p_max_age;
313   l_rec.gndr_alwd_cd                     := p_gndr_alwd_cd;
314   l_rec.pty_attribute_category           := p_pty_attribute_category;
315   l_rec.pty_attribute1                   := p_pty_attribute1;
316   l_rec.pty_attribute2                   := p_pty_attribute2;
317   l_rec.pty_attribute3                   := p_pty_attribute3;
318   l_rec.pty_attribute4                   := p_pty_attribute4;
319   l_rec.pty_attribute5                   := p_pty_attribute5;
320   l_rec.pty_attribute6                   := p_pty_attribute6;
321   l_rec.pty_attribute7                   := p_pty_attribute7;
322   l_rec.pty_attribute8                   := p_pty_attribute8;
323   l_rec.pty_attribute9                   := p_pty_attribute9;
324   l_rec.pty_attribute10                  := p_pty_attribute10;
325   l_rec.pty_attribute11                  := p_pty_attribute11;
326   l_rec.pty_attribute12                  := p_pty_attribute12;
327   l_rec.pty_attribute13                  := p_pty_attribute13;
328   l_rec.pty_attribute14                  := p_pty_attribute14;
329   l_rec.pty_attribute15                  := p_pty_attribute15;
330   l_rec.pty_attribute16                  := p_pty_attribute16;
331   l_rec.pty_attribute17                  := p_pty_attribute17;
332   l_rec.pty_attribute18                  := p_pty_attribute18;
333   l_rec.pty_attribute19                  := p_pty_attribute19;
334   l_rec.pty_attribute20                  := p_pty_attribute20;
335   l_rec.pty_attribute21                  := p_pty_attribute21;
336   l_rec.pty_attribute22                  := p_pty_attribute22;
337   l_rec.pty_attribute23                  := p_pty_attribute23;
338   l_rec.pty_attribute24                  := p_pty_attribute24;
339   l_rec.pty_attribute25                  := p_pty_attribute25;
340   l_rec.pty_attribute26                  := p_pty_attribute26;
341   l_rec.pty_attribute27                  := p_pty_attribute27;
342   l_rec.pty_attribute28                  := p_pty_attribute28;
343   l_rec.pty_attribute29                  := p_pty_attribute29;
344   l_rec.pty_attribute30                  := p_pty_attribute30;
345   l_rec.object_version_number            := p_object_version_number;
346   --
347   -- Return the plsql record structure.
348   --
349   Return(l_rec);
350 --
351 End convert_args;
352 --
353 end ben_pty_shd;