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