DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XIC_SHD

Source


1 Package Body ben_xic_shd as
2 /* $Header: bexicrhi.pkb 120.2 2006/03/20 13:02:22 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
11 -- |------------------------< return_api_dml_status >-------------------------|
8 g_package  varchar2(33)	:= '  ben_xic_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
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_INCL_CHG_FK1') 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_INCL_CHG_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   ElsIf (p_constraint_name = 'BEN_EXT_INCL_CHG_FK3') Then
47     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
48     fnd_message.set_token('PROCEDURE', l_proc);
49     fnd_message.set_token('STEP','15');
50     fnd_message.raise_error;
51   ElsIf (p_constraint_name = 'BEN_EXT_INCL_CHG_PK') Then
52     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
53     fnd_message.set_token('PROCEDURE', l_proc);
54     fnd_message.set_token('STEP','20');
55     fnd_message.raise_error;
56   Else
57     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
58     fnd_message.set_token('PROCEDURE', l_proc);
59     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
60     fnd_message.raise_error;
61   End If;
62   --
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_ext_incl_chg_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         ext_incl_chg_id,
81 	chg_evt_cd,
82 	chg_evt_source,
83 	ext_rcd_in_file_id,
84 	ext_data_elmt_in_rcd_id,
85 	business_group_id,
86         legislation_code,
87         last_update_date,
88         creation_date,
89         last_updated_by,
90         last_update_login,
91         created_by ,
92 	object_version_number
93     from	ben_ext_incl_chg
94     where	ext_incl_chg_id = p_ext_incl_chg_id;
95 --
96   l_proc	varchar2(72)	:= g_package||'api_updating';
97   l_fct_ret	boolean;
98 --
99 Begin
100   hr_utility.set_location('Entering:'||l_proc, 5);
101   --
102   If (
103 	p_ext_incl_chg_id is null and
104 	p_object_version_number is null
105      ) Then
106     --
107     -- One of the primary key arguments is null therefore we must
108     -- set the returning function value to false
109     --
110     l_fct_ret := false;
111   Else
112     If (
113 	p_ext_incl_chg_id = g_old_rec.ext_incl_chg_id and
114 	p_object_version_number = g_old_rec.object_version_number
115        ) Then
116       hr_utility.set_location(l_proc, 10);
117       --
118       -- The g_old_rec is current therefore we must
119       -- set the returning function to true
120       --
121       l_fct_ret := true;
122     Else
123       --
124       -- Select the current row into g_old_rec
125       --
126       Open C_Sel1;
127       Fetch C_Sel1 Into g_old_rec;
128       If C_Sel1%notfound Then
129         Close C_Sel1;
130         --
131         -- The primary key is invalid therefore we must error
132         --
133         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
134         fnd_message.raise_error;
135       End If;
136       Close C_Sel1;
137       If (p_object_version_number <> g_old_rec.object_version_number) Then
138         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
139         fnd_message.raise_error;
140       End If;
141       hr_utility.set_location(l_proc, 15);
142       l_fct_ret := true;
143     End If;
144   End If;
145   hr_utility.set_location(' Leaving:'||l_proc, 20);
146   Return (l_fct_ret);
147 --
148 End api_updating;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |---------------------------------< lck >----------------------------------|
152 -- ----------------------------------------------------------------------------
153 Procedure lck
154   (
155   p_ext_incl_chg_id                    in number,
156   p_object_version_number              in number
157   ) is
158 --
159 -- Cursor selects the 'current' row from the HR Schema
160 --
161   Cursor C_Sel1 is
162     select 	ext_incl_chg_id,
163 	chg_evt_cd,
164 	chg_evt_source,
165 	ext_rcd_in_file_id,
166 	ext_data_elmt_in_rcd_id,
167 	business_group_id,
168 	legislation_code,
169         last_update_date,
170         creation_date,
171         last_updated_by,
172         last_update_login,
173         created_by ,
174 	object_version_number
175     from	ben_ext_incl_chg
176     where	ext_incl_chg_id = p_ext_incl_chg_id
177     for	update nowait;
178 --
179   l_proc	varchar2(72) := g_package||'lck';
180 --
181 Begin
182   hr_utility.set_location('Entering:'||l_proc, 5);
183   --
184   -- Add any mandatory argument checking here:
185   -- Example:
186   -- hr_api.mandatory_arg_error
187   --   (p_api_name       => l_proc,
188   --    p_argument       => 'object_version_number',
189   --    p_argument_value => p_object_version_number);
190   --
191   Open  C_Sel1;
192   Fetch C_Sel1 Into g_old_rec;
193   If C_Sel1%notfound then
194     Close C_Sel1;
195     --
196     -- The primary key is invalid therefore we must error
197     --
198     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
199     fnd_message.raise_error;
200   End If;
201   Close C_Sel1;
202   If (p_object_version_number <> g_old_rec.object_version_number) Then
203         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
204         fnd_message.raise_error;
205       End If;
206 --
207   hr_utility.set_location(' Leaving:'||l_proc, 10);
208 --
209 -- We need to trap the ORA LOCK exception
210 --
211 Exception
212   When HR_Api.Object_Locked then
213     --
214     -- The object is locked therefore we need to supply a meaningful
215     -- error message.
216     --
217     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
218     fnd_message.set_token('TABLE_NAME', 'ben_ext_incl_chg');
219     fnd_message.raise_error;
220 End lck;
221 --
222 -- ----------------------------------------------------------------------------
223 -- |-----------------------------< convert_args >-----------------------------|
224 -- ----------------------------------------------------------------------------
225 Function convert_args
226 	(
227 	p_ext_incl_chg_id               in number,
228 	p_chg_evt_cd                    in varchar2,
229 	p_chg_evt_source                in varchar2,
230 	p_ext_rcd_in_file_id            in number,
231 	p_ext_data_elmt_in_rcd_id       in number,
232 	p_business_group_id             in number,
233 	p_legislation_code              in varchar2,
234         p_last_update_date              in date,
235         p_creation_date                 in date,
236         p_last_updated_by               in number,
237         p_last_update_login             in number,
238         p_created_by                    in number,
239 	p_object_version_number         in number
240 	)
241 	Return g_rec_type is
242 --
243   l_rec	  g_rec_type;
244   l_proc  varchar2(72) := g_package||'convert_args';
245 --
246 Begin
247   --
248   hr_utility.set_location('Entering:'||l_proc, 5);
249   --
250   -- Convert arguments into local l_rec structure.
251   --
252   l_rec.ext_incl_chg_id                  := p_ext_incl_chg_id;
253   l_rec.chg_evt_cd                       := p_chg_evt_cd;
254   l_rec.chg_evt_source                   := p_chg_evt_source;
255   l_rec.ext_rcd_in_file_id               := p_ext_rcd_in_file_id;
256   l_rec.ext_data_elmt_in_rcd_id          := p_ext_data_elmt_in_rcd_id;
257   l_rec.business_group_id                := p_business_group_id;
258   l_rec.legislation_code                 := p_legislation_code;
259   l_rec.last_update_date                 := p_last_update_date;
260   l_rec.creation_date                    := p_creation_date;
261   l_rec.last_updated_by                  := p_last_updated_by;
262   l_rec.last_update_login                := p_last_update_login;
263   l_rec.created_by                       := p_created_by;
264   l_rec.object_version_number            := p_object_version_number;
265 
266   --
267   -- Return the plsql record structure.
268   --
269   hr_utility.set_location(' Leaving:'||l_proc, 10);
270   Return(l_rec);
271 --
272 End convert_args;
273 --
274 end ben_xic_shd;