[Home] [Help]
PACKAGE BODY: APPS.AMS_DM_IMP_ATTRIBUTE_PVT
Source
1 PACKAGE BODY AMS_Dm_Imp_Attribute_PVT as
2 /* $Header: amsvdiab.pls 115.7 2004/06/21 08:11:13 rosharma ship $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 -- AMS_Dm_Imp_Attribute_PVT
7 -- Purpose
8 --
9 -- History
10 --
11 -- NOTE
12 --
13 -- This Api is generated with Latest version of
14 -- Rosetta, where g_miss indicates NULL and
15 -- NULL indicates missing value. Rosetta Version 1.55
16 -- End of Comments
17 -- ===============================================================
18
19
20 G_PKG_NAME CONSTANT VARCHAR2(30):= 'AMS_Dm_Imp_Attribute_PVT';
21 G_FILE_NAME CONSTANT VARCHAR2(12) := 'amsvdiab.pls';
22
23 --
24 -- Foreward Procedure Declarations
25 --
26 AMS_DEBUG_HIGH_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_HIGH);
27 AMS_DEBUG_LOW_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW);
28 AMS_DEBUG_MEDIUM_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_MEDIUM);
29
30 PROCEDURE Default_Imp_Attribute_Items (
31 p_imp_attribute_rec IN imp_attribute_rec_type ,
32 x_imp_attribute_rec OUT NOCOPY imp_attribute_rec_type
33 );
34
35
36 -- Hint: Primary key needs to be returned.
37 -- ==============================================================================
38 -- Start of Comments
39 -- ==============================================================================
40 -- API Name
41 -- Create_Imp_Attribute
42 -- Type
43 -- Private
44 -- Pre-Req
45 --
46 -- Parameters
47 --
48 -- IN
49 -- p_api_version_number IN NUMBER Required
50 -- p_init_msg_list IN VARCHAR2 Optional Default = FND_API_G_FALSE
51 -- p_commit IN VARCHAR2 Optional Default = FND_API.G_FALSE
52 -- p_validation_level IN NUMBER Optional Default = FND_API.G_VALID_LEVEL_FULL
53 -- p_imp_attribute_rec IN imp_attribute_rec_type Required
54 --
55 -- OUT
56 -- x_return_status OUT VARCHAR2
57 -- x_msg_count OUT NUMBER
58 -- x_msg_data OUT VARCHAR2
59 -- Version : Current version 1.0
60 -- Note: This automatic generated procedure definition, it includes standard IN/OUT parameters
61 -- and basic operation, developer must manually add parameters and business logic as necessary.
62 --
63 -- History
64 --
65 -- NOTE
66 --
67 -- End of Comments
68 -- ==============================================================================
69
70 PROCEDURE Create_Imp_Attribute(
71 p_api_version_number IN NUMBER,
72 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
73 p_commit IN VARCHAR2 := FND_API.G_FALSE,
74 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
75
76 x_return_status OUT NOCOPY VARCHAR2,
77 x_msg_count OUT NOCOPY NUMBER,
78 x_msg_data OUT NOCOPY VARCHAR2,
79
80 p_imp_attribute_rec IN imp_attribute_rec_type := g_miss_imp_attribute_rec,
81 x_Dm_Imp_Attribute_id OUT NOCOPY NUMBER
82 )
83 IS
84 L_API_NAME CONSTANT VARCHAR2(30) := 'Create_Imp_Attribute';
85 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
86 l_return_status_full VARCHAR2(1);
87 l_object_version_number NUMBER := 1;
88 l_org_id NUMBER := FND_API.G_MISS_NUM;
89 l_Dm_Imp_Attribute_id NUMBER;
90 l_dummy NUMBER;
91 l_imp_attribute_rec imp_attribute_rec_type;
92 BEGIN
93 -- Standard Start of API savepoint
94 SAVEPOINT create_Dm_Imp_Attribute_pvt;
95
96 -- Standard call to check for call compatibility.
97 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
98 p_api_version_number,
99 l_api_name,
100 G_PKG_NAME)
101 THEN
102 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
103 END IF;
104
105 -- Initialize message list if p_init_msg_list is set to TRUE.
106 IF FND_API.to_Boolean( p_init_msg_list )
107 THEN
108 FND_MSG_PUB.initialize;
109 END IF;
110
111 -- Debug Message
112 IF (AMS_DEBUG_HIGH_ON) THEN
113
114 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
115 END IF;
116
117 -- Initialize API return status to SUCCESS
118 x_return_status := FND_API.G_RET_STS_SUCCESS;
119
120 -- Local variable initialization
121 Default_Imp_Attribute_Items (
122 p_imp_attribute_rec => p_imp_attribute_rec,
123 x_imp_attribute_rec => l_imp_attribute_rec
124 );
125
126 -- =========================================================================
127 -- Validate Environment
128 -- =========================================================================
129
130 IF FND_GLOBAL.USER_ID IS NULL THEN
131 AMS_Utility_PVT.Error_Message(p_message_name => 'USER_PROFILE_MISSING');
132 RAISE FND_API.G_EXC_ERROR;
133 END IF;
134
135 IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL) THEN
136 -- Debug message
137 IF (AMS_DEBUG_HIGH_ON) THEN
138
139 AMS_UTILITY_PVT.debug_message('Private API: Validate_Imp_Attribute');
140 END IF;
141
142 -- Invoke validation procedures
143 Validate_imp_attribute(
144 p_api_version_number => 1.0,
145 p_init_msg_list => FND_API.G_FALSE,
146 p_validation_level => p_validation_level,
147 p_validation_mode => JTF_PLSQL_API.g_create,
148 p_imp_attribute_rec => l_imp_attribute_rec,
149 x_return_status => x_return_status,
150 x_msg_count => x_msg_count,
151 x_msg_data => x_msg_data);
152 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
153 RAISE FND_API.G_EXC_ERROR;
154 END IF;
155 END IF;
156
157 -- Debug Message
158 IF (AMS_DEBUG_HIGH_ON) THEN
159
160 AMS_UTILITY_PVT.debug_message( 'Private API: Calling create table handler');
161 END IF;
162
163 -- Invoke table handler(Ams_Dm_Imp_Attribute_Pkg.Insert_Row)
164 Ams_Dm_Imp_Attribute_Pkg.Insert_Row(
165 px_Dm_Imp_Attribute_id => l_imp_attribute_rec.imp_attribute_id,
166 p_last_update_date => SYSDATE,
167 p_last_updated_by => FND_GLOBAL.USER_ID,
168 p_creation_date => SYSDATE,
169 p_created_by => FND_GLOBAL.USER_ID,
170 p_last_update_login => FND_GLOBAL.conc_login_id,
171 px_object_version_number => l_object_version_number,
172 p_model_id => l_imp_attribute_rec.model_id,
173 p_source_field_id => l_imp_attribute_rec.source_field_id,
174 p_rank => l_imp_attribute_rec.rank,
175 p_value => l_imp_attribute_rec.value
176 );
177 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
178 RAISE FND_API.G_EXC_ERROR;
179 END IF;
180 --
181 -- End of API body
182 --
183
184 x_Dm_Imp_Attribute_id := l_imp_attribute_rec.imp_attribute_id;
185
186 -- Standard check for p_commit
187 IF FND_API.to_Boolean( p_commit )
188 THEN
189 COMMIT WORK;
190 END IF;
191
192 -- Debug Message
193 IF (AMS_DEBUG_HIGH_ON) THEN
194
195 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
196 END IF;
197
198 -- Standard call to get message count and if count is 1, get message info.
199 FND_MSG_PUB.Count_And_Get
200 (p_count => x_msg_count,
201 p_data => x_msg_data
202 );
203 EXCEPTION
204
205 WHEN AMS_Utility_PVT.resource_locked THEN
206 x_return_status := FND_API.g_ret_sts_error;
207 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
208
209 WHEN FND_API.G_EXC_ERROR THEN
210 ROLLBACK TO CREATE_Dm_Imp_Attribute_PVT;
211 x_return_status := FND_API.G_RET_STS_ERROR;
212 -- Standard call to get message count and if count=1, get the message
213 FND_MSG_PUB.Count_And_Get (
214 p_encoded => FND_API.G_FALSE,
215 p_count => x_msg_count,
216 p_data => x_msg_data
217 );
218
219 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
220 ROLLBACK TO CREATE_Dm_Imp_Attribute_PVT;
221 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
222 -- Standard call to get message count and if count=1, get the message
223 FND_MSG_PUB.Count_And_Get (
224 p_encoded => FND_API.G_FALSE,
225 p_count => x_msg_count,
226 p_data => x_msg_data
227 );
228
229 WHEN OTHERS THEN
230 ROLLBACK TO CREATE_Dm_Imp_Attribute_PVT;
231 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
232 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
233 THEN
234 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
235 END IF;
236 -- Standard call to get message count and if count=1, get the message
237 FND_MSG_PUB.Count_And_Get (
238 p_encoded => FND_API.G_FALSE,
239 p_count => x_msg_count,
240 p_data => x_msg_data
241 );
242 End Create_Imp_Attribute;
243
244
245 -- ==============================================================================
246 -- Start of Comments
247 -- ==============================================================================
248 -- API Name
249 -- Update_Imp_Attribute
250 -- Type
251 -- Private
252 -- Pre-Req
253 --
254 -- Parameters
255 --
256 -- IN
257 -- p_api_version_number IN NUMBER Required
258 -- p_init_msg_list IN VARCHAR2 Optional Default = FND_API_G_FALSE
259 -- p_commit IN VARCHAR2 Optional Default = FND_API.G_FALSE
260 -- p_validation_level IN NUMBER Optional Default = FND_API.G_VALID_LEVEL_FULL
261 -- p_imp_attribute_rec IN imp_attribute_rec_type Required
262 --
263 -- OUT
264 -- x_return_status OUT VARCHAR2
265 -- x_msg_count OUT NUMBER
266 -- x_msg_data OUT VARCHAR2
267 -- Version : Current version 1.0
268 -- Note: This automatic generated procedure definition, it includes standard IN/OUT parameters
269 -- and basic operation, developer must manually add parameters and business logic as necessary.
270 --
271 -- History
272 --
273 -- NOTE
274 --
275 -- End of Comments
276 -- ==============================================================================
277
278 PROCEDURE Update_Imp_Attribute(
279 p_api_version_number IN NUMBER,
280 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
281 p_commit IN VARCHAR2 := FND_API.G_FALSE,
282 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
283
284 x_return_status OUT NOCOPY VARCHAR2,
285 x_msg_count OUT NOCOPY NUMBER,
286 x_msg_data OUT NOCOPY VARCHAR2,
287
288 p_imp_attribute_rec IN imp_attribute_rec_type,
289 x_object_version_number OUT NOCOPY NUMBER
290 )
291
292 IS
293
294 CURSOR c_get_imp_attribute(imp_attribute_id NUMBER) IS
295 SELECT *
296 FROM AMS_DM_IMP_ATTRIBUTES
297 WHERE imp_attribute_id = p_imp_attribute_rec.imp_attribute_id;
298
299 L_API_NAME CONSTANT VARCHAR2(30) := 'Update_Imp_Attribute';
300 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
301 -- Local Variables
302 l_object_version_number NUMBER := p_imp_attribute_rec.object_version_number;
303 l_Dm_Imp_Attribute_id NUMBER;
304 l_ref_imp_attribute_rec c_get_Imp_Attribute%ROWTYPE ;
305 l_tar_imp_attribute_rec imp_attribute_rec_type := p_imp_attribute_rec;
306 l_rowid ROWID;
307 BEGIN
308 -- Standard Start of API savepoint
309 SAVEPOINT update_Dm_Imp_Attribute_pvt;
310
311 -- Standard call to check for call compatibility.
312 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
313 p_api_version_number,
314 l_api_name,
315 G_PKG_NAME)
316 THEN
317 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
318 END IF;
319
320
321 -- Initialize message list if p_init_msg_list is set to TRUE.
322 IF FND_API.to_Boolean( p_init_msg_list ) THEN
323 FND_MSG_PUB.initialize;
324 END IF;
325
326 -- Debug Message
327 IF (AMS_DEBUG_HIGH_ON) THEN
328
329 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
330 END IF;
331
332 -- Initialize API return status to SUCCESS
333 x_return_status := FND_API.G_RET_STS_SUCCESS;
334
335 -- Debug Message
336 IF (AMS_DEBUG_HIGH_ON) THEN
337
338 AMS_UTILITY_PVT.debug_message('Private API: - Open Cursor to Select');
339 END IF;
340
341 OPEN c_get_Imp_Attribute( l_tar_imp_attribute_rec.imp_attribute_id);
342 FETCH c_get_Imp_Attribute INTO l_ref_imp_attribute_rec ;
343 If ( c_get_Imp_Attribute%NOTFOUND) THEN
344 AMS_Utility_PVT.Error_Message(p_message_name => 'API_MISSING_UPDATE_TARGET',
345 p_token_name => 'INFO',
346 p_token_value => 'Imp_Attribute') ;
347 RAISE FND_API.G_EXC_ERROR;
348 END IF;
349 -- Debug Message
350 IF (AMS_DEBUG_HIGH_ON) THEN
351
355
352 AMS_UTILITY_PVT.debug_message('Private API: - Close Cursor');
353 END IF;
354 CLOSE c_get_Imp_Attribute;
356
357 If (l_tar_imp_attribute_rec.object_version_number is NULL or
358 l_tar_imp_attribute_rec.object_version_number = FND_API.G_MISS_NUM ) Then
359 AMS_Utility_PVT.Error_Message(p_message_name => 'API_VERSION_MISSING',
360 p_token_name => 'COLUMN',
361 p_token_value => 'Last_Update_Date') ;
362 RAISE FND_API.G_EXC_ERROR;
363 END IF;
364 -- Check Whether record has been changed by someone else
365 If (l_tar_imp_attribute_rec.object_version_number <> l_ref_imp_attribute_rec.object_version_number) Then
366 AMS_Utility_PVT.Error_Message(p_message_name => 'API_RECORD_CHANGED',
367 p_token_name => 'INFO',
368 p_token_value => 'Imp_Attribute') ;
369 RAISE FND_API.G_EXC_ERROR;
370 END IF;
371
372 IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL) THEN
373 -- Debug message
374 IF (AMS_DEBUG_HIGH_ON) THEN
375
376 AMS_UTILITY_PVT.debug_message('Private API: Validate_Imp_Attribute');
377 END IF;
378
379 -- Invoke validation procedures
380 Validate_imp_attribute(
381 p_api_version_number => 1.0,
382 p_init_msg_list => FND_API.G_FALSE,
383 p_validation_level => p_validation_level,
384 p_validation_mode => JTF_PLSQL_API.g_update,
385 p_imp_attribute_rec => p_imp_attribute_rec,
386 x_return_status => x_return_status,
387 x_msg_count => x_msg_count,
388 x_msg_data => x_msg_data);
389 END IF;
390 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
391 RAISE FND_API.G_EXC_ERROR;
392 END IF;
393
394 -- Debug Message
395 IF (AMS_DEBUG_HIGH_ON) THEN
396
397 AMS_UTILITY_PVT.debug_message('Private API: Calling update table handler');
398 END IF;
399
400 -- Invoke table handler(Ams_Dm_Imp_Attribute_Pkg.Update_Row)
401 Ams_Dm_Imp_Attribute_Pkg.Update_Row(
402 p_Dm_Imp_Attribute_id => p_imp_attribute_rec.imp_attribute_id,
403 p_last_update_date => SYSDATE,
404 p_last_updated_by => FND_GLOBAL.USER_ID,
405 p_last_update_login => FND_GLOBAL.conc_login_id,
406 px_object_version_number => l_object_version_number,
407 p_model_id => p_imp_attribute_rec.model_id,
408 p_source_field_id => p_imp_attribute_rec.source_field_id,
409 p_rank => p_imp_attribute_rec.rank,
410 p_value => p_imp_attribute_rec.value
411 );
412 --
413 -- End of API body.
414 --
415
416 x_object_version_number := l_object_version_number;
417
418 -- Standard check for p_commit
419 IF FND_API.to_Boolean( p_commit )
420 THEN
421 COMMIT WORK;
422 END IF;
423
424 -- Debug Message
425 IF (AMS_DEBUG_HIGH_ON) THEN
426
427 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
428 END IF;
429
430 -- Standard call to get message count and if count is 1, get message info.
431 FND_MSG_PUB.Count_And_Get
432 (p_count => x_msg_count,
433 p_data => x_msg_data
434 );
435 EXCEPTION
436
437 WHEN AMS_Utility_PVT.resource_locked THEN
438 x_return_status := FND_API.g_ret_sts_error;
439 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
440
441 WHEN FND_API.G_EXC_ERROR THEN
442 ROLLBACK TO UPDATE_Dm_Imp_Attribute_PVT;
443 x_return_status := FND_API.G_RET_STS_ERROR;
444 -- Standard call to get message count and if count=1, get the message
445 FND_MSG_PUB.Count_And_Get (
446 p_encoded => FND_API.G_FALSE,
447 p_count => x_msg_count,
448 p_data => x_msg_data
449 );
450
451 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
452 ROLLBACK TO UPDATE_Dm_Imp_Attribute_PVT;
453 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
454 -- Standard call to get message count and if count=1, get the message
455 FND_MSG_PUB.Count_And_Get (
456 p_encoded => FND_API.G_FALSE,
457 p_count => x_msg_count,
458 p_data => x_msg_data
459 );
460
461 WHEN OTHERS THEN
462 ROLLBACK TO UPDATE_Dm_Imp_Attribute_PVT;
463 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
464 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
465 THEN
466 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
467 END IF;
468 -- Standard call to get message count and if count=1, get the message
469 FND_MSG_PUB.Count_And_Get (
470 p_encoded => FND_API.G_FALSE,
471 p_count => x_msg_count,
472 p_data => x_msg_data
473 );
474 End Update_Imp_Attribute;
475
476
477 -- ==============================================================================
478 -- Start of Comments
479 -- ==============================================================================
480 -- API Name
481 -- Delete_Imp_Attribute
482 -- Type
483 -- Private
484 -- Pre-Req
485 --
486 -- Parameters
487 --
488 -- IN
492 -- p_validation_level IN NUMBER Optional Default = FND_API.G_VALID_LEVEL_FULL
489 -- p_api_version_number IN NUMBER Required
490 -- p_init_msg_list IN VARCHAR2 Optional Default = FND_API_G_FALSE
491 -- p_commit IN VARCHAR2 Optional Default = FND_API.G_FALSE
493 -- p_Dm_Imp_Attribute_id IN NUMBER
494 -- p_object_version_number IN NUMBER Optional Default = NULL
495 --
496 -- OUT
497 -- x_return_status OUT VARCHAR2
498 -- x_msg_count OUT NUMBER
499 -- x_msg_data OUT VARCHAR2
500 -- Version : Current version 1.0
501 -- Note: This automatic generated procedure definition, it includes standard IN/OUT parameters
502 -- and basic operation, developer must manually add parameters and business logic as necessary.
503 --
504 -- History
505 --
506 -- NOTE
507 --
508 -- End of Comments
509 -- ==============================================================================
510
511 PROCEDURE Delete_Imp_Attribute(
512 p_api_version_number IN NUMBER,
513 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
514 p_commit IN VARCHAR2 := FND_API.G_FALSE,
515 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
516 x_return_status OUT NOCOPY VARCHAR2,
517 x_msg_count OUT NOCOPY NUMBER,
518 x_msg_data OUT NOCOPY VARCHAR2,
519 p_Dm_Imp_Attribute_id IN NUMBER,
520 p_object_version_number IN NUMBER
521 )
522 IS
523 L_API_NAME CONSTANT VARCHAR2(30) := 'Delete_Imp_Attribute';
524 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
525 l_object_version_number NUMBER;
526 BEGIN
527 -- Standard Start of API savepoint
528 SAVEPOINT delete_Dm_Imp_Attribute_pvt;
529
530 -- Standard call to check for call compatibility.
531 IF NOT FND_API.Compatible_API_Call (l_api_version_number,
532 p_api_version_number,
533 l_api_name,
534 G_PKG_NAME)
535 THEN
536 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
537 END IF;
538
539
540 -- Initialize message list if p_init_msg_list is set to TRUE.
541 IF FND_API.to_Boolean( p_init_msg_list )
542 THEN
543 FND_MSG_PUB.initialize;
544 END IF;
545
546
547
548 -- Debug Message
549 IF (AMS_DEBUG_HIGH_ON) THEN
550
551 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
552 END IF;
553
554
555
556 -- Initialize API return status to SUCCESS
557 x_return_status := FND_API.G_RET_STS_SUCCESS;
558
559 --
560 -- Api body
561 --
562 -- Debug Message
563 IF (AMS_DEBUG_HIGH_ON) THEN
564
565 AMS_UTILITY_PVT.debug_message( 'Private API: Calling delete table handler');
566 END IF;
567
568 -- Invoke table handler(Ams_Dm_Imp_Attribute_Pkg.Delete_Row)
569 Ams_Dm_Imp_Attribute_Pkg.Delete_Row(
570 p_Dm_Imp_Attribute_id => p_Dm_Imp_Attribute_id,
571 p_object_version_number => p_object_version_number );
572 --
573 -- End of API body
574 --
575
576 -- Standard check for p_commit
577 IF FND_API.to_Boolean( p_commit )
578 THEN
579 COMMIT WORK;
580 END IF;
581
582
583 -- Debug Message
587 END IF;
584 IF (AMS_DEBUG_HIGH_ON) THEN
585
586 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
588
589
590 -- Standard call to get message count and if count is 1, get message info.
591 FND_MSG_PUB.Count_And_Get
592 (p_count => x_msg_count,
593 p_data => x_msg_data
594 );
595 EXCEPTION
596
597 WHEN AMS_Utility_PVT.resource_locked THEN
598 x_return_status := FND_API.g_ret_sts_error;
599 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
600
601 WHEN FND_API.G_EXC_ERROR THEN
602 ROLLBACK TO DELETE_Dm_Imp_Attribute_PVT;
603 x_return_status := FND_API.G_RET_STS_ERROR;
604 -- Standard call to get message count and if count=1, get the message
605 FND_MSG_PUB.Count_And_Get (
606 p_encoded => FND_API.G_FALSE,
607 p_count => x_msg_count,
608 p_data => x_msg_data
609 );
610
611 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
612 ROLLBACK TO DELETE_Dm_Imp_Attribute_PVT;
613 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
614 -- Standard call to get message count and if count=1, get the message
615 FND_MSG_PUB.Count_And_Get (
616 p_encoded => FND_API.G_FALSE,
617 p_count => x_msg_count,
618 p_data => x_msg_data
619 );
620
621 WHEN OTHERS THEN
622 ROLLBACK TO DELETE_Dm_Imp_Attribute_PVT;
623 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
624 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
625 THEN
626 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
627 END IF;
628 -- Standard call to get message count and if count=1, get the message
629 FND_MSG_PUB.Count_And_Get (
630 p_encoded => FND_API.G_FALSE,
631 p_count => x_msg_count,
632 p_data => x_msg_data
633 );
634 End Delete_Imp_Attribute;
635
636
637
638 -- Hint: Primary key needs to be returned.
639 -- ==============================================================================
640 -- Start of Comments
641 -- ==============================================================================
642 -- API Name
643 -- Lock_Imp_Attribute
644 -- Type
645 -- Private
646 -- Pre-Req
647 --
648 -- Parameters
649 --
650 -- IN
651 -- p_api_version_number IN NUMBER Required
652 -- p_init_msg_list IN VARCHAR2 Optional Default = FND_API_G_FALSE
653 -- p_commit IN VARCHAR2 Optional Default = FND_API.G_FALSE
654 -- p_validation_level IN NUMBER Optional Default = FND_API.G_VALID_LEVEL_FULL
655 -- p_imp_attribute_rec IN imp_attribute_rec_type Required
656 --
657 -- OUT
658 -- x_return_status OUT VARCHAR2
659 -- x_msg_count OUT NUMBER
660 -- x_msg_data OUT VARCHAR2
661 -- Version : Current version 1.0
662 -- Note: This automatic generated procedure definition, it includes standard IN/OUT parameters
663 -- and basic operation, developer must manually add parameters and business logic as necessary.
664 --
668 --
665 -- History
666 --
667 -- NOTE
669 -- End of Comments
670 -- ==============================================================================
671
672 PROCEDURE Lock_Imp_Attribute(
673 p_api_version_number IN NUMBER,
674 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
675
676 x_return_status OUT NOCOPY VARCHAR2,
677 x_msg_count OUT NOCOPY NUMBER,
678 x_msg_data OUT NOCOPY VARCHAR2,
679
680 p_Dm_Imp_Attribute_id IN NUMBER,
681 p_object_version IN NUMBER
682 )
683 IS
684 L_API_NAME CONSTANT VARCHAR2(30) := 'Lock_Imp_Attribute';
685 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
686 L_FULL_NAME CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
687 l_Dm_Imp_Attribute_id NUMBER;
688
689 CURSOR c_imp_attribute IS
690 SELECT imp_attribute_id
691 FROM ams_dm_imp_attributes
692 WHERE imp_attribute_id = p_Dm_Imp_Attribute_id
693 AND object_version_number = p_object_version
694 FOR UPDATE NOWAIT;
695 BEGIN
696
697 -- Debug Message
698 IF (AMS_DEBUG_HIGH_ON) THEN
699
700 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
701 END IF;
702
703 -- Initialize message list if p_init_msg_list is set to TRUE.
704 IF FND_API.to_Boolean( p_init_msg_list )
705 THEN
706 FND_MSG_PUB.initialize;
707 END IF;
708
709 -- Standard call to check for call compatibility.
710 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
711 p_api_version_number,
712 l_api_name,
713 G_PKG_NAME)
714 THEN
715 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
716 END IF;
717
718 -- Initialize API return status to SUCCESS
719 x_return_status := FND_API.G_RET_STS_SUCCESS;
720
721 ------------------------ lock -------------------------
722
723 IF (AMS_DEBUG_HIGH_ON) THEN
724
725
726
727 AMS_Utility_PVT.debug_message(l_full_name||': start');
728
729 END IF;
730 OPEN c_imp_attribute;
731 FETCH c_imp_attribute INTO l_Dm_Imp_Attribute_id;
732 IF (c_imp_attribute%NOTFOUND) THEN
733 CLOSE c_imp_attribute;
734 AMS_Utility_PVT.error_message ('AMS_API_RECORD_NOT_FOUND');
735 RAISE FND_API.g_exc_error;
736 END IF;
737 CLOSE c_imp_attribute;
738
739 -------------------- finish --------------------------
740 FND_MSG_PUB.count_and_get(
741 p_encoded => FND_API.g_false,
742 p_count => x_msg_count,
743 p_data => x_msg_data);
744 IF (AMS_DEBUG_HIGH_ON) THEN
745
746 AMS_Utility_PVT.debug_message(l_full_name ||': end');
747 END IF;
748 EXCEPTION
749
750 WHEN AMS_Utility_PVT.resource_locked THEN
751 x_return_status := FND_API.g_ret_sts_error;
752 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
753
754 WHEN FND_API.G_EXC_ERROR THEN
755 ROLLBACK TO LOCK_Dm_Imp_Attribute_PVT;
756 x_return_status := FND_API.G_RET_STS_ERROR;
757 -- Standard call to get message count and if count=1, get the message
758 FND_MSG_PUB.Count_And_Get (
759 p_encoded => FND_API.G_FALSE,
760 p_count => x_msg_count,
761 p_data => x_msg_data
762 );
763
764 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
765 ROLLBACK TO LOCK_Dm_Imp_Attribute_PVT;
766 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
767 -- Standard call to get message count and if count=1, get the message
768 FND_MSG_PUB.Count_And_Get (
769 p_encoded => FND_API.G_FALSE,
770 p_count => x_msg_count,
771 p_data => x_msg_data
772 );
773
774 WHEN OTHERS THEN
775 ROLLBACK TO LOCK_Dm_Imp_Attribute_PVT;
776 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
777 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
778 THEN
779 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
780 END IF;
781 -- Standard call to get message count and if count=1, get the message
782 FND_MSG_PUB.Count_And_Get (
783 p_encoded => FND_API.G_FALSE,
784 p_count => x_msg_count,
785 p_data => x_msg_data
786 );
787 End Lock_Imp_Attribute;
788
789
790 PROCEDURE check_Imp_Attribute_UK_Items(
791 p_imp_attribute_rec IN imp_attribute_rec_type,
792 p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
793 x_return_status OUT NOCOPY VARCHAR2)
794 IS
795 l_valid_flag VARCHAR2(1);
796 BEGIN
797 x_return_status := FND_API.g_ret_sts_success;
798
799 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
800 l_valid_flag := AMS_Utility_PVT.check_uniqueness(
801 'ams_dm_imp_attributes',
802 'model_id = ' || p_imp_attribute_rec.model_id ||
803 ' AND source_field_id = ' || p_imp_attribute_rec.source_field_id
807 x_return_status := FND_API.g_ret_sts_error;
804 );
805 IF l_valid_flag = FND_API.g_false THEN
806 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_DM_MODEL_FIELD_DUP');
808 END IF;
809 ELSE
810 l_valid_flag := AMS_Utility_PVT.check_uniqueness(
811 'ams_dm_imp_attributes',
812 'imp_attribute_id = ' || p_imp_attribute_rec.imp_attribute_id ||
813 ' AND imp_attribute_id <> ' || p_imp_attribute_rec.imp_attribute_id
814 );
815 IF l_valid_flag = FND_API.g_false THEN
816 AMS_Utility_PVT.Error_Message('AMS_API_DUPLICATE_ID', 'ID_FIELD','IMP_ATTRIBUTE_ID');
817 x_return_status := FND_API.g_ret_sts_error;
818 END IF;
819 END IF;
820 END check_Imp_Attribute_UK_Items;
821
822
823 PROCEDURE check_Imp_Attribute_Req_Items(
824 p_imp_attribute_rec IN imp_attribute_rec_type,
825 p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
826 x_return_status OUT NOCOPY VARCHAR2
827 )
828 IS
829 BEGIN
830 x_return_status := FND_API.g_ret_sts_success;
831
832 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
833 IF p_imp_attribute_rec.model_id = FND_API.G_MISS_NUM OR p_imp_attribute_rec.model_id IS NULL THEN
834 AMS_Utility_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'MODEL_ID');
835 x_return_status := FND_API.g_ret_sts_error;
836 END IF;
837
838 IF p_imp_attribute_rec.source_field_id = FND_API.G_MISS_NUM OR p_imp_attribute_rec.source_field_id IS NULL THEN
839 AMS_Utility_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'SOURCE_FIELD_ID');
840 x_return_status := FND_API.g_ret_sts_error;
841 END IF;
842
843 IF p_imp_attribute_rec.value = FND_API.G_MISS_NUM OR p_imp_attribute_rec.value IS NULL THEN
844 AMS_Utility_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'VALUE');
845 x_return_status := FND_API.g_ret_sts_error;
846 END IF;
847 ELSE
848 IF p_imp_attribute_rec.model_id = FND_API.G_MISS_NUM THEN
849 AMS_Utility_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'MODEL_ID');
850 x_return_status := FND_API.g_ret_sts_error;
851 END IF;
852
853 IF p_imp_attribute_rec.source_field_id = FND_API.G_MISS_NUM THEN
854 AMS_Utility_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'SOURCE_FIELD_ID');
855 x_return_status := FND_API.g_ret_sts_error;
856 END IF;
857
858 IF p_imp_attribute_rec.value = FND_API.G_MISS_NUM THEN
859 AMS_Utility_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'VALUE');
860 x_return_status := FND_API.g_ret_sts_error;
861 END IF;
862 END IF;
863 END check_Imp_Attribute_Req_Items;
864
865
866 PROCEDURE Check_Imp_Attribute_FK_Items(
867 p_imp_attribute_rec IN imp_attribute_rec_type,
868 x_return_status OUT NOCOPY VARCHAR2
869 )
870 IS
871 CURSOR c_model (p_model_id IN NUMBER) IS
872 SELECT 1
873 FROM ams_dm_models_all_b
874 WHERE model_id = p_model_id;
875
876 CURSOR c_field (p_source_field_id IN NUMBER) IS
877 SELECT 1
878 FROM ams_list_src_fields
879 WHERE list_source_field_id = p_source_field_id;
880
881 l_dummy NUMBER;
882 BEGIN
883 x_return_status := FND_API.g_ret_sts_success;
884
885 OPEN c_model (p_imp_attribute_rec.model_id);
886 FETCH c_model INTO l_dummy;
887 IF c_model%NOTFOUND THEN
888 AMS_Utility_PVT.error_message ('AMS_DM_INVALID_MODEL_REF');
889 x_return_status := FND_API.g_ret_sts_error;
893 OPEN c_field (p_imp_attribute_rec.source_field_id);
890 END IF;
891 CLOSE c_model;
892
894 FETCH c_field INTO l_dummy;
895 IF c_field%NOTFOUND THEN
896 AMS_Utility_PVT.error_message ('AMS_DM_INVALID_SOURCE_FIELD');
897 x_return_status := FND_API.g_ret_sts_error;
898 END IF;
899 CLOSE c_field;
900 END Check_Imp_Attribute_FK_Items;
901
902
903 PROCEDURE Check_Imp_Attrib_Lookup_Items(
904 p_imp_attribute_rec IN imp_attribute_rec_type,
905 x_return_status OUT NOCOPY VARCHAR2
906 )
907 IS
908 BEGIN
909 x_return_status := FND_API.g_ret_sts_success;
910
911 -- no lookups for this object
912 END Check_Imp_Attrib_Lookup_Items;
913
914
915 --
916 -- NOTE
917 -- Validate every item for every validation
918 -- type before returning to main api, so all
919 -- errors are displayed after a single api call.
920 --
921 PROCEDURE Check_Imp_Attribute_Items (
922 p_imp_attribute_rec IN imp_attribute_rec_type,
923 p_validation_mode IN VARCHAR2,
924 x_return_status OUT NOCOPY VARCHAR2
925 )
926 IS
927 l_return_status VARCHAR2(1);
928 BEGIN
929 l_return_status := FND_API.g_ret_sts_success;
930
931 -- Check Items Uniqueness API calls
932 check_Imp_Attribute_UK_Items(
933 p_imp_attribute_rec => p_imp_attribute_rec,
934 p_validation_mode => p_validation_mode,
935 x_return_status => x_return_status);
936 IF x_return_status <> FND_API.g_ret_sts_success THEN
937 l_return_status := FND_API.g_ret_sts_error;
938 END IF;
939
940 -- Check Items Required/NOT NULL API calls
941
942 check_Imp_Attribute_Req_Items(
943 p_imp_attribute_rec => p_imp_attribute_rec,
944 p_validation_mode => p_validation_mode,
945 x_return_status => x_return_status);
946 IF x_return_status <> FND_API.g_ret_sts_success THEN
947 l_return_status := FND_API.g_ret_sts_error;
948 END IF;
949 -- Check Items Foreign Keys API calls
950
951 Check_Imp_Attribute_FK_Items(
952 p_imp_attribute_rec => p_imp_attribute_rec,
953 x_return_status => x_return_status);
954 IF x_return_status <> FND_API.g_ret_sts_success THEN
955 l_return_status := FND_API.g_ret_sts_error;
956 END IF;
957 -- Check Items Lookups
958
959 Check_Imp_Attrib_Lookup_Items(
960 p_imp_attribute_rec => p_imp_attribute_rec,
961 x_return_status => x_return_status);
962 IF x_return_status <> FND_API.g_ret_sts_success THEN
963 l_return_status := FND_API.g_ret_sts_error;
964 END IF;
965
966 x_return_status := l_return_status;
967 END Check_Imp_Attribute_Items;
968
969
970 PROCEDURE Complete_Imp_Attribute_Rec (
971 p_imp_attribute_rec IN imp_attribute_rec_type,
972 x_complete_rec OUT NOCOPY imp_attribute_rec_type)
973 IS
974 l_return_status VARCHAR2(1);
975
976 CURSOR c_complete IS
977 SELECT *
978 FROM ams_dm_imp_attributes
979 WHERE imp_attribute_id = p_imp_attribute_rec.imp_attribute_id;
980 l_imp_attribute_rec c_complete%ROWTYPE;
981 BEGIN
982 x_complete_rec := p_imp_attribute_rec;
983
987
984 OPEN c_complete;
985 FETCH c_complete INTO l_imp_attribute_rec;
986 CLOSE c_complete;
988 -- imp_attribute_id
989 IF p_imp_attribute_rec.imp_attribute_id IS NULL THEN
990 x_complete_rec.imp_attribute_id := l_imp_attribute_rec.imp_attribute_id;
991 END IF;
992
993 -- last_update_date
994 IF p_imp_attribute_rec.last_update_date IS NULL THEN
995 x_complete_rec.last_update_date := l_imp_attribute_rec.last_update_date;
996 END IF;
997
998 -- last_updated_by
999 IF p_imp_attribute_rec.last_updated_by IS NULL THEN
1000 x_complete_rec.last_updated_by := l_imp_attribute_rec.last_updated_by;
1001 END IF;
1002
1003 -- creation_date
1004 IF p_imp_attribute_rec.creation_date IS NULL THEN
1005 x_complete_rec.creation_date := l_imp_attribute_rec.creation_date;
1006 END IF;
1007
1008 -- created_by
1009 IF p_imp_attribute_rec.created_by IS NULL THEN
1010 x_complete_rec.created_by := l_imp_attribute_rec.created_by;
1011 END IF;
1012
1013 -- last_update_login
1014 IF p_imp_attribute_rec.last_update_login IS NULL THEN
1015 x_complete_rec.last_update_login := l_imp_attribute_rec.last_update_login;
1016 END IF;
1017
1018 -- object_version_number
1019 IF p_imp_attribute_rec.object_version_number IS NULL THEN
1020 x_complete_rec.object_version_number := l_imp_attribute_rec.object_version_number;
1021 END IF;
1022
1023 -- model_id
1024 IF p_imp_attribute_rec.model_id IS NULL THEN
1025 x_complete_rec.model_id := l_imp_attribute_rec.model_id;
1026 END IF;
1027
1028 -- source_field_id
1029 IF p_imp_attribute_rec.source_field_id IS NULL THEN
1030 x_complete_rec.source_field_id := l_imp_attribute_rec.source_field_id;
1031 END IF;
1032
1033 -- rank
1034 IF p_imp_attribute_rec.rank IS NULL THEN
1035 x_complete_rec.rank := l_imp_attribute_rec.rank;
1036 END IF;
1037
1038 -- value
1039 IF p_imp_attribute_rec.value IS NULL THEN
1040 x_complete_rec.value := l_imp_attribute_rec.value;
1041 END IF;
1042 -- Note: Developers need to modify the procedure
1043 -- to handle any business specific requirements.
1044 END Complete_Imp_Attribute_Rec;
1045
1046
1047 PROCEDURE Default_Imp_Attribute_Items (
1048 p_imp_attribute_rec IN imp_attribute_rec_type ,
1049 x_imp_attribute_rec OUT NOCOPY imp_attribute_rec_type
1050 )
1051 IS
1052 CURSOR c_id IS
1053 SELECT ams_dm_imp_attributes_s.NEXTVAL
1054 FROM dual;
1055
1056 CURSOR c_id_exists (l_id IN NUMBER) IS
1057 SELECT 1
1058 FROM AMS_DM_IMP_ATTRIBUTES
1059 WHERE imp_attribute_id = l_id;
1060
1064 WHERE t.target_id = m.target_id
1061 CURSOR c_lookup_field_id (l_model_id IN NUMBER, l_source_column_name IN VARCHAR2 ) IS
1062 SELECT f.list_source_field_id
1063 FROM ams_list_src_fields f, ams_dm_models_all_b m, ams_dm_targets_b t
1065 AND m.model_id = l_model_id
1066 AND f.list_source_type_id = t.data_source_id
1067 AND f.source_column_name = l_source_column_name
1068 UNION
1069 SELECT f.list_source_field_id
1070 FROM ams_list_src_fields f, ams_dm_models_all_b m
1071 WHERE f.list_source_type_id IN (SELECT dts.data_source_id
1072 FROM ams_dm_target_sources dts
1073 WHERE dts.target_id = m.target_id)
1074 AND m.model_id = l_model_id
1075 AND f.source_column_name = l_source_column_name
1076 ;
1077
1078 l_dummy NUMBER;
1079 l_dm_imp_attribute_id NUMBER;
1080 l_source_field_id NUMBER;
1081
1082 BEGIN
1083 x_imp_attribute_rec := p_imp_attribute_rec;
1084
1085 -- default imp_attribute_id
1086 IF p_imp_attribute_rec.imp_attribute_id IS NULL OR p_imp_attribute_rec.imp_attribute_id = FND_API.g_miss_num THEN
1087 LOOP
1088 l_dummy := NULL;
1089 OPEN c_id;
1090 FETCH c_id INTO l_dm_imp_attribute_id;
1091 CLOSE c_id;
1092
1093 OPEN c_id_exists(l_dm_imp_attribute_id);
1094 FETCH c_id_exists INTO l_dummy;
1095 CLOSE c_id_exists;
1096 EXIT WHEN l_dummy IS NULL;
1097 END LOOP;
1098 ELSE
1099 l_dm_imp_attribute_id := p_imp_attribute_rec.imp_attribute_id;
1100 END IF;
1101
1102 -- look up source_field_id for the source field name
1103 IF p_imp_attribute_rec.source_field_name IS NOT NULL AND p_imp_attribute_rec.source_field_name <> FND_API.g_miss_char THEN
1104
1105 -- Open the cursor and fetch the source field id into a local variable
1106 OPEN c_lookup_field_id (p_imp_attribute_rec.model_id , p_imp_attribute_rec.source_field_name);
1107 FETCH c_lookup_field_id INTO l_source_field_id;
1108 CLOSE c_lookup_field_id;
1109
1110 x_imp_attribute_rec.source_field_id := l_source_field_id;
1111
1112 END IF;
1113
1114 x_imp_attribute_rec.imp_attribute_id := l_dm_imp_attribute_id;
1115 END Default_Imp_Attribute_Items;
1116
1117
1118 PROCEDURE Validate_Imp_Attribute(
1119 p_api_version_number IN NUMBER,
1120 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1121 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1122 p_imp_attribute_rec IN imp_attribute_rec_type,
1123 p_validation_mode IN VARCHAR2,
1124 x_return_status OUT NOCOPY VARCHAR2,
1125 x_msg_count OUT NOCOPY NUMBER,
1126 x_msg_data OUT NOCOPY VARCHAR2
1127 )
1128 IS
1129 L_API_NAME CONSTANT VARCHAR2(30) := 'Validate_Imp_Attribute';
1130 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
1131 l_object_version_number NUMBER;
1132 l_imp_attribute_rec imp_attribute_rec_type;
1133 BEGIN
1134 -- Standard Start of API savepoint
1135 SAVEPOINT validate_Dm_Imp_Attribute_;
1136
1137 -- Standard call to check for call compatibility.
1138 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
1139 p_api_version_number,
1140 l_api_name,
1141 G_PKG_NAME)
1142 THEN
1143 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1144 END IF;
1145
1146
1147 -- Initialize message list if p_init_msg_list is set to TRUE.
1148 IF FND_API.to_Boolean( p_init_msg_list )
1149 THEN
1150 FND_MSG_PUB.initialize;
1151 END IF;
1152
1153
1154 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1155 Check_Imp_Attribute_Items(
1156 p_imp_attribute_rec => p_imp_attribute_rec,
1157 p_validation_mode => p_validation_mode,
1158 x_return_status => x_return_status
1159 );
1160 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1161 RAISE FND_API.G_EXC_ERROR;
1162 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1163 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1164 END IF;
1165 END IF;
1166
1167 Complete_Imp_Attribute_Rec(
1168 p_imp_attribute_rec => p_imp_attribute_rec,
1169 x_complete_rec => l_imp_attribute_rec
1170 );
1171
1172 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1173 Validate_Imp_Attribute_Rec(
1174 p_api_version_number => 1.0,
1175 p_init_msg_list => FND_API.G_FALSE,
1176 x_return_status => x_return_status,
1177 x_msg_count => x_msg_count,
1181 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1178 x_msg_data => x_msg_data,
1179 p_imp_attribute_rec => l_imp_attribute_rec);
1180
1182 RAISE FND_API.G_EXC_ERROR;
1183 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1184 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1185 END IF;
1186 END IF;
1187
1188 -- Debug Message
1189 IF (AMS_DEBUG_HIGH_ON) THEN
1190
1191 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
1192 END IF;
1193
1194 -- Initialize API return status to SUCCESS
1195 x_return_status := FND_API.G_RET_STS_SUCCESS;
1196
1197 -- Debug Message
1198 IF (AMS_DEBUG_HIGH_ON) THEN
1199
1200 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
1201 END IF;
1202
1203 -- Standard call to get message count and if count is 1, get message info.
1204 FND_MSG_PUB.Count_And_Get
1205 (p_count => x_msg_count,
1206 p_data => x_msg_data
1207 );
1208 EXCEPTION
1209
1210 WHEN AMS_Utility_PVT.resource_locked THEN
1211 x_return_status := FND_API.g_ret_sts_error;
1212 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
1213
1214 WHEN FND_API.G_EXC_ERROR THEN
1215 ROLLBACK TO VALIDATE_Dm_Imp_Attribute_;
1216 x_return_status := FND_API.G_RET_STS_ERROR;
1217 -- Standard call to get message count and if count=1, get the message
1218 FND_MSG_PUB.Count_And_Get (
1219 p_encoded => FND_API.G_FALSE,
1220 p_count => x_msg_count,
1221 p_data => x_msg_data
1222 );
1223
1224 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1225 ROLLBACK TO VALIDATE_Dm_Imp_Attribute_;
1226 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1227 -- Standard call to get message count and if count=1, get the message
1228 FND_MSG_PUB.Count_And_Get (
1229 p_encoded => FND_API.G_FALSE,
1230 p_count => x_msg_count,
1231 p_data => x_msg_data
1232 );
1233
1234 WHEN OTHERS THEN
1235 ROLLBACK TO VALIDATE_Dm_Imp_Attribute_;
1236 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1237 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1238 THEN
1239 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1240 END IF;
1241 -- Standard call to get message count and if count=1, get the message
1242 FND_MSG_PUB.Count_And_Get (
1243 p_encoded => FND_API.G_FALSE,
1244 p_count => x_msg_count,
1245 p_data => x_msg_data
1246 );
1247 End Validate_Imp_Attribute;
1248
1249
1250 PROCEDURE Validate_Imp_Attribute_Rec (
1251 p_api_version_number IN NUMBER,
1252 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1253 x_return_status OUT NOCOPY VARCHAR2,
1254 x_msg_count OUT NOCOPY NUMBER,
1255 x_msg_data OUT NOCOPY VARCHAR2,
1256 p_imp_attribute_rec IN imp_attribute_rec_type
1257 )
1258 IS
1259 BEGIN
1260 -- Initialize message list if p_init_msg_list is set to TRUE.
1261 IF FND_API.to_Boolean( p_init_msg_list )
1262 THEN
1263 FND_MSG_PUB.initialize;
1264 END IF;
1265
1266 -- Initialize API return status to SUCCESS
1267 x_return_status := FND_API.G_RET_STS_SUCCESS;
1268
1269 -- Hint: Validate data
1270 -- If data not valid
1271 -- THEN
1272 -- x_return_status := FND_API.G_RET_STS_ERROR;
1273
1274 -- Debug Message
1275 IF (AMS_DEBUG_HIGH_ON) THEN
1276
1277 AMS_UTILITY_PVT.debug_message('Private API: Validate_dm_model_rec');
1278 END IF;
1279
1280 END Validate_Imp_Attribute_Rec;
1281
1282 END AMS_Dm_Imp_Attribute_PVT;