[Home] [Help]
PACKAGE BODY: APPS.PV_ATTRIBUTE_CODE_PVT
Source
1 PACKAGE BODY PV_ATTRIBUTE_CODE_PVT as
2 /* $Header: pvxvatcb.pls 120.1 2005/06/30 14:47:38 appldev ship $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 -- PV_Attribute_Code_PVT
7 -- Purpose
8 --
9 -- History
10 --
11 -- NOTE
12 --
13 -- End of Comments
14 -- ===============================================================
15
16
17 G_PKG_NAME CONSTANT VARCHAR2(30):= 'PV_ATTRIBUTE_CODE_PVT';
18 G_FILE_NAME CONSTANT VARCHAR2(12) := 'pvxvatcb.pls';
19
20 G_USER_ID NUMBER := NVL(FND_GLOBAL.USER_ID,-1);
21 G_LOGIN_ID NUMBER := NVL(FND_GLOBAL.CONC_LOGIN_ID,-1);
22
23 -- Hint: Primary key needs to be returned.
24
25 PROCEDURE Create_Attribute_Code(
26 p_api_version_number IN NUMBER
27 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
28 ,p_commit IN VARCHAR2 := FND_API.G_FALSE
29 ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
30
31 ,x_return_status OUT NOCOPY VARCHAR2
32 ,x_msg_count OUT NOCOPY NUMBER
33 ,x_msg_data OUT NOCOPY VARCHAR2
34
35 ,p_attribute_code_rec IN attribute_code_rec_type := g_miss_attribute_code_rec
36 ,x_attr_code_id OUT NOCOPY NUMBER
37 )
38 IS
39 l_api_name CONSTANT VARCHAR2(30) := 'Create_Attribute_Code';
40 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
41 l_api_version_number CONSTANT NUMBER := 1.0;
42 l_return_status_full VARCHAR2(1);
43 l_object_version_number NUMBER := 1;
44 l_org_id NUMBER := FND_API.G_MISS_NUM;
45 l_attr_code_id NUMBER;
46 l_dummy NUMBER;
47 l_attribute_code_rec attribute_code_rec_type := p_attribute_code_rec;
48
49 CURSOR c_id IS
50 SELECT PV_ATTRIBUTE_CODES_S.NEXTVAL
51 FROM dual;
52
53 CURSOR c_id_exists (l_id IN NUMBER) IS
54 SELECT 1
55 FROM PV_ATTRIBUTE_CODES_B
56 WHERE ATTR_CODE_ID = l_id;
57
58 BEGIN
59 -- Standard Start of API savepoint
60 SAVEPOINT CREATE_Attribute_Code_PVT;
61
62 -- Standard call to check for call compatibility.
63 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
64 p_api_version_number,
65 l_api_name,
66 G_PKG_NAME)
67 THEN
68 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
69 END IF;
70
71 -- Initialize message list if p_init_msg_list is set to TRUE.
72 IF FND_API.to_Boolean( p_init_msg_list )
73 THEN
74 FND_MSG_PUB.initialize;
75 END IF;
76
77 -- Debug Message
78 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
79 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - start');
80 end if;
81
82
83 -- Initialize API return status to SUCCESS
84 x_return_status := FND_API.G_RET_STS_SUCCESS;
85
86 -- Local variable initialization
87
88 IF p_attribute_code_rec.attr_code_id IS NULL
89 OR p_attribute_code_rec.attr_code_id = FND_API.g_miss_num THEN
90 LOOP
91 l_dummy := NULL;
92 OPEN c_id;
93 FETCH c_id INTO l_attr_code_id;
94 CLOSE c_id;
95
96 OPEN c_id_exists(l_attr_code_id);
97 FETCH c_id_exists INTO l_dummy;
98 CLOSE c_id_exists;
99 EXIT WHEN l_dummy IS NULL;
100 END LOOP;
101 ELSE
102 l_attr_code_id := p_attribute_code_rec.attr_code_id;
103 END IF;
104
105 -- =========================================================================
106 -- Validate Environment
107 -- =========================================================================
108
109 IF FND_GLOBAL.User_Id IS NULL
110 THEN
111 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
112 FND_MESSAGE.set_name('PV', 'PV_API_USER_PROFILE_MISSING');
113 FND_MSG_PUB.add;
114 end if;
115 RAISE FND_API.G_EXC_ERROR;
116 END IF;
117
118 IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
119 THEN
120 -- Debug message
121 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
122 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - Validate_Attribute_Code');
123 end if;
124
125 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : Before Validate_attribute_Code' );
126
127 -- Populate the default required items
128 l_attribute_code_rec.attr_code_id := l_attr_code_id;
129 l_attribute_code_rec.last_update_date := SYSDATE;
130 l_attribute_code_rec.last_updated_by := G_USER_ID;
131 l_attribute_code_rec.creation_date := SYSDATE;
132 l_attribute_code_rec.created_by := G_USER_ID;
133 l_attribute_code_rec.last_update_login := G_LOGIN_ID;
134 l_attribute_code_rec.object_version_number := l_object_version_number;
135
136 -- Invoke validation procedures
137 Validate_Attribute_Code(
138 p_api_version_number => 1.0
139 ,p_init_msg_list => FND_API.G_FALSE
140 ,p_validation_level => p_validation_level
141 ,p_validation_mode => JTF_PLSQL_API.g_create
142 ,p_attribute_code_rec => l_attribute_code_rec
143 ,x_return_status => x_return_status
144 ,x_msg_count => x_msg_count
145 ,x_msg_data => x_msg_data
146 );
147
148 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : After Validate_attribute_code' );
149 END IF;
150
151 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
152 RAISE FND_API.G_EXC_ERROR;
153 END IF;
154
155 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : After Validate' );
156 -- Debug Message
157 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
158 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - Calling create table handler');
159 end if;
160
161 -- Invoke table handler(PV_ATTRIBUTE_CODE_PKG.Insert_Row)
162 PV_ATTRIBUTE_CODE_PKG.Insert_Row(
163 px_attr_code_id => l_attribute_code_rec.attr_code_id,
164 p_attr_code => UPPER(l_attribute_code_rec.attr_code),
165 p_last_update_date => l_attribute_code_rec.last_update_date,
166 p_last_updated_by => l_attribute_code_rec.last_updated_by,
167 p_creation_date => l_attribute_code_rec.creation_date,
168 p_created_by => l_attribute_code_rec.created_by,
169 p_last_update_login => l_attribute_code_rec.last_update_login,
170 px_object_version_number => l_attribute_code_rec.object_version_number,
171 p_attribute_id => l_attribute_code_rec.attribute_id,
172 p_enabled_flag => l_attribute_code_rec.enabled_flag,
173 --p_security_group_id => p_attribute_code_rec.security_group_id
174 p_description => l_attribute_code_rec.description
175 );
176
177 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : After' );
178
179 x_ATTR_CODE_ID := l_attribute_code_rec.attr_code_id;
180
181 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
182 RAISE FND_API.G_EXC_ERROR;
183 END IF;
184 --
185 -- End of API body
186 --
187
188 -- Standard check for p_commit
189 IF FND_API.to_Boolean( p_commit )
190 THEN
191 COMMIT WORK;
192 END IF;
193
194
195 -- Debug Message
196 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
197 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - end');
198 end if;
199
200 -- Standard call to get message count and if count is 1, get message info.
201 FND_MSG_PUB.Count_And_Get
202 (p_count => x_msg_count,
203 p_data => x_msg_data
204 );
205 EXCEPTION
206 /*
207 WHEN PVX_Utility_PVT.resource_locked THEN
208 x_return_status := FND_API.g_ret_sts_error;
209 PVX_Utility_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
210 */
211 WHEN FND_API.G_EXC_ERROR THEN
212 ROLLBACK TO CREATE_Attribute_Code_PVT;
213 x_return_status := FND_API.G_RET_STS_ERROR;
214 -- Standard call to get message count and if count=1, get the message
215 FND_MSG_PUB.Count_And_Get (
216 p_encoded => FND_API.G_FALSE,
217 p_count => x_msg_count,
218 p_data => x_msg_data
219 );
220
221 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
222 ROLLBACK TO CREATE_Attribute_Code_PVT;
223 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
224 -- Standard call to get message count and if count=1, get the message
225 FND_MSG_PUB.Count_And_Get (
226 p_encoded => FND_API.G_FALSE,
227 p_count => x_msg_count,
228 p_data => x_msg_data
229 );
230
231 WHEN OTHERS THEN
232 ROLLBACK TO CREATE_Attribute_Code_PVT;
233 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
234 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
235 THEN
236 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
237 END IF;
238 -- Standard call to get message count and if count=1, get the message
239 FND_MSG_PUB.Count_And_Get (
240 p_encoded => FND_API.G_FALSE,
241 p_count => x_msg_count,
242 p_data => x_msg_data
243 );
244 End Create_Attribute_Code;
245
246
247 PROCEDURE Update_Attribute_Code(
248 p_api_version_number IN NUMBER
249 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
250 ,p_commit IN VARCHAR2 := FND_API.G_FALSE
251 ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
252
253 ,x_return_status OUT NOCOPY VARCHAR2
254 ,x_msg_count OUT NOCOPY NUMBER
255 ,x_msg_data OUT NOCOPY VARCHAR2
256
257 ,p_attribute_code_rec IN attribute_code_rec_type
258 ,x_object_version_number OUT NOCOPY NUMBER
259 )
260 IS
261
262 CURSOR c_get_attribute_code(cv_ATTR_CODE_ID NUMBER) IS
263 SELECT *
264 FROM PV_ATTRIBUTE_CODES_B
265 WHERE ATTR_CODE_ID = cv_ATTR_CODE_ID;
266
267 l_api_name CONSTANT VARCHAR2(30) := 'Update_Attribute_Code';
268 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
269 l_api_version_number CONSTANT NUMBER := 1.0;
270 -- Local Variables
271 l_object_version_number NUMBER;
272 l_ATTR_CODE_ID NUMBER;
273 l_ref_attribute_code_rec c_get_attribute_code%ROWTYPE ;
274 l_tar_attribute_code_rec PV_ATTRIBUTE_CODE_PVT.attribute_code_rec_type := p_attribute_code_rec;
275 --l_attribute_code_rec PV_ATTRIBUTE_CODE_PVT.attribute_code_rec_type := p_attribute_code_rec;
276 l_rowid ROWID;
277
278 l_being_used_list VARCHAR2(30000);
279 l_delete_flag VARCHAR2(1):='Y';
280
281 cursor lc_check_rules (pc_attr_code_id number) is
282 select distinct seleted.attribute_value,rules.process_rule_name
283 from pv_enty_select_criteria criteria,pv_selected_attr_values seleted,
284 pv_process_rules_vl rules,pv_attribute_codes_vl code
285 where code.attr_code_id= pc_attr_code_id and
286 criteria.attribute_id= code.attribute_id and
287 criteria.selection_criteria_id= seleted.selection_criteria_id and
288 criteria.process_rule_id= rules.process_rule_id and
289 seleted.attribute_value=code.attr_code;
290
291 cursor lc_check_programs (pc_attr_code_id number) is
292 select pp.program_id, pp.program_name, ppt.partner_type
293 from pv_partner_program_vl pp, pv_partner_program_type_b pt,
294 pv_program_partner_types ppt, pv_attribute_codes_vl code
295 where
296 pp.program_type_id = ppt.program_type_id
297 and pp.PROGRAM_STATUS_CODE NOT IN ('CANCEL', 'CLOSED','ARCHIVE')
298 and pp.program_type_id = pt.program_type_id
299 and pt.enabled_flag = 'Y'
300 and ppt.partner_type = code.attr_code
301 and code.attr_code_id= pc_attr_code_id
302 and code.attribute_id = 3;
303
304
305
306 cursor lc_check_attr_enty_vals (pc_attr_code_id number) is
307 select distinct entity
308 from pv_enty_attr_values entyval, pv_attribute_codes_vl code
309 where code.attr_code_id= pc_attr_code_id and
310 code.attribute_id = entyval.attribute_id and
311 code.attr_code=entyval.attr_value and
312 entyval.latest_flag = 'Y' ;
313
314
315
316 BEGIN
317 -- Standard Start of API savepoint
318 SAVEPOINT UPDATE_Attribute_Code_PVT;
319
320 -- Standard call to check for call compatibility.
321 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
322 p_api_version_number,
323 l_api_name,
324 G_PKG_NAME)
325 THEN
326 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
327 END IF;
328
329 -- Initialize message list if p_init_msg_list is set to TRUE.
330 IF FND_API.to_Boolean( p_init_msg_list )
331 THEN
332 FND_MSG_PUB.initialize;
333 END IF;
334
335 -- Debug Message
336 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
337 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - start');
338 end if;
339
340
341 -- Initialize API return status to SUCCESS
342 x_return_status := FND_API.G_RET_STS_SUCCESS;
343
344 -- Debug Message
345 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
346 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - Open Cursor to Select');
347 end if;
348
349
350 OPEN c_get_attribute_code( l_tar_attribute_code_rec.attr_code_id);
351
352 FETCH c_get_attribute_code INTO l_ref_attribute_code_rec ;
353
354 IF ( c_get_attribute_code%NOTFOUND) THEN
355 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
356 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_ENTITY');
357 FND_MESSAGE.set_token('MODE','Update');
358 FND_MESSAGE.set_token('ENTITY','Attribute_Code');
359 FND_MESSAGE.set_token('ID',TO_CHAR(l_tar_attribute_code_rec.attr_code_id));
360 FND_MSG_PUB.add;
361 end if;
362 RAISE FND_API.G_EXC_ERROR;
363 END IF;
364 -- Debug Message
365 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
366 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - Close Cursor');
367 end if;
368 CLOSE c_get_attribute_code;
369
370 if(l_ref_attribute_code_rec.enabled_flag = 'Y' and p_attribute_code_rec.enabled_flag= 'N') then
371
372 --check for seeded attribute code
373 /* if(p_attribute_code_rec.attr_code_id <10000) then
374 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
375 THEN
376 FND_MESSAGE.Set_Name('PV', 'PV_ATTRCODE_NOTDISABLED_SEEDED');
377 FND_MESSAGE.Set_Token('ATTRIBUTE_CODE',p_attribute_code_rec.attr_code );
378 FND_MSG_PUB.Add;
379 END IF;
380 RAISE FND_API.G_EXC_ERROR;
381 end if;
382 */
383
384 --check for rules reference
385 for x in lc_check_rules (pc_attr_code_id =>p_attribute_code_rec.attr_code_id)
386 loop
387 l_delete_flag := 'N' ;
388 l_being_used_list := l_being_used_list || ','|| x.process_rule_name ;
389 end loop;
390
391
392 if(l_delete_flag = 'N') then
393
394 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
395 THEN
396 FND_MESSAGE.Set_Name('PV', 'PV_ATTRCODE_NOTDISABLED_RULE');
397 FND_MESSAGE.Set_Token('ATTRIBUTE_CODE',p_attribute_code_rec.attr_code );
398 FND_MESSAGE.Set_Token('RULES_LIST',substr(l_being_used_list,2) );
399 FND_MSG_PUB.Add;
400 END IF;
401
402 RAISE FND_API.G_EXC_ERROR;
403
404 end if;
405
406 l_being_used_list := '';
407
408 --check for programs reference for atttibute is 3, which is partner types
409 -- for bug# 3477359
410
411 if(p_attribute_code_rec.attribute_id = 3) then
412 for x in lc_check_programs (pc_attr_code_id =>p_attribute_code_rec.attr_code_id)
413 loop
414 l_delete_flag := 'N' ;
415 l_being_used_list := l_being_used_list || ','|| x.program_name ;
416 end loop;
417
418
419 if(l_delete_flag = 'N') then
420
421 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
422 THEN
423 FND_MESSAGE.Set_Name('PV', 'PV_ATTRCODE_NOTDISABLED_PROGR');
424 FND_MESSAGE.Set_Token('ATTRIBUTE_CODE',p_attribute_code_rec.attr_code );
425 FND_MESSAGE.Set_Token('PROGRAMS_LIST',substr(l_being_used_list,2) );
426 FND_MSG_PUB.Add;
427 END IF;
428
429 RAISE FND_API.G_EXC_ERROR;
430
431 end if;
432 end if;
433
434
435 --check for entity value reference for seded attr codes for bug# 3203420
436 if (p_attribute_code_rec.attr_code_id < 10000) then
437
438 for x in lc_check_attr_enty_vals (pc_attr_code_id =>p_attribute_code_rec.attr_code_id)
439 loop
440 l_delete_flag := 'N';
441 l_being_used_list := l_being_used_list || ','|| x.entity ;
442 end loop;
443 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
444 FND_MESSAGE.set_name('PV', 'PV_DEBUG_MESSAGE');
445 FND_MESSAGE.set_token('TEXT', 'Entity List '|| l_being_used_list );
446 FND_MSG_PUB.add;
447 END IF;
448
449
450 if(l_delete_flag = 'N') then
451
452 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
453 THEN
454 FND_MESSAGE.Set_Name('PV', 'PV_ATTRCODE_NOTDISABLED_ENTITY');
455 FND_MESSAGE.Set_Token('ATTRIBUTE_CODE',p_attribute_code_rec.attr_code );
456 FND_MESSAGE.Set_Token('ENTITY_LIST',substr(l_being_used_list,2) );
457 FND_MSG_PUB.Add;
458 END IF;
459
460 RAISE FND_API.G_EXC_ERROR;
461
462 end if;
463
464 end if;
465
466 end if;
467 IF (l_tar_attribute_code_rec.object_version_number is NULL or
468 l_tar_attribute_code_rec.object_version_number = FND_API.G_MISS_NUM ) Then
469
470 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
471 FND_MESSAGE.set_name('PV', 'PV_API_VERSION_MISSING');
472 FND_MESSAGE.set_token('COLUMN',TO_CHAR(l_tar_attribute_code_rec.last_update_date));
473 FND_MSG_PUB.add;
474 end if;
475 RAISE FND_API.G_EXC_ERROR;
476 End if;
477
478 -- Check Whether record has been changed by someone else
479 If (l_tar_attribute_code_rec.object_version_number <> l_ref_attribute_code_rec.object_version_number) Then
480 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
481 FND_MESSAGE.set_name('PV', 'PV_API_RECORD_CHANGED');
482 FND_MESSAGE.set_token('VALUE','Attribute_Code');
483 FND_MSG_PUB.add;
484 end if;
485 RAISE FND_API.G_EXC_ERROR;
486 End if;
487 IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
488 THEN
489 -- Debug message
490 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
491 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - Validate_Attribute_Code');
492 end if;
493
494 -- Invoke validation procedures
495 Validate_Attribute_Code(
496 p_api_version_number => 1.0
497 ,p_init_msg_list => FND_API.G_FALSE
498 ,p_validation_level => p_validation_level
499 ,p_validation_mode => JTF_PLSQL_API.g_update
500 ,p_attribute_code_rec => p_attribute_code_rec
501 ,x_return_status => x_return_status
502 ,x_msg_count => x_msg_count
503 ,x_msg_data => x_msg_data
504 );
505
506 END IF;
507
508 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
509 RAISE FND_API.G_EXC_ERROR;
510 END IF;
511
512
513 -- Debug Message
514 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
515 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - Calling update table handler');
516 end if;
517
518 -- Invoke table handler(PV_ATTRIBUTE_CODE_PKG.Update_Row)
519 PV_ATTRIBUTE_CODE_PKG.Update_Row(
520 p_attr_code_id => p_attribute_code_rec.attr_code_id,
521 p_attr_code => p_attribute_code_rec.attr_code,
522 p_last_update_date => SYSDATE,
523 p_last_updated_by => G_USER_ID,
524 --p_creation_date => SYSDATE,
525 --p_created_by => G_USER_ID,
526 p_last_update_login => G_LOGIN_ID,
527 p_object_version_number => p_attribute_code_rec.object_version_number,
528 p_attribute_id => p_attribute_code_rec.attribute_id,
529 p_enabled_flag => p_attribute_code_rec.enabled_flag,
530 --p_security_group_id => p_attribute_code_rec.security_group_id
531 p_description => p_attribute_code_rec.description
532 );
533
534
535 x_object_version_number := p_attribute_code_rec.object_version_number + 1;
536 --
537 -- End of API body.
538 --
539
540 -- Standard check for p_commit
541 IF FND_API.to_Boolean( p_commit )
542 THEN
543 COMMIT WORK;
544 END IF;
545
546
547 -- Debug Message
548 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
549 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - end');
550 end if;
551
552 -- Standard call to get message count and if count is 1, get message info.
553 FND_MSG_PUB.Count_And_Get
554 (p_count => x_msg_count,
555 p_data => x_msg_data
556 );
557 EXCEPTION
558 /*
559 WHEN PVX_Utility_PVT.resource_locked THEN
560 x_return_status := FND_API.g_ret_sts_error;
561 PVX_Utility_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
562 */
563 WHEN FND_API.G_EXC_ERROR THEN
564 ROLLBACK TO UPDATE_Attribute_Code_PVT;
565 x_return_status := FND_API.G_RET_STS_ERROR;
566 -- Standard call to get message count and if count=1, get the message
567 FND_MSG_PUB.Count_And_Get (
568 p_encoded => FND_API.G_FALSE,
569 p_count => x_msg_count,
570 p_data => x_msg_data
571 );
572
573 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
574 ROLLBACK TO UPDATE_Attribute_Code_PVT;
575 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
576 -- Standard call to get message count and if count=1, get the message
577 FND_MSG_PUB.Count_And_Get (
578 p_encoded => FND_API.G_FALSE,
579 p_count => x_msg_count,
580 p_data => x_msg_data
581 );
582
583 WHEN OTHERS THEN
584 ROLLBACK TO UPDATE_Attribute_Code_PVT;
585 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
586 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
587 THEN
588 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
589 END IF;
590 -- Standard call to get message count and if count=1, get the message
591 FND_MSG_PUB.Count_And_Get (
592 p_encoded => FND_API.G_FALSE,
593 p_count => x_msg_count,
594 p_data => x_msg_data
595 );
596 End Update_Attribute_Code;
597
598
599 PROCEDURE Delete_Attribute_Code(
600 p_api_version_number IN NUMBER
601 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
602 ,p_commit IN VARCHAR2 := FND_API.G_FALSE
603 ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
604
605 ,x_return_status OUT NOCOPY VARCHAR2
606 ,x_msg_count OUT NOCOPY NUMBER
607 ,x_msg_data OUT NOCOPY VARCHAR2
608
609 ,p_attr_code_id IN NUMBER
610 ,p_object_version_number IN NUMBER
611 )
612
613 IS
614 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Attribute_Code';
615 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
616 l_api_version_number CONSTANT NUMBER := 1.0;
617 l_object_version_number NUMBER;
618 l_attribute_id NUMBER;
619 l_attribute_name VARCHAR2(60);
620 l_delete_flag VARCHAR2(1):='Y';
621 l_being_used_list VARCHAR2(30000);
622 l_attr_code VARCHAR2(30);
623 l_meaning VARCHAR2(80);
624 cursor lc_get_attr_code_details (pc_attr_code_id number) is
625 select code.attr_code
626 from pv_attribute_codes_vl code
627 where code.attr_code_id= pc_attr_code_id ;
628
629 cursor lc_get_attr_details (pc_attr_code_id number) is
630 select attr.attribute_id,attr.name
631 from pv_attributes_vl attr,pv_attribute_codes_vl code
632 where code.attr_code_id= pc_attr_code_id and code.attribute_id = attr.attribute_id;
633
634 cursor lc_check_attr_enty_vals (pc_attr_code_id number) is
635 select distinct entity
636 from pv_enty_attr_values entyval, pv_attribute_codes_vl code
637 where code.attr_code_id= pc_attr_code_id and
638 code.attribute_id = entyval.attribute_id and
639 code.attr_code=entyval.attr_value;
640
641
642 cursor lc_check_rules (pc_attr_code_id number) is
643 select distinct seleted.attribute_value,rules.process_rule_name
644 from pv_enty_select_criteria criteria,pv_selected_attr_values seleted,
645 pv_process_rules_vl rules,pv_attribute_codes_vl code
646 where code.attr_code_id= pc_attr_code_id and
647 criteria.attribute_id= code.attribute_id and
648 criteria.selection_criteria_id= seleted.selection_criteria_id and
649 criteria.process_rule_id= rules.process_rule_id and
650 seleted.attribute_value=code.attr_code;
651
652 cursor lc_attribute_usages (pc_attr_code_id number) is
653 select distinct usage.attribute_usage_code
654 from pv_attribute_usages usage, pv_attribute_codes_vl code
655 where code.attr_code_id=pc_attr_code_id and
656 code.attr_code=usage.attribute_usage_code;
657
658 BEGIN
659 -- Standard Start of API savepoint
660 SAVEPOINT DELETE_Attribute_Code_PVT;
661
662 -- Standard call to check for call compatibility.
663 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
664 p_api_version_number,
665 l_api_name,
666 G_PKG_NAME)
667 THEN
668 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
669 END IF;
670
671 -- Initialize message list if p_init_msg_list is set to TRUE.
672 IF FND_API.to_Boolean( p_init_msg_list )
673 THEN
674 FND_MSG_PUB.initialize;
675 END IF;
676
677 -- Debug Message
678 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
679 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - start');
680 end if;
681
682
683 -- Initialize API return status to SUCCESS
684 x_return_status := FND_API.G_RET_STS_SUCCESS;
685
686 --
687 -- Api body
688 --
689
690
691 --getting attr code details
692 for x in lc_get_attr_code_details (pc_attr_code_id =>p_attr_code_id)
693 loop
694 l_attr_code := x.attr_code;
695
696 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
697 FND_MESSAGE.set_name('PV', 'PV_DEBUG_MESSAGE');
698 FND_MESSAGE.set_token('TEXT', 'Attr Code:-- '|| l_attr_code);
699 FND_MSG_PUB.add;
700 END IF;
701 end loop;
702
703
704 --getting attr details
705 for x in lc_get_attr_details (pc_attr_code_id =>p_attr_code_id)
706 loop
707 l_attribute_id := x.attribute_id;
708
709 l_attribute_name := x.name;
710
711 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
712 FND_MESSAGE.set_name('PV', 'PV_DEBUG_MESSAGE');
713 FND_MESSAGE.set_token('TEXT', 'Attr:-- '|| l_attribute_id );
714 FND_MSG_PUB.add;
715 END IF;
716 end loop;
717
718 --check for seeded attribute code
719 if(p_attr_code_id <10000) then
720 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
721 THEN
722 FND_MESSAGE.Set_Name('PV', 'PV_ATTRCODE_NOTDELETE_SEEDED');
723 FND_MESSAGE.Set_Token('ATTRIBUTE_CODE',l_attr_code );
724 FND_MSG_PUB.Add;
725 END IF;
726 RAISE FND_API.G_EXC_ERROR;
727 end if;
728
729 --check attribute usage code if VAD_OF or RESELLERS if attribute_id=3 Partner Types attribute
730 --check attribute usages if attribute_id=3 Partner Types attribute
731
732 if(l_attribute_id = 3) then
733
734 if(l_attr_code = 'VAD' or l_attr_code = 'RESELLER') then
735 l_delete_flag := 'N';
736 end if;
737
738 if(l_delete_flag = 'N') then
739
740 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
741 THEN
742 FND_MESSAGE.Set_Name('PV', 'PV_ATTRCODE_VADOF_RESELLERS');
743 FND_MESSAGE.Set_Token('NAME',l_attribute_name );
744 FND_MSG_PUB.Add;
745 END IF;
746
747 RAISE FND_API.G_EXC_ERROR;
748
749 end if;
750
751 for x in lc_attribute_usages (pc_attr_code_id =>p_attr_code_id)
752 loop
753 l_delete_flag := 'N';
754
755 end loop;
756
757
758 if(l_delete_flag = 'N') then
759
760 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
761 THEN
762 FND_MESSAGE.Set_Name('PV', 'PV_ATTRCODE_REFERENCED_USAGE');
763 FND_MESSAGE.Set_Token('ATTRIBUTE_CODE',l_attr_code );
764 FND_MSG_PUB.Add;
765 END IF;
766
767 RAISE FND_API.G_EXC_ERROR;
768
769 end if;
770 end if; -- end if(l_attribute_id=3)
771
772
773 --check for entity value reference
774
775 for x in lc_check_attr_enty_vals (pc_attr_code_id =>p_attr_code_id)
776 loop
777 l_delete_flag := 'N';
778 FOR y IN (select meaning from pv_lookups
779 where lookup_type = 'PV_VALID_ENTY_VALUE_TYPES'
780 and lookup_code = x.entity
781 ) LOOP
782 l_meaning := y.meaning;
783 END LOOP;
784
785
786 l_being_used_list := l_being_used_list || ','|| l_meaning ;
787 l_meaning:='';
788 end loop;
789
790 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
791 FND_MESSAGE.set_name('PV', 'PV_DEBUG_MESSAGE');
792 FND_MESSAGE.set_token('TEXT', 'Entity List '|| l_being_used_list );
793 FND_MSG_PUB.add;
794 END IF;
795
796
797 if(l_delete_flag = 'N') then
798
799 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
800 THEN
801 FND_MESSAGE.Set_Name('PV', 'PV_ATTRCODE_REFERENCED_ENTITY');
802 FND_MESSAGE.Set_Token('ATTRIBUTE_CODE',l_attr_code );
803 FND_MESSAGE.Set_Token('ENTITY_LIST',substr(l_being_used_list,2) );
804 FND_MSG_PUB.Add;
805 END IF;
806
807 RAISE FND_API.G_EXC_ERROR;
808
809 end if;
810
811 --check for rules reference
812 for x in lc_check_rules (pc_attr_code_id =>p_attr_code_id)
813 loop
814 l_delete_flag := 'N' ;
815 l_being_used_list := l_being_used_list || ','|| x.process_rule_name ;
816 end loop;
817
818
819 if(l_delete_flag = 'N') then
820
821 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
822 THEN
823 FND_MESSAGE.Set_Name('PV', 'PV_ATTR_REFERENCED_RULE');
824 FND_MESSAGE.Set_Token('ATTRIBUTE_CODE',l_attr_code );
825 FND_MESSAGE.Set_Token('RULES_LIST',substr(l_being_used_list,2) );
826 FND_MSG_PUB.Add;
827 END IF;
828
829 RAISE FND_API.G_EXC_ERROR;
830
831 end if;
832
833 -- Debug Message
834 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
835 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - Calling delete table handler');
836 END IF;
837
838
839 -- Invoke table handler(PV_ATTRIBUTE_CODE_PKG.Delete_Row)
840 PV_ATTRIBUTE_CODE_PKG.Delete_Row(
841 p_ATTR_CODE_ID => p_ATTR_CODE_ID);
842
843
844
845
846 --
847 -- End of API body
848 --
849
850 -- Standard check for p_commit
851 IF FND_API.to_Boolean( p_commit )
852 THEN
853 COMMIT WORK;
854 END IF;
855
856
857 -- Debug Message
858 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
859 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - end');
860 END IF;
861
862 -- Standard call to get message count and if count is 1, get message info.
863 FND_MSG_PUB.Count_And_Get
864 (p_count => x_msg_count,
865 p_data => x_msg_data
866 );
867 EXCEPTION
868 /*
869 WHEN PVX_Utility_PVT.resource_locked THEN
870 x_return_status := FND_API.g_ret_sts_error;
871 PVX_Utility_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
872 */
873 WHEN FND_API.G_EXC_ERROR THEN
874 ROLLBACK TO DELETE_Attribute_Code_PVT;
875 x_return_status := FND_API.G_RET_STS_ERROR;
876 -- Standard call to get message count and if count=1, get the message
877 FND_MSG_PUB.Count_And_Get (
878 p_encoded => FND_API.G_FALSE,
879 p_count => x_msg_count,
880 p_data => x_msg_data
881 );
882
883 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
884 ROLLBACK TO DELETE_Attribute_Code_PVT;
885 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
886 -- Standard call to get message count and if count=1, get the message
887 FND_MSG_PUB.Count_And_Get (
888 p_encoded => FND_API.G_FALSE,
889 p_count => x_msg_count,
890 p_data => x_msg_data
891 );
892
893 WHEN OTHERS THEN
894 ROLLBACK TO DELETE_Attribute_Code_PVT;
895 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
896 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
897 THEN
898 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
899 END IF;
900 -- Standard call to get message count and if count=1, get the message
901 FND_MSG_PUB.Count_And_Get (
902 p_encoded => FND_API.G_FALSE,
903 p_count => x_msg_count,
904 p_data => x_msg_data
905 );
906 End Delete_Attribute_Code;
907
908
909
910 -- Hint: Primary key needs to be returned.
911 PROCEDURE Lock_Attribute_Code(
912 p_api_version_number IN NUMBER
913 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
914
915 ,x_return_status OUT NOCOPY VARCHAR2
916 ,x_msg_count OUT NOCOPY NUMBER
917 ,x_msg_data OUT NOCOPY VARCHAR2
918
919 ,p_ATTR_CODE_ID IN NUMBER
920 ,p_object_version IN NUMBER
921 )
922
923 IS
924 l_api_name CONSTANT VARCHAR2(30) := 'Lock_Attribute_Code';
925 l_api_version_number CONSTANT NUMBER := 1.0;
926 L_FULL_NAME CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
927 l_ATTR_CODE_ID NUMBER;
928
929 CURSOR c_Attribute_Code IS
930 SELECT ATTR_CODE_ID
931 FROM PV_ATTRIBUTE_CODES_B
932 WHERE ATTR_CODE_ID = p_ATTR_CODE_ID
933 AND object_version_number = p_object_version
934 FOR UPDATE NOWAIT;
935
936 BEGIN
937 -- Standard Start of API savepoint
938 SAVEPOINT LOCK_Attribute_Code_PVT;
939
940 -- Debug Message
941 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
942 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - start');
943 END IF;
944
945 -- Initialize message list if p_init_msg_list is set to TRUE.
946 IF FND_API.to_Boolean( p_init_msg_list )
947 THEN
948 FND_MSG_PUB.initialize;
949 END IF;
950
951 -- Standard call to check for call compatibility.
952 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
953 p_api_version_number,
954 l_api_name,
955 G_PKG_NAME)
956 THEN
957 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
958 END IF;
959
960
961 -- Initialize API return status to SUCCESS
962 x_return_status := FND_API.G_RET_STS_SUCCESS;
963
964
965 ------------------------ lock -------------------------
966
967 PVX_Utility_PVT.debug_message(l_full_name||': start');
968 OPEN c_Attribute_Code;
969
970 FETCH c_Attribute_Code INTO l_ATTR_CODE_ID;
971
972 IF (c_Attribute_Code%NOTFOUND) THEN
973 CLOSE c_Attribute_Code;
974 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
975 FND_MESSAGE.set_name('PV', 'PV_API_RECORD_NOT_FOUND');
976 FND_MSG_PUB.add;
977 END IF;
978 RAISE FND_API.g_exc_error;
979 END IF;
980
981 CLOSE c_Attribute_Code;
982
983 -------------------- finish --------------------------
984 FND_MSG_PUB.count_and_get(
985 p_encoded => FND_API.g_false,
986 p_count => x_msg_count,
987 p_data => x_msg_data);
988 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
989 PVX_Utility_PVT.debug_message(l_full_name ||': end');
990 END IF;
991 EXCEPTION
992 /*
993 WHEN PVX_Utility_PVT.resource_locked THEN
994 x_return_status := FND_API.g_ret_sts_error;
995 PVX_Utility_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
996 */
997 WHEN FND_API.G_EXC_ERROR THEN
998 ROLLBACK TO LOCK_Attribute_Code_PVT;
999 x_return_status := FND_API.G_RET_STS_ERROR;
1000 -- Standard call to get message count and if count=1, get the message
1001 FND_MSG_PUB.Count_And_Get (
1002 p_encoded => FND_API.G_FALSE,
1003 p_count => x_msg_count,
1004 p_data => x_msg_data
1005 );
1006
1007 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1008 ROLLBACK TO LOCK_Attribute_Code_PVT;
1009 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1010 -- Standard call to get message count and if count=1, get the message
1011 FND_MSG_PUB.Count_And_Get (
1012 p_encoded => FND_API.G_FALSE,
1013 p_count => x_msg_count,
1014 p_data => x_msg_data
1015 );
1016
1017 WHEN OTHERS THEN
1018 ROLLBACK TO LOCK_Attribute_Code_PVT;
1019 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1020 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1021 THEN
1022 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1023 END IF;
1024 -- Standard call to get message count and if count=1, get the message
1025 FND_MSG_PUB.Count_And_Get (
1026 p_encoded => FND_API.G_FALSE,
1027 p_count => x_msg_count,
1028 p_data => x_msg_data
1029 );
1030 End Lock_Attribute_Code;
1031
1032
1033 PROCEDURE check_uk_items(
1034 p_attribute_code_rec IN attribute_code_rec_type
1035 ,p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create
1036 ,x_return_status OUT NOCOPY VARCHAR2)
1037 IS
1038 l_valid_flag VARCHAR2(1);
1039
1040 cursor lc_get_attr_code (pc_attribute_id number) is
1041 select attr_code from pv_attribute_codes_b
1042 where attribute_id = pc_attribute_id;
1043
1044
1045
1046 BEGIN
1047 x_return_status := FND_API.g_ret_sts_success;
1048 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1049 l_valid_flag := PVX_Utility_PVT.check_uniqueness(
1050 'PV_ATTRIBUTE_CODES_B',
1051 'ATTR_CODE_ID = ''' || p_attribute_code_rec.ATTR_CODE_ID ||''''
1052 );
1053 ELSE
1054 l_valid_flag := PVX_Utility_PVT.check_uniqueness(
1055 'PV_ATTRIBUTE_CODES_B',
1056 'ATTR_CODE_ID = ''' || p_attribute_code_rec.ATTR_CODE_ID ||
1057 ''' AND ATTR_CODE_ID <> ' || p_attribute_code_rec.ATTR_CODE_ID
1058 );
1059 END IF;
1060
1061
1062 IF l_valid_flag = FND_API.g_false THEN
1063 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1064 FND_MESSAGE.set_name('PV', 'PV_API_DUPLICATE_ENTITY');
1065 FND_MESSAGE.set_token('ID',to_char(p_attribute_code_rec.ATTR_CODE_ID) );
1066 FND_MESSAGE.set_token('ENTITY','Attribute_Code');
1067 FND_MSG_PUB.add;
1068 END IF;
1069 x_return_status := FND_API.g_ret_sts_error;
1070 RETURN;
1071 END IF;
1072
1073 --check for uniqueness of attribute_code
1074 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1075 for x in lc_get_attr_code (pc_attribute_id =>p_attribute_code_rec.attribute_id)
1076 loop
1077 if (UPPER(p_attribute_code_rec.attr_code)=UPPER(x.attr_code)) then
1078 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1079
1080 FND_MESSAGE.set_name('PV', 'PV_DUPLICATE_RECORD');
1081 --FND_MESSAGE.set_name('PV', 'PV_API_DUPLICATE_ENTITY');
1082 --FND_MESSAGE.set_token('ID',to_char(p_attribute_code_rec.ATTR_CODE_ID) || ':::' || p_attribute_code_rec.ATTR_CODE);
1083 --FND_MESSAGE.set_token('ENTITY','Attribute_Code');
1084 FND_MSG_PUB.add;
1085 END IF;
1086 --x_return_status := FND_API.g_ret_sts_error;
1087 RAISE FND_API.G_EXC_ERROR;
1088 end if;
1089
1090 end loop;
1091 END IF;
1092
1093 END check_uk_items;
1094
1095 PROCEDURE check_req_items(
1096 p_attribute_code_rec IN attribute_code_rec_type
1097 ,p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create
1098 ,x_return_status OUT NOCOPY VARCHAR2
1099 )
1100 IS
1101 BEGIN
1102 x_return_status := FND_API.g_ret_sts_success;
1103
1104 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1105
1106 IF p_attribute_code_rec.attr_code_id = FND_API.G_MISS_NUM
1107 OR p_attribute_code_rec.attr_code_id IS NULL THEN
1108 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1109 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1110 FND_MESSAGE.set_token('COLUMN','attr_code_id');
1111 FND_MSG_PUB.add;
1112 END IF;
1113 x_return_status := FND_API.g_ret_sts_error;
1114 RETURN;
1115 END IF;
1116
1117 IF p_attribute_code_rec.attr_code = FND_API.G_MISS_CHAR
1118 OR p_attribute_code_rec.attr_code IS NULL THEN
1119 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1120 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1121 FND_MESSAGE.set_token('COLUMN','attr_code');
1122 FND_MSG_PUB.add;
1123 END IF;
1124 x_return_status := FND_API.g_ret_sts_error;
1125 RETURN;
1126 END IF;
1127
1128 IF p_attribute_code_rec.last_update_date = FND_API.G_MISS_DATE
1129 OR p_attribute_code_rec.last_update_date IS NULL THEN
1130 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1131 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1132 FND_MESSAGE.set_token('COLUMN','last_update_date');
1133 FND_MSG_PUB.add;
1134 END IF;
1135 x_return_status := FND_API.g_ret_sts_error;
1136 RETURN;
1137 END IF;
1138
1139 IF p_attribute_code_rec.last_updated_by = FND_API.G_MISS_NUM
1140 OR p_attribute_code_rec.last_updated_by IS NULL THEN
1141 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1142 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1143 FND_MESSAGE.set_token('COLUMN','last_updated_by');
1144 FND_MSG_PUB.add;
1145 END IF;
1146 x_return_status := FND_API.g_ret_sts_error;
1147 RETURN;
1148 END IF;
1149
1150 IF p_attribute_code_rec.creation_date = FND_API.G_MISS_DATE
1151 OR p_attribute_code_rec.creation_date IS NULL THEN
1152 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1153 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1154 FND_MESSAGE.set_token('COLUMN','creation_date');
1155 FND_MSG_PUB.add;
1156 END IF;
1157 x_return_status := FND_API.g_ret_sts_error;
1158 RETURN;
1159 END IF;
1160
1161 IF p_attribute_code_rec.created_by = FND_API.G_MISS_NUM
1162 OR p_attribute_code_rec.created_by IS NULL THEN
1163 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1164 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1165 FND_MESSAGE.set_token('COLUMN','created_by');
1166 FND_MSG_PUB.add;
1167 END IF;
1168 x_return_status := FND_API.g_ret_sts_error;
1169 RETURN;
1170 END IF;
1171
1172 IF p_attribute_code_rec.last_update_login = FND_API.G_MISS_NUM
1173 OR p_attribute_code_rec.last_update_login IS NULL THEN
1174 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1175 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1176 FND_MESSAGE.set_token('COLUMN','last_update_login');
1177 FND_MSG_PUB.add;
1178 END IF;
1179 x_return_status := FND_API.g_ret_sts_error;
1180 RETURN;
1181 END IF;
1182
1183 IF p_attribute_code_rec.object_version_number = FND_API.G_MISS_NUM
1184 OR p_attribute_code_rec.object_version_number IS NULL THEN
1185 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1186 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1187 FND_MESSAGE.set_token('COLUMN','object_version_number');
1188 FND_MSG_PUB.add;
1189 END IF;
1190 x_return_status := FND_API.g_ret_sts_error;
1191 RETURN;
1192 END IF;
1193
1194 IF p_attribute_code_rec.attribute_id = FND_API.G_MISS_NUM
1195 OR p_attribute_code_rec.attribute_id IS NULL THEN
1196 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1197 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1198 FND_MESSAGE.set_token('COLUMN','attribute_id');
1199 FND_MSG_PUB.add;
1200 END IF;
1201 x_return_status := FND_API.g_ret_sts_error;
1202 RETURN;
1203 END IF;
1204
1205 IF p_attribute_code_rec.enabled_flag = FND_API.G_MISS_CHAR
1206 OR p_attribute_code_rec.enabled_flag IS NULL THEN
1207 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1208 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1209 FND_MESSAGE.set_token('COLUMN','enabled_flag');
1210 FND_MSG_PUB.add;
1211 END IF;
1212 x_return_status := FND_API.g_ret_sts_error;
1213 RETURN;
1214 END IF;
1215
1216
1217 IF p_attribute_code_rec.description = FND_API.G_MISS_CHAR
1218 OR p_attribute_code_rec.description IS NULL THEN
1219 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1220 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1221 FND_MESSAGE.set_token('COLUMN','description');
1222 FND_MSG_PUB.add;
1223 END IF;
1224 x_return_status := FND_API.g_ret_sts_error;
1225 RETURN;
1226 END IF;
1227
1228 ELSE
1229
1230 IF p_attribute_code_rec.attr_code_id IS NULL THEN
1231 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1232 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1233 FND_MESSAGE.set_token('COLUMN','attr_code_id');
1234 FND_MSG_PUB.add;
1235 END IF;
1236 x_return_status := FND_API.g_ret_sts_error;
1237 RETURN;
1238 END IF;
1239
1240 IF p_attribute_code_rec.attr_code IS NULL THEN
1241 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1242 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1243 FND_MESSAGE.set_token('COLUMN','attr_code');
1244 FND_MSG_PUB.add;
1245 END IF;
1246 x_return_status := FND_API.g_ret_sts_error;
1247 RETURN;
1248 END IF;
1249
1250 IF p_attribute_code_rec.last_update_date IS NULL THEN
1251 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1252 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1253 FND_MESSAGE.set_token('COLUMN','last_update_date');
1254 FND_MSG_PUB.add;
1255 END IF;
1256 x_return_status := FND_API.g_ret_sts_error;
1257 RETURN;
1258 END IF;
1259
1260 IF p_attribute_code_rec.last_updated_by IS NULL THEN
1261 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1262 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1263 FND_MESSAGE.set_token('COLUMN','last_updated_by');
1264 FND_MSG_PUB.add;
1265 END IF;
1266 x_return_status := FND_API.g_ret_sts_error;
1267 RETURN;
1268 END IF;
1269
1270 IF p_attribute_code_rec.creation_date IS NULL THEN
1271 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1272 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1273 FND_MESSAGE.set_token('COLUMN','creation_date');
1274 FND_MSG_PUB.add;
1275 END IF;
1276 x_return_status := FND_API.g_ret_sts_error;
1277 RETURN;
1278 END IF;
1279
1280 IF p_attribute_code_rec.created_by IS NULL THEN
1281 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1282 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1283 FND_MESSAGE.set_token('COLUMN','created_by');
1284 FND_MSG_PUB.add;
1285 END IF;
1286 x_return_status := FND_API.g_ret_sts_error;
1287 RETURN;
1288 END IF;
1289
1290 IF p_attribute_code_rec.last_update_login IS NULL THEN
1291 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1292 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1293 FND_MESSAGE.set_token('COLUMN','last_update_login');
1294 FND_MSG_PUB.add;
1295 END IF;
1296 x_return_status := FND_API.g_ret_sts_error;
1297 RETURN;
1298 END IF;
1299
1300 IF p_attribute_code_rec.object_version_number IS NULL THEN
1301 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1302 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1303 FND_MESSAGE.set_token('COLUMN','object_version_number');
1304 FND_MSG_PUB.add;
1305 END IF;
1306 x_return_status := FND_API.g_ret_sts_error;
1307 RETURN;
1308 END IF;
1309
1310 IF p_attribute_code_rec.attribute_id IS NULL THEN
1311 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1312 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1313 FND_MESSAGE.set_token('COLUMN','attribute_id');
1314 FND_MSG_PUB.add;
1315 END IF;
1316 x_return_status := FND_API.g_ret_sts_error;
1317 RETURN;
1318 END IF;
1319
1320 IF p_attribute_code_rec.enabled_flag IS NULL THEN
1321 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1322 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1323 FND_MESSAGE.set_token('COLUMN','enabled_flag');
1324 FND_MSG_PUB.add;
1325 END IF;
1326 x_return_status := FND_API.g_ret_sts_error;
1327 RETURN;
1328 END IF;
1329
1330
1331
1332 IF p_attribute_code_rec.description IS NULL THEN
1333 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
1334 FND_MESSAGE.set_name('PV', 'PV_API_MISSING_REQ_COLUMN');
1335 FND_MESSAGE.set_token('COLUMN','description');
1336 FND_MSG_PUB.add;
1337 END IF;
1338 x_return_status := FND_API.g_ret_sts_error;
1339 RETURN;
1340 END IF;
1341
1342 END IF;
1343
1344 END check_req_items;
1345
1346 PROCEDURE check_FK_items(
1347 p_attribute_code_rec IN attribute_code_rec_type,
1348 x_return_status OUT NOCOPY VARCHAR2
1349 )
1350 IS
1351 BEGIN
1352 x_return_status := FND_API.g_ret_sts_success;
1353
1354 -- Enter custom code here
1355
1356 END check_FK_items;
1357
1358 PROCEDURE check_Lookup_items(
1359 p_attribute_code_rec IN attribute_code_rec_type,
1360 x_return_status OUT NOCOPY VARCHAR2
1361 )
1362 IS
1363 BEGIN
1364 x_return_status := FND_API.g_ret_sts_success;
1365
1366 -- Enter custom code here
1367
1368 END check_Lookup_items;
1369
1370 PROCEDURE Check_Attr_Code_Items (
1371 p_attribute_code_rec IN attribute_code_rec_type
1372 ,p_validation_mode IN VARCHAR2
1373 ,x_return_status OUT NOCOPY VARCHAR2
1374 )
1375 IS
1376 l_api_name CONSTANT VARCHAR2(30) := 'Check_Attr_Code_Items';
1377 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
1378
1379 BEGIN
1380
1381 -- Check Items Uniqueness API calls
1382 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : Before check_uk_items' );
1383 check_uk_items(
1384 p_attribute_code_rec => p_attribute_code_rec
1385 ,p_validation_mode => p_validation_mode
1386 ,x_return_status => x_return_status
1387 );
1388 IF x_return_status <> FND_API.g_ret_sts_success THEN
1389 RETURN;
1390 END IF;
1391
1392 -- Check Items Required/NOT NULL API calls
1393 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : Before check_req_items' );
1394 check_req_items(
1395 p_attribute_code_rec => p_attribute_code_rec
1396 ,p_validation_mode => p_validation_mode
1397 ,x_return_status => x_return_status
1398 );
1399 IF x_return_status <> FND_API.g_ret_sts_success THEN
1400 RETURN;
1401 END IF;
1402 -- Check Items Foreign Keys API calls
1403 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : Before check_FK_items' );
1404 check_FK_items(
1405 p_attribute_code_rec => p_attribute_code_rec
1406 ,x_return_status => x_return_status
1407 );
1408 IF x_return_status <> FND_API.g_ret_sts_success THEN
1409 RETURN;
1410 END IF;
1411 -- Check Items Lookups
1412 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : Before check_Lookup_items' );
1413 check_Lookup_items(
1414 p_attribute_code_rec => p_attribute_code_rec
1415 ,x_return_status => x_return_status
1416 );
1417 IF x_return_status <> FND_API.g_ret_sts_success THEN
1418 RETURN;
1419 END IF;
1420
1421 END Check_Attr_Code_Items;
1422
1423 PROCEDURE Complete_attribute_code_Rec (
1424 p_attribute_code_rec IN attribute_code_rec_type,
1425 x_complete_rec OUT NOCOPY attribute_code_rec_type)
1426 IS
1427 l_return_status VARCHAR2(1);
1428
1429 CURSOR c_complete IS
1430 SELECT *
1431 FROM pv_attribute_codes_b
1432 WHERE attr_code_id = p_attribute_code_rec.attr_code_id;
1433 l_attribute_code_rec c_complete%ROWTYPE;
1434 BEGIN
1435 x_complete_rec := p_attribute_code_rec;
1436
1437
1438 OPEN c_complete;
1439 FETCH c_complete INTO l_attribute_code_rec;
1440 CLOSE c_complete;
1441
1442 -- attr_code_id
1443 IF p_attribute_code_rec.attr_code_id = FND_API.g_miss_num THEN
1444 x_complete_rec.attr_code_id := l_attribute_code_rec.attr_code_id;
1445 END IF;
1446
1447 -- attr_code
1448 IF p_attribute_code_rec.attr_code = FND_API.g_miss_char THEN
1449 x_complete_rec.attr_code := l_attribute_code_rec.attr_code;
1450 END IF;
1451
1452 -- last_update_date
1453 IF p_attribute_code_rec.last_update_date = FND_API.g_miss_date THEN
1454 x_complete_rec.last_update_date := l_attribute_code_rec.last_update_date;
1455 END IF;
1456
1457 -- last_updated_by
1458 IF p_attribute_code_rec.last_updated_by = FND_API.g_miss_num THEN
1459 x_complete_rec.last_updated_by := l_attribute_code_rec.last_updated_by;
1460 END IF;
1461
1462 -- creation_date
1463 IF p_attribute_code_rec.creation_date = FND_API.g_miss_date THEN
1464 x_complete_rec.creation_date := l_attribute_code_rec.creation_date;
1465 END IF;
1466
1467 -- created_by
1468 IF p_attribute_code_rec.created_by = FND_API.g_miss_num THEN
1469 x_complete_rec.created_by := l_attribute_code_rec.created_by;
1470 END IF;
1471
1472 -- last_update_login
1473 IF p_attribute_code_rec.last_update_login = FND_API.g_miss_num THEN
1474 x_complete_rec.last_update_login := l_attribute_code_rec.last_update_login;
1475 END IF;
1476
1477 -- object_version_number
1478 IF p_attribute_code_rec.object_version_number = FND_API.g_miss_num THEN
1479 x_complete_rec.object_version_number := l_attribute_code_rec.object_version_number;
1480 END IF;
1481
1482 -- attribute_id
1483 IF p_attribute_code_rec.attribute_id = FND_API.g_miss_num THEN
1484 x_complete_rec.attribute_id := l_attribute_code_rec.attribute_id;
1485 END IF;
1486
1487 -- enabled_flag
1488 IF p_attribute_code_rec.enabled_flag = FND_API.g_miss_char THEN
1489 x_complete_rec.enabled_flag := l_attribute_code_rec.enabled_flag;
1490 END IF;
1491
1492
1493
1494 -- security_group_id
1495 --IF p_attribute_code_rec.security_group_id = FND_API.g_miss_num THEN
1496 -- x_complete_rec.security_group_id := l_attribute_code_rec.security_group_id;
1497 --END IF;
1498 -- Note: Developers need to modify the procedure
1499 -- to handle any business specific requirements.
1500 END Complete_attribute_code_Rec;
1501
1502
1503
1504
1505
1506 PROCEDURE Validate_Attribute_Code(
1507 p_api_version_number IN NUMBER
1508 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
1509 ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
1510 ,p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.G_UPDATE
1511 ,p_attribute_code_rec IN attribute_code_rec_type
1512 ,x_return_status OUT NOCOPY VARCHAR2
1513 ,x_msg_count OUT NOCOPY NUMBER
1514 ,x_msg_data OUT NOCOPY VARCHAR2
1515 )
1516 IS
1517 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Attribute_Code';
1518 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
1519 l_api_version_number CONSTANT NUMBER := 1.0;
1520 l_object_version_number NUMBER;
1521 l_attribute_code_rec PV_Attribute_Code_PVT.attribute_code_rec_type;
1522
1523 BEGIN
1524 -- Standard Start of API savepoint
1525 SAVEPOINT Validate_Attribute_Code;
1526
1527 -- Standard call to check for call compatibility.
1528 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
1529 p_api_version_number,
1530 l_api_name,
1531 G_PKG_NAME)
1532 THEN
1533 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1534 END IF;
1535
1536 -- Initialize message list if p_init_msg_list is set to TRUE.
1537 IF FND_API.to_Boolean( p_init_msg_list )
1538 THEN
1539 FND_MSG_PUB.initialize;
1540 END IF;
1541 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1542 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : Before Check_Attr_Code_Items' );
1543 Check_Attr_Code_Items(
1544 p_attribute_code_rec => p_attribute_code_rec
1545 ,p_validation_mode => p_validation_mode
1546 ,x_return_status => x_return_status
1547 );
1548 --DBMS_OUTPUT.PUT_LINE(l_full_name||' : After Check_Attr_Code_Items' );
1549 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1550 RAISE FND_API.G_EXC_ERROR;
1551 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1552 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1553 END IF;
1554 END IF;
1555
1556 Complete_attribute_code_rec(
1557 p_attribute_code_rec => p_attribute_code_rec
1558 ,x_complete_rec => l_attribute_code_rec
1559 );
1560
1561 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1562 Validate_attr_code_rec(
1563 p_api_version_number => 1.0
1564 ,p_init_msg_list => FND_API.G_FALSE
1565 ,x_return_status => x_return_status
1566 ,x_msg_count => x_msg_count
1567 ,x_msg_data => x_msg_data
1568 ,p_attribute_code_rec => l_attribute_code_rec
1569 ,p_validation_mode => p_validation_mode
1570 );
1571
1572 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1573 RAISE FND_API.G_EXC_ERROR;
1574 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1575 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1576 END IF;
1577 END IF;
1578
1579
1580 -- Debug Message
1581
1582 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
1583 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - start');
1584 END IF;
1585 -- Initialize API return status to SUCCESS
1586 x_return_status := FND_API.G_RET_STS_SUCCESS;
1587
1588
1589 -- Debug Message
1590 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
1591 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - end');
1592 END IF;
1593
1594 -- Standard call to get message count and if count is 1, get message info.
1595 FND_MSG_PUB.Count_And_Get
1596 (p_count => x_msg_count,
1597 p_data => x_msg_data
1598 );
1599 EXCEPTION
1600 /*
1601 WHEN PVX_Utility_PVT.resource_locked THEN
1602 x_return_status := FND_API.g_ret_sts_error;
1603 PVX_Utility_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
1604 */
1605 WHEN FND_API.G_EXC_ERROR THEN
1606 ROLLBACK TO Validate_Attribute_Code;
1607 x_return_status := FND_API.G_RET_STS_ERROR;
1608 -- Standard call to get message count and if count=1, get the message
1609 FND_MSG_PUB.Count_And_Get (
1610 p_encoded => FND_API.G_FALSE,
1611 p_count => x_msg_count,
1612 p_data => x_msg_data
1613 );
1614
1615 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1616 ROLLBACK TO Validate_Attribute_Code;
1617 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1618 -- Standard call to get message count and if count=1, get the message
1619 FND_MSG_PUB.Count_And_Get (
1620 p_encoded => FND_API.G_FALSE,
1621 p_count => x_msg_count,
1622 p_data => x_msg_data
1623 );
1624
1625 WHEN OTHERS THEN
1626 ROLLBACK TO Validate_Attribute_Code;
1627 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1628 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1629 THEN
1630 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1631 END IF;
1632 -- Standard call to get message count and if count=1, get the message
1633 FND_MSG_PUB.Count_And_Get (
1634 p_encoded => FND_API.G_FALSE,
1635 p_count => x_msg_count,
1636 p_data => x_msg_data
1637 );
1638 End Validate_Attribute_Code;
1639
1640
1641 PROCEDURE Validate_Attr_Code_Rec(
1642 p_api_version_number IN NUMBER
1643 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
1644 ,x_return_status OUT NOCOPY VARCHAR2
1645 ,x_msg_count OUT NOCOPY NUMBER
1646 ,x_msg_data OUT NOCOPY VARCHAR2
1647 ,p_attribute_code_rec IN attribute_code_rec_type
1648 ,p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.G_UPDATE
1649 )
1650 IS
1651 BEGIN
1652 -- Initialize message list if p_init_msg_list is set to TRUE.
1653 IF FND_API.to_Boolean( p_init_msg_list )
1654 THEN
1655 FND_MSG_PUB.initialize;
1656 END IF;
1657
1658 -- Initialize API return status to SUCCESS
1659 x_return_status := FND_API.G_RET_STS_SUCCESS;
1660
1661 -- Hint: Validate data
1662 -- If data not valid
1663 -- THEN
1664 -- x_return_status := FND_API.G_RET_STS_ERROR;
1665
1666 -- Debug Message
1667 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW)) THEN
1668 PVX_Utility_PVT.debug_message('Private API: Validate_dm_model_rec');
1669 END IF;
1670
1671 -- Standard call to get message count and if count is 1, get message info.
1672 FND_MSG_PUB.Count_And_Get
1673 (p_count => x_msg_count,
1674 p_data => x_msg_data
1675 );
1676 END VALIDATE_ATTR_CODE_REC;
1677
1678 END PV_ATTRIBUTE_CODE_PVT;
1679