DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BLI_SHD

Source


1 Package Body ben_bli_shd as
2 /* $Header: beblirhi.pkb 115.7 2002/12/10 15:17:02 bmanyam ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bli_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 = 'AVCON_BEN_B_CRTD__000') 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 = 'AVCON_BEN_B_DLTD__000') 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 = 'AVCON_BEN_B_REPLC_000') 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   ElsIf (p_constraint_name = 'AVCON_BEN_B_TMPRL_000') Then
52     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
53     hr_utility.set_message_token('PROCEDURE', l_proc);
54     hr_utility.set_message_token('STEP','20');
55     hr_utility.raise_error;
56   ElsIf (p_constraint_name = 'BEN_BATCH_LER_INFO_FK1') Then
60     hr_utility.raise_error;
57     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
58     hr_utility.set_message_token('PROCEDURE', l_proc);
59     hr_utility.set_message_token('STEP','25');
61   ElsIf (p_constraint_name = 'BEN_BATCH_LER_INFO_FK2') Then
62     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
63     hr_utility.set_message_token('PROCEDURE', l_proc);
64     hr_utility.set_message_token('STEP','30');
65     hr_utility.raise_error;
66   ElsIf (p_constraint_name = 'BEN_BATCH_LER_INFO_PK') Then
67     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
68     hr_utility.set_message_token('PROCEDURE', l_proc);
69     hr_utility.set_message_token('STEP','35');
70     hr_utility.raise_error;
71   Else
72     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
73     hr_utility.set_message_token('PROCEDURE', l_proc);
74     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
75     hr_utility.raise_error;
76   End If;
77   --
78   hr_utility.set_location(' Leaving:'||l_proc, 10);
79 End constraint_error;
80 --
81 -- ----------------------------------------------------------------------------
82 -- |-----------------------------< api_updating >-----------------------------|
83 -- ----------------------------------------------------------------------------
84 Function api_updating
85   (
86   p_batch_ler_id                       in number,
87   p_object_version_number              in number
88   )      Return Boolean Is
89 --
90   --
91   -- Cursor selects the 'current' row from the HR Schema
92   --
93   Cursor C_Sel1 is
94     select
95 	batch_ler_id,
96 	benefit_action_id,
97 	person_id,
98 	ler_id,
99 	lf_evt_ocrd_dt,
100 	replcd_flag,
101 	crtd_flag,
102 	tmprl_flag,
103 	dltd_flag,
104         open_and_clsd_flag,
105         clsd_flag,
106         not_crtd_flag,
107         stl_actv_flag,
108         clpsd_flag,
109         clsn_flag,
110         no_effect_flag,
111         cvrge_rt_prem_flag,
112 	per_in_ler_id,
113 	business_group_id,
114 	object_version_number
115     from	ben_batch_ler_info
116     where	batch_ler_id = p_batch_ler_id;
117 --
118   l_proc	varchar2(72)	:= g_package||'api_updating';
119   l_fct_ret	boolean;
120 --
121 Begin
122   hr_utility.set_location('Entering:'||l_proc, 5);
123   --
124   If (
125 	p_batch_ler_id is null and
126 	p_object_version_number is null
127      ) Then
128     --
129     -- One of the primary key arguments is null therefore we must
130     -- set the returning function value to false
131     --
132     l_fct_ret := false;
133   Else
134     If (
135 	p_batch_ler_id = g_old_rec.batch_ler_id and
136 	p_object_version_number = g_old_rec.object_version_number
137        ) Then
138       hr_utility.set_location(l_proc, 10);
139       --
140       -- The g_old_rec is current therefore we must
141       -- set the returning function to true
142       --
143       l_fct_ret := true;
144     Else
145       --
146       -- Select the current row into g_old_rec
147       --
148       Open C_Sel1;
149       Fetch C_Sel1 Into g_old_rec;
150       If C_Sel1%notfound Then
151         Close C_Sel1;
152         --
153         -- The primary key is invalid therefore we must error
154         --
155         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
156         hr_utility.raise_error;
157       End If;
158       Close C_Sel1;
159       If (p_object_version_number <> g_old_rec.object_version_number) Then
160         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
161         hr_utility.raise_error;
162       End If;
163       hr_utility.set_location(l_proc, 15);
164       l_fct_ret := true;
165     End If;
166   End If;
167   hr_utility.set_location(' Leaving:'||l_proc, 20);
168   Return (l_fct_ret);
169 --
170 End api_updating;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |---------------------------------< lck >----------------------------------|
174 -- ----------------------------------------------------------------------------
175 Procedure lck
176   (
177   p_batch_ler_id                       in number,
178   p_object_version_number              in number
179   ) is
180 --
181 -- Cursor selects the 'current' row from the HR Schema
182 --
183   Cursor C_Sel1 is
184     select 	batch_ler_id,
185 	benefit_action_id,
186 	person_id,
187 	ler_id,
188 	lf_evt_ocrd_dt,
189 	replcd_flag,
190 	crtd_flag,
191 	tmprl_flag,
192 	dltd_flag,
193         open_and_clsd_flag,
194         clsd_flag,
195         not_crtd_flag,
196         stl_actv_flag,
197         clpsd_flag,
198         clsn_flag,
199         no_effect_flag,
200         cvrge_rt_prem_flag,
201 	per_in_ler_id,
202 	business_group_id,
203 	object_version_number
204     from	ben_batch_ler_info
205     where	batch_ler_id = p_batch_ler_id
206     for	update nowait;
207 --
208   l_proc	varchar2(72) := g_package||'lck';
209 --
210 Begin
211   hr_utility.set_location('Entering:'||l_proc, 5);
212   --
213   -- Add any mandatory argument checking here:
214   -- Example:
215   -- hr_api.mandatory_arg_error
216   --   (p_api_name       => l_proc,
217   --    p_argument       => 'object_version_number',
218   --    p_argument_value => p_object_version_number);
219   --
220   Open  C_Sel1;
221   Fetch C_Sel1 Into g_old_rec;
222   If C_Sel1%notfound then
223     Close C_Sel1;
224     --
228     hr_utility.raise_error;
225     -- The primary key is invalid therefore we must error
226     --
227     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
229   End If;
230   Close C_Sel1;
231   If (p_object_version_number <> g_old_rec.object_version_number) Then
232         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
233         hr_utility.raise_error;
234       End If;
235 --
236   hr_utility.set_location(' Leaving:'||l_proc, 10);
237 --
238 -- We need to trap the ORA LOCK exception
239 --
240 Exception
241   When HR_Api.Object_Locked then
242     --
243     -- The object is locked therefore we need to supply a meaningful
244     -- error message.
245     --
246     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
247     hr_utility.set_message_token('TABLE_NAME', 'ben_batch_ler_info');
248     hr_utility.raise_error;
249 End lck;
250 --
251 -- ----------------------------------------------------------------------------
252 -- |-----------------------------< convert_args >-----------------------------|
253 -- ----------------------------------------------------------------------------
254 Function convert_args
255 	(
256 	p_batch_ler_id                  in number,
257 	p_benefit_action_id             in number,
258 	p_person_id                     in number,
259 	p_ler_id                        in number,
260 	p_lf_evt_ocrd_dt                in date,
261 	p_replcd_flag                   in varchar2,
262 	p_crtd_flag                     in varchar2,
263 	p_tmprl_flag                    in varchar2,
264 	p_dltd_flag                     in varchar2,
265         p_open_and_clsd_flag            in varchar2,
266         p_clsd_flag                     in varchar2,
267         p_not_crtd_flag                 in varchar2,
268         p_stl_actv_flag                 in varchar2,
269         p_clpsd_flag                    in varchar2,
270         p_clsn_flag                     in varchar2,
271         p_no_effect_flag                in varchar2,
272         p_cvrge_rt_prem_flag            in varchar2,
273 	p_per_in_ler_id                 in number,
274 	p_business_group_id             in number,
275 	p_object_version_number         in number
276 	)
277 	Return g_rec_type is
278 --
279   l_rec	  g_rec_type;
280   l_proc  varchar2(72) := g_package||'convert_args';
281 --
282 Begin
283   --
284   hr_utility.set_location('Entering:'||l_proc, 5);
285   --
286   -- Convert arguments into local l_rec structure.
287   --
288   l_rec.batch_ler_id                     := p_batch_ler_id;
289   l_rec.benefit_action_id                := p_benefit_action_id;
290   l_rec.person_id                        := p_person_id;
291   l_rec.ler_id                           := p_ler_id;
292   l_rec.lf_evt_ocrd_dt                   := p_lf_evt_ocrd_dt;
293   l_rec.replcd_flag                      := p_replcd_flag;
294   l_rec.crtd_flag                        := p_crtd_flag;
295   l_rec.tmprl_flag                       := p_tmprl_flag;
296   l_rec.dltd_flag                        := p_dltd_flag;
297   l_rec.open_and_clsd_flag               := p_open_and_clsd_flag;
298   l_rec.clsd_flag                        := p_clsd_flag;
299   l_rec.not_crtd_flag                    := p_not_crtd_flag;
300   l_rec.stl_actv_flag                    := p_stl_actv_flag;
301   l_rec.clpsd_flag                       := p_clpsd_flag;
302   l_rec.clsn_flag                        := p_clsn_flag;
303   l_rec.no_effect_flag                   := p_no_effect_flag;
304   l_rec.cvrge_rt_prem_flag               := p_cvrge_rt_prem_flag;
305   l_rec.per_in_ler_id                    := p_per_in_ler_id;
306   l_rec.business_group_id                := p_business_group_id;
307   l_rec.object_version_number            := p_object_version_number;
308   --
309   -- Return the plsql record structure.
310   --
311   hr_utility.set_location(' Leaving:'||l_proc, 10);
312   Return(l_rec);
313 --
314 End convert_args;
315 --
316 end ben_bli_shd;