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