DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BMN_SHD

Source


1 Package Body ben_bmn_shd as
2 /* $Header: bebmnrhi.pkb 115.7 2002/12/09 12:40:49 lakrish ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bmn_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_REPORTING_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_REPORTING_PK') 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   Else
47     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50     hr_utility.raise_error;
51   End If;
52   --
53   hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (
61   p_reporting_id                       in number,
62   p_object_version_number              in number
63   )      Return Boolean Is
64 --
65   --
66   -- Cursor selects the 'current' row from the HR Schema
67   --
68   Cursor C_Sel1 is
69     select
70 	reporting_id,
71 	benefit_action_id,
72 	thread_id,
73 	sequence,
74 	text,
75         rep_typ_cd,
76         error_message_code,
77         national_identifier,
78         related_person_ler_id,
79         temporal_ler_id,
80         ler_id,
81         person_id,
82         pgm_id,
83         pl_id,
84         related_person_id,
85         oipl_id,
86         pl_typ_id,
87         actl_prem_id                      ,
88         val                               ,
89         mo_num                            ,
90         yr_num                            ,
91 	object_version_number
92     from	ben_reporting
93     where	reporting_id = p_reporting_id;
94 --
95   l_proc	varchar2(72)	:= g_package||'api_updating';
96   l_fct_ret	boolean;
97 --
98 Begin
99   hr_utility.set_location('Entering:'||l_proc, 5);
100   --
101   If (
102 	p_reporting_id is null and
103 	p_object_version_number is null
104      ) Then
105     --
106     -- One of the primary key arguments is null therefore we must
107     -- set the returning function value to false
108     --
109     l_fct_ret := false;
110   Else
111     If (
112 	p_reporting_id = g_old_rec.reporting_id and
113 	p_object_version_number = g_old_rec.object_version_number
114        ) Then
115       hr_utility.set_location(l_proc, 10);
116       --
117       -- The g_old_rec is current therefore we must
118       -- set the returning function to true
119       --
120       l_fct_ret := true;
121     Else
122       --
123       -- Select the current row into g_old_rec
124       --
125       Open C_Sel1;
126       Fetch C_Sel1 Into g_old_rec;
127       If C_Sel1%notfound Then
128         Close C_Sel1;
129         --
130         -- The primary key is invalid therefore we must error
131         --
132         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
133         hr_utility.raise_error;
134       End If;
135       Close C_Sel1;
136       If (p_object_version_number <> g_old_rec.object_version_number) Then
137         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
138         hr_utility.raise_error;
139       End If;
140       hr_utility.set_location(l_proc, 15);
141       l_fct_ret := true;
142     End If;
143   End If;
144   hr_utility.set_location(' Leaving:'||l_proc, 20);
145   Return (l_fct_ret);
146 --
147 End api_updating;
148 --
149 -- ----------------------------------------------------------------------------
150 -- |---------------------------------< lck >----------------------------------|
151 -- ----------------------------------------------------------------------------
152 Procedure lck
153   (
154   p_reporting_id                       in number,
155   p_object_version_number              in number
156   ) is
157 --
158 -- Cursor selects the 'current' row from the HR Schema
159 --
160   Cursor C_Sel1 is
161     select 	reporting_id,
162 	benefit_action_id,
163 	thread_id,
164 	sequence,
165 	text,
166         rep_typ_cd,
167         error_message_code,
168         national_identifier,
169         related_person_ler_id,
170         temporal_ler_id,
171         ler_id,
172         person_id,
173         pgm_id,
174         pl_id,
175         related_person_id,
176         oipl_id,
177         pl_typ_id,
178         actl_prem_id                      ,
179         val                               ,
180         mo_num                            ,
181         yr_num                            ,
182 	object_version_number
183     from	ben_reporting
184     where	reporting_id = p_reporting_id
185     for	update nowait;
186 --
187   l_proc	varchar2(72) := g_package||'lck';
188 --
189 Begin
190   hr_utility.set_location('Entering:'||l_proc, 5);
191   --
192   -- Add any mandatory argument checking here:
193   -- Example:
194   -- hr_api.mandatory_arg_error
195   --   (p_api_name       => l_proc,
196   --    p_argument       => 'object_version_number',
197   --    p_argument_value => p_object_version_number);
198   --
199   Open  C_Sel1;
200   Fetch C_Sel1 Into g_old_rec;
201   If C_Sel1%notfound then
202     Close C_Sel1;
203     --
204     -- The primary key is invalid therefore we must error
205     --
206     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
207     hr_utility.raise_error;
208   End If;
209   Close C_Sel1;
210   If (p_object_version_number <> g_old_rec.object_version_number) Then
211         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
212         hr_utility.raise_error;
213       End If;
214 --
215   hr_utility.set_location(' Leaving:'||l_proc, 10);
216 --
217 -- We need to trap the ORA LOCK exception
218 --
219 Exception
220   When HR_Api.Object_Locked then
221     --
222     -- The object is locked therefore we need to supply a meaningful
223     -- error message.
224     --
225     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
226     hr_utility.set_message_token('TABLE_NAME', 'ben_reporting');
227     hr_utility.raise_error;
228 End lck;
229 --
230 -- ----------------------------------------------------------------------------
231 -- |-----------------------------< convert_args >-----------------------------|
232 -- ----------------------------------------------------------------------------
233 Function convert_args
234 	(
235 	p_reporting_id                  in number,
236 	p_benefit_action_id             in number,
237 	p_thread_id                     in number,
238 	p_sequence                      in number,
239 	p_text                          in varchar2,
240         p_rep_typ_cd                    in varchar2,
241         p_error_message_code            in varchar2,
242         p_national_identifier           in varchar2,
243         p_related_person_ler_id         in number,
244         p_temporal_ler_id               in number,
245         p_ler_id                        in number,
246         p_person_id                     in number,
247         p_pgm_id                        in number,
248         p_pl_id                         in number,
249         p_related_person_id             in number,
250         p_oipl_id                       in number,
251         p_pl_typ_id                     in number,
252         p_actl_prem_id                  in    number,
253         p_val                           in    number,
254         p_mo_num                        in    number,
255         p_yr_num                        in    number,
256 	p_object_version_number         in number
257 	)
258 	Return g_rec_type is
259 --
260   l_rec	  g_rec_type;
261   l_proc  varchar2(72) := g_package||'convert_args';
262 --
263 Begin
264   --
265   hr_utility.set_location('Entering:'||l_proc, 5);
266   --
267   -- Convert arguments into local l_rec structure.
268   --
269   l_rec.reporting_id                     := p_reporting_id;
270   l_rec.benefit_action_id                := p_benefit_action_id;
271   l_rec.thread_id                        := p_thread_id        ;
272   l_rec.sequence                         := p_sequence;
273   l_rec.text                             := p_text;
274   l_rec.rep_typ_cd                       := p_rep_typ_cd;
275   l_rec.error_message_code               := p_error_message_code;
276   l_rec.national_identifier              := p_national_identifier;
277   l_rec.related_person_ler_id            := p_related_person_ler_id;
278   l_rec.temporal_ler_id                  := p_temporal_ler_id;
279   l_rec.ler_id                           := p_ler_id;
280   l_rec.person_id                        := p_person_id;
281   l_rec.pgm_id                           := p_pgm_id;
282   l_rec.pl_id                            := p_pl_id;
283   l_rec.related_person_id                := p_related_person_id;
284   l_rec.pl_typ_id                        := p_pl_typ_id;
285   l_rec.actl_prem_id                  := p_actl_prem_id;
286   l_rec.val                           := p_val    ;
287   l_rec.mo_num                        := p_mo_num    ;
288   l_rec.yr_num                        := p_yr_num    ;
289   l_rec.oipl_id                          := p_oipl_id;
290   l_rec.object_version_number            := p_object_version_number;
291   --
292   -- Return the plsql record structure.
293   --
294   hr_utility.set_location(' Leaving:'||l_proc, 10);
295   Return(l_rec);
296 --
297 End convert_args;
298 --
299 end ben_bmn_shd;