[Home] [Help]
PACKAGE BODY: APPS.BEN_BRI_SHD
Source
1 Package Body ben_bri_shd as
2 /* $Header: bebrirhi.pkb 120.0 2005/05/28 00:51:44 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_bri_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_BATCH_RATE_INFO_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_BATCH_RATE_INFO_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_BATCH_RATE_INFO_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_batch_rt_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 batch_rt_id,
76 benefit_action_id,
77 person_id,
78 pgm_id,
79 pl_id,
80 oipl_id,
81 bnft_rt_typ_cd,
82 dflt_flag,
83 val,
84 old_val,
85 tx_typ_cd,
86 acty_typ_cd,
87 mn_elcn_val,
88 mx_elcn_val,
89 incrmt_elcn_val,
90 dflt_val,
91 rt_strt_dt,
92 business_group_id,
93 object_version_number,
94 enrt_cvg_strt_dt,
95 enrt_cvg_thru_dt,
96 actn_cd,
97 close_actn_itm_dt
98 from ben_batch_rate_info
99 where batch_rt_id = p_batch_rt_id;
100 --
101 l_proc varchar2(72) := g_package||'api_updating';
102 l_fct_ret boolean;
103 --
104 Begin
105 hr_utility.set_location('Entering:'||l_proc, 5);
106 --
107 If (
108 p_batch_rt_id is null and
109 p_object_version_number is null
110 ) Then
111 --
112 -- One of the primary key arguments is null therefore we must
113 -- set the returning function value to false
114 --
115 l_fct_ret := false;
116 Else
117 If (
118 p_batch_rt_id = g_old_rec.batch_rt_id and
119 p_object_version_number = g_old_rec.object_version_number
120 ) Then
121 hr_utility.set_location(l_proc, 10);
122 --
123 -- The g_old_rec is current therefore we must
124 -- set the returning function to true
125 --
126 l_fct_ret := true;
127 Else
128 --
129 -- Select the current row into g_old_rec
130 --
131 Open C_Sel1;
132 Fetch C_Sel1 Into g_old_rec;
133 If C_Sel1%notfound Then
134 Close C_Sel1;
135 --
136 -- The primary key is invalid therefore we must error
137 --
138 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
139 hr_utility.raise_error;
140 End If;
141 Close C_Sel1;
142 If (p_object_version_number <> g_old_rec.object_version_number) Then
143 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
144 hr_utility.raise_error;
145 End If;
146 hr_utility.set_location(l_proc, 15);
147 l_fct_ret := true;
148 End If;
149 End If;
150 hr_utility.set_location(' Leaving:'||l_proc, 20);
151 Return (l_fct_ret);
152 --
153 End api_updating;
154 --
155 -- ----------------------------------------------------------------------------
156 -- |---------------------------------< lck >----------------------------------|
157 -- ----------------------------------------------------------------------------
158 Procedure lck
159 (
160 p_batch_rt_id in number,
161 p_object_version_number in number
162 ) is
163 --
164 -- Cursor selects the 'current' row from the HR Schema
165 --
166 Cursor C_Sel1 is
167 select batch_rt_id,
168 benefit_action_id,
169 person_id,
170 pgm_id,
171 pl_id,
172 oipl_id,
173 bnft_rt_typ_cd,
174 dflt_flag,
175 val,
176 old_val,
177 tx_typ_cd,
178 acty_typ_cd,
179 mn_elcn_val,
180 mx_elcn_val,
181 incrmt_elcn_val,
182 dflt_val,
183 rt_strt_dt,
184 business_group_id,
185 object_version_number,
186 enrt_cvg_strt_dt,
187 enrt_cvg_thru_dt,
188 actn_cd,
189 close_actn_itm_dt
190 from ben_batch_rate_info
191 where batch_rt_id = p_batch_rt_id
192 for update nowait;
193 --
194 l_proc varchar2(72) := g_package||'lck';
195 --
196 Begin
197 hr_utility.set_location('Entering:'||l_proc, 5);
198 --
199 -- Add any mandatory argument checking here:
200 -- Example:
201 -- hr_api.mandatory_arg_error
202 -- (p_api_name => l_proc,
203 -- p_argument => 'object_version_number',
204 -- p_argument_value => p_object_version_number);
205 --
206 Open C_Sel1;
207 Fetch C_Sel1 Into g_old_rec;
208 If C_Sel1%notfound then
209 Close C_Sel1;
210 --
211 -- The primary key is invalid therefore we must error
212 --
213 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
214 hr_utility.raise_error;
215 End If;
216 Close C_Sel1;
217 If (p_object_version_number <> g_old_rec.object_version_number) Then
218 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
219 hr_utility.raise_error;
220 End If;
221 --
222 hr_utility.set_location(' Leaving:'||l_proc, 10);
223 --
224 -- We need to trap the ORA LOCK exception
225 --
226 Exception
227 When HR_Api.Object_Locked then
228 --
229 -- The object is locked therefore we need to supply a meaningful
230 -- error message.
231 --
232 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
233 hr_utility.set_message_token('TABLE_NAME', 'ben_batch_rate_info');
234 hr_utility.raise_error;
235 End lck;
236 --
237 -- ----------------------------------------------------------------------------
238 -- |-----------------------------< convert_args >-----------------------------|
239 -- ----------------------------------------------------------------------------
240 Function convert_args
241 (
242 p_batch_rt_id in number,
243 p_benefit_action_id in number,
244 p_person_id in number,
245 p_pgm_id in number,
246 p_pl_id in number,
247 p_oipl_id in number,
248 p_bnft_rt_typ_cd in varchar2,
249 p_dflt_flag in varchar2,
250 p_val in number,
251 p_old_val in number,
252 p_tx_typ_cd in varchar2,
253 p_acty_typ_cd in varchar2,
254 p_mn_elcn_val in number,
255 p_mx_elcn_val in number,
256 p_incrmt_elcn_val in number,
257 p_dflt_val in number,
258 p_rt_strt_dt in date,
259 p_business_group_id in number,
260 p_object_version_number in number,
261 p_enrt_cvg_strt_dt in date,
262 p_enrt_cvg_thru_dt in date,
263 p_actn_cd in varchar2,
264 p_close_actn_itm_dt in date
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.batch_rt_id := p_batch_rt_id;
278 l_rec.benefit_action_id := p_benefit_action_id;
279 l_rec.person_id := p_person_id;
280 l_rec.pgm_id := p_pgm_id;
281 l_rec.pl_id := p_pl_id;
282 l_rec.oipl_id := p_oipl_id;
283 l_rec.bnft_rt_typ_cd := p_bnft_rt_typ_cd;
284 l_rec.dflt_flag := p_dflt_flag;
285 l_rec.val := p_val;
286 l_rec.old_val := p_old_val;
287 l_rec.tx_typ_cd := p_tx_typ_cd;
288 l_rec.acty_typ_cd := p_acty_typ_cd;
289 l_rec.mn_elcn_val := p_mn_elcn_val;
290 l_rec.mx_elcn_val := p_mx_elcn_val;
291 l_rec.incrmt_elcn_val := p_incrmt_elcn_val;
292 l_rec.dflt_val := p_dflt_val;
293 l_rec.rt_strt_dt := p_rt_strt_dt;
294 l_rec.business_group_id := p_business_group_id;
295 l_rec.object_version_number := p_object_version_number;
296 l_rec.enrt_cvg_strt_dt := p_enrt_cvg_strt_dt;
297 l_rec.enrt_cvg_thru_dt := p_enrt_cvg_thru_dt;
298 l_rec.actn_cd := p_actn_cd;
299 l_rec.close_actn_itm_dt := p_close_actn_itm_dt;
300 --
301 -- Return the plsql record structure.
302 --
303 hr_utility.set_location(' Leaving:'||l_proc, 10);
304 Return(l_rec);
305 --
306 End convert_args;
307 --
308 end ben_bri_shd;