[Home] [Help]
PACKAGE BODY: APPS.BEN_XWC_SHD
Source
1 Package Body ben_xwc_shd as
2 /* $Header: bexwcrhi.pkb 120.3 2006/04/27 11:31:07 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xwc_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_WHERE_CLAUSE_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_WHERE_CLAUSE_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_WHERE_CLAUSE_FK3') 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_WHERE_CLAUSE_FK4') Then
52 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
53 fnd_message.set_token('PROCEDURE', l_proc);
54 fnd_message.set_token('STEP','20');
55 fnd_message.raise_error;
56 ElsIf (p_constraint_name = 'BEN_EXT_WHERE_CLAUSE_FK6') Then
57 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
58 fnd_message.set_token('PROCEDURE', l_proc);
59 fnd_message.set_token('STEP','25');
60 fnd_message.raise_error;
61 ElsIf (p_constraint_name = 'BEN_EXT_WHERE_CLAUSE_PK') Then
62 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
63 fnd_message.set_token('PROCEDURE', l_proc);
64 fnd_message.set_token('STEP','30');
65 fnd_message.raise_error;
66 Else
67 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
68 fnd_message.set_token('PROCEDURE', l_proc);
69 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
70 fnd_message.raise_error;
71 End If;
72 --
73 hr_utility.set_location(' Leaving:'||l_proc, 10);
74 End constraint_error;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |-----------------------------< api_updating >-----------------------------|
78 -- ----------------------------------------------------------------------------
79 Function api_updating
80 (
81 p_ext_where_clause_id in number,
82 p_object_version_number in number
83 ) Return Boolean Is
84 --
85 --
86 -- Cursor selects the 'current' row from the HR Schema
87 --
88 Cursor C_Sel1 is
89 select
90 ext_where_clause_id,
91 seq_num,
92 oper_cd,
93 val,
94 and_or_cd,
95 ext_data_elmt_id,
96 cond_ext_data_elmt_id,
97 ext_rcd_in_file_id,
98 ext_data_elmt_in_rcd_id,
99 business_group_id,
100 legislation_code,
101 last_update_date,
102 creation_date,
103 last_updated_by,
104 last_update_login,
105 created_by ,
106 object_version_number,
107 cond_ext_data_elmt_in_rcd_id
108 from ben_ext_where_clause
109 where ext_where_clause_id = p_ext_where_clause_id;
110 --
111 l_proc varchar2(72) := g_package||'api_updating';
112 l_fct_ret boolean;
113 --
114 Begin
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 --
117 If (
118 p_ext_where_clause_id is null and
119 p_object_version_number is null
120 ) Then
121 --
122 -- One of the primary key arguments is null therefore we must
123 -- set the returning function value to false
124 --
125 l_fct_ret := false;
126 Else
127 If (
128 p_ext_where_clause_id = g_old_rec.ext_where_clause_id and
129 p_object_version_number = g_old_rec.object_version_number
130 ) Then
131 hr_utility.set_location(l_proc, 10);
132 --
133 -- The g_old_rec is current therefore we must
134 -- set the returning function to true
135 --
136 l_fct_ret := true;
137 Else
138 --
139 -- Select the current row into g_old_rec
140 --
141 Open C_Sel1;
142 Fetch C_Sel1 Into g_old_rec;
143 If C_Sel1%notfound Then
144 Close C_Sel1;
145 --
146 -- The primary key is invalid therefore we must error
147 --
148 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
149 fnd_message.raise_error;
150 End If;
151 Close C_Sel1;
152 If (p_object_version_number <> g_old_rec.object_version_number) Then
153 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
154 fnd_message.raise_error;
155 End If;
156 hr_utility.set_location(l_proc, 15);
157 l_fct_ret := true;
158 End If;
159 End If;
160 hr_utility.set_location(' Leaving:'||l_proc, 20);
161 Return (l_fct_ret);
162 --
163 End api_updating;
164 --
165 -- ----------------------------------------------------------------------------
166 -- |---------------------------------< lck >----------------------------------|
167 -- ----------------------------------------------------------------------------
168 Procedure lck
169 (
170 p_ext_where_clause_id in number,
171 p_object_version_number in number
172 ) is
173 --
174 -- Cursor selects the 'current' row from the HR Schema
175 --
176 Cursor C_Sel1 is
177 select ext_where_clause_id,
178 seq_num,
179 oper_cd,
180 val,
181 and_or_cd,
182 ext_data_elmt_id,
183 cond_ext_data_elmt_id,
184 ext_rcd_in_file_id,
185 ext_data_elmt_in_rcd_id,
186 business_group_id,
187 legislation_code,
188 last_update_date,
189 creation_date,
190 last_updated_by,
191 last_update_login,
192 created_by ,
193 object_version_number,
194 cond_ext_data_elmt_in_rcd_id
195 from ben_ext_where_clause
196 where ext_where_clause_id = p_ext_where_clause_id
197 for update nowait;
198 --
199 l_proc varchar2(72) := g_package||'lck';
200 --
201 Begin
202 hr_utility.set_location('Entering:'||l_proc, 5);
203 --
204 -- Add any mandatory argument checking here:
205 -- Example:
206 -- hr_api.mandatory_arg_error
207 -- (p_api_name => l_proc,
208 -- p_argument => 'object_version_number',
209 -- p_argument_value => p_object_version_number);
210 --
211 Open C_Sel1;
212 Fetch C_Sel1 Into g_old_rec;
213 If C_Sel1%notfound then
214 Close C_Sel1;
215 --
216 -- The primary key is invalid therefore we must error
217 --
218 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
219 fnd_message.raise_error;
220 End If;
221 Close C_Sel1;
222 If (p_object_version_number <> g_old_rec.object_version_number) Then
223 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
224 fnd_message.raise_error;
225 End If;
226 --
227 hr_utility.set_location(' Leaving:'||l_proc, 10);
228 --
229 -- We need to trap the ORA LOCK exception
230 --
231 Exception
232 When HR_Api.Object_Locked then
233 --
234 -- The object is locked therefore we need to supply a meaningful
235 -- error message.
236 --
237 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
238 fnd_message.set_token('TABLE_NAME', 'ben_ext_where_clause');
239 fnd_message.raise_error;
240 End lck;
241 --
242 -- ----------------------------------------------------------------------------
243 -- |-----------------------------< convert_args >-----------------------------|
244 -- ----------------------------------------------------------------------------
245 Function convert_args
246 (
247 p_ext_where_clause_id in number,
248 p_seq_num in number,
249 p_oper_cd in varchar2,
250 p_val in varchar2,
251 p_and_or_cd in varchar2,
252 p_ext_data_elmt_id in number,
253 p_cond_ext_data_elmt_id in number,
254 p_ext_rcd_in_file_id in number,
255 p_ext_data_elmt_in_rcd_id in number,
256 p_business_group_id in number,
257 p_legislation_code in varchar2,
258 p_last_update_date in date,
259 p_creation_date in date,
260 p_last_updated_by in number,
261 p_last_update_login in number,
262 p_created_by in number,
263 p_object_version_number in number,
264 p_cond_ext_data_elmt_in_rcd_id in number
265 )
266 Return g_rec_type is
267 --
268 l_rec g_rec_type;
269 l_proc varchar2(72) := g_package||'convert_args';
270 --
271 Begin
272 --
273 hr_utility.set_location('Entering:'||l_proc, 5);
274 --
275 -- Convert arguments into local l_rec structure.
276 --
277 l_rec.ext_where_clause_id := p_ext_where_clause_id;
278 l_rec.seq_num := p_seq_num;
279 l_rec.oper_cd := p_oper_cd;
280 l_rec.val := p_val;
281 l_rec.and_or_cd := p_and_or_cd;
282 l_rec.ext_data_elmt_id := p_ext_data_elmt_id;
283 l_rec.cond_ext_data_elmt_id := p_cond_ext_data_elmt_id;
284 l_rec.ext_rcd_in_file_id := p_ext_rcd_in_file_id;
285 l_rec.ext_data_elmt_in_rcd_id := p_ext_data_elmt_in_rcd_id;
286 l_rec.business_group_id := p_business_group_id;
287 l_rec.legislation_code := p_legislation_code;
288 l_rec.last_update_date := p_last_update_date;
289 l_rec.creation_date := p_creation_date;
290 l_rec.last_updated_by := p_last_updated_by;
291 l_rec.last_update_login := p_last_update_login;
292 l_rec.created_by := p_created_by;
293 l_rec.object_version_number := p_object_version_number;
294 l_rec.cond_ext_data_elmt_in_rcd_id := p_cond_ext_data_elmt_in_rcd_id;
295 --
296 -- Return the plsql record structure.
297 --
298 hr_utility.set_location(' Leaving:'||l_proc, 10);
299 Return(l_rec);
300 --
301 End convert_args;
302 --
303 end ben_xwc_shd;