[Home] [Help]
PACKAGE BODY: APPS.BEN_BDI_SHD
Source
1 Package Body ben_bdi_shd as
2 /* $Header: bebdirhi.pkb 120.0.12000000.2 2007/09/11 12:48:32 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_bdi_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_DPNT_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_DPNT_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_DPNT_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_dpnt_id in number,
67 p_object_version_number in varchar2
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_dpnt_id,
76 benefit_action_id,
77 person_id,
78 pgm_id,
82 dpnt_person_id,
79 pl_id,
80 oipl_id,
81 contact_typ_cd,
83 business_group_id,
84 object_version_number,
85 enrt_cvg_strt_dt,
86 enrt_cvg_thru_dt,
87 actn_cd
88 from ben_batch_dpnt_info
89 where batch_dpnt_id = p_batch_dpnt_id;
90 --
91 l_proc varchar2(72) := g_package||'api_updating';
92 l_fct_ret boolean;
93 --
94 Begin
95 hr_utility.set_location('Entering:'||l_proc, 5);
96 --
97 If (
98 p_batch_dpnt_id is null and
99 p_object_version_number is null
100 ) Then
101 --
102 -- One of the primary key arguments is null therefore we must
103 -- set the returning function value to false
104 --
105 l_fct_ret := false;
106 Else
107 If (
108 p_batch_dpnt_id = g_old_rec.batch_dpnt_id and
109 p_object_version_number = g_old_rec.object_version_number
110 ) Then
111 hr_utility.set_location(l_proc, 10);
112 --
113 -- The g_old_rec is current therefore we must
114 -- set the returning function to true
115 --
116 l_fct_ret := true;
117 Else
118 --
119 -- Select the current row into g_old_rec
120 --
121 Open C_Sel1;
122 Fetch C_Sel1 Into g_old_rec;
123 If C_Sel1%notfound Then
124 Close C_Sel1;
125 --
126 -- The primary key is invalid therefore we must error
127 --
128 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
129 hr_utility.raise_error;
130 End If;
131 Close C_Sel1;
132 If (p_object_version_number <> g_old_rec.object_version_number) Then
133 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
134 hr_utility.raise_error;
135 End If;
136 hr_utility.set_location(l_proc, 15);
137 l_fct_ret := true;
138 End If;
139 End If;
140 hr_utility.set_location(' Leaving:'||l_proc, 20);
141 Return (l_fct_ret);
142 --
143 End api_updating;
144 --
145 -- ----------------------------------------------------------------------------
146 -- |---------------------------------< lck >----------------------------------|
147 -- ----------------------------------------------------------------------------
148 Procedure lck
149 (
150 p_batch_dpnt_id in number,
151 p_object_version_number in varchar2
152 ) is
153 --
154 -- Cursor selects the 'current' row from the HR Schema
155 --
156 Cursor C_Sel1 is
157 select batch_dpnt_id,
158 benefit_action_id,
159 person_id,
160 pgm_id,
161 pl_id,
162 oipl_id,
163 contact_typ_cd,
164 dpnt_person_id,
165 business_group_id,
166 object_version_number,
167 enrt_cvg_strt_dt,
168 enrt_cvg_thru_dt,
169 actn_cd
170 from ben_batch_dpnt_info
171 where batch_dpnt_id = p_batch_dpnt_id
172 for update nowait;
173 --
174 l_proc varchar2(72) := g_package||'lck';
175 --
176 Begin
177 hr_utility.set_location('Entering:'||l_proc, 5);
178 --
179 -- Add any mandatory argument checking here:
180 -- Example:
181 -- hr_api.mandatory_arg_error
182 -- (p_api_name => l_proc,
183 -- p_argument => 'object_version_number',
184 -- p_argument_value => p_object_version_number);
185 --
186 Open C_Sel1;
187 Fetch C_Sel1 Into g_old_rec;
188 If C_Sel1%notfound then
189 Close C_Sel1;
190 --
191 -- The primary key is invalid therefore we must error
192 --
193 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
194 hr_utility.raise_error;
195 End If;
196 Close C_Sel1;
197 If (p_object_version_number <> g_old_rec.object_version_number) Then
198 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
199 hr_utility.raise_error;
200 End If;
201 --
202 hr_utility.set_location(' Leaving:'||l_proc, 10);
203 --
204 -- We need to trap the ORA LOCK exception
205 --
206 Exception
207 When HR_Api.Object_Locked then
208 --
209 -- The object is locked therefore we need to supply a meaningful
210 -- error message.
211 --
212 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
213 hr_utility.set_message_token('TABLE_NAME', 'ben_batch_dpnt_info');
214 hr_utility.raise_error;
215 End lck;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |-----------------------------< convert_args >-----------------------------|
219 -- ----------------------------------------------------------------------------
220 Function convert_args
221 (
222 p_batch_dpnt_id in number,
223 p_benefit_action_id in number,
224 p_person_id in number,
225 p_pgm_id in number,
226 p_pl_id in number,
227 p_oipl_id in number,
228 p_contact_typ_cd in varchar2,
229 p_dpnt_person_id in number,
230 p_business_group_id in number,
231 p_object_version_number in varchar2,
232 p_enrt_cvg_strt_dt in date,
233 p_enrt_cvg_thru_dt in date,
234 p_actn_cd in varchar2
235 )
236 Return g_rec_type is
237 --
238 l_rec g_rec_type;
239 l_proc varchar2(72) := g_package||'convert_args';
240 --
241 Begin
242 --
243 hr_utility.set_location('Entering:'||l_proc, 5);
244 --
245 -- Convert arguments into local l_rec structure.
246 --
247 l_rec.batch_dpnt_id := p_batch_dpnt_id;
248 l_rec.benefit_action_id := p_benefit_action_id;
249 l_rec.person_id := p_person_id;
250 l_rec.pgm_id := p_pgm_id;
251 l_rec.pl_id := p_pl_id;
252 l_rec.oipl_id := p_oipl_id;
253 l_rec.contact_typ_cd := p_contact_typ_cd;
254 l_rec.dpnt_person_id := p_dpnt_person_id;
255 l_rec.business_group_id := p_business_group_id;
256 l_rec.object_version_number := p_object_version_number;
257 l_rec.enrt_cvg_strt_dt := p_enrt_cvg_strt_dt;
258 l_rec.enrt_cvg_thru_dt := p_enrt_cvg_thru_dt;
259 l_rec.actn_cd := p_actn_cd;
260 --
261 -- Return the plsql record structure.
262 --
263 hr_utility.set_location(' Leaving:'||l_proc, 10);
264 Return(l_rec);
265 --
266 End convert_args;
267 --
268 end ben_bdi_shd;