[Home] [Help]
PACKAGE BODY: APPS.BEN_XCT_SHD
Source
1 Package Body ben_xct_shd as
2 /* $Header: bexctrhi.pkb 115.12 2002/12/31 20:39:06 stee ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xct_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_CRIT_TYP_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_CRIT_TYP_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_CRIT_TYP_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 ElsIf (p_constraint_name = 'BEN_EXT_CRIT_VAL_FK1') Then
52 ben_utility.child_exists_error(p_table_name => 'BEN_EXT_CRIT_VAL');
53 Else
54 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
55 fnd_message.set_token('PROCEDURE', l_proc);
56 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
57 fnd_message.raise_error;
58 End If;
59 --
60 hr_utility.set_location(' Leaving:'||l_proc, 10);
61 End constraint_error;
62 --
63 -- ----------------------------------------------------------------------------
64 -- |-----------------------------< api_updating >-----------------------------|
65 -- ----------------------------------------------------------------------------
66 Function api_updating
67 (
68 p_ext_crit_typ_id in number,
69 p_object_version_number in number
70 ) Return Boolean Is
71 --
72 --
73 -- Cursor selects the 'current' row from the HR Schema
74 --
75 Cursor C_Sel1 is
76 select
77 ext_crit_typ_id,
78 crit_typ_cd,
79 ext_crit_prfl_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 excld_flag
89 from ben_ext_crit_typ
90 where ext_crit_typ_id = p_ext_crit_typ_id;
91 --
92 l_proc varchar2(72) := g_package||'api_updating';
93 l_fct_ret boolean;
94 --
95 Begin
96 hr_utility.set_location('Entering:'||l_proc, 5);
97 --
98 If (
99 p_ext_crit_typ_id is null and
100 p_object_version_number is null
101 ) Then
102 --
103 -- One of the primary key arguments is null therefore we must
104 -- set the returning function value to false
105 --
106 l_fct_ret := false;
107 Else
108 If (
109 p_ext_crit_typ_id = g_old_rec.ext_crit_typ_id and
110 p_object_version_number = g_old_rec.object_version_number
111 ) Then
112 hr_utility.set_location(l_proc, 10);
113 --
114 -- The g_old_rec is current therefore we must
115 -- set the returning function to true
116 --
117 l_fct_ret := true;
118 Else
119 --
120 -- Select the current row into g_old_rec
121 --
122 Open C_Sel1;
123 Fetch C_Sel1 Into g_old_rec;
124 If C_Sel1%notfound Then
125 Close C_Sel1;
126 --
127 -- The primary key is invalid therefore we must error
128 --
129 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
130 fnd_message.raise_error;
131 End If;
132 Close C_Sel1;
133 If (p_object_version_number <> g_old_rec.object_version_number) Then
134 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
135 fnd_message.raise_error;
136 End If;
137 hr_utility.set_location(l_proc, 15);
138 l_fct_ret := true;
139 End If;
140 End If;
141 hr_utility.set_location(' Leaving:'||l_proc, 20);
142 Return (l_fct_ret);
143 --
144 End api_updating;
145 --
146 -- ----------------------------------------------------------------------------
147 -- |---------------------------------< lck >----------------------------------|
148 -- ----------------------------------------------------------------------------
149 Procedure lck
150 (
151 p_ext_crit_typ_id in number,
152 p_object_version_number in number
153 ) is
154 --
155 -- Cursor selects the 'current' row from the HR Schema
156 --
157 Cursor C_Sel1 is
158 select ext_crit_typ_id,
159 crit_typ_cd,
160 ext_crit_prfl_id,
161 business_group_id,
162 legislation_code,
163 last_update_date,
164 creation_date,
165 last_updated_by,
166 last_update_login,
167 created_by ,
168 object_version_number,
169 excld_flag
170 from ben_ext_crit_typ
171 where ext_crit_typ_id = p_ext_crit_typ_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_crit_typ');
214 fnd_message.raise_error;
215 End lck;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |-----------------------------< convert_args >-----------------------------|
219 -- ----------------------------------------------------------------------------
220 Function convert_args
221 (
222 p_ext_crit_typ_id in number,
223 p_crit_typ_cd in varchar2,
224 p_ext_crit_prfl_id in number,
225 p_business_group_id in number,
226 p_legislation_code in varchar2,
227 p_last_update_date in date,
228 p_creation_date in date,
229 p_last_updated_by in number,
230 p_last_update_login in number,
231 p_created_by in number,
232 p_object_version_number in number,
233 p_excld_flag in varchar2
234 )
235 Return g_rec_type is
236 --
237 l_rec g_rec_type;
238 l_proc varchar2(72) := g_package||'convert_args';
239 --
240 Begin
241 --
242 hr_utility.set_location('Entering:'||l_proc, 5);
243 --
244 -- Convert arguments into local l_rec structure.
245 --
246 l_rec.ext_crit_typ_id := p_ext_crit_typ_id;
247 l_rec.crit_typ_cd := p_crit_typ_cd;
248 l_rec.ext_crit_prfl_id := p_ext_crit_prfl_id;
249 l_rec.business_group_id := p_business_group_id;
250 l_rec.legislation_code := p_legislation_code;
251 l_rec.last_update_date := p_last_update_date;
252 l_rec.creation_date := p_creation_date;
253 l_rec.last_updated_by := p_last_updated_by;
254 l_rec.last_update_login := p_last_update_login;
255 l_rec.created_by := p_created_by;
256 l_rec.object_version_number := p_object_version_number;
257 l_rec.excld_flag := p_excld_flag;
258 --
259 -- Return the plsql record structure.
260 --
261 hr_utility.set_location(' Leaving:'||l_proc, 10);
262 Return(l_rec);
263 --
264 End convert_args;
265 --
266 end ben_xct_shd;