DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_PRICING_CONT_PUB

Source


1 PACKAGE BODY OE_Pricing_Cont_PUB AS
2 /* $Header: OEXPPRCB.pls 120.5 2006/09/14 17:58:30 shulin ship $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'OE_Pricing_Cont_PUB';
7 
8 --  Forward declaration of Procedure Id_To_Value
9 
10 PROCEDURE Id_To_Value
11 (   p_Agreement_rec                 IN  Agreement_Rec_Type
12 ,   p_Price_LHeader_rec             IN  QP_Price_List_PUB.Price_List_Rec_Type
13 ,   p_Price_LLine_tbl               IN  QP_Price_List_PUB.Price_List_Line_Tbl_Type
14 ,   p_Pricing_Attr_tbl              IN  QP_Price_List_PUB.Pricing_Attr_Tbl_Type
15 ,   x_Agreement_val_rec             OUT NOCOPY /* file.sql.39 change */ Agreement_Val_Rec_Type
16 ,   x_Price_LHeader_val_rec         OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Val_Rec_Type
17 ,   x_Price_LLine_val_tbl           OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type
18 ,   x_Pricing_Attr_val_tbl          OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type
19 );
20 
21 --  Forward declaration of procedure Value_To_Id
22 
23 PROCEDURE Value_To_Id
24 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
25 ,   p_Agreement_rec                 IN  Agreement_Rec_Type
26 ,   p_Agreement_val_rec             IN  Agreement_Val_Rec_Type
27 ,   p_Price_LHeader_rec             IN  QP_Price_List_PUB.Price_List_Rec_Type
28 ,   p_Price_LHeader_val_rec         IN  QP_Price_List_PUB.Price_List_Val_Rec_Type
29 ,   p_Price_LLine_tbl               IN  QP_Price_List_PUB.Price_List_Line_Tbl_Type
30 ,   p_Price_LLine_val_tbl           IN  QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type
31 ,   p_Pricing_Attr_tbl              IN  QP_Price_List_PUB.Pricing_Attr_Tbl_Type
32 ,   p_Pricing_Attr_val_tbl          IN  QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type
33 ,   x_Agreement_rec                 OUT NOCOPY /* file.sql.39 change */ Agreement_Rec_Type
34 ,   x_Price_LHeader_rec             OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Rec_Type
35 ,   x_Price_LLine_tbl               OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Tbl_Type
36 ,   x_Pricing_Attr_tbl              OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Tbl_Type
37 );
38 
39 --  Start of Comments
40 --  API name    Process_Agreement
41 --  Type        Public
42 --  Function
43 --
44 --  Pre-reqs
45 --
46 --  Parameters
47 --
48 --  Version     Current version = 1.0
49 --              Initial version = 1.0
50 --
51 --  Notes
52 --
53 --  End of Comments
54 
55 PROCEDURE Process_Agreement
56 (   p_api_version_number            IN  NUMBER
57 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
58 ,   p_return_values                 IN  VARCHAR2 := FND_API.G_FALSE
59 ,   p_commit                        IN  VARCHAR2 := FND_API.G_FALSE
60 ,   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
61 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
62 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
63 ,   p_Agreement_rec                 IN  Agreement_Rec_Type :=
64                                         G_MISS_AGREEMENT_REC
65 ,   p_Agreement_val_rec             IN  Agreement_Val_Rec_Type :=
66                                         G_MISS_AGREEMENT_VAL_REC
67 ,   p_Price_LHeader_rec             IN  QP_Price_List_PUB.Price_List_Rec_Type :=
68 								G_MISS_PRICE_LIST_REC
69 ,   p_Price_LHeader_val_rec         IN  QP_Price_List_PUB.Price_List_Val_Rec_Type :=
70 								G_MISS_PRICE_LIST_VAL_REC
71 ,   p_Price_LLine_tbl               IN  QP_Price_List_PUB.Price_List_Line_Tbl_Type :=
72 								G_MISS_PRICE_LIST_LINE_TBL
73 ,   p_Price_LLine_val_tbl           IN  QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type :=
74 								G_MISS_PRICE_LIST_LINE_VAL_TBL
75 ,   p_Pricing_Attr_tbl              IN  QP_Price_List_PUB.Pricing_Attr_Tbl_Type :=
76 								G_MISS_PRICING_ATTR_TBL
77 ,   p_Pricing_Attr_val_tbl          IN  QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type :=
78 								G_MISS_PRICING_ATTR_VAL_TBL
79 ,   x_Agreement_rec                 OUT NOCOPY /* file.sql.39 change */ Agreement_Rec_Type
80 ,   x_Agreement_val_rec             OUT NOCOPY /* file.sql.39 change */ Agreement_Val_Rec_Type
81 ,   x_Price_LHeader_rec             OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Rec_Type
82 ,   x_Price_LHeader_val_rec         OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Val_Rec_Type
83 ,   x_Price_LLine_tbl               OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Tbl_Type
84 ,   x_Price_LLine_val_tbl           OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type
85 ,   x_Pricing_Attr_tbl              OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Tbl_Type
86 ,   x_Pricing_Attr_val_tbl          OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type
87 ,   p_check_duplicate_lines         IN  VARCHAR2 DEFAULT NULL  --5024919, 5018856, 5024801
88 )
89 IS
90 l_api_version_number          CONSTANT NUMBER := 1.0;
91 l_api_name                    CONSTANT VARCHAR2(30):= 'Process_Agreement';
92 l_control_rec                 QP_GLOBALS.Control_Rec_Type;
93 l_control_rec_dummy                 OE_GLOBALS.Control_Rec_Type;
94 
95 l_return_status               VARCHAR2(1);
96 l_Agreement_rec               Agreement_Rec_Type;
97 l_Price_LHeader_rec           QP_Price_List_PUB.Price_List_Rec_Type;
98 l_Price_LHeader_rec_dummy     OE_Price_List_PUB.Price_List_Rec_Type;
99 l_Price_LLine_tbl             QP_Price_List_PUB.Price_List_Line_Tbl_Type;
100 l_Price_LLine_tbl_dummy       OE_Price_List_PUB.Price_List_Line_Tbl_Type;
101 l_QUALIFIERS_tbl              Qp_Qualifier_Rules_Pub.Qualifiers_Tbl_Type;
102 x_QUALIFIERS_tbl              Qp_Qualifier_Rules_Pub.Qualifiers_Tbl_Type; --4949185, 5530054
103 l_Pricing_Attr_tbl            QP_Price_List_PUB.Pricing_Attr_Tbl_Type;
104 l_installed_status            VARCHAR2(1);
105 
106 l_Contract_rec                Contract_Rec_Type;
107 l_Discount_Header_rec         Discount_Header_Rec_Type;
108 l_Discount_Cust_tbl           Discount_Cust_Tbl_Type;
109 l_Discount_Line_tbl           Discount_Line_Tbl_Type;
110 l_Price_Break_tbl             Price_Break_Tbl_Type;
111 
112 l_p_Price_LHeader_rec		QP_Price_List_PUB.Price_List_Rec_Type;--[prarasto]
113 l_p_Price_LLine_tbl		QP_Price_List_PUB.Price_List_Line_Tbl_Type;	 --[prarasto]
114 l_p_QUALIFIERS_tbl		Qp_Qualifier_Rules_Pub.Qualifiers_Tbl_Type;	 --[prarasto]
115 l_p_Pricing_Attr_tbl		QP_Price_List_PUB.Pricing_Attr_Tbl_Type;	 --[prarasto]
116 l_p_Contract_rec		Contract_Rec_Type;	 --[prarasto]
117 l_p_Agreement_rec		Agreement_Rec_Type;	 --[prarasto]
118 l_p_Price_LHeader_rec_dummy	OE_Price_List_PUB.Price_List_Rec_Type; --[prarasto]
119 l_p_Discount_Header_rec		Discount_Header_Rec_Type; --[prarasto]
120 l_p_Price_LLine_tbl_dummy	OE_Price_List_PUB.Price_List_Line_Tbl_Type;  --[prarasto]
121 l_p_Discount_Cust_tbl		Discount_Cust_Tbl_Type; --[prarasto]
122 l_p_Discount_Line_tbl		Discount_Line_Tbl_Type; --[prarasto]
123 l_p_Price_Break_tbl		Price_Break_Tbl_Type; --[prarasto]
124 
125 BEGIN
126 --5018856, 5024919, 5024801
127 QP_GLOBALS.G_CHECK_DUP_PRICELIST_LINES := p_check_duplicate_lines;
128 oe_debug_pub.add('G_CHECK_DUP_PRICELIST_LINES '||QP_GLOBALS.G_CHECK_DUP_PRICELIST_LINES);
129     --  Standard call to check for call compatibility
130 
131     IF NOT FND_API.Compatible_API_Call
132            (   l_api_version_number
133            ,   p_api_version_number
134            ,   l_api_name
135            ,   G_PKG_NAME
136            )
137     THEN
138         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
139     END IF;
140 
141 
142   	/* check for installation status ; if it's basic then this api
143    	is not available */
144 
145   	l_installed_status := QP_UTIL.get_qp_status;
146 
147   	IF l_installed_status IN ('S', 'N') THEN
148 		 l_return_status := FND_API.G_RET_STS_ERROR;
149 		 FND_MESSAGE.SET_NAME('QP', 'QP_BASIC_PRICING_UNAVAILABLE');
150 		 OE_MSG_PUB.Add;
151 		 RAISE FND_API.G_EXC_ERROR;
152 	END IF;
153 
154 --added for moac
155 --Initialize MOAC and set org context to Multiple
156 
157   IF MO_GLOBAL.get_access_mode is null THEN
158     MO_GLOBAL.Init('QP');
159 --    MO_GLOBAL.set_policy_context('M', null); --commented as MO_GLOBAL.Init will set_policy_context  to 'M' or 'S' based on profile settings
160   END IF;--MO_GLOBAL
161 
162 
163     --  Perform Value to Id conversion
164 
165     Value_To_Id
166     (   x_return_status               => l_return_status
167     ,   p_Agreement_rec               => p_Agreement_rec
168     ,   p_Agreement_val_rec           => p_Agreement_val_rec
169     ,   p_Price_LHeader_rec           => p_Price_LHeader_rec
170     ,   p_Price_LHeader_val_rec       => p_Price_LHeader_val_rec
171     ,   p_Price_LLine_tbl             => p_Price_LLine_tbl
172     ,   p_Price_LLine_val_tbl         => p_Price_LLine_val_tbl
173     ,   p_Pricing_Attr_tbl	      => p_Pricing_Attr_tbl
174     ,   p_Pricing_Attr_val_tbl        => p_Pricing_Attr_val_tbl
175     ,   x_Agreement_rec               => l_Agreement_rec
176     ,   x_Price_LHeader_rec           => l_Price_LHeader_rec
177     ,   x_Price_LLine_tbl             => l_Price_LLine_tbl
178     ,   x_Pricing_Attr_tbl            => l_Pricing_Attr_tbl
179     );
180 
181     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
182         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
183     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
184         RAISE FND_API.G_EXC_ERROR;
185     END IF;
186 
187 
188 /* First we will process the price list associated with the agreement
189    and as we get the price list id, we can associate that with the agreement record later */
190 
191 -- Call the Process_Price_List PRIVATE API
192 	oe_debug_pub.add('operation='||NVL(l_Price_LHeader_rec.operation,'MYNAME'));
193 
194   if l_Price_LHeader_rec.operation <> FND_API.G_MISS_CHAR  then
195 
196 		-- Call the process_price_list only when a price list record has been passed
197 
198 		oe_debug_pub.add('Calling the process_price_list API');
199 
200     l_p_Price_LHeader_rec := l_Price_LHeader_rec;--[prarasto]
201     l_p_Price_LLine_tbl := l_Price_LLine_tbl;	 --[prarasto]
202     l_p_QUALIFIERS_tbl  := l_QUALIFIERS_tbl;	 --[prarasto]
203     l_p_Pricing_Attr_tbl:= l_Pricing_Attr_tbl;	 --[prarasto]
204 
205     QP_LIST_HEADERS_PVT.Process_Price_List
206 	(   p_api_version_number          => 1.0
207 	,   p_init_msg_list               => p_init_msg_list
208 	,   p_validation_level            => FND_API.G_VALID_LEVEL_FULL
209 	,   p_commit                      => p_commit
210 	,   x_return_status               => x_return_status
211 	,   x_msg_count                   => x_msg_count
212 	,   x_msg_data                    => x_msg_data
213 	,   p_control_rec                 => l_control_rec
214 	,   p_PRICE_LIST_rec              => l_p_Price_LHeader_rec
215 	,   p_PRICE_LIST_LINE_tbl         => l_p_Price_LLine_tbl
216 	,   p_QUALIFIERS_tbl              => l_p_QUALIFIERS_tbl
217 	,   p_PRICING_ATTR_tbl            => l_p_Pricing_Attr_tbl
218 	,   x_PRICE_LIST_rec              => x_Price_LHeader_rec -- 4949185, 5530054
219 	,   x_PRICE_LIST_LINE_tbl         => x_Price_LLine_tbl -- 4949185, 5530054
220 	,   x_QUALIFIERS_tbl              => x_QUALIFIERS_tbl-- 4949185, 5530054
221 	,   x_PRICING_ATTR_tbl            => x_Pricing_Attr_tbl-- 4949185, 5530054
222     );
223 
224 	oe_debug_pub.add('After process price list..');
225 	oe_debug_pub.add('Price List Id ='||to_char(l_Price_LHeader_rec.list_header_id));
226 
227     --  Load Id OUT parameters.
228     -- 4949185, 5530054 x_Price_LHeader_rec            := l_Price_LHeader_rec;
229     -- 4949185, 5530054 x_Price_LLine_tbl              := l_Price_LLine_tbl;
230     -- 4949185, 5530054 x_Pricing_Attr_tbl             := l_Pricing_Attr_tbl;
231 
232                 l_Price_LHeader_rec            := x_Price_LHeader_rec; --4949185, 5530054
233       		l_Price_LLine_tbl              := x_Price_LLine_tbl; --4949185, 5530054
234 	 	l_Pricing_Attr_tbl             := x_Pricing_Attr_tbl; --4949185, 5530054
235 
236 	/*
237 
238 	--  If p_return_values is TRUE then convert Ids to Values.
239 
240 	IF FND_API.to_Boolean(p_return_values) THEN
241 		Id_To_Value
242 		(   p_PRICE_LIST_rec              => l_Price_LHeader_rec
243 		,   p_PRICE_LIST_LINE_tbl         => l_Price_LLine_tbl
244 		,   p_PRICING_ATTR_tbl            => l_Pricing_Attr_tbl
245 		,   x_PRICE_LIST_val_rec          => x_Price_LHeader_val_rec
246 		,   x_PRICE_LIST_LINE_val_tbl     => x_Price_LLine_val_tbl
247 		,   x_PRICING_ATTR_val_tbl        => x_Pricing_Attr_val_tbl
248 		);
249 
250 	END IF;
251 
252 	*/
253 
254 		/* Assign the price list id to agreement.price_list_id */
255 
256 		l_Agreement_rec.price_list_id := x_Price_LHeader_rec.list_header_id;
257 
258 	end if;
259 	-- end calling the process_price_list when a price lisr record is passed
260 
261 
262 
263 	oe_debug_pub.add('Price List Id ='||to_char(l_Agreement_rec.price_list_id));
264 
265     	--  Call OE_Pricing_Cont_PVT.Process_Pricing_Cont
266 	--  We are still using the old structure for calling this procedure
267 	--  since the procedure is already used by many other programs
268 
269    l_Discount_Header_rec.attribute1 := 'Calling from PUBLIC API';
270 
271     l_p_Contract_rec	:= l_Contract_rec;	 --[prarasto]
272     l_p_Agreement_rec	:= l_Agreement_rec;	 --[prarasto]
273     l_p_Price_LHeader_rec_dummy := l_Price_LHeader_rec_dummy; --[prarasto]
274     l_p_Discount_Header_rec := l_Discount_Header_rec; --[prarasto]
275     l_p_Price_LLine_tbl_dummy := l_Price_LLine_tbl_dummy;  --[prarasto]
276     l_p_Discount_Cust_tbl := l_Discount_Cust_tbl; --[prarasto]
277     l_p_Discount_Line_tbl := l_Discount_Line_tbl;  --[prarasto]
278     l_p_Price_Break_tbl	:= l_Price_Break_tbl; --[prarasto]
279 
280     OE_Pricing_Cont_PVT.Process_Pricing_Cont
281     (   p_api_version_number          => 1.0
282     ,   p_init_msg_list               => p_init_msg_list
283     ,   p_validation_level            => FND_API.G_VALID_LEVEL_FULL
284     ,   p_commit                      => p_commit
285     ,   x_return_status               => x_return_status
286     ,   x_msg_count                   => x_msg_count
287     ,   x_msg_data                    => x_msg_data
288     ,   p_control_rec                 => l_control_rec_dummy
289     ,   p_Contract_rec                => l_p_Contract_rec
290     ,   p_Agreement_rec               => l_p_Agreement_rec
291     ,   p_Price_LHeader_rec           => l_p_Price_LHeader_rec_dummy
292     ,   p_Discount_Header_rec         => l_p_Discount_Header_rec
293     ,   p_Price_LLine_tbl             => l_p_Price_LLine_tbl_dummy
294     ,   p_Discount_Cust_tbl           => l_p_Discount_Cust_tbl
295     ,   p_Discount_Line_tbl           => l_p_Discount_Line_tbl
296     ,   p_Price_Break_tbl             => l_p_Price_Break_tbl
297     ,   x_Contract_rec                => l_Contract_rec
298     ,   x_Agreement_rec               => l_Agreement_rec
299     ,   x_Price_LHeader_rec           => l_Price_LHeader_rec_dummy
300     ,   x_Discount_Header_rec         => l_Discount_Header_rec
301     ,   x_Price_LLine_tbl             => l_Price_LLine_tbl_dummy
302     ,   x_Discount_Cust_tbl           => l_Discount_Cust_tbl
303     ,   x_Discount_Line_tbl           => l_Discount_Line_tbl
304     ,   x_Price_Break_tbl             => l_Price_Break_tbl
305     );
306 
307 
308     --  Load Id OUT parameters.
309 
310     x_Agreement_rec                := l_Agreement_rec;
311 
312     -- oe_msg_pub.add('After Process_pricing_Cont.');
313     -- oe_msg_pub.add('Agreement id is ='||to_char(l_Agreement_rec.agreement_id));
314     -- bug 3650357
315 
316      oe_debug_pub.add('After Process_pricing_Cont.');
317      oe_debug_pub.add('Agreement id is ='||to_char(l_Agreement_rec.agreement_id));
318 
319 -- not needed
320 /*
321      x_Contract_rec                 := l_Contract_rec;
322 --	x_Discount_Header_rec          := l_Discount_Header_rec;
323 	x_Discount_Cust_tbl            := l_Discount_Cust_tbl;
324 	x_Discount_Line_tbl            := l_Discount_Line_tbl;
325 	x_Price_Break_tbl              := l_Price_Break_tbl;
326 */
327 
328 
329     --  If p_return_values is TRUE then convert Ids to Values.
330 
331     IF FND_API.to_Boolean(p_return_values) THEN
332 
333         Id_To_Value
334         (   p_Agreement_rec               => l_Agreement_rec
335         ,   p_Price_LHeader_rec           => l_Price_LHeader_rec
336         ,   p_Price_LLine_tbl             => l_Price_LLine_tbl
337 	   ,   p_Pricing_Attr_tbl		  => l_Pricing_Attr_tbl
338         ,   x_Agreement_val_rec           => x_Agreement_val_rec
339         ,   x_Price_LHeader_val_rec       => x_Price_LHeader_val_rec
340         ,   x_Price_LLine_val_tbl         => x_Price_LLine_val_tbl
341 	   ,   x_Pricing_Attr_val_tbl    	  => x_Pricing_Attr_val_tbl
342         );
343 
344     END IF;
345 
346 EXCEPTION
347 
348     WHEN FND_API.G_EXC_ERROR THEN
349 
350         x_return_status := FND_API.G_RET_STS_ERROR;
351 
352         --  Get message count and data
353 
354         OE_MSG_PUB.Count_And_Get
355         (   p_count                       => x_msg_count
356         ,   p_data                        => x_msg_data
357         );
358 
359     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
360 
361         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
362 
363         --  Get message count and data
364 
365         OE_MSG_PUB.Count_And_Get
366         (   p_count                       => x_msg_count
367         ,   p_data                        => x_msg_data
368         );
369 
370     WHEN OTHERS THEN
371 
372         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
373 
374         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
375         THEN
376             OE_MSG_PUB.Add_Exc_Msg
377             (   G_PKG_NAME
378             ,   'Process_Agreement'
379             );
380         END IF;
381 
382         --  Get message count and data
383 
384         OE_MSG_PUB.Count_And_Get
385         (   p_count                       => x_msg_count
386         ,   p_data                        => x_msg_data
387         );
388 
389 END Process_Agreement;
390 
391 --  Start of Comments
392 --  API name    Lock_Agreement
393 --  Type        Public
394 --  Function
395 --
396 --  Pre-reqs
397 --
398 --  Parameters
399 --
400 --  Version     Current version = 1.0
401 --              Initial version = 1.0
402 --
403 --  Notes
404 --
405 --  End of Comments
406 
407 PROCEDURE Lock_Agreement
408 (   p_api_version_number            IN  NUMBER
409 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
410 ,   p_return_values                 IN  VARCHAR2 := FND_API.G_FALSE
411 ,   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
412 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
413 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
414 ,   p_Agreement_rec                 IN  Agreement_Rec_Type :=
415                                         G_MISS_AGREEMENT_REC
416 ,   p_Agreement_val_rec             IN  Agreement_Val_Rec_Type :=
417                                         G_MISS_AGREEMENT_VAL_REC
418 ,   p_Price_LHeader_rec             IN  QP_Price_List_PUB.Price_List_Rec_Type :=
419                                         G_MISS_PRICE_List_REC
420 --                                        QP_Price_List_PUB.G_MISS_PRICE_List_REC   --2449157
421 ,   p_Price_LHeader_val_rec         IN  QP_Price_List_PUB.Price_List_Val_Rec_Type :=
422                                         G_MISS_PRICE_List_VAL_REC
423 --                                        QP_Price_List_PUB.G_MISS_PRICE_List_VAL_REC --2449157
424 ,   p_Price_LLine_tbl               IN  QP_Price_List_PUB.Price_List_Line_Tbl_Type :=
425                                         G_MISS_PRICE_List_Line_TBL
426 --                                        QP_Price_List_PUB.G_MISS_PRICE_List_Line_TBL --2449157
427 ,   p_Price_LLine_val_tbl           IN  QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type :=
428                                         G_MISS_PRICE_List_Line_VAL_TBL
429 --                                        QP_Price_List_PUB.G_MISS_PRICE_List_Line_VAL_TBL  --2449157
430 ,   p_Pricing_Attr_tbl              IN  QP_Price_List_PUB.Pricing_Attr_Tbl_Type :=
431 								G_MISS_PRICING_ATTR_TBL
432 ,   p_Pricing_Attr_val_tbl          IN  QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type :=
433 								G_MISS_PRICING_ATTR_VAL_TBL
434 ,   x_Agreement_rec                 OUT NOCOPY /* file.sql.39 change */ Agreement_Rec_Type
435 ,   x_Agreement_val_rec             OUT NOCOPY /* file.sql.39 change */ Agreement_Val_Rec_Type
436 ,   x_Price_LHeader_rec             OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Rec_Type
437 ,   x_Price_LHeader_val_rec         OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Val_Rec_Type
438 ,   x_Price_LLine_tbl               OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Tbl_Type
439 ,   x_Price_LLine_val_tbl           OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type
440 ,   x_Pricing_Attr_tbl              OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Tbl_Type
441 ,   x_Pricing_Attr_val_tbl          OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type
442 )
443 IS
444 l_api_version_number          CONSTANT NUMBER := 1.0;
445 l_api_name                    CONSTANT VARCHAR2(30):= 'Lock_Agreement';
446 l_return_status               VARCHAR2(1);
447 l_Agreement_rec               Agreement_Rec_Type;
448 l_Price_LHeader_rec           QP_Price_List_PUB.Price_List_Rec_Type;
449 l_Price_LHeader_rec_dummy     OE_Price_List_PUB.Price_List_Rec_Type;
450 l_Price_LLine_tbl             QP_Price_List_PUB.Price_List_Line_Tbl_Type;
451 l_Price_LLine_tbl_dummy       OE_Price_List_PUB.Price_List_Line_Tbl_Type;
452 l_QUALIFIERS_tbl              Qp_Qualifier_Rules_Pub.Qualifiers_Tbl_Type;
453 l_PRICING_ATTR_tbl            QP_Price_List_PUB.Pricing_Attr_Tbl_Type;
454 
455 l_Contract_rec                Contract_Rec_Type;
456 l_Discount_Header_rec         Discount_Header_Rec_Type;
457 l_Discount_Cust_tbl           OE_Pricing_Cont_PUB.Discount_Cust_Tbl_Type;
458 l_Discount_Line_tbl           OE_Pricing_Cont_PUB.Discount_Line_Tbl_Type;
459 l_Price_Break_tbl             OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
460 
461 
462 l_p_Contract_rec		Contract_Rec_Type;	 --[prarasto]
463 l_p_Agreement_rec		Agreement_Rec_Type;	 --[prarasto]
464 l_p_Price_LHeader_rec_dummy	OE_Price_List_PUB.Price_List_Rec_Type; --[prarasto]
465 l_p_Discount_Header_rec		Discount_Header_Rec_Type; --[prarasto]
466 l_p_Price_LLine_tbl_dummy	OE_Price_List_PUB.Price_List_Line_Tbl_Type;  --[prarasto]
467 l_p_Discount_Cust_tbl		Discount_Cust_Tbl_Type; --[prarasto]
468 l_p_Discount_Line_tbl		Discount_Line_Tbl_Type; --[prarasto]
469 l_p_Price_Break_tbl		Price_Break_Tbl_Type; --[prarasto]
470 BEGIN
471 
472 /* In the Beta Version of the PUBLIC API, Lock( ) functionality is not delivered */
473 
474     --  Standard call to check for call compatibility
475 
476     IF NOT FND_API.Compatible_API_Call
477            (   l_api_version_number
478            ,   p_api_version_number
479            ,   l_api_name
480            ,   G_PKG_NAME
481            )
482     THEN
483         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
484     END IF;
485 
486 --added for moac
487 --Initialize MOAC and set org context to Multiple
488 
489   IF MO_GLOBAL.get_access_mode is null THEN
490     MO_GLOBAL.Init('QP');
491 --    MO_GLOBAL.set_policy_context('M', null); --commented as MO_GLOBAL.Init will set_policy_context  to 'M' or 'S' based on profile settings
492   END IF;--MO_GLOBAL
493 
494 
495     --  Perform Value to Id conversion
496 
497      Value_To_Id
498 	(   x_return_status               => l_return_status
499 	,   p_Agreement_rec               => p_Agreement_rec
500 	,   p_Agreement_val_rec           => p_Agreement_val_rec
501 	,   p_Price_LHeader_rec           => p_Price_LHeader_rec
502 	,   p_Price_LHeader_val_rec       => p_Price_LHeader_val_rec
503 	,   p_Price_LLine_tbl             => p_Price_LLine_tbl
504 	,   p_Price_LLine_val_tbl         => p_Price_LLine_val_tbl
505 	,   p_Pricing_Attr_tbl            => p_Pricing_Attr_tbl
506 	,   p_Pricing_Attr_val_tbl        => p_Pricing_Attr_val_tbl
507 	,   x_Agreement_rec               => l_Agreement_rec
508 	,   x_Price_LHeader_rec           => l_Price_LHeader_rec
509 	,   x_Price_LLine_tbl             => l_Price_LLine_tbl
510 	,   x_Pricing_Attr_tbl            => l_Pricing_Attr_tbl
511 	);
512 
513 
514 
515     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
516         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
517     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
518         RAISE FND_API.G_EXC_ERROR;
519     END IF;
520 
521 
522     --  Call OE_Pricing_Cont_PVT.Lock_Pricing_Cont
523 
524     l_p_Contract_rec	:= l_Contract_rec;	 --[prarasto]
525     l_p_Agreement_rec	:= l_Agreement_rec;	 --[prarasto]
526     l_p_Price_LHeader_rec_dummy := l_Price_LHeader_rec_dummy; --[prarasto]
527     l_p_Discount_Header_rec := l_Discount_Header_rec; --[prarasto]
528     l_p_Price_LLine_tbl_dummy := l_Price_LLine_tbl_dummy;  --[prarasto]
529     l_p_Discount_Cust_tbl := l_Discount_Cust_tbl; --[prarasto]
530     l_p_Discount_Line_tbl := l_Discount_Line_tbl;  --[prarasto]
531     l_p_Price_Break_tbl	:= l_Price_Break_tbl; --[prarasto]
532 
533 
534     OE_Pricing_Cont_PVT.Lock_Pricing_Cont
535     (   p_api_version_number          => 1.0
536     ,   p_init_msg_list               => p_init_msg_list
537     ,   x_return_status               => x_return_status
538     ,   x_msg_count                   => x_msg_count
539     ,   x_msg_data                    => x_msg_data
540     ,   p_Contract_rec                => l_p_Contract_rec
541     ,   p_Agreement_rec               => l_p_Agreement_rec
542     ,   p_Price_LHeader_rec           => l_p_Price_LHeader_rec_dummy
543     ,   p_Discount_Header_rec         => l_p_Discount_Header_rec
544     ,   p_Price_LLine_tbl             => l_p_Price_LLine_tbl_dummy
545     ,   p_Discount_Cust_tbl           => l_p_Discount_Cust_tbl
546     ,   p_Discount_Line_tbl           => l_p_Discount_Line_tbl
547     ,   p_Price_Break_tbl             => l_p_Price_Break_tbl
548     ,   x_Contract_rec                => l_Contract_rec
549     ,   x_Agreement_rec               => l_Agreement_rec
550     ,   x_Price_LHeader_rec           => l_Price_LHeader_rec_dummy
551     ,   x_Discount_Header_rec         => l_Discount_Header_rec
552     ,   x_Price_LLine_tbl             => l_Price_LLine_tbl_dummy
553     ,   x_Discount_Cust_tbl           => l_Discount_Cust_tbl
554     ,   x_Discount_Line_tbl           => l_Discount_Line_tbl
555     ,   x_Price_Break_tbl             => l_Price_Break_tbl
556     );
557 
558     --  Load Id OUT NOCOPY /* file.sql.39 change */ parameters.
559 
560     x_Agreement_rec                := l_Agreement_rec;
561     x_Price_LHeader_rec            := l_Price_LHeader_rec;
562     x_Price_LLine_tbl              := l_Price_LLine_tbl;
563 
564     --x_Contract_rec                 := l_Contract_rec;
565     --x_Discount_Cust_tbl            := l_Discount_Cust_tbl;
566     --x_Discount_Header_rec          := l_Discount_Header_rec;
567     --x_Discount_Line_tbl            := l_Discount_Line_tbl;
568     --x_Price_Break_tbl              := l_Price_Break_tbl;
569 
570     --  If p_return_values is TRUE then convert Ids to Values.
571 
572     IF FND_API.to_Boolean(p_return_values) THEN
573 
574         Id_To_Value
575 	 	(   p_Agreement_rec               => l_Agreement_rec
576 		,   p_Price_LHeader_rec           => l_Price_LHeader_rec
577 		,   p_Price_LLine_tbl             => l_Price_LLine_tbl
578 		,   p_Pricing_Attr_tbl            => l_Pricing_Attr_tbl
579 		,   x_Agreement_val_rec           => x_Agreement_val_rec
580 		,   x_Price_LHeader_val_rec       => x_Price_LHeader_val_rec
581 		,   x_Price_LLine_val_tbl         => x_Price_LLine_val_tbl
582 		,   x_Pricing_Attr_val_tbl        => x_Pricing_Attr_val_tbl
583 		);
584 
585 
586     END IF;
587 
588 EXCEPTION
589 
590     WHEN FND_API.G_EXC_ERROR THEN
591 
592         x_return_status := FND_API.G_RET_STS_ERROR;
593 
594         --  Get message count and data
595 
596         OE_MSG_PUB.Count_And_Get
597         (   p_count                       => x_msg_count
598         ,   p_data                        => x_msg_data
599         );
600 
601     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
602 
603         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
604 
605         --  Get message count and data
606 
607         OE_MSG_PUB.Count_And_Get
608         (   p_count                       => x_msg_count
609         ,   p_data                        => x_msg_data
610         );
611 
612     WHEN OTHERS THEN
613 
614         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
615 
616         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
617         THEN
618             OE_MSG_PUB.Add_Exc_Msg
619             (   G_PKG_NAME
620             ,   'Lock_Agreement'
621             );
622         END IF;
623 
624         --  Get message count and data
625 
626         OE_MSG_PUB.Count_And_Get
627         (   p_count                       => x_msg_count
628         ,   p_data                        => x_msg_data
629         );
630 
631 END Lock_Agreement;
632 
633 --  Start of Comments
634 --  API name    Get_Agreement
635 --  Type        Public
636 --  Function
637 --
638 --  Pre-reqs
639 --
640 --  Parameters
641 --
642 --  Version     Current version = 1.0
643 --              Initial version = 1.0
644 --
645 --  Notes
646 --
647 --  End of Comments
648 
649 PROCEDURE Get_Agreement
650 (   p_api_version_number            IN  NUMBER
651 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
652 ,   p_return_values                 IN  VARCHAR2 := FND_API.G_FALSE
653 ,   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
654 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
655 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
656 ,   p_agreement_id		    IN  NUMBER := FND_API.G_MISS_NUM
657 /*, p_agreement                     IN  VARCHAR2 := FND_API.G_MISS_CHAR
658 ,   p_revision 		 		 IN VARCHAR2 := FND_API.G_MISS_CHAR */
659 ,   x_Agreement_rec                 OUT NOCOPY /* file.sql.39 change */ Agreement_Rec_Type
660 ,   x_Agreement_val_rec 	    OUT NOCOPY /* file.sql.39 change */ Agreement_Val_Rec_Type
661 ,   x_Price_LHeader_rec             OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Rec_Type
662 ,   x_Price_LHeader_val_rec         OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Val_Rec_Type
663 ,   x_Price_LLine_tbl               OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Tbl_Type
664 ,   x_Price_LLine_val_tbl           OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type
665 ,   x_PRICING_ATTR_tbl              OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Tbl_Type
666 ,   x_Pricing_Attr_val_tbl          OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type
667 )
668 IS
669 l_api_version_number          CONSTANT NUMBER := 1.0;
670 l_api_name                    CONSTANT VARCHAR2(30):= 'Get_Agreement';
671 l_agreement_id                NUMBER := p_agreement_id;
672 l_Agreement_rec               OE_Pricing_Cont_PUB.Agreement_Rec_Type;
673 l_Price_LHeader_rec           OE_Price_List_PUB.Price_List_Rec_Type;
674 l_Price_LLine_tbl             OE_Price_List_PUB.Price_List_Line_Tbl_Type;
675 l_QUALIFIERS_tbl              Qp_Qualifier_Rules_Pub.Qualifiers_Tbl_Type;
676 l_PRICING_ATTR_tbl            OE_Price_List_PUB.Pricing_Attr_Tbl_Type;
677 l_x_PRICING_ATTR_tbl          OE_Price_List_PUB.Pricing_Attr_Tbl_Type;
678 l_pricing_contract_id         NUMBER;
679 
680 BEGIN
681 
682 /* In the beta version of this API Get( ) and Lock( ) functionalities are not delivered */
683 
684 
685     --  Standard call to check for call compatibility
686 
687     IF NOT FND_API.Compatible_API_Call
688            (   l_api_version_number
689            ,   p_api_version_number
690            ,   l_api_name
691            ,   G_PKG_NAME
692            )
693     THEN
694         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
695     END IF;
696 
697     --  Standard check for Val/ID conversion
698 
699 
700     --  Call OE_Pricing_Cont_PVT.Get_Pricing_Cont
701     /*
702 
703     OE_Pricing_Cont_PVT.Get_Pricing_Cont
704     (   p_api_version_number          => 1.0
705     ,   p_init_msg_list               => p_init_msg_list
706     ,   x_return_status               => x_return_status
707     ,   x_msg_count                   => x_msg_count
708     ,   x_msg_data                    => x_msg_data
709     ,   p_agreement_id 		        => l_pricing_contract_id
710     ,   x_Agreement_rec               => l_Agreement_rec
711     ,   x_Price_LHeader_rec           => l_Price_LHeader_rec
712     ,   x_Price_LLine_tbl             => l_Price_LLine_tbl
713     ,   x_Pricing_Attr_tbl       	   => l_Pricing_Attr_tbl
714     );
715 
716     */
717 
718 
719     --  Load Id OUT parameters.
720 /*
721     x_Agreement_rec                := l_Agreement_rec;
722     x_Price_LHeader_rec            := l_Price_LHeader_rec;
723     x_Price_LLine_tbl              := l_Price_LLine_tbl;
724     --x_QUALIFIERS_tbl               := l_QUALIFIERS_tbl;
725     x_PRICING_ATTR_tbl             := l_PRICING_ATTR_tbl;
726 */
727 
728     --  If p_return_values is TRUE then convert Ids to Values.
729 
730 /* Commenting as of now since we do not have any logic for id_to_value conversion
731     IF FND_API.TO_BOOLEAN(p_return_values) THEN
732 
733         Id_To_Value
734 		(   p_Agreement_rec               => l_Agreement_rec
735 		,   p_Price_LHeader_rec           => l_Price_LHeader_rec
736 		,   p_Price_LLine_tbl             => l_Price_LLine_tbl
737 		,   p_Pricing_Attr_tbl            => l_Pricing_Attr_tbl
738 		,   x_Agreement_val_rec           => x_Agreement_val_rec
739 		,   x_Price_LHeader_val_rec       => x_Price_LHeader_val_rec
740 		,   x_Price_LLine_val_tbl         => x_Price_LLine_val_tbl
741 		,   x_Pricing_Attr_val_tbl        => x_Pricing_Attr_val_tbl
742 		);
743 
744     END IF;
745 */
746 
747     --  Set return status
748 
749     x_return_status := FND_API.G_RET_STS_SUCCESS;
750 
751     --  Get message count and data
752 
753     OE_MSG_PUB.Count_And_Get
754     (   p_count                       => x_msg_count
755     ,   p_data                        => x_msg_data
756     );
757 
758 
759 EXCEPTION
760 
761     WHEN FND_API.G_EXC_ERROR THEN
762 
763         x_return_status := FND_API.G_RET_STS_ERROR;
764 
765         --  Get message count and data
766 
767         OE_MSG_PUB.Count_And_Get
768         (   p_count                       => x_msg_count
769         ,   p_data                        => x_msg_data
770         );
771 
772     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
773 
774         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
775 
776         --  Get message count and data
777 
778         OE_MSG_PUB.Count_And_Get
779         (   p_count                       => x_msg_count
780         ,   p_data                        => x_msg_data
781         );
782 
783     WHEN OTHERS THEN
784 
785         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
786 
787         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
788         THEN
789             OE_MSG_PUB.Add_Exc_Msg
790             (   G_PKG_NAME
791             ,   'Get_Agreement'
792             );
793         END IF;
794 
795         --  Get message count and data
796 
797         OE_MSG_PUB.Count_And_Get
798         (   p_count                       => x_msg_count
799         ,   p_data                        => x_msg_data
800         );
801 
802 END Get_Agreement;
803 
804 --  Procedure Id_To_Value
805 
806 PROCEDURE Id_To_Value
807 (   p_Agreement_rec                 IN  Agreement_Rec_Type
808 ,   p_Price_LHeader_rec             IN  QP_Price_List_PUB.Price_List_Rec_Type
809 ,   p_Price_LLine_tbl               IN  QP_Price_List_PUB.Price_List_Line_Tbl_Type
810 ,   p_Pricing_Attr_tbl              IN  QP_Price_List_PUB.Pricing_Attr_Tbl_Type
811 ,   x_Agreement_val_rec             OUT NOCOPY /* file.sql.39 change */ Agreement_Val_Rec_Type
812 ,   x_Price_LHeader_val_rec         OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Val_Rec_Type
813 ,   x_Price_LLine_val_tbl           OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type
814 ,   x_Pricing_Attr_val_tbl          OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type
815 )
816 IS
817 
818 BEGIN
819 
820     --  Convert Agreement
821 
822     x_Agreement_val_rec := OE_Agreement_Util.Get_Values(p_Agreement_rec);
823 
824     --  Convert Price_LHeader
825 
826     x_Price_LHeader_val_rec := QP_Price_List_Util.Get_Values(p_Price_LHeader_rec);
827 
828     --  Convert Price_LLine
829 
830     FOR I IN 1..p_Price_LLine_tbl.COUNT LOOP
831         x_Price_LLine_val_tbl(I) :=
832             QP_Price_List_Line_Util.Get_Values(p_Price_LLine_tbl(I));
833     END LOOP;
834 
835 
836     --  Convert PRICING_ATTR
837 
838     FOR I IN 1..p_Pricing_Attr_tbl.COUNT LOOP
839         x_Pricing_Attr_val_tbl(I) :=
840             QP_pll_pricing_attr_Util.Get_Values(p_Pricing_Attr_tbl(I));
841     END LOOP;
842 
843 
844 EXCEPTION
845 
846     WHEN OTHERS THEN
847 
848         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
849         THEN
850             OE_MSG_PUB.Add_Exc_Msg
851             (   G_PKG_NAME
852             ,   'Id_To_Value'
853             );
854         END IF;
855 
856         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
857 
858 END Id_To_Value;
859 
860 --  Procedure Value_To_Id
861 
862 PROCEDURE Value_To_Id
863 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
864 ,   p_Agreement_rec                 IN  Agreement_Rec_Type
865 ,   p_Agreement_val_rec             IN  Agreement_Val_Rec_Type
866 ,   p_Price_LHeader_rec             IN  QP_Price_List_PUB.Price_List_Rec_Type
867 ,   p_Price_LHeader_val_rec         IN  QP_Price_List_PUB.Price_List_Val_Rec_Type
868 ,   p_Price_LLine_tbl               IN  QP_Price_List_PUB.Price_List_Line_Tbl_Type
869 ,   p_Price_LLine_val_tbl           IN  QP_Price_List_PUB.Price_List_Line_Val_Tbl_Type
870 ,   p_Pricing_Attr_tbl			 IN  QP_Price_List_PUB.Pricing_Attr_Tbl_Type
871 ,   p_Pricing_Attr_val_tbl		 IN  QP_Price_List_PUB.Pricing_Attr_Val_Tbl_Type
872 ,   x_Agreement_rec                 OUT NOCOPY /* file.sql.39 change */ Agreement_Rec_Type
873 ,   x_Price_LHeader_rec             OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Rec_Type
874 ,   x_Price_LLine_tbl	            OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Price_List_Line_Tbl_Type
875 ,   x_Pricing_Attr_tbl	       	    OUT NOCOPY /* file.sql.39 change */ QP_Price_List_PUB.Pricing_Attr_Tbl_Type
876 )
877 IS
878 l_Agreement_rec               Agreement_Rec_Type;
879 l_Price_LHeader_rec           QP_Price_List_PUB.Price_List_Rec_Type;
880 l_Price_LLine_rec             QP_Price_List_PUB.Price_List_Line_Rec_Type;
881 l_Pricing_Attr_rec			QP_Price_List_PUB.Pricing_Attr_Rec_Type;
882 
883 l_index                       BINARY_INTEGER;
884 
885 BEGIN
886 
887     --  Init x_return_status.
888 
889     x_return_status := FND_API.G_RET_STS_SUCCESS;
890 
891     --  Convert Agreement
892 
893     l_Agreement_rec := OE_Agreement_Util.Get_Ids
894     (   p_Agreement_rec               => p_Agreement_rec
895     ,   p_Agreement_val_rec           => p_Agreement_val_rec
896     );
897 
898     x_Agreement_rec                := l_Agreement_rec;
899 
900     IF l_Agreement_rec.return_status = FND_API.G_RET_STS_ERROR THEN
901         x_return_status := FND_API.G_RET_STS_ERROR;
902     END IF;
903 
904     --  Convert Price_LHeader
905 
906     l_Price_LHeader_rec := QP_Price_List_Util.Get_Ids
907     (   p_Price_List_rec           => p_Price_LHeader_rec
908     ,   p_Price_List_val_rec       => p_Price_LHeader_val_rec
909     );
910 
911     x_Price_LHeader_rec            := l_Price_LHeader_rec;
912 
913     IF l_Price_LHeader_rec.return_status = FND_API.G_RET_STS_ERROR THEN
914         x_return_status := FND_API.G_RET_STS_ERROR;
915     END IF;
916 
917 
918     --  Convert Price_LLine
919 
920     x_Price_LLine_tbl := p_Price_LLine_tbl;
921 
922     l_index := p_Price_LLine_val_tbl.FIRST;
923 
924     WHILE l_index IS NOT NULL LOOP
925 
926         l_Price_LLine_rec := QP_Price_List_Line_Util.Get_Ids
927         (   p_Price_List_Line_rec             => p_Price_LLine_tbl(l_index)
928         ,   p_Price_List_Line_val_rec         => p_Price_LLine_val_tbl(l_index)
929         );
930 
931         x_Price_LLine_tbl(l_index)     := l_Price_LLine_rec;
932 
933         IF l_Price_LLine_rec.return_status = FND_API.G_RET_STS_ERROR THEN
934             x_return_status := FND_API.G_RET_STS_ERROR;
935         END IF;
936 
937         l_index := p_Price_LLine_val_tbl.NEXT(l_index);
938 
939     END LOOP;
940 
941     --  Convert PRICING_ATTR
942 
943 	x_Pricing_Attr_tbl := p_Pricing_Attr_tbl;
944 
945 	l_index := p_PRICING_ATTR_val_tbl.FIRST;
946 
947 	WHILE l_index IS NOT NULL LOOP
948 
949 	 	l_PRICING_ATTR_rec := QP_pll_pricing_attr_Util.Get_Ids
950 	 	(   	p_PRICING_ATTR_rec            => p_PRICING_ATTR_tbl(l_index)
951 		 ,	p_PRICING_ATTR_val_rec        => p_PRICING_ATTR_val_tbl(l_index)
952 	 	 );
953 
954 	 	x_Pricing_Attr_tbl(l_index)    := l_Pricing_Attr_rec;
955 
956 	 	IF l_PRICING_ATTR_rec.return_status = FND_API.G_RET_STS_ERROR THEN
957 			x_return_status := FND_API.G_RET_STS_ERROR;
958 	 	END IF;
959 
960 	 	l_index := p_Pricing_Attr_val_tbl.NEXT(l_index);
961 	 END LOOP;
962 
963 
964 EXCEPTION
965 
966     WHEN OTHERS THEN
967 
968         x_return_status := FND_API.G_RET_STS_ERROR; /* file.sql.39 change */
969 
970         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
971         THEN
972             OE_MSG_PUB.Add_Exc_Msg
973             (   G_PKG_NAME
974             ,   'Value_To_Id'
975             );
976         END IF;
977 
978         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
979 
980 END Value_To_Id;
981 
982 END OE_Pricing_Cont_PUB;