[Home] [Help]
PACKAGE BODY: APPS.PER_PPC_SHD
Source
4 -- ----------------------------------------------------------------------------
1 Package Body per_ppc_shd as
2 /* $Header: peppcrhi.pkb 120.4 2006/08/16 14:04:23 abhshriv noship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_ppc_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 = 'PER_PAY_PROPOSAL_COMPONENT_FK1') Then
37 hr_utility.set_location(l_proc,10);
38 hr_utility.set_message(801,'HR_51310_PPC_INVAL_PRO_ID');
39 hr_utility.raise_error;
40 ElsIf (p_constraint_name = 'PER_PAY_PROPOSAL_COMPONENT_FK2') Then
41 hr_utility.set_location(l_proc,15);
42 hr_utility.set_message (801,'HR_51317_PPC_INVAL_BUS_GRP_ID');
43 hr_utility.raise_error;
44 ElsIf (p_constraint_name = 'PER_PAY_PROPOSAL_COMPONENT_PK') Then
45 hr_utility.set_location(l_proc,20);
46 hr_utility.set_message (801,'HR_51319_PPC_INVAL_COMP_ID');
47 hr_utility.raise_error;
48 ElsIf (p_constraint_name = 'PER_PAY_PROPOSAL_COMPONENT_UK2') Then
49 hr_utility.set_location(l_proc,25);
50 hr_utility.set_message(801, 'HR_51313_PPC_UNIQ_COMP_REAS');
51 hr_utility.raise_error;
52 ElsIf (p_constraint_name = 'PER_PPC_APPROVED_CHK') Then
53 hr_utility.set_location(l_proc,30);
54 hr_utility.set_message(801, 'HR_51278_PYP_INVL_APPR_VAL');
55 hr_utility.raise_error;
56 Else
57 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
58 hr_utility.set_message_token('PROCEDURE', l_proc);
59 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
60 hr_utility.raise_error;
61 End If;
62 --
63 hr_utility.set_location(' Leaving:'||l_proc, 35);
64 End constraint_error;
65 --
66 -- ----------------------------------------------------------------------------
67 -- |-----------------------------< api_updating >-----------------------------|
68 -- ----------------------------------------------------------------------------
69 Function api_updating
70 (
71 p_component_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 component_id,
81 pay_proposal_id,
82 business_group_id,
83 approved,
84 component_reason,
85 change_amount_n,
86 change_percentage,
90 attribute2,
87 comments,
88 attribute_category,
89 attribute1,
91 attribute3,
92 attribute4,
93 attribute5,
94 attribute6,
95 attribute7,
96 attribute8,
97 attribute9,
98 attribute10,
99 attribute11,
100 attribute12,
101 attribute13,
102 attribute14,
103 attribute15,
104 attribute16,
105 attribute17,
106 attribute18,
107 attribute19,
108 attribute20,
109 object_version_number
110 from per_pay_proposal_components
111 where component_id = p_component_id;
112 --
113 l_proc varchar2(72) := g_package||'api_updating';
114 l_fct_ret boolean;
115 --
116 Begin
117 hr_utility.set_location('Entering:'||l_proc, 5);
118 --
119 If (
120 p_component_id is null and
121 p_object_version_number is null
122 ) Then
123 --
124 -- One of the primary key arguments is null therefore we must
125 -- set the returning function value to false
126 --
127 l_fct_ret := false;
128 Else
129 If (
130 p_component_id = g_old_rec.component_id and
131 p_object_version_number = g_old_rec.object_version_number
132 ) Then
133 hr_utility.set_location(l_proc, 10);
134 --
135 -- The g_old_rec is current therefore we must
136 -- set the returning function to true
137 --
138 l_fct_ret := true;
139 Else
140 --
141 -- Select the current row into g_old_rec
142 --
143 Open C_Sel1;
144 Fetch C_Sel1 Into g_old_rec;
145 If C_Sel1%notfound Then
146 Close C_Sel1;
147 --
148 -- The primary key is invalid therefore we must error
149 --
150 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
151 hr_utility.raise_error;
152 End If;
153 Close C_Sel1;
154 If (p_object_version_number <> g_old_rec.object_version_number) Then
155 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
156 hr_utility.raise_error;
157 End If;
158 hr_utility.set_location(l_proc, 15);
159 l_fct_ret := true;
160 End If;
161 End If;
162 hr_utility.set_location(' Leaving:'||l_proc, 20);
163 Return (l_fct_ret);
164 --
165 End api_updating;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |---------------------------------< lck >----------------------------------|
169 -- ----------------------------------------------------------------------------
170 Procedure lck
171 (
172 p_component_id in number,
173 p_object_version_number in number
174 ) is
175 --
176 -- Cursor selects the 'current' row from the HR Schema
177 --
178 Cursor C_Sel1 is
179 select
180 component_id,
181 pay_proposal_id,
182 business_group_id,
183 approved,
184 component_reason,
185 change_amount_n,
186 change_percentage,
187 comments,
188 attribute_category,
189 attribute1,
190 attribute2,
191 attribute3,
192 attribute4,
193 attribute5,
194 attribute6,
195 attribute7,
196 attribute8,
197 attribute9,
198 attribute10,
199 attribute11,
200 attribute12,
201 attribute13,
202 attribute14,
203 attribute15,
204 attribute16,
205 attribute17,
206 attribute18,
207 attribute19,
208 attribute20,
209 object_version_number
210 from per_pay_proposal_components
211 where component_id = p_component_id
212 for update nowait;
213 --
214 l_proc varchar2(72) := g_package||'lck';
215 --
216 Begin
217 hr_utility.set_location('Entering:'||l_proc, 5);
218 --
219 hr_api.mandatory_arg_error
220 (p_api_name => l_proc,
221 p_argument => 'object_version_number',
222 p_argument_value => p_object_version_number);
223 --
224 hr_api.mandatory_arg_error
225 (p_api_name => l_proc,
226 p_argument => 'component_id',
227 p_argument_value => p_component_id);
228 --
229 Open C_Sel1;
230 Fetch C_Sel1 Into g_old_rec;
231 If C_Sel1%notfound then
232 Close C_Sel1;
233 --
234 -- The primary key is invalid therefore we must error
235 --
236 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
237 hr_utility.raise_error;
238 End If;
239 Close C_Sel1;
240 If (p_object_version_number <> g_old_rec.object_version_number) Then
241 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
242 hr_utility.raise_error;
243 End If;
244 --
245 hr_utility.set_location(' Leaving:'||l_proc, 10);
246 --
247 -- We need to trap the ORA LOCK exception
248 --
249 Exception
250 When HR_Api.Object_Locked then
251 --
252 -- The object is locked therefore we need to supply a meaningful
253 -- error message.
254 --
255 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
256 hr_utility.set_message_token('TABLE_NAME', 'per_pay_proposal_components');
257 hr_utility.raise_error;
258 End lck;
259 --
260 -- ----------------------------------------------------------------------------
261 -- |-----------------------------< convert_args >-----------------------------|
262 -- ----------------------------------------------------------------------------
263 Function convert_args
267 p_business_group_id in number,
264 (
265 p_component_id in number,
266 p_pay_proposal_id in number,
268 p_approved in varchar2,
269 p_component_reason in varchar2,
270 p_change_amount_n in number,
271 p_change_percentage in number,
272 p_comments in varchar2,
273 p_attribute_category in varchar2,
274 p_attribute1 in varchar2,
275 p_attribute2 in varchar2,
276 p_attribute3 in varchar2,
277 p_attribute4 in varchar2,
278 p_attribute5 in varchar2,
279 p_attribute6 in varchar2,
280 p_attribute7 in varchar2,
281 p_attribute8 in varchar2,
282 p_attribute9 in varchar2,
283 p_attribute10 in varchar2,
284 p_attribute11 in varchar2,
285 p_attribute12 in varchar2,
286 p_attribute13 in varchar2,
287 p_attribute14 in varchar2,
288 p_attribute15 in varchar2,
289 p_attribute16 in varchar2,
290 p_attribute17 in varchar2,
291 p_attribute18 in varchar2,
292 p_attribute19 in varchar2,
293 p_attribute20 in varchar2,
294 p_object_version_number in number
295 )
296 Return g_rec_type is
297 --
298 l_rec g_rec_type;
299 l_proc varchar2(72) := g_package||'convert_args';
300 --
301 Begin
302 --
303 hr_utility.set_location('Entering:'||l_proc, 5);
304 --
305 -- Convert arguments into local l_rec structure.
306 --
307 l_rec.component_id := p_component_id;
308 l_rec.pay_proposal_id := p_pay_proposal_id;
309 l_rec.business_group_id := p_business_group_id;
310 l_rec.approved := p_approved;
311 l_rec.component_reason := p_component_reason;
312 l_rec.change_amount_n := p_change_amount_n;
313 l_rec.change_percentage := p_change_percentage;
314 l_rec.comments := p_comments;
315 l_rec.attribute_category := p_attribute_category;
316 l_rec.attribute1 := p_attribute1;
317 l_rec.attribute2 := p_attribute2;
318 l_rec.attribute3 := p_attribute3;
319 l_rec.attribute4 := p_attribute4;
320 l_rec.attribute5 := p_attribute5;
321 l_rec.attribute6 := p_attribute6;
322 l_rec.attribute7 := p_attribute7;
323 l_rec.attribute8 := p_attribute8;
324 l_rec.attribute9 := p_attribute9;
325 l_rec.attribute10 := p_attribute10;
326 l_rec.attribute11 := p_attribute11;
327 l_rec.attribute12 := p_attribute12;
328 l_rec.attribute13 := p_attribute13;
329 l_rec.attribute14 := p_attribute14;
330 l_rec.attribute15 := p_attribute15;
331 l_rec.attribute16 := p_attribute16;
332 l_rec.attribute17 := p_attribute17;
333 l_rec.attribute18 := p_attribute18;
334 l_rec.attribute19 := p_attribute19;
335 l_rec.attribute20 := p_attribute20;
336 l_rec.object_version_number := p_object_version_number;
337 --
338 -- Return the plsql record structure.
339 --
340 hr_utility.set_location(' Leaving:'||l_proc, 10);
341 Return(l_rec);
342 --
343 End convert_args;
344 --
345 end per_ppc_shd;