[Home] [Help]
PACKAGE BODY: APPS.PER_RES_SHD
Source
1 Package Body per_res_shd as
2 /* $Header: peresrhi.pkb 115.2 2003/04/02 13:38:24 eumenyio noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_res_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'PER_CAGR_ENT_RESULTS_PK') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 Else
27 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30 fnd_message.raise_error;
31 End If;
32 --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39 (p_cagr_entitlement_result_id in number
40 ,p_object_version_number in number
41 )
42 Return Boolean Is
43 --
44 --
45 -- Cursor selects the 'current' row from the HR Schema
46 --
47 Cursor C_Sel1 is
48 select
49 cagr_entitlement_result_id
50 ,assignment_id
51 ,start_date
52 ,end_date
53 ,collective_agreement_id
54 ,cagr_entitlement_item_id
55 ,element_type_id
56 ,input_value_id
57 ,cagr_api_id
58 ,cagr_api_param_id
59 ,category_name
60 ,cagr_entitlement_id
61 ,cagr_entitlement_line_id
62 ,value
63 ,units_of_measure
64 ,range_from
65 ,range_to
66 ,grade_spine_id
67 ,parent_spine_id
68 ,step_id
69 ,from_step_id
70 ,to_step_id
71 ,beneficial_flag
72 ,oipl_id
73 ,chosen_flag
74 ,column_type
75 ,column_size
76 ,cagr_request_id
77 ,business_group_id
78 ,legislation_code
79 ,eligy_prfl_id
80 ,formula_id
81 ,object_version_number
82 from per_cagr_entitlement_results
83 where cagr_entitlement_result_id = p_cagr_entitlement_result_id;
84 --
85 l_fct_ret boolean;
86 --
87 Begin
88 --
89 If (p_cagr_entitlement_result_id is null and
90 p_object_version_number is null
91 ) Then
92 --
93 -- One of the primary key arguments is null therefore we must
94 -- set the returning function value to false
95 --
96 l_fct_ret := false;
97 Else
98 If (p_cagr_entitlement_result_id
99 = per_res_shd.g_old_rec.cagr_entitlement_result_id and
100 p_object_version_number
101 = per_res_shd.g_old_rec.object_version_number
102 ) Then
103 --
104 -- The g_old_rec is current therefore we must
105 -- set the returning function to true
106 --
107 l_fct_ret := true;
108 Else
109 --
110 -- Select the current row into g_old_rec
111 --
112 Open C_Sel1;
113 Fetch C_Sel1 Into per_res_shd.g_old_rec;
114 If C_Sel1%notfound Then
115 Close C_Sel1;
116 --
117 -- The primary key is invalid therefore we must error
118 --
119 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
120 fnd_message.raise_error;
121 End If;
122 Close C_Sel1;
123 If (p_object_version_number
124 <> per_res_shd.g_old_rec.object_version_number) Then
125 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
126 fnd_message.raise_error;
127 End If;
128 l_fct_ret := true;
129 End If;
130 End If;
131 Return (l_fct_ret);
132 --
133 End api_updating;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |---------------------------------< lck >----------------------------------|
137 -- ----------------------------------------------------------------------------
138 Procedure lck
139 (p_cagr_entitlement_result_id in number
140 ,p_object_version_number in number
141 ) is
142 --
143 -- Cursor selects the 'current' row from the HR Schema
144 --
145 Cursor C_Sel1 is
146 select
147 cagr_entitlement_result_id
148 ,assignment_id
149 ,start_date
150 ,end_date
151 ,collective_agreement_id
152 ,cagr_entitlement_item_id
153 ,element_type_id
154 ,input_value_id
155 ,cagr_api_id
156 ,cagr_api_param_id
157 ,category_name
158 ,cagr_entitlement_id
159 ,cagr_entitlement_line_id
160 ,value
161 ,units_of_measure
162 ,range_from
163 ,range_to
164 ,grade_spine_id
165 ,parent_spine_id
166 ,step_id
167 ,from_step_id
168 ,to_step_id
169 ,beneficial_flag
170 ,oipl_id
171 ,chosen_flag
172 ,column_type
173 ,column_size
174 ,cagr_request_id
175 ,business_group_id
176 ,legislation_code
177 ,eligy_prfl_id
178 ,formula_id
179 ,object_version_number
180 from per_cagr_entitlement_results
181 where cagr_entitlement_result_id = p_cagr_entitlement_result_id
182 for update nowait;
183 --
184 l_proc varchar2(72) := g_package||'lck';
185 --
186 Begin
187 hr_utility.set_location('Entering:'||l_proc, 5);
188 --
189 hr_api.mandatory_arg_error
190 (p_api_name => l_proc
191 ,p_argument => 'CAGR_ENTITLEMENT_RESULT_ID'
192 ,p_argument_value => p_cagr_entitlement_result_id
193 );
194 hr_utility.set_location(l_proc,6);
195 hr_api.mandatory_arg_error
196 (p_api_name => l_proc
197 ,p_argument => 'OBJECT_VERSION_NUMBER'
198 ,p_argument_value => p_object_version_number
199 );
200 --
201 Open C_Sel1;
202 Fetch C_Sel1 Into per_res_shd.g_old_rec;
203 If C_Sel1%notfound then
204 Close C_Sel1;
205 --
206 -- The primary key is invalid therefore we must error
207 --
208 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
209 fnd_message.raise_error;
210 End If;
211 Close C_Sel1;
212 If (p_object_version_number
213 <> per_res_shd.g_old_rec.object_version_number) Then
214 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
215 fnd_message.raise_error;
216 End If;
217 --
218 hr_utility.set_location(' Leaving:'||l_proc, 10);
219 --
220 -- We need to trap the ORA LOCK exception
221 --
222 Exception
223 When HR_Api.Object_Locked then
224 --
225 -- The object is locked therefore we need to supply a meaningful
226 -- error message.
227 --
228 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
229 fnd_message.set_token('TABLE_NAME', 'per_cagr_entitlement_results');
230 fnd_message.raise_error;
231 End lck;
232 --
233 -- ----------------------------------------------------------------------------
234 -- |-----------------------------< convert_args >-----------------------------|
235 -- ----------------------------------------------------------------------------
236 Function convert_args
237 (p_cagr_entitlement_result_id in number
238 ,p_assignment_id in number
239 ,p_start_date in date
240 ,p_end_date in date
241 ,p_collective_agreement_id in number
242 ,p_cagr_entitlement_item_id in number
243 ,p_element_type_id in number
244 ,p_input_value_id in number
245 ,p_cagr_api_id in number
246 ,p_cagr_api_param_id in number
247 ,p_category_name in varchar2
248 ,p_cagr_entitlement_id in number
249 ,p_cagr_entitlement_line_id in number
250 ,p_value in varchar2
251 ,p_units_of_measure in varchar2
252 ,p_range_from in varchar2
253 ,p_range_to in varchar2
254 ,p_grade_spine_id in number
255 ,p_parent_spine_id in number
256 ,p_step_id in number
257 ,p_from_step_id in number
258 ,p_to_step_id in number
259 ,p_beneficial_flag in varchar2
260 ,p_oipl_id in number
261 ,p_chosen_flag in varchar2
262 ,p_column_type in varchar2
263 ,p_column_size in number
264 ,p_cagr_request_id in number
265 ,p_business_group_id in number
266 ,p_legislation_code in varchar2
267 ,p_eligy_prfl_id in number
268 ,p_formula_id in number
269 ,p_object_version_number in number
270 )
271 Return g_rec_type is
272 --
273 l_rec g_rec_type;
274 --
275 Begin
276 --
277 -- Convert arguments into local l_rec structure.
278 --
279 l_rec.cagr_entitlement_result_id := p_cagr_entitlement_result_id;
280 l_rec.assignment_id := p_assignment_id;
281 l_rec.start_date := p_start_date;
282 l_rec.end_date := p_end_date;
283 l_rec.collective_agreement_id := p_collective_agreement_id;
284 l_rec.cagr_entitlement_item_id := p_cagr_entitlement_item_id;
285 l_rec.element_type_id := p_element_type_id;
286 l_rec.input_value_id := p_input_value_id;
287 l_rec.cagr_api_id := p_cagr_api_id;
288 l_rec.cagr_api_param_id := p_cagr_api_param_id;
289 l_rec.category_name := p_category_name;
290 l_rec.cagr_entitlement_id := p_cagr_entitlement_id;
291 l_rec.cagr_entitlement_line_id := p_cagr_entitlement_line_id;
292 l_rec.value := p_value;
293 l_rec.units_of_measure := p_units_of_measure;
294 l_rec.range_from := p_range_from;
295 l_rec.range_to := p_range_to;
296 l_rec.grade_spine_id := p_grade_spine_id;
297 l_rec.parent_spine_id := p_parent_spine_id;
298 l_rec.step_id := p_step_id;
299 l_rec.from_step_id := p_from_step_id;
300 l_rec.to_step_id := p_to_step_id;
301 l_rec.beneficial_flag := p_beneficial_flag;
302 l_rec.oipl_id := p_oipl_id;
303 l_rec.chosen_flag := p_chosen_flag;
304 l_rec.column_type := p_column_type;
305 l_rec.column_size := p_column_size;
306 l_rec.cagr_request_id := p_cagr_request_id;
307 l_rec.business_group_id := p_business_group_id;
308 l_rec.legislation_code := p_legislation_code;
309 l_rec.eligy_prfl_id := p_eligy_prfl_id;
310 l_rec.formula_id := p_formula_id;
311 l_rec.object_version_number := p_object_version_number;
312 --
313 -- Return the plsql record structure.
314 --
315 Return(l_rec);
316 --
317 End convert_args;
318 --
319 end per_res_shd;