DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XDD_SHD

Source


1 Package Body ben_xdd_shd as
2 /* $Header: bexddrhi.pkb 120.1 2005/06/08 13:09:46 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_xdd_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_DATA_ELMT_DECD_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_DATA_ELMT_DECD_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_DATA_ELMT_DECD_PK') 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   Else
52     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
53     fnd_message.set_token('PROCEDURE', l_proc);
54     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
55     fnd_message.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_ext_data_elmt_decd_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 		ext_data_elmt_decd_id,
76 	val,
77 	dcd_val,
78 	chg_evt_source,
79 	ext_data_elmt_id,
80 	business_group_id,
81 	legislation_code,
82         last_update_date,
83         creation_date,
84         last_updated_by,
85         last_update_login,
86         created_by ,
87 	object_version_number
88     from	ben_ext_data_elmt_decd
89     where	ext_data_elmt_decd_id = p_ext_data_elmt_decd_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_ext_data_elmt_decd_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_ext_data_elmt_decd_id = g_old_rec.ext_data_elmt_decd_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         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
129         fnd_message.raise_error;
130       End If;
131       Close C_Sel1;
132       If (p_object_version_number <> g_old_rec.object_version_number) Then
133         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
134         fnd_message.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_ext_data_elmt_decd_id              in number,
151   p_object_version_number              in number
152   ) is
153 --
154 -- Cursor selects the 'current' row from the HR Schema
155 --
156   Cursor C_Sel1 is
157     select 	ext_data_elmt_decd_id,
158 	val,
159 	dcd_val,
160 	chg_evt_source,
161 	ext_data_elmt_id,
162 	business_group_id,
163 	legislation_code,
164         last_update_date,
165         creation_date,
166         last_updated_by,
167         last_update_login,
168         created_by ,
169 	object_version_number
170     from	ben_ext_data_elmt_decd
171     where	ext_data_elmt_decd_id = p_ext_data_elmt_decd_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     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
194     fnd_message.raise_error;
195   End If;
196   Close C_Sel1;
197   If (p_object_version_number <> g_old_rec.object_version_number) Then
198         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
199         fnd_message.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     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
213     fnd_message.set_token('TABLE_NAME', 'ben_ext_data_elmt_decd');
214     fnd_message.raise_error;
215 End lck;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |-----------------------------< convert_args >-----------------------------|
219 -- ----------------------------------------------------------------------------
220 Function convert_args
221 	(
222 	p_ext_data_elmt_decd_id         in number,
223 	p_val                           in varchar2,
224 	p_dcd_val                       in varchar2,
225 	p_chg_evt_source                in varchar2,
226 	p_ext_data_elmt_id              in number,
227 	p_business_group_id             in number,
228 	p_legislation_code              in varchar2,
229         p_last_update_date              in date,
230         p_creation_date                 in date,
231         p_last_updated_by               in number,
232         p_last_update_login             in number,
233         p_created_by                    in number,
234 	p_object_version_number         in number
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.ext_data_elmt_decd_id            := p_ext_data_elmt_decd_id;
248   l_rec.val                              := p_val;
249   l_rec.dcd_val                          := p_dcd_val;
250   l_rec.chg_evt_source                   := p_chg_evt_source;
251   l_rec.ext_data_elmt_id                 := p_ext_data_elmt_id;
252   l_rec.business_group_id                := p_business_group_id;
253   l_rec.legislation_code                 := p_legislation_code;
254   l_rec.last_update_date                 := p_last_update_date;
255   l_rec.creation_date                    := p_creation_date;
256   l_rec.last_updated_by                  := p_last_updated_by;
257   l_rec.last_update_login                := p_last_update_login;
258   l_rec.created_by                       := p_created_by;
259   l_rec.object_version_number            := p_object_version_number;
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_xdd_shd;