DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PPL_SHD

Source


1 Package Body ben_ppl_shd as
2 /* $Header: bepplrhi.pkb 120.0.12000000.3 2007/02/08 07:41:23 vborkar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_ppl_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_PTNL_LER_FOR_PER_PK') 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_PTNL_LER_FOR_PER_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','5');
45     hr_utility.raise_error;
46   ElsIf (p_constraint_name = 'BEN_PTNL_LER_FOR_PER_FK3') 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','10');
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_ptnl_ler_for_per_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 		ptnl_ler_for_per_id,
76 		csd_by_ptnl_ler_for_per_id,
77 	lf_evt_ocrd_dt,
78         trgr_table_pk_id,
79 	ptnl_ler_for_per_stat_cd,
80 	ptnl_ler_for_per_src_cd,
81         mnl_dt,
82         enrt_perd_id,
83 	ntfn_dt,
84 	dtctd_dt,
85 	procd_dt,
86 	unprocd_dt,
87 	voidd_dt,
88 	mnlo_dt,
89 	ler_id,
90 	person_id,
91 	business_group_id,
92 	request_id,
93 	program_application_id,
94 	program_id,
95 	program_update_date,
96 	object_version_number
97     from	ben_ptnl_ler_for_per
98     where	ptnl_ler_for_per_id = p_ptnl_ler_for_per_id;
99 --
100   l_proc	varchar2(72)	:= g_package||'api_updating';
101   l_fct_ret	boolean;
102 --
103 Begin
104   hr_utility.set_location('Entering:'||l_proc, 5);
105   --
106   If (
107 	p_ptnl_ler_for_per_id is null and
108 	p_object_version_number is null
109      ) Then
110     --
111     -- One of the primary key arguments is null therefore we must
112     -- set the returning function value to false
113     --
114     l_fct_ret := false;
115   Else
116     If (
117 	p_ptnl_ler_for_per_id = g_old_rec.ptnl_ler_for_per_id and
118 	p_object_version_number = g_old_rec.object_version_number
119        ) Then
120       hr_utility.set_location(l_proc, 10);
121       --
122       -- The g_old_rec is current therefore we must
123       -- set the returning function to true
124       --
125       l_fct_ret := true;
126     Else
127       --
128       -- Select the current row into g_old_rec
129       --
130       Open C_Sel1;
131       Fetch C_Sel1 Into g_old_rec;
132       If C_Sel1%notfound Then
133         Close C_Sel1;
134         --
135         -- The primary key is invalid therefore we must error
136         --
137         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
138         hr_utility.raise_error;
139       End If;
140       Close C_Sel1;
141       If (p_object_version_number <> g_old_rec.object_version_number) Then
142         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
143         hr_utility.raise_error;
144       End If;
145       hr_utility.set_location(l_proc, 15);
146       l_fct_ret := true;
147     End If;
148   End If;
149   hr_utility.set_location(' Leaving:'||l_proc, 20);
150   Return (l_fct_ret);
151 --
152 End api_updating;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |---------------------------------< lck >----------------------------------|
156 -- ----------------------------------------------------------------------------
157 Procedure lck
158   (
159   p_ptnl_ler_for_per_id                in number,
160   p_object_version_number              in number
161   ) is
162 --
163 -- Cursor selects the 'current' row from the HR Schema
164 --
165   Cursor C_Sel1 is
166     select 	ptnl_ler_for_per_id,
167          	csd_by_ptnl_ler_for_per_id,
168 	lf_evt_ocrd_dt,
169         trgr_table_pk_id,
170 	ptnl_ler_for_per_stat_cd,
171 	ptnl_ler_for_per_src_cd,
172         mnl_dt,
173         enrt_perd_id,
174 	ntfn_dt,
175 	dtctd_dt,
176 	procd_dt,
177 	unprocd_dt,
178 	voidd_dt,
179 	mnlo_dt,
180 	ler_id,
181 	person_id,
182 	business_group_id,
183 	request_id,
184 	program_application_id,
185 	program_id,
186 	program_update_date,
187 	object_version_number
188     from	ben_ptnl_ler_for_per
189     where	ptnl_ler_for_per_id = p_ptnl_ler_for_per_id
190     for	update nowait;
191 --
192   l_proc	varchar2(72) := g_package||'lck';
193 --
194 Begin
195   hr_utility.set_location('Entering:'||l_proc, 5);
196   --
197   -- Add any mandatory argument checking here:
198   -- Example:
199   -- hr_api.mandatory_arg_error
200   --   (p_api_name       => l_proc,
201   --    p_argument       => 'object_version_number',
202   --    p_argument_value => p_object_version_number);
203   --
204   Open  C_Sel1;
205   Fetch C_Sel1 Into g_old_rec;
206   If C_Sel1%notfound then
207     Close C_Sel1;
208     --
209     -- The primary key is invalid therefore we must error
210     --
211     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
212     hr_utility.raise_error;
213   End If;
214   Close C_Sel1;
215   If (p_object_version_number <> g_old_rec.object_version_number) Then
216         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
217         hr_utility.raise_error;
218       End If;
219 --
220   hr_utility.set_location(' Leaving:'||l_proc, 10);
221 --
222 -- We need to trap the ORA LOCK exception
223 --
224 Exception
225   When HR_Api.Object_Locked then
226     --
227     -- The object is locked therefore we need to supply a meaningful
228     -- error message.
229     --
230 --    hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
231 --    hr_utility.set_message_token('TABLE_NAME', 'ben_ptnl_ler_for_per');
232 	hr_utility.set_message(805, 'BEN_93651_PPL_OBJECT_LOCKED'); -- Bug 3140549
233     hr_utility.raise_error;
234 End lck;
235 --
236 -- ----------------------------------------------------------------------------
237 -- |-----------------------------< convert_args >-----------------------------|
238 -- ----------------------------------------------------------------------------
239 Function convert_args
240 	(
241 	p_ptnl_ler_for_per_id           in number,
242 	p_csd_by_ptnl_ler_for_per_id    in number,
243 	p_lf_evt_ocrd_dt                in date,
244         p_trgr_table_pk_id              in number,
245 	p_ptnl_ler_for_per_stat_cd      in varchar2,
246 	p_ptnl_ler_for_per_src_cd       in varchar2,
247         p_mnl_dt                        in date,
248         p_enrt_perd_id                  in number,
249 	p_ntfn_dt                       in date,
250 	p_dtctd_dt                      in date,
251 	p_procd_dt                      in date,
252 	p_unprocd_dt                    in date,
253 	p_voidd_dt                      in date,
254 	p_mnlo_dt                       in date,
255 	p_ler_id                        in number,
256 	p_person_id                     in number,
257 	p_business_group_id             in number,
258 	p_request_id                    in number,
259 	p_program_application_id        in number,
260 	p_program_id                    in number,
261 	p_program_update_date           in date,
262 	p_object_version_number         in number
263 	)
264 	Return g_rec_type is
265 --
266   l_rec	  g_rec_type;
267   l_proc  varchar2(72) := g_package||'convert_args';
268 --
269 Begin
270   --
271   hr_utility.set_location('Entering:'||l_proc, 5);
272   --
273   -- Convert arguments into local l_rec structure.
274   --
275   l_rec.ptnl_ler_for_per_id              := p_ptnl_ler_for_per_id;
276   l_rec.csd_by_ptnl_ler_for_per_id       := p_csd_by_ptnl_ler_for_per_id;
277   l_rec.lf_evt_ocrd_dt                   := p_lf_evt_ocrd_dt;
278   l_rec.trgr_table_pk_id                 := p_trgr_table_pk_id;
279   l_rec.ptnl_ler_for_per_stat_cd         := p_ptnl_ler_for_per_stat_cd;
280   l_rec.ptnl_ler_for_per_src_cd          := p_ptnl_ler_for_per_src_cd;
281   l_rec.mnl_dt                           := p_mnl_dt;
282   l_rec.enrt_perd_id                     := p_enrt_perd_id;
283   l_rec.ntfn_dt                          := p_ntfn_dt;
284   l_rec.dtctd_dt                         := p_dtctd_dt;
285   l_rec.procd_dt                         := p_procd_dt;
286   l_rec.unprocd_dt                       := p_unprocd_dt;
287   l_rec.voidd_dt                         := p_voidd_dt;
288   l_rec.mnlo_dt                          := p_mnlo_dt;
289   l_rec.ler_id                           := p_ler_id;
290   l_rec.person_id                        := p_person_id;
291   l_rec.business_group_id                := p_business_group_id;
292   l_rec.request_id                       := p_request_id;
293   l_rec.program_application_id           := p_program_application_id;
294   l_rec.program_id                       := p_program_id;
295   l_rec.program_update_date              := p_program_update_date;
296   l_rec.object_version_number            := p_object_version_number;
297   --
298   -- Return the plsql record structure.
299   --
300   hr_utility.set_location(' Leaving:'||l_proc, 10);
301   Return(l_rec);
302 --
303 End convert_args;
304 --
305 end ben_ppl_shd;