DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XRE_SHD

Source


1 Package Body ben_xre_shd as
2 /* $Header: bexrerhi.pkb 115.8 2002/12/16 17:41:12 glingapp ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_xre_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_EXT_RSLT_ERR_PK') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','5');
40     fnd_message.raise_error;
41   ElsIf (p_constraint_name = 'BEN_EXT_RSLT_ERR_FK2') Then
42     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('STEP','10');
45     fnd_message.raise_error;
46   Else
47     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
48     fnd_message.set_token('PROCEDURE', l_proc);
49     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
50     fnd_message.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_ext_rslt_err_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 		ext_rslt_err_id,
71 	err_num,
72         err_txt,
73 	typ_cd,
74 	person_id,
75 	business_group_id,
76 	object_version_number,
77 	request_id,
78 	program_application_id,
79 	program_id,
80 	program_update_date,
81         ext_rslt_id
82     from	ben_ext_rslt_err
83     where	ext_rslt_err_id = p_ext_rslt_err_id;
84 --
85   l_proc	varchar2(72)	:= g_package||'api_updating';
86   l_fct_ret	boolean;
87 --
88 Begin
89   hr_utility.set_location('Entering:'||l_proc, 5);
90   --
91   If (
92 	p_ext_rslt_err_id is null and
93 	p_object_version_number is null
94      ) Then
95     --
96     -- One of the primary key arguments is null therefore we must
97     -- set the returning function value to false
98     --
99     l_fct_ret := false;
100   Else
101     If (
102 	p_ext_rslt_err_id = g_old_rec.ext_rslt_err_id and
103 	p_object_version_number = g_old_rec.object_version_number
104        ) Then
105       hr_utility.set_location(l_proc, 10);
106       --
107       -- The g_old_rec is current therefore we must
108       -- set the returning function to true
109       --
110       l_fct_ret := true;
111     Else
112       --
113       -- Select the current row into g_old_rec
114       --
115       Open C_Sel1;
116       Fetch C_Sel1 Into g_old_rec;
117       If C_Sel1%notfound Then
118         Close C_Sel1;
119         --
120         -- The primary key is invalid therefore we must error
121         --
122         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
123         fnd_message.raise_error;
124       End If;
125       Close C_Sel1;
126       If (p_object_version_number <> g_old_rec.object_version_number) Then
127         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
128         fnd_message.raise_error;
129       End If;
130       hr_utility.set_location(l_proc, 15);
131       l_fct_ret := true;
132     End If;
133   End If;
134   hr_utility.set_location(' Leaving:'||l_proc, 20);
135   Return (l_fct_ret);
136 --
137 End api_updating;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |---------------------------------< lck >----------------------------------|
141 -- ----------------------------------------------------------------------------
142 Procedure lck
143   (
144   p_ext_rslt_err_id                    in number,
145   p_object_version_number              in number
146   ) is
147 --
148 -- Cursor selects the 'current' row from the HR Schema
149 --
150   Cursor C_Sel1 is
151     select 	ext_rslt_err_id,
152 	err_num,
153         err_txt,
154 	typ_cd,
155 	person_id,
156 	business_group_id,
157 	object_version_number,
158 	request_id,
159 	program_application_id,
160 	program_id,
161 	program_update_date,
162         ext_rslt_id
163     from	ben_ext_rslt_err
164     where	ext_rslt_err_id = p_ext_rslt_err_id
165     for	update nowait;
166 --
167   l_proc	varchar2(72) := g_package||'lck';
168 --
169 Begin
170   hr_utility.set_location('Entering:'||l_proc, 5);
171   --
172   -- Add any mandatory argument checking here:
173   -- Example:
174   -- hr_api.mandatory_arg_error
175   --   (p_api_name       => l_proc,
176   --    p_argument       => 'object_version_number',
177   --    p_argument_value => p_object_version_number);
178   --
179   Open  C_Sel1;
180   Fetch C_Sel1 Into g_old_rec;
181   If C_Sel1%notfound then
182     Close C_Sel1;
183     --
184     -- The primary key is invalid therefore we must error
185     --
186     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
187     fnd_message.raise_error;
188   End If;
189   Close C_Sel1;
190   If (p_object_version_number <> g_old_rec.object_version_number) Then
191         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
192         fnd_message.raise_error;
193       End If;
194 --
195   hr_utility.set_location(' Leaving:'||l_proc, 10);
196 --
197 -- We need to trap the ORA LOCK exception
198 --
199 Exception
200   When HR_Api.Object_Locked then
201     --
202     -- The object is locked therefore we need to supply a meaningful
203     -- error message.
204     --
205     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
206     fnd_message.set_token('TABLE_NAME', 'ben_ext_rslt_err');
207     fnd_message.raise_error;
208 End lck;
209 --
210 -- ----------------------------------------------------------------------------
211 -- |-----------------------------< convert_args >-----------------------------|
212 -- ----------------------------------------------------------------------------
213 Function convert_args
214 	(
215 	p_ext_rslt_err_id               in number,
216 	p_err_num                       in number,
217 	p_err_txt                       in varchar2,
218 	p_typ_cd                        in varchar2,
219 	p_person_id                     in number,
220 	p_business_group_id             in number,
221 	p_object_version_number         in number,
222 	p_request_id                    in number,
223 	p_program_application_id        in number,
224 	p_program_id                    in number,
225 	p_program_update_date           in date,
226         p_ext_rslt_id                   in number
227 	)
228 	Return g_rec_type is
229 --
230   l_rec	  g_rec_type;
231   l_proc  varchar2(72) := g_package||'convert_args';
232 --
233 Begin
234   --
235   hr_utility.set_location('Entering:'||l_proc, 5);
236   --
237   -- Convert arguments into local l_rec structure.
238   --
239   l_rec.ext_rslt_err_id                  := p_ext_rslt_err_id;
240   l_rec.err_num                          := p_err_num;
241   l_rec.err_txt                          := p_err_txt;
242   l_rec.typ_cd                           := p_typ_cd;
243   l_rec.person_id                        := p_person_id;
244   l_rec.business_group_id                := p_business_group_id;
245   l_rec.object_version_number            := p_object_version_number;
246   l_rec.request_id                       := p_request_id;
247   l_rec.program_application_id           := p_program_application_id;
248   l_rec.program_id                       := p_program_id;
249   l_rec.program_update_date              := p_program_update_date;
250   l_rec.ext_rslt_id                      := p_ext_rslt_id;
251   --
252   -- Return the plsql record structure.
253   --
254   hr_utility.set_location(' Leaving:'||l_proc, 10);
255   Return(l_rec);
256 --
257 End convert_args;
258 --
259 end ben_xre_shd;