DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BEI_SHD

Source


1 Package Body ben_bei_shd as
2 /* $Header: bebeirhi.pkb 120.0 2005/05/28 00:38:07 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bei_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_ELIG__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 = 'BEN_BATCH_ELIG_INFO_FK1') 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_ELIG_INFO_FK2') 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 = 'BEN_BATCH_ELIG_INFO_PK') 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   Else
57     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
58     hr_utility.set_message_token('PROCEDURE', l_proc);
62   --
59     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
60     hr_utility.raise_error;
61   End If;
63   hr_utility.set_location(' Leaving:'||l_proc, 10);
64 End constraint_error;
65 --
66 -- ----------------------------------------------------------------------------
67 -- |-----------------------------< api_updating >-----------------------------|
68 -- ----------------------------------------------------------------------------
69 Function api_updating
70   (
71   p_batch_elig_id                      in number,
72   p_object_version_number              in number
73   )      Return Boolean Is
74 --
75   --
76   -- Cursor selects the 'current' row from the HR Schema
77   --
78   Cursor C_Sel1 is
79     select
80 	batch_elig_id,
81 	benefit_action_id,
82 	person_id,
83 	pgm_id,
84 	pl_id,
85 	oipl_id,
86 	elig_flag,
87 	inelig_text,
88 	business_group_id,
89 	object_version_number
90     from	ben_batch_elig_info
91     where	batch_elig_id = p_batch_elig_id;
92 --
93   l_proc	varchar2(72)	:= g_package||'api_updating';
94   l_fct_ret	boolean;
95 --
96 Begin
97   hr_utility.set_location('Entering:'||l_proc, 5);
98   --
99   If (
100 	p_batch_elig_id is null and
101 	p_object_version_number is null
102      ) Then
103     --
104     -- One of the primary key arguments is null therefore we must
105     -- set the returning function value to false
106     --
107     l_fct_ret := false;
108   Else
109     If (
110 	p_batch_elig_id = g_old_rec.batch_elig_id and
111 	p_object_version_number = g_old_rec.object_version_number
112        ) Then
113       hr_utility.set_location(l_proc, 10);
114       --
115       -- The g_old_rec is current therefore we must
116       -- set the returning function to true
117       --
118       l_fct_ret := true;
119     Else
120       --
121       -- Select the current row into g_old_rec
122       --
123       Open C_Sel1;
124       Fetch C_Sel1 Into g_old_rec;
125       If C_Sel1%notfound Then
126         Close C_Sel1;
127         --
128         -- The primary key is invalid therefore we must error
129         --
130         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
131         hr_utility.raise_error;
132       End If;
133       Close C_Sel1;
134       If (p_object_version_number <> g_old_rec.object_version_number) Then
135         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
136         hr_utility.raise_error;
137       End If;
138       hr_utility.set_location(l_proc, 15);
139       l_fct_ret := true;
140     End If;
141   End If;
142   hr_utility.set_location(' Leaving:'||l_proc, 20);
143   Return (l_fct_ret);
144 --
145 End api_updating;
146 --
147 -- ----------------------------------------------------------------------------
148 -- |---------------------------------< lck >----------------------------------|
149 -- ----------------------------------------------------------------------------
150 Procedure lck
151   (
152   p_batch_elig_id                      in number,
153   p_object_version_number              in number
154   ) is
155 --
156 -- Cursor selects the 'current' row from the HR Schema
157 --
158   Cursor C_Sel1 is
159     select 	batch_elig_id,
160 	benefit_action_id,
161 	person_id,
162 	pgm_id,
163 	pl_id,
164 	oipl_id,
165 	elig_flag,
166 	inelig_text,
167 	business_group_id,
168 	object_version_number
169     from	ben_batch_elig_info
170     where	batch_elig_id = p_batch_elig_id
171     for	update nowait;
172 --
173   l_proc	varchar2(72) := g_package||'lck';
174 --
175 Begin
176   hr_utility.set_location('Entering:'||l_proc, 5);
177   --
178   -- Add any mandatory argument checking here:
179   -- Example:
180   -- hr_api.mandatory_arg_error
181   --   (p_api_name       => l_proc,
182   --    p_argument       => 'object_version_number',
183   --    p_argument_value => p_object_version_number);
184   --
185   Open  C_Sel1;
186   Fetch C_Sel1 Into g_old_rec;
187   If C_Sel1%notfound then
188     Close C_Sel1;
189     --
190     -- The primary key is invalid therefore we must error
191     --
192     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
193     hr_utility.raise_error;
194   End If;
195   Close C_Sel1;
196   If (p_object_version_number <> g_old_rec.object_version_number) Then
197         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
198         hr_utility.raise_error;
199       End If;
200 --
201   hr_utility.set_location(' Leaving:'||l_proc, 10);
202 --
203 -- We need to trap the ORA LOCK exception
204 --
205 Exception
206   When HR_Api.Object_Locked then
207     --
208     -- The object is locked therefore we need to supply a meaningful
209     -- error message.
210     --
211     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
212     hr_utility.set_message_token('TABLE_NAME', 'ben_batch_elig_info');
213     hr_utility.raise_error;
214 End lck;
215 --
216 -- ----------------------------------------------------------------------------
217 -- |-----------------------------< convert_args >-----------------------------|
218 -- ----------------------------------------------------------------------------
219 Function convert_args
220 	(
221 	p_batch_elig_id                 in number,
222 	p_benefit_action_id             in number,
223 	p_person_id                     in number,
224 	p_pgm_id                        in number,
225 	p_pl_id                         in number,
226 	p_oipl_id                       in number,
227 	p_elig_flag                     in varchar2,
228 	p_inelig_text                   in varchar2,
229 	p_business_group_id             in number,
230 	p_object_version_number         in number
231 	)
232 	Return g_rec_type is
233 --
234   l_rec	  g_rec_type;
235   l_proc  varchar2(72) := g_package||'convert_args';
236 --
237 Begin
238   --
239   hr_utility.set_location('Entering:'||l_proc, 5);
240   --
241   -- Convert arguments into local l_rec structure.
242   --
243   l_rec.batch_elig_id                    := p_batch_elig_id;
244   l_rec.benefit_action_id                := p_benefit_action_id;
245   l_rec.person_id                        := p_person_id;
246   l_rec.pgm_id                           := p_pgm_id;
247   l_rec.pl_id                            := p_pl_id;
248   l_rec.oipl_id                          := p_oipl_id;
249   l_rec.elig_flag                        := p_elig_flag;
250   l_rec.inelig_text                      := p_inelig_text;
251   l_rec.business_group_id                := p_business_group_id;
252   l_rec.object_version_number            := p_object_version_number;
253   --
254   -- Return the plsql record structure.
255   --
256   hr_utility.set_location(' Leaving:'||l_proc, 10);
257   Return(l_rec);
258 --
259 End convert_args;
260 --
261 end ben_bei_shd;