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