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