[Home] [Help]
PACKAGE BODY: APPS.BEN_XRS_SHD
Source
1 Package Body ben_xrs_shd as
2 /* $Header: bexrsrhi.pkb 120.1 2005/06/08 14:21:35 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xrs_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_RSLT_FK1') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 ElsIf (p_constraint_name = 'BEN_EXT_RSLT_FK2') Then
42 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('STEP','10');
45 hr_utility.raise_error;
46 ElsIf (p_constraint_name = 'BEN_EXT_RSLT_PK') Then
47 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
48 hr_utility.set_message_token('PROCEDURE', l_proc);
49 hr_utility.set_message_token('STEP','15');
50 hr_utility.raise_error;
51 Else
52 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
53 hr_utility.set_message_token('PROCEDURE', l_proc);
54 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
55 hr_utility.raise_error;
56 End If;
57 --
58 hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65 (
66 p_ext_rslt_id in number,
67 p_object_version_number in number
68 ) Return Boolean Is
69 --
70 --
71 -- Cursor selects the 'current' row from the HR Schema
72 --
73 Cursor C_Sel1 is
74 select
75 ext_rslt_id,
76 run_strt_dt,
77 run_end_dt,
78 ext_stat_cd,
79 tot_rec_num,
80 tot_per_num,
81 tot_err_num,
82 eff_dt,
83 ext_strt_dt,
84 ext_end_dt,
85 output_name,
86 drctry_name,
87 ext_dfn_id,
88 business_group_id,
89 program_application_id,
90 program_id,
91 program_update_date,
92 request_id,
93 output_type,
94 xdo_template_id,
95 object_version_number
96 from ben_ext_rslt
97 where ext_rslt_id = p_ext_rslt_id;
98 --
99 l_proc varchar2(72) := g_package||'api_updating';
100 l_fct_ret boolean;
101 --
102 Begin
103 hr_utility.set_location('Entering:'||l_proc, 5);
104 --
105 If (
106 p_ext_rslt_id is null and
107 p_object_version_number is null
108 ) Then
109 --
110 -- One of the primary key arguments is null therefore we must
111 -- set the returning function value to false
112 --
113 l_fct_ret := false;
114 Else
115 If (
116 p_ext_rslt_id = g_old_rec.ext_rslt_id and
117 p_object_version_number = g_old_rec.object_version_number
118 ) Then
119 hr_utility.set_location(l_proc, 10);
120 --
121 -- The g_old_rec is current therefore we must
122 -- set the returning function to true
123 --
124 l_fct_ret := true;
125 Else
126 --
127 -- Select the current row into g_old_rec
128 --
129 Open C_Sel1;
130 Fetch C_Sel1 Into g_old_rec;
131 If C_Sel1%notfound Then
132 Close C_Sel1;
133 --
134 -- The primary key is invalid therefore we must error
135 --
136 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
137 hr_utility.raise_error;
138 End If;
139 Close C_Sel1;
140 If (p_object_version_number <> g_old_rec.object_version_number) Then
141 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
142 hr_utility.raise_error;
143 End If;
144 hr_utility.set_location(l_proc, 15);
145 l_fct_ret := true;
146 End If;
147 End If;
148 hr_utility.set_location(' Leaving:'||l_proc, 20);
149 Return (l_fct_ret);
150 --
151 End api_updating;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |---------------------------------< lck >----------------------------------|
155 -- ----------------------------------------------------------------------------
156 Procedure lck
157 (
158 p_ext_rslt_id in number,
159 p_object_version_number in number
160 ) is
161 --
162 -- Cursor selects the 'current' row from the HR Schema
163 --
164 Cursor C_Sel1 is
165 select ext_rslt_id,
166 run_strt_dt,
167 run_end_dt,
168 ext_stat_cd,
169 tot_rec_num,
170 tot_per_num,
171 tot_err_num,
172 eff_dt,
173 ext_strt_dt,
174 ext_end_dt,
175 output_name,
176 drctry_name,
177 ext_dfn_id,
178 business_group_id,
179 program_application_id,
180 program_id,
181 program_update_date,
182 request_id,
183 output_type,
184 xdo_template_id,
185 object_version_number
186 from ben_ext_rslt
187 where ext_rslt_id = p_ext_rslt_id
188 for update nowait;
189 --
190 l_proc varchar2(72) := g_package||'lck';
191 --
192 Begin
193 hr_utility.set_location('Entering:'||l_proc, 5);
194 --
195 -- Add any mandatory argument checking here:
196 -- Example:
197 -- hr_api.mandatory_arg_error
198 -- (p_api_name => l_proc,
199 -- p_argument => 'object_version_number',
200 -- p_argument_value => p_object_version_number);
201 --
202 Open C_Sel1;
203 Fetch C_Sel1 Into g_old_rec;
204 If C_Sel1%notfound then
205 Close C_Sel1;
206 --
207 -- The primary key is invalid therefore we must error
208 --
209 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
210 hr_utility.raise_error;
211 End If;
212 Close C_Sel1;
213 If (p_object_version_number <> g_old_rec.object_version_number) Then
214 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
215 hr_utility.raise_error;
216 End If;
217 --
218 hr_utility.set_location(' Leaving:'||l_proc, 10);
219 --
220 -- We need to trap the ORA LOCK exception
221 --
222 Exception
223 When HR_Api.Object_Locked then
224 --
225 -- The object is locked therefore we need to supply a meaningful
226 -- error message.
227 --
228 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
229 hr_utility.set_message_token('TABLE_NAME', 'ben_ext_rslt');
230 hr_utility.raise_error;
231 End lck;
232 --
233 -- ----------------------------------------------------------------------------
234 -- |-----------------------------< convert_args >-----------------------------|
235 -- ----------------------------------------------------------------------------
236 Function convert_args
237 (
238 p_ext_rslt_id in number,
239 p_run_strt_dt in date,
240 p_run_end_dt in date,
241 p_ext_stat_cd in varchar2,
242 p_tot_rec_num in number,
243 p_tot_per_num in number,
244 p_tot_err_num in number,
245 p_eff_dt in date,
246 p_ext_strt_dt in date,
247 p_ext_end_dt in date,
248 p_output_name in varchar2,
249 p_drctry_name in varchar2,
250 p_ext_dfn_id in number,
251 p_business_group_id in number,
252 p_program_application_id in number,
253 p_program_id in number,
254 p_program_update_date in date,
255 p_request_id in number,
256 p_output_type in varchar2,
257 p_xdo_template_id in number,
258 p_object_version_number in number
259 )
260 Return g_rec_type is
261 --
262 l_rec g_rec_type;
263 l_proc varchar2(72) := g_package||'convert_args';
264 --
265 Begin
266 --
267 hr_utility.set_location('Entering:'||l_proc, 5);
268 --
269 -- Convert arguments into local l_rec structure.
270 --
271 l_rec.ext_rslt_id := p_ext_rslt_id;
272 l_rec.run_strt_dt := p_run_strt_dt;
273 l_rec.run_end_dt := p_run_end_dt;
274 l_rec.ext_stat_cd := p_ext_stat_cd;
275 l_rec.tot_rec_num := p_tot_rec_num;
276 l_rec.tot_per_num := p_tot_per_num;
277 l_rec.tot_err_num := p_tot_err_num;
278 l_rec.eff_dt := p_eff_dt;
279 l_rec.ext_strt_dt := p_ext_strt_dt;
280 l_rec.ext_end_dt := p_ext_end_dt;
281 l_rec.output_name := p_output_name;
282 l_rec.drctry_name := p_drctry_name;
283 l_rec.ext_dfn_id := p_ext_dfn_id;
284 l_rec.business_group_id := p_business_group_id;
285 l_rec.program_application_id := p_program_application_id;
286 l_rec.program_id := p_program_id;
287 l_rec.program_update_date := p_program_update_date;
288 l_rec.request_id := p_request_id;
289 l_rec.output_type := p_output_type;
290 l_rec.xdo_template_id := p_xdo_template_id;
291 l_rec.object_version_number := p_object_version_number;
292 --
293 -- Return the plsql record structure.
294 --
295 hr_utility.set_location(' Leaving:'||l_proc, 10);
296 Return(l_rec);
297 --
298 End convert_args;
299 --
300 end ben_xrs_shd;