DBA Data[Home] [Help]

PACKAGE BODY: APPS.QP_PRICE_FORMULA_PUB

Source


1 PACKAGE BODY QP_Price_Formula_PUB AS
2 /* $Header: QPXPPRFB.pls 120.4 2006/10/25 08:14:53 nirmkuma ship $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'QP_Price_Formula_PUB';
7 
8 --  Forward declaration of Procedure Id_To_Value
9 
10 PROCEDURE Id_To_Value
11 (   p_FORMULA_rec                   IN  Formula_Rec_Type
12 ,   p_FORMULA_LINES_tbl             IN  Formula_Lines_Tbl_Type
13 ,   x_FORMULA_val_rec               OUT NOCOPY /* file.sql.39 change */ Formula_Val_Rec_Type
14 ,   x_FORMULA_LINES_val_tbl         OUT NOCOPY /* file.sql.39 change */ Formula_Lines_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_FORMULA_rec                   IN  Formula_Rec_Type
22 ,   p_FORMULA_val_rec               IN  Formula_Val_Rec_Type
23 ,   p_FORMULA_LINES_tbl             IN  Formula_Lines_Tbl_Type
24 ,   p_FORMULA_LINES_val_tbl         IN  Formula_Lines_Val_Tbl_Type
25 ,   x_FORMULA_rec                   OUT NOCOPY /* file.sql.39 change */ Formula_Rec_Type
26 ,   x_FORMULA_LINES_tbl             OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Tbl_Type
27 );
28 
29 --  Start of Comments
30 --  API name    Process_Price_Formula
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_Price_Formula
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_FORMULA_rec                   IN  Formula_Rec_Type :=
54                                         G_MISS_FORMULA_REC
55 ,   p_FORMULA_val_rec               IN  Formula_Val_Rec_Type :=
56                                         G_MISS_FORMULA_VAL_REC
57 ,   p_FORMULA_LINES_tbl             IN  Formula_Lines_Tbl_Type :=
58                                         G_MISS_FORMULA_LINES_TBL
59 ,   p_FORMULA_LINES_val_tbl         IN  Formula_Lines_Val_Tbl_Type :=
60                                         G_MISS_FORMULA_LINES_VAL_TBL
61 ,   x_FORMULA_rec                   OUT NOCOPY /* file.sql.39 change */ Formula_Rec_Type
62 ,   x_FORMULA_val_rec               OUT NOCOPY /* file.sql.39 change */ Formula_Val_Rec_Type
63 ,   x_FORMULA_LINES_tbl             OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Tbl_Type
64 ,   x_FORMULA_LINES_val_tbl         OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Val_Tbl_Type
65 )
66 IS
67 l_api_version_number          CONSTANT NUMBER := 1.0;
68 l_api_name                    CONSTANT VARCHAR2(30):= 'Process_Price_Formula';
69 l_control_rec                 QP_GLOBALS.Control_Rec_Type;
70 l_return_status               VARCHAR2(1);
71 l_qp_status                   VARCHAR2(1);
72 l_FORMULA_rec                 Formula_Rec_Type;
73 l_FORMULA_LINES_tbl           Formula_Lines_Tbl_Type;
74 
75 l_p_FORMULA_rec		      Formula_Rec_Type; --[prarasto]
76 l_p_FORMULA_LINES_tbl         Formula_Lines_Tbl_Type;--[prarasto]
77 
78 BEGIN
79     SAVEPOINT QP_PPF;
80     --  Standard call to check for call compatibility
81 
82     IF NOT FND_API.Compatible_API_Call
83            (   l_api_version_number
84            ,   p_api_version_number
85            ,   l_api_name
86            ,   G_PKG_NAME
87            )
88     THEN
89         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
90     END IF;
91 
92     l_qp_status := QP_UTIL.get_qp_status;
93 
94     IF l_qp_status = 'S' THEN -- Public API unavailable for Basic Pricing
95 
96        l_return_status := FND_API.G_RET_STS_ERROR;
97 	  FND_MESSAGE.SET_NAME('QP', 'QP_BASIC_PRICING_UNAVAILABLE');
98 	  OE_MSG_PUB.Add;
99        RAISE FND_API.G_EXC_ERROR;
100 
101     ELSIF l_qp_status = 'N' THEN
102 
103        l_return_status := FND_API.G_RET_STS_ERROR;
104 	  FND_MESSAGE.SET_NAME('QP', 'QP_PRICING_NOT_INSTALLED');
105 	  OE_MSG_PUB.Add;
106        RAISE FND_API.G_EXC_ERROR;
107 
108     END IF;
109 
110     --  Perform Value to Id conversion
111 
112     Value_To_Id
113     (   x_return_status               => l_return_status
114     ,   p_FORMULA_rec                 => p_FORMULA_rec
115     ,   p_FORMULA_val_rec             => p_FORMULA_val_rec
116     ,   p_FORMULA_LINES_tbl           => p_FORMULA_LINES_tbl
117     ,   p_FORMULA_LINES_val_tbl       => p_FORMULA_LINES_val_tbl
118     ,   x_FORMULA_rec                 => l_FORMULA_rec
119     ,   x_FORMULA_LINES_tbl           => l_FORMULA_LINES_tbl
120     );
121 
122     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
123         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
124     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
125         RAISE FND_API.G_EXC_ERROR;
126     END IF;
127 
128 
129     --  Call QP_Price_Formula_PVT.Process_Price_Formula
130     -- rbagri - set the called_from_ui indicator to 'N', as QP_PRICE_FORMULA_PUB.Process_Price_Formula is
131     -- being called from public package
132 
133     l_control_rec.called_from_ui := 'N';
134     l_p_FORMULA_rec := l_FORMULA_rec;		  --[prarasto]
135     l_p_FORMULA_LINES_tbl := l_FORMULA_LINES_tbl; --[prarasto]
136 
137     QP_Price_Formula_PVT.Process_Price_Formula
138     (   p_api_version_number          => 1.0
139     ,   p_init_msg_list               => p_init_msg_list
140     ,   p_validation_level            => FND_API.G_VALID_LEVEL_FULL
141     ,   p_commit                      => p_commit
142     ,   x_return_status               => x_return_status
143     ,   x_msg_count                   => x_msg_count
144     ,   x_msg_data                    => x_msg_data
145     ,   p_control_rec                 => l_control_rec
146     ,   p_FORMULA_rec                 => l_p_FORMULA_rec
147     ,   p_FORMULA_LINES_tbl           => l_p_FORMULA_LINES_tbl
148     ,   x_FORMULA_rec                 => l_FORMULA_rec
149     ,   x_FORMULA_LINES_tbl           => l_FORMULA_LINES_tbl
150     );
151 
152     --  Load Id OUT parameters.
153 
154     x_FORMULA_rec                  := l_FORMULA_rec;
155     x_FORMULA_LINES_tbl            := l_FORMULA_LINES_tbl;
156 
157     --  If p_return_values is TRUE then convert Ids to Values.
158 
159     IF FND_API.to_Boolean(p_return_values) THEN
160 
161         Id_To_Value
162         (   p_FORMULA_rec                 => l_FORMULA_rec
163         ,   p_FORMULA_LINES_tbl           => l_FORMULA_LINES_tbl
164         ,   x_FORMULA_val_rec             => x_FORMULA_val_rec
165         ,   x_FORMULA_LINES_val_tbl       => x_FORMULA_LINES_val_tbl
166         );
167 
168     END IF;
169 
170 --Roll Back the transaction if the return status is not success and it is called from API, bug #5345652
171 
172         If x_return_status <> 'S' AND l_control_rec.called_from_ui='N' THEN
173                 Rollback TO QP_PPF;
174         END IF;
175 
176 EXCEPTION
177 
178     WHEN FND_API.G_EXC_ERROR THEN
179 
180         x_return_status := FND_API.G_RET_STS_ERROR;
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 --Roll Back the transaction if the return status is not success and it is called from API, bug #5345652
189         If l_control_rec.called_from_ui='N' THEN
190                 Rollback TO QP_PPF;
191         END IF;
192 
193     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
194 
195         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
196 
197         --  Get message count and data
198 
199         OE_MSG_PUB.Count_And_Get
200         (   p_count                       => x_msg_count
201         ,   p_data                        => x_msg_data
202         );
203 --Roll Back the transaction if the return status is not success and it is called from API, bug #5345652
204         If l_control_rec.called_from_ui='N' THEN
205                 Rollback TO QP_PPF;
206         END IF;
207 
208     WHEN OTHERS THEN
209 
210         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
211 
212         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
213         THEN
214             OE_MSG_PUB.Add_Exc_Msg
215             (   G_PKG_NAME
216             ,   'Process_Price_Formula'
217             );
218         END IF;
219 
220         --  Get message count and data
221 
222         OE_MSG_PUB.Count_And_Get
223         (   p_count                       => x_msg_count
224         ,   p_data                        => x_msg_data
225         );
226 --Roll Back the transaction if the return status is not success and it is called from API, bug #5345652
227         If l_control_rec.called_from_ui='N' THEN
228                 Rollback TO QP_PPF;
229         END IF;
230 
231 END Process_Price_Formula;
232 
233 --  Start of Comments
234 --  API name    Lock_Price_Formula
235 --  Type        Public
236 --  Function
237 --
238 --  Pre-reqs
239 --
240 --  Parameters
241 --
242 --  Version     Current version = 1.0
243 --              Initial version = 1.0
244 --
245 --  Notes
246 --
247 --  End of Comments
248 
249 PROCEDURE Lock_Price_Formula
250 (   p_api_version_number            IN  NUMBER
251 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
252 ,   p_return_values                 IN  VARCHAR2 := FND_API.G_FALSE
253 ,   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
254 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
255 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
256 ,   p_FORMULA_rec                   IN  Formula_Rec_Type :=
257                                         G_MISS_FORMULA_REC
258 ,   p_FORMULA_val_rec               IN  Formula_Val_Rec_Type :=
259                                         G_MISS_FORMULA_VAL_REC
260 ,   p_FORMULA_LINES_tbl             IN  Formula_Lines_Tbl_Type :=
261                                         G_MISS_FORMULA_LINES_TBL
262 ,   p_FORMULA_LINES_val_tbl         IN  Formula_Lines_Val_Tbl_Type :=
263                                         G_MISS_FORMULA_LINES_VAL_TBL
264 ,   x_FORMULA_rec                   OUT NOCOPY /* file.sql.39 change */ Formula_Rec_Type
265 ,   x_FORMULA_val_rec               OUT NOCOPY /* file.sql.39 change */ Formula_Val_Rec_Type
266 ,   x_FORMULA_LINES_tbl             OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Tbl_Type
267 ,   x_FORMULA_LINES_val_tbl         OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Val_Tbl_Type
268 )
269 IS
270 l_api_version_number          CONSTANT NUMBER := 1.0;
271 l_api_name                    CONSTANT VARCHAR2(30):= 'Lock_Price_Formula';
272 l_return_status               VARCHAR2(1);
273 l_FORMULA_rec                 Formula_Rec_Type;
274 l_FORMULA_LINES_tbl           Formula_Lines_Tbl_Type;
275 
276 l_p_FORMULA_rec		      Formula_Rec_Type; --[prarasto]
277 l_p_FORMULA_LINES_tbl         Formula_Lines_Tbl_Type;--[prarasto]
278 
279 BEGIN
280 
281     --  Standard call to check for call compatibility
282 
283     IF NOT FND_API.Compatible_API_Call
284            (   l_api_version_number
285            ,   p_api_version_number
286            ,   l_api_name
287            ,   G_PKG_NAME
288            )
289     THEN
290         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
291     END IF;
292 
293     --  Perform Value to Id conversion
294 
295     Value_To_Id
296     (   x_return_status               => l_return_status
297     ,   p_FORMULA_rec                 => p_FORMULA_rec
298     ,   p_FORMULA_val_rec             => p_FORMULA_val_rec
299     ,   p_FORMULA_LINES_tbl           => p_FORMULA_LINES_tbl
300     ,   p_FORMULA_LINES_val_tbl       => p_FORMULA_LINES_val_tbl
301     ,   x_FORMULA_rec                 => l_FORMULA_rec
302     ,   x_FORMULA_LINES_tbl           => l_FORMULA_LINES_tbl
303     );
304 
305     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
306         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
307     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
308         RAISE FND_API.G_EXC_ERROR;
309     END IF;
310 
311 
312     --  Call QP_Price_Formula_PVT.Lock_Price_Formula
313 
314     l_p_FORMULA_rec := l_FORMULA_rec;		  --[prarasto]
315     l_p_FORMULA_LINES_tbl := l_FORMULA_LINES_tbl; --[prarasto]
316 
317     QP_Price_Formula_PVT.Lock_Price_Formula
318     (   p_api_version_number          => 1.0
319     ,   p_init_msg_list               => p_init_msg_list
320     ,   x_return_status               => x_return_status
321     ,   x_msg_count                   => x_msg_count
322     ,   x_msg_data                    => x_msg_data
323     ,   p_FORMULA_rec                 => l_p_FORMULA_rec
324     ,   p_FORMULA_LINES_tbl           => l_p_FORMULA_LINES_tbl
325     ,   x_FORMULA_rec                 => l_FORMULA_rec
326     ,   x_FORMULA_LINES_tbl           => l_FORMULA_LINES_tbl
327     );
328 
329     --  Load Id OUT parameters.
330 
331     x_FORMULA_rec                  := l_FORMULA_rec;
332     x_FORMULA_LINES_tbl            := l_FORMULA_LINES_tbl;
333 
334     --  If p_return_values is TRUE then convert Ids to Values.
335 
336     IF FND_API.to_Boolean(p_return_values) THEN
337 
338         Id_To_Value
339         (   p_FORMULA_rec                 => l_FORMULA_rec
340         ,   p_FORMULA_LINES_tbl           => l_FORMULA_LINES_tbl
341         ,   x_FORMULA_val_rec             => x_FORMULA_val_rec
342         ,   x_FORMULA_LINES_val_tbl       => x_FORMULA_LINES_val_tbl
343         );
344 
345     END IF;
346 
347 EXCEPTION
348 
349     WHEN FND_API.G_EXC_ERROR THEN
350 
351         x_return_status := FND_API.G_RET_STS_ERROR;
352 
353         --  Get message count and data
354 
355         OE_MSG_PUB.Count_And_Get
356         (   p_count                       => x_msg_count
357         ,   p_data                        => x_msg_data
358         );
359 
360     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
361 
362         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
363 
364         --  Get message count and data
365 
366         OE_MSG_PUB.Count_And_Get
367         (   p_count                       => x_msg_count
368         ,   p_data                        => x_msg_data
369         );
370 
371     WHEN OTHERS THEN
372 
373         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
374 
375         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
376         THEN
377             OE_MSG_PUB.Add_Exc_Msg
378             (   G_PKG_NAME
379             ,   'Lock_Price_Formula'
380             );
381         END IF;
382 
383         --  Get message count and data
384 
385         OE_MSG_PUB.Count_And_Get
386         (   p_count                       => x_msg_count
387         ,   p_data                        => x_msg_data
388         );
389 
390 END Lock_Price_Formula;
391 
392 --  Start of Comments
393 --  API name    Get_Price_Formula
394 --  Type        Public
395 --  Function
396 --
397 --  Pre-reqs
398 --
399 --  Parameters
400 --
401 --  Version     Current version = 1.0
402 --              Initial version = 1.0
403 --
404 --  Notes
405 --
406 --  End of Comments
407 
408 PROCEDURE Get_Price_Formula
409 (   p_api_version_number            IN  NUMBER
410 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
411 ,   p_return_values                 IN  VARCHAR2 := FND_API.G_FALSE
412 ,   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
413 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
414 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
415 ,   p_price_formula_id              IN  NUMBER :=
416                                         FND_API.G_MISS_NUM
417 ,   p_price_formula                 IN  VARCHAR2 :=
418                                         FND_API.G_MISS_CHAR
419 ,   x_FORMULA_rec                   OUT NOCOPY /* file.sql.39 change */ Formula_Rec_Type
420 ,   x_FORMULA_val_rec               OUT NOCOPY /* file.sql.39 change */ Formula_Val_Rec_Type
421 ,   x_FORMULA_LINES_tbl             OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Tbl_Type
422 ,   x_FORMULA_LINES_val_tbl         OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Val_Tbl_Type
423 )
424 IS
425 l_api_version_number          CONSTANT NUMBER := 1.0;
426 l_api_name                    CONSTANT VARCHAR2(30):= 'Get_Price_Formula';
427 l_price_formula_id            NUMBER := p_price_formula_id;
428 l_FORMULA_rec                 QP_Price_Formula_PUB.Formula_Rec_Type;
429 l_FORMULA_LINES_tbl           QP_Price_Formula_PUB.Formula_Lines_Tbl_Type;
430 BEGIN
431 
432     --  Standard call to check for call compatibility
433 
434     IF NOT FND_API.Compatible_API_Call
435            (   l_api_version_number
436            ,   p_api_version_number
437            ,   l_api_name
438            ,   G_PKG_NAME
439            )
440     THEN
441         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
442     END IF;
443 
444     --  Standard check for Val/ID conversion
445 
446     IF  p_price_formula = FND_API.G_MISS_CHAR
447     THEN
448 
449         l_price_formula_id := p_price_formula_id;
450 
451     ELSIF p_price_formula_id <> FND_API.G_MISS_NUM THEN
452 
453         l_price_formula_id := p_price_formula_id;
454 
455         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
456         THEN
457 
458             FND_MESSAGE.SET_NAME('QP','FND_BOTH_VAL_AND_ID_EXIST');
459             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','price_formula');
460             OE_MSG_PUB.Add;
461 
462         END IF;
463 
464     ELSE
465 
466         --  Convert Value to Id
467 
468         l_price_formula_id := QP_Value_To_Id.price_formula
469         (   p_price_formula               => p_price_formula
470         );
471 
472         IF l_price_formula_id = FND_API.G_MISS_NUM THEN
473             IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
474             THEN
475 
476                 FND_MESSAGE.SET_NAME('QP','Invalid Business Object Value');
477                 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','price_formula');
478                 OE_MSG_PUB.Add;
479 
480             END IF;
481         END IF;
482 
483         RAISE FND_API.G_EXC_ERROR;
484 
485     END IF;
486 
487 
488     --  Call QP_Price_Formula_PVT.Get_Price_Formula
489 
490     QP_Price_Formula_PVT.Get_Price_Formula
491     (   p_api_version_number          => 1.0
492     ,   p_init_msg_list               => p_init_msg_list
493     ,   x_return_status               => x_return_status
494     ,   x_msg_count                   => x_msg_count
495     ,   x_msg_data                    => x_msg_data
496     ,   p_price_formula_id            => l_price_formula_id
497     ,   x_FORMULA_rec                 => l_FORMULA_rec
498     ,   x_FORMULA_LINES_tbl           => l_FORMULA_LINES_tbl
499     );
500 
501     --  Load Id OUT parameters.
502 
503     x_FORMULA_rec                  := l_FORMULA_rec;
504     x_FORMULA_LINES_tbl            := l_FORMULA_LINES_tbl;
505 
506     --  If p_return_values is TRUE then convert Ids to Values.
507 
508     IF FND_API.TO_BOOLEAN(p_return_values) THEN
509 
510         Id_To_Value
511         (   p_FORMULA_rec                 => l_FORMULA_rec
512         ,   p_FORMULA_LINES_tbl           => l_FORMULA_LINES_tbl
513         ,   x_FORMULA_val_rec             => x_FORMULA_val_rec
514         ,   x_FORMULA_LINES_val_tbl       => x_FORMULA_LINES_val_tbl
515         );
516 
517     END IF;
518 
519     --  Set return status
520 
521     x_return_status := FND_API.G_RET_STS_SUCCESS;
522 
523     --  Get message count and data
524 
525     OE_MSG_PUB.Count_And_Get
526     (   p_count                       => x_msg_count
527     ,   p_data                        => x_msg_data
528     );
529 
530 
531 EXCEPTION
532 
533     WHEN FND_API.G_EXC_ERROR THEN
534 
535         x_return_status := FND_API.G_RET_STS_ERROR;
536 
537         --  Get message count and data
538 
539         OE_MSG_PUB.Count_And_Get
540         (   p_count                       => x_msg_count
541         ,   p_data                        => x_msg_data
542         );
543 
544     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
545 
546         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
547 
548         --  Get message count and data
549 
550         OE_MSG_PUB.Count_And_Get
551         (   p_count                       => x_msg_count
552         ,   p_data                        => x_msg_data
553         );
554 
555     WHEN OTHERS THEN
556 
557         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
558 
559         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
560         THEN
561             OE_MSG_PUB.Add_Exc_Msg
562             (   G_PKG_NAME
563             ,   'Get_Price_Formula'
564             );
565         END IF;
566 
567         --  Get message count and data
568 
569         OE_MSG_PUB.Count_And_Get
570         (   p_count                       => x_msg_count
571         ,   p_data                        => x_msg_data
572         );
573 
574 END Get_Price_Formula;
575 
576 --  Procedure Id_To_Value
577 
578 PROCEDURE Id_To_Value
579 (   p_FORMULA_rec                   IN  Formula_Rec_Type
580 ,   p_FORMULA_LINES_tbl             IN  Formula_Lines_Tbl_Type
581 ,   x_FORMULA_val_rec               OUT NOCOPY /* file.sql.39 change */ Formula_Val_Rec_Type
582 ,   x_FORMULA_LINES_val_tbl         OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Val_Tbl_Type
583 )
584 IS
585 BEGIN
586 
587     --  Convert FORMULA
588 
589     x_FORMULA_val_rec := QP_Formula_Util.Get_Values(p_FORMULA_rec);
590 
591     --  Convert FORMULA_LINES
592 
593     FOR I IN 1..p_FORMULA_LINES_tbl.COUNT LOOP
594         x_FORMULA_LINES_val_tbl(I) :=
595             QP_Formula_Lines_Util.Get_Values(p_FORMULA_LINES_tbl(I));
596     END LOOP;
597 
598 EXCEPTION
599 
600     WHEN OTHERS THEN
601 
602         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
603         THEN
604             OE_MSG_PUB.Add_Exc_Msg
605             (   G_PKG_NAME
606             ,   'Id_To_Value'
607             );
608         END IF;
609 
610         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
611 
612 END Id_To_Value;
613 
614 --  Procedure Value_To_Id
615 
616 PROCEDURE Value_To_Id
617 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
618 ,   p_FORMULA_rec                   IN  Formula_Rec_Type
619 ,   p_FORMULA_val_rec               IN  Formula_Val_Rec_Type
620 ,   p_FORMULA_LINES_tbl             IN  Formula_Lines_Tbl_Type
621 ,   p_FORMULA_LINES_val_tbl         IN  Formula_Lines_Val_Tbl_Type
622 ,   x_FORMULA_rec                   OUT NOCOPY /* file.sql.39 change */ Formula_Rec_Type
623 ,   x_FORMULA_LINES_tbl             OUT NOCOPY /* file.sql.39 change */ Formula_Lines_Tbl_Type
624 )
625 IS
626 l_FORMULA_rec                 Formula_Rec_Type;
627 l_FORMULA_LINES_rec           Formula_Lines_Rec_Type;
628 l_index                       BINARY_INTEGER;
629 BEGIN
630 
631     --  Init x_return_status.
632 
633     x_return_status := FND_API.G_RET_STS_SUCCESS;
634 
635     --  Convert FORMULA
636 
637     l_FORMULA_rec := QP_Formula_Util.Get_Ids
638     (   p_FORMULA_rec                 => p_FORMULA_rec
639     ,   p_FORMULA_val_rec             => p_FORMULA_val_rec
640     );
641 
642     x_FORMULA_rec                  := l_FORMULA_rec;
643 
644     IF l_FORMULA_rec.return_status = FND_API.G_RET_STS_ERROR THEN
645         x_return_status := FND_API.G_RET_STS_ERROR;
646     END IF;
647 
648     --  Convert FORMULA_LINES
649 
650     x_FORMULA_LINES_tbl := p_FORMULA_LINES_tbl;
651 
652     l_index := p_FORMULA_LINES_val_tbl.FIRST;
653 
654     WHILE l_index IS NOT NULL LOOP
655 
656         l_FORMULA_LINES_rec := QP_Formula_Lines_Util.Get_Ids
657         (   p_FORMULA_LINES_rec           => p_FORMULA_LINES_tbl(l_index)
658         ,   p_FORMULA_LINES_val_rec       => p_FORMULA_LINES_val_tbl(l_index)
659         );
660 
661         x_FORMULA_LINES_tbl(l_index)   := l_FORMULA_LINES_rec;
662 
663         IF l_FORMULA_LINES_rec.return_status = FND_API.G_RET_STS_ERROR THEN
664             x_return_status := FND_API.G_RET_STS_ERROR;
665         END IF;
666 
667         l_index := p_FORMULA_LINES_val_tbl.NEXT(l_index);
668 
669     END LOOP;
670 
671 EXCEPTION
672 
673     WHEN OTHERS THEN
674 
675         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
676         THEN
677             OE_MSG_PUB.Add_Exc_Msg
678             (   G_PKG_NAME
679             ,   'Value_To_Id'
680             );
681         END IF;
682 
683         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
684 
685 END Value_To_Id;
686 
687 END QP_Price_Formula_PUB;