[Home] [Help]
PACKAGE BODY: APPS.QP_ATTRIBUTES_PUB
Source
1 PACKAGE BODY QP_Attributes_PUB AS
2 /* $Header: QPXPATRB.pls 120.2 2005/07/06 04:52:05 appldev ship $ */
3
4 -- Global constant holding the package name
5
6 G_PKG_NAME CONSTANT VARCHAR2(30) := 'QP_Attributes_PUB';
7
8 -- Forward declaration of Procedure Id_To_Value
9
10 PROCEDURE Id_To_Value
11 ( p_CON_rec IN Con_Rec_Type
12 , p_SEG_tbl IN Seg_Tbl_Type
13 , x_CON_val_rec OUT NOCOPY /* file.sql.39 change */ Con_Val_Rec_Type
14 , x_SEG_val_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Val_Tbl_Type
15 );
16
17 -- Forward declaration of procedure Value_To_Id
18
19 PROCEDURE Value_To_Id
20 ( x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2
21 , p_CON_rec IN Con_Rec_Type
22 , p_CON_val_rec IN Con_Val_Rec_Type
23 , p_SEG_tbl IN Seg_Tbl_Type
24 , p_SEG_val_tbl IN Seg_Val_Tbl_Type
25 , x_CON_rec OUT NOCOPY /* file.sql.39 change */ Con_Rec_Type
26 , x_SEG_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Tbl_Type
27 );
28
29 -- Start of Comments
30 -- API name Process_Attributes
31 -- Type Public
32 -- Function
33 --
34 -- Pre-reqs
35 --
36 -- Parameters
37 --
38 -- Version Current version = 1.0
39 -- Initial version = 1.0
40 --
41 -- Notes
42 --
43 -- End of Comments
44
45 PROCEDURE Process_Attributes
46 ( p_api_version_number IN NUMBER
47 , p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
48 , p_return_values IN VARCHAR2 := FND_API.G_FALSE
49 , p_commit IN VARCHAR2 := FND_API.G_FALSE
50 , x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2
51 , x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER
52 , x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
53 , p_CON_rec IN Con_Rec_Type :=
54 G_MISS_CON_REC
55 , p_CON_val_rec IN Con_Val_Rec_Type :=
56 G_MISS_CON_VAL_REC
57 , p_SEG_tbl IN Seg_Tbl_Type :=
58 G_MISS_SEG_TBL
59 , p_SEG_val_tbl IN Seg_Val_Tbl_Type :=
60 G_MISS_SEG_VAL_TBL
61 , x_CON_rec OUT NOCOPY /* file.sql.39 change */ Con_Rec_Type
62 , x_CON_val_rec OUT NOCOPY /* file.sql.39 change */ Con_Val_Rec_Type
63 , x_SEG_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Tbl_Type
64 , x_SEG_val_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Val_Tbl_Type
65 )
66 IS
67 l_api_version_number CONSTANT NUMBER := 1.0;
68 l_api_name CONSTANT VARCHAR2(30):= 'Process_Attributes';
69 l_control_rec QP_GLOBALS.Control_Rec_Type;
70 l_return_status VARCHAR2(1);
71 l_CON_rec Con_Rec_Type;
72 l_p_CON_rec Con_Rec_Type;
73 l_SEG_tbl Seg_Tbl_Type;
74 l_p_SEG_tbl Seg_Tbl_Type;
75 BEGIN
76
77 -- Standard call to check for call compatibility
78
79 IF NOT FND_API.Compatible_API_Call
80 ( l_api_version_number
81 , p_api_version_number
82 , l_api_name
83 , G_PKG_NAME
84 )
85 THEN
86 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
87 END IF;
88
89 -- Perform Value to Id conversion
90
91 Value_To_Id
92 ( x_return_status => l_return_status
93 , p_CON_rec => p_CON_rec
94 , p_CON_val_rec => p_CON_val_rec
95 , p_SEG_tbl => p_SEG_tbl
96 , p_SEG_val_tbl => p_SEG_val_tbl
97 , x_CON_rec => l_CON_rec
98 , x_SEG_tbl => l_SEG_tbl
99 );
100
101 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
102 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
103 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
104 RAISE FND_API.G_EXC_ERROR;
105 END IF;
106
107
108 -- Call QP_Attributes_PVT.Process_Attributes
109
110 l_p_CON_rec := l_CON_rec;
111 l_p_SEG_tbl := l_SEG_tbl;
112
113 QP_Attributes_PVT.Process_Attributes
114 ( p_api_version_number => 1.0
115 , p_init_msg_list => p_init_msg_list
116 , p_validation_level => FND_API.G_VALID_LEVEL_FULL
117 , p_commit => p_commit
118 , x_return_status => x_return_status
119 , x_msg_count => x_msg_count
120 , x_msg_data => x_msg_data
121 , p_control_rec => l_control_rec
122 , p_CON_rec => l_p_CON_rec
123 , p_SEG_tbl => l_p_SEG_tbl
124 , x_CON_rec => l_CON_rec
125 , x_SEG_tbl => l_SEG_tbl
126 );
127
128 -- Load Id OUT parameters.
129
130 x_CON_rec := l_CON_rec;
131 x_SEG_tbl := l_SEG_tbl;
132
133 -- If p_return_values is TRUE then convert Ids to Values.
134
135 IF FND_API.to_Boolean(p_return_values) THEN
136
137 Id_To_Value
138 ( p_CON_rec => l_CON_rec
139 , p_SEG_tbl => l_SEG_tbl
140 , x_CON_val_rec => x_CON_val_rec
141 , x_SEG_val_tbl => x_SEG_val_tbl
142 );
143
144 END IF;
145
146 EXCEPTION
147
148 WHEN FND_API.G_EXC_ERROR THEN
149
150 x_return_status := FND_API.G_RET_STS_ERROR;
151
152 -- Get message count and data
153
154 OE_MSG_PUB.Count_And_Get
155 ( p_count => x_msg_count
156 , p_data => x_msg_data
157 );
158
159 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
160
161 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
162
163 -- Get message count and data
164
165 OE_MSG_PUB.Count_And_Get
166 ( p_count => x_msg_count
167 , p_data => x_msg_data
168 );
169
170 WHEN OTHERS THEN
171
172 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
173
174 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
175 THEN
176 OE_MSG_PUB.Add_Exc_Msg
177 ( G_PKG_NAME
178 , 'Process_Attributes'
179 );
180 END IF;
181
182 -- Get message count and data
183
184 OE_MSG_PUB.Count_And_Get
185 ( p_count => x_msg_count
186 , p_data => x_msg_data
187 );
188
189 END Process_Attributes;
190
191 -- Start of Comments
192 -- API name Lock_Attributes
193 -- Type Public
194 -- Function
195 --
196 -- Pre-reqs
197 --
198 -- Parameters
199 --
200 -- Version Current version = 1.0
201 -- Initial version = 1.0
202 --
203 -- Notes
204 --
205 -- End of Comments
206
207 PROCEDURE Lock_Attributes
208 ( p_api_version_number IN NUMBER
209 , p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
210 , p_return_values IN VARCHAR2 := FND_API.G_FALSE
211 , x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2
212 , x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER
213 , x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
214 , p_CON_rec IN Con_Rec_Type :=
215 G_MISS_CON_REC
216 , p_CON_val_rec IN Con_Val_Rec_Type :=
217 G_MISS_CON_VAL_REC
218 , p_SEG_tbl IN Seg_Tbl_Type :=
219 G_MISS_SEG_TBL
220 , p_SEG_val_tbl IN Seg_Val_Tbl_Type :=
221 G_MISS_SEG_VAL_TBL
222 , x_CON_rec OUT NOCOPY /* file.sql.39 change */ Con_Rec_Type
223 , x_CON_val_rec OUT NOCOPY /* file.sql.39 change */ Con_Val_Rec_Type
224 , x_SEG_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Tbl_Type
225 , x_SEG_val_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Val_Tbl_Type
226 )
227 IS
228 l_api_version_number CONSTANT NUMBER := 1.0;
229 l_api_name CONSTANT VARCHAR2(30):= 'Lock_Attributes';
230 l_return_status VARCHAR2(1);
231 l_CON_rec Con_Rec_Type;
232 l_p_CON_rec Con_Rec_Type;
233 l_SEG_tbl Seg_Tbl_Type;
234 l_p_SEG_tbl Seg_Tbl_Type;
235 BEGIN
236
237 -- Standard call to check for call compatibility
238
239 IF NOT FND_API.Compatible_API_Call
240 ( l_api_version_number
241 , p_api_version_number
242 , l_api_name
243 , G_PKG_NAME
244 )
245 THEN
246 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
247 END IF;
248
249 -- Perform Value to Id conversion
250
251 Value_To_Id
252 ( x_return_status => l_return_status
253 , p_CON_rec => p_CON_rec
254 , p_CON_val_rec => p_CON_val_rec
255 , p_SEG_tbl => p_SEG_tbl
256 , p_SEG_val_tbl => p_SEG_val_tbl
257 , x_CON_rec => l_CON_rec
258 , x_SEG_tbl => l_SEG_tbl
259 );
260
261 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
262 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
263 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
264 RAISE FND_API.G_EXC_ERROR;
265 END IF;
266
267
268 -- Call QP_Attributes_PVT.Lock_Attributes
269 l_p_CON_rec := l_CON_rec;
270 l_p_SEG_tbl := l_SEG_tbl;
271 QP_Attributes_PVT.Lock_Attributes
272 ( p_api_version_number => 1.0
273 , p_init_msg_list => p_init_msg_list
274 , x_return_status => x_return_status
275 , x_msg_count => x_msg_count
276 , x_msg_data => x_msg_data
277 , p_CON_rec => l_p_CON_rec
278 , p_SEG_tbl => l_p_SEG_tbl
279 , x_CON_rec => l_CON_rec
280 , x_SEG_tbl => l_SEG_tbl
281 );
282
283 -- Load Id OUT parameters.
284
285 x_CON_rec := l_CON_rec;
286 x_SEG_tbl := l_SEG_tbl;
287
288 -- If p_return_values is TRUE then convert Ids to Values.
289
290 IF FND_API.to_Boolean(p_return_values) THEN
291
292 Id_To_Value
293 ( p_CON_rec => l_CON_rec
294 , p_SEG_tbl => l_SEG_tbl
295 , x_CON_val_rec => x_CON_val_rec
296 , x_SEG_val_tbl => x_SEG_val_tbl
297 );
298
299 END IF;
300
301 EXCEPTION
302
303 WHEN FND_API.G_EXC_ERROR THEN
304
305 x_return_status := FND_API.G_RET_STS_ERROR;
306
307 -- Get message count and data
308
309 OE_MSG_PUB.Count_And_Get
310 ( p_count => x_msg_count
311 , p_data => x_msg_data
312 );
313
314 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
315
316 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
317
318 -- Get message count and data
319
320 OE_MSG_PUB.Count_And_Get
321 ( p_count => x_msg_count
322 , p_data => x_msg_data
323 );
324
325 WHEN OTHERS THEN
326
327 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
328
329 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
330 THEN
331 OE_MSG_PUB.Add_Exc_Msg
332 ( G_PKG_NAME
333 , 'Lock_Attributes'
334 );
335 END IF;
336
337 -- Get message count and data
338
339 OE_MSG_PUB.Count_And_Get
340 ( p_count => x_msg_count
341 , p_data => x_msg_data
342 );
343
344 END Lock_Attributes;
345
346 -- Start of Comments
347 -- API name Get_Attributes
348 -- Type Public
349 -- Function
350 --
351 -- Pre-reqs
352 --
353 -- Parameters
354 --
355 -- Version Current version = 1.0
356 -- Initial version = 1.0
357 --
358 -- Notes
359 --
363 ( p_api_version_number IN NUMBER
360 -- End of Comments
361
362 PROCEDURE Get_Attributes
364 , p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
365 , p_return_values IN VARCHAR2 := FND_API.G_FALSE
366 , x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2
367 , x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER
368 , x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
369 , p_prc_context_id IN NUMBER :=
370 FND_API.G_MISS_NUM
371 , p_prc_context IN VARCHAR2 :=
372 FND_API.G_MISS_CHAR
373 , x_CON_rec OUT NOCOPY /* file.sql.39 change */ Con_Rec_Type
374 , x_CON_val_rec OUT NOCOPY /* file.sql.39 change */ Con_Val_Rec_Type
375 , x_SEG_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Tbl_Type
376 , x_SEG_val_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Val_Tbl_Type
377 )
378 IS
379 l_api_version_number CONSTANT NUMBER := 1.0;
380 l_api_name CONSTANT VARCHAR2(30):= 'Get_Attributes';
381 l_prc_context_id NUMBER := p_prc_context_id;
382 l_CON_rec QP_Attributes_PUB.Con_Rec_Type;
383 l_SEG_tbl QP_Attributes_PUB.Seg_Tbl_Type;
384 BEGIN
385
386 -- Standard call to check for call compatibility
387
388 IF NOT FND_API.Compatible_API_Call
389 ( l_api_version_number
390 , p_api_version_number
391 , l_api_name
392 , G_PKG_NAME
393 )
394 THEN
395 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
396 END IF;
397
398 -- Standard check for Val/ID conversion
399
400 IF p_prc_context = FND_API.G_MISS_CHAR
401 THEN
402
403 l_prc_context_id := p_prc_context_id;
404
405 ELSIF p_prc_context_id <> FND_API.G_MISS_NUM THEN
406
407 l_prc_context_id := p_prc_context_id;
408
409 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
410 THEN
411
412 FND_MESSAGE.SET_NAME('QP','FND_BOTH_VAL_AND_ID_EXIST');
413 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','prc_context');
414 OE_MSG_PUB.Add;
415
416 END IF;
417
418 ELSE
419
420 -- Convert Value to Id
421
422 l_prc_context_id := QP_Value_To_Id.prc_context
423 ( p_prc_context => p_prc_context
424 );
425
426 IF l_prc_context_id = FND_API.G_MISS_NUM THEN
427 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
428 THEN
429
430 FND_MESSAGE.SET_NAME('QP','Invalid Business Object Value');
431 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','prc_context');
432 OE_MSG_PUB.Add;
433
434 END IF;
435 END IF;
436
437 RAISE FND_API.G_EXC_ERROR;
438
439 END IF;
440
441
442 -- Call QP_Attributes_PVT.Get_Attributes
443
444 QP_Attributes_PVT.Get_Attributes
445 ( p_api_version_number => 1.0
446 , p_init_msg_list => p_init_msg_list
447 , x_return_status => x_return_status
448 , x_msg_count => x_msg_count
449 , x_msg_data => x_msg_data
450 , p_prc_context_id => l_prc_context_id
451 , x_CON_rec => l_CON_rec
452 , x_SEG_tbl => l_SEG_tbl
453 );
454
455 -- Load Id OUT parameters.
456
457 x_CON_rec := l_CON_rec;
458 x_SEG_tbl := l_SEG_tbl;
459
460 -- If p_return_values is TRUE then convert Ids to Values.
461
462 IF FND_API.TO_BOOLEAN(p_return_values) THEN
463
464 Id_To_Value
465 ( p_CON_rec => l_CON_rec
466 , p_SEG_tbl => l_SEG_tbl
467 , x_CON_val_rec => x_CON_val_rec
468 , x_SEG_val_tbl => x_SEG_val_tbl
469 );
470
471 END IF;
472
473 -- Set return status
474
475 x_return_status := FND_API.G_RET_STS_SUCCESS;
476
477 -- Get message count and data
478
479 OE_MSG_PUB.Count_And_Get
480 ( p_count => x_msg_count
481 , p_data => x_msg_data
482 );
483
484
485 EXCEPTION
486
487 WHEN FND_API.G_EXC_ERROR THEN
488
489 x_return_status := FND_API.G_RET_STS_ERROR;
490
491 -- Get message count and data
492
493 OE_MSG_PUB.Count_And_Get
494 ( p_count => x_msg_count
495 , p_data => x_msg_data
496 );
497
498 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
499
500 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
501
502 -- Get message count and data
503
504 OE_MSG_PUB.Count_And_Get
505 ( p_count => x_msg_count
506 , p_data => x_msg_data
507 );
508
509 WHEN OTHERS THEN
510
511 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
512
513 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
514 THEN
515 OE_MSG_PUB.Add_Exc_Msg
516 ( G_PKG_NAME
517 , 'Get_Attributes'
518 );
519 END IF;
520
521 -- Get message count and data
522
523 OE_MSG_PUB.Count_And_Get
524 ( p_count => x_msg_count
525 , p_data => x_msg_data
526 );
527
528 END Get_Attributes;
529
530 -- Procedure Id_To_Value
531
532 PROCEDURE Id_To_Value
533 ( p_CON_rec IN Con_Rec_Type
534 , p_SEG_tbl IN Seg_Tbl_Type
535 , x_CON_val_rec OUT NOCOPY /* file.sql.39 change */ Con_Val_Rec_Type
536 , x_SEG_val_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Val_Tbl_Type
537 )
538 IS
539 BEGIN
540
541 -- Convert CON
542
543 x_CON_val_rec := QP_Con_Util.Get_Values(p_CON_rec);
544
545 -- Convert SEG
546
547 FOR I IN 1..p_SEG_tbl.COUNT LOOP
548 x_SEG_val_tbl(I) :=
549 QP_Seg_Util.Get_Values(p_SEG_tbl(I));
550 END LOOP;
551
552 EXCEPTION
553
554 WHEN OTHERS THEN
555
556 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
557 THEN
558 OE_MSG_PUB.Add_Exc_Msg
559 ( G_PKG_NAME
560 , 'Id_To_Value'
561 );
562 END IF;
563
564 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
565
566 END Id_To_Value;
567
568 -- Procedure Value_To_Id
569
570 PROCEDURE Value_To_Id
571 ( x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2
572 , p_CON_rec IN Con_Rec_Type
573 , p_CON_val_rec IN Con_Val_Rec_Type
574 , p_SEG_tbl IN Seg_Tbl_Type
575 , p_SEG_val_tbl IN Seg_Val_Tbl_Type
576 , x_CON_rec OUT NOCOPY /* file.sql.39 change */ Con_Rec_Type
577 , x_SEG_tbl OUT NOCOPY /* file.sql.39 change */ Seg_Tbl_Type
578 )
579 IS
580 l_CON_rec Con_Rec_Type;
581 l_SEG_rec Seg_Rec_Type;
582 l_index BINARY_INTEGER;
583 BEGIN
584
585 -- Init x_return_status.
586
587 x_return_status := FND_API.G_RET_STS_SUCCESS;
588
589 -- Convert CON
590
591 l_CON_rec := QP_Con_Util.Get_Ids
592 ( p_CON_rec => p_CON_rec
593 , p_CON_val_rec => p_CON_val_rec
594 );
595
596 x_CON_rec := l_CON_rec;
597
598 IF l_CON_rec.return_status = FND_API.G_RET_STS_ERROR THEN
599 x_return_status := FND_API.G_RET_STS_ERROR;
600 END IF;
601
602 -- Convert SEG
603
604 x_SEG_tbl := p_SEG_tbl;
605
606 l_index := p_SEG_val_tbl.FIRST;
607
608 WHILE l_index IS NOT NULL LOOP
609
610 l_SEG_rec := QP_Seg_Util.Get_Ids
611 ( p_SEG_rec => p_SEG_tbl(l_index)
612 , p_SEG_val_rec => p_SEG_val_tbl(l_index)
613 );
614
615 x_SEG_tbl(l_index) := l_SEG_rec;
616
617 IF l_SEG_rec.return_status = FND_API.G_RET_STS_ERROR THEN
618 x_return_status := FND_API.G_RET_STS_ERROR;
619 END IF;
620
621 l_index := p_SEG_val_tbl.NEXT(l_index);
622
623 END LOOP;
624
625 EXCEPTION
626
627 WHEN OTHERS THEN
628
629 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
630 THEN
631 OE_MSG_PUB.Add_Exc_Msg
632 ( G_PKG_NAME
633 , 'Value_To_Id'
634 );
635 END IF;
636
637 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
638
639 END Value_To_Id;
640
641 END QP_Attributes_PUB;