DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XCV_SHD

Source


1 Package Body ben_xcv_shd as
2 /* $Header: bexcvrhi.pkb 120.3 2006/04/11 11:18:40 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_xcv_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_VAL_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_VAL_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_EXT_CRIT_VAL_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   ElsIf (p_constraint_name = 'BEN_EXT_CRIT_CMBN_FK1') Then
52     ben_utility.child_exists_error(p_table_name => 'BEN_EXT_CRIT_CMBN');
53   Else
54     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
55     fnd_message.set_token('PROCEDURE', l_proc);
56     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
57     fnd_message.raise_error;
58   End If;
59   --
60   hr_utility.set_location(' Leaving:'||l_proc, 10);
61 End constraint_error;
62 --
63 -- ----------------------------------------------------------------------------
64 -- |-----------------------------< api_updating >-----------------------------|
65 -- ----------------------------------------------------------------------------
66 Function api_updating
67   (
68   p_ext_crit_val_id                    in number,
69   p_object_version_number              in number
70   )      Return Boolean Is
71 --
72   --
73   -- Cursor selects the 'current' row from the HR Schema
74   --
75   Cursor C_Sel1 is
76     select
77 		ext_crit_val_id,
78 	val_1,
79 	val_2,
80 	ext_crit_typ_id,
81 	business_group_id,
82 	ext_crit_bg_id  ,
83 	legislation_code,
84         last_update_date,
85         creation_date,
86         last_updated_by,
87         last_update_login,
88         created_by ,
89 	object_version_number
90     from	ben_ext_crit_val
91     where	ext_crit_val_id = p_ext_crit_val_id;
92 --
93   l_proc	varchar2(72)	:= g_package||'api_updating';
94   l_fct_ret	boolean;
95 --
96 Begin
97   hr_utility.set_location('Entering:'||l_proc, 5);
98   --
99   If (
100 	p_ext_crit_val_id is null and
101 	p_object_version_number is null
102      ) Then
103     --
104     -- One of the primary key arguments is null therefore we must
105     -- set the returning function value to false
106     --
107     l_fct_ret := false;
108   Else
109     If (
110 	p_ext_crit_val_id = g_old_rec.ext_crit_val_id and
111 	p_object_version_number = g_old_rec.object_version_number
112        ) Then
113       hr_utility.set_location(l_proc, 10);
114       --
115       -- The g_old_rec is current therefore we must
116       -- set the returning function to true
117       --
118       l_fct_ret := true;
119     Else
120       --
121       -- Select the current row into g_old_rec
122       --
123       Open C_Sel1;
124       Fetch C_Sel1 Into g_old_rec;
125       If C_Sel1%notfound Then
126         Close C_Sel1;
127         --
128         -- The primary key is invalid therefore we must error
129         --
130         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
131         fnd_message.raise_error;
132       End If;
133       Close C_Sel1;
134       If (p_object_version_number <> g_old_rec.object_version_number) Then
135         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
136         fnd_message.raise_error;
137       End If;
138       hr_utility.set_location(l_proc, 15);
139       l_fct_ret := true;
140     End If;
141   End If;
142   hr_utility.set_location(' Leaving:'||l_proc, 20);
143   Return (l_fct_ret);
144 --
145 End api_updating;
146 --
147 -- ----------------------------------------------------------------------------
148 -- |---------------------------------< lck >----------------------------------|
149 -- ----------------------------------------------------------------------------
150 Procedure lck
151   (
152   p_ext_crit_val_id                    in number,
153   p_object_version_number              in number
154   ) is
155 --
156 -- Cursor selects the 'current' row from the HR Schema
157 --
158   Cursor C_Sel1 is
159     select 	ext_crit_val_id,
160 	val_1,
161 	val_2,
162 	ext_crit_typ_id,
163 	business_group_id,
164 	ext_crit_bg_id,
165 	legislation_code,
166        last_update_date,
167         creation_date,
168         last_updated_by,
169         last_update_login,
170         created_by ,
171 	object_version_number
172     from	ben_ext_crit_val
173     where	ext_crit_val_id = p_ext_crit_val_id
174     for	update nowait;
175 --
176   l_proc	varchar2(72) := g_package||'lck';
177 --
178 Begin
179   hr_utility.set_location('Entering:'||l_proc, 5);
180   --
181   -- Add any mandatory argument checking here:
182   -- Example:
183   -- hr_api.mandatory_arg_error
184   --   (p_api_name       => l_proc,
185   --    p_argument       => 'object_version_number',
186   --    p_argument_value => p_object_version_number);
187   --
188   Open  C_Sel1;
189   Fetch C_Sel1 Into g_old_rec;
190   If C_Sel1%notfound then
191     Close C_Sel1;
192     --
193     -- The primary key is invalid therefore we must error
194     --
195     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
196     fnd_message.raise_error;
197   End If;
198   Close C_Sel1;
199   If (p_object_version_number <> g_old_rec.object_version_number) Then
200         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
201         fnd_message.raise_error;
202       End If;
203 --
204   hr_utility.set_location(' Leaving:'||l_proc, 10);
205 --
206 -- We need to trap the ORA LOCK exception
207 --
208 Exception
209   When HR_Api.Object_Locked then
210     --
211     -- The object is locked therefore we need to supply a meaningful
212     -- error message.
213     --
214     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
215     fnd_message.set_token('TABLE_NAME', 'ben_ext_crit_val');
216     fnd_message.raise_error;
217 End lck;
218 --
219 -- ----------------------------------------------------------------------------
220 -- |-----------------------------< convert_args >-----------------------------|
221 -- ----------------------------------------------------------------------------
222 Function convert_args
223 	(
224 	p_ext_crit_val_id               in number,
225 	p_val_1                         in varchar2,
226 	p_val_2                         in varchar2,
227 	p_ext_crit_typ_id               in number,
228 	p_business_group_id             in number,
229 	p_ext_crit_bg_id                in number,
230 	p_legislation_code              in varchar2,
231         p_last_update_date              in date,
232         p_creation_date                 in date,
233         p_last_updated_by               in number,
234         p_last_update_login             in number,
235         p_created_by                    in number,
236 	p_object_version_number         in number
237 	)
238 	Return g_rec_type is
239 --
240   l_rec	  g_rec_type;
241   l_proc  varchar2(72) := g_package||'convert_args';
242 --
243 Begin
244   --
245   hr_utility.set_location('Entering:'||l_proc, 5);
246   --
247   -- Convert arguments into local l_rec structure.
248   --
249   l_rec.ext_crit_val_id                  := p_ext_crit_val_id;
250   l_rec.val_1                            := p_val_1;
251   l_rec.val_2                            := p_val_2;
252   l_rec.ext_crit_typ_id                  := p_ext_crit_typ_id;
253   l_rec.business_group_id                := p_business_group_id;
254   l_rec.ext_crit_bg_id                   := p_ext_crit_bg_id;
255   l_rec.legislation_code		 := p_legislation_code;
256   l_rec.last_update_date                 := p_last_update_date;
257   l_rec.creation_date                    := p_creation_date;
258   l_rec.last_updated_by                  := p_last_updated_by;
259   l_rec.last_update_login                := p_last_update_login;
260   l_rec.created_by                       := p_created_by;
261   l_rec.object_version_number            := p_object_version_number;
262   --
263   -- Return the plsql record structure.
264   --
265   hr_utility.set_location(' Leaving:'||l_proc, 10);
266   Return(l_rec);
267 --
268 End convert_args;
269 --
270 end ben_xcv_shd;