DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_OE_FORM_PRICE_BREAK

Source


1 PACKAGE BODY OE_OE_Form_Price_Break AS
2 /* $Header: OEXFDPBB.pls 120.1 2005/06/08 04:06:49 appldev  $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'OE_OE_Form_Price_Break';
7 
8 --  Global variables holding cached record.
9 
10 g_Price_Break_rec             OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
11 g_db_Price_Break_rec          OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
12 -- g_Price_LLine_rec		     OE_Price_List_PUB.Price_List_Line_Rec_Type;
13 
14 -- Forward declaration of procedures maintaining entity record cache.
15 FUNCTION Get_Price_Id
16 (   p_db_record                     IN  BOOLEAN := FALSE
17 ,   p_price_list_line_id            IN  NUMBER
18 )
19 RETURN OE_Price_List_PUB.Price_List_Line_Rec_Type;
20 
21 PROCEDURE Write_Price_Break
22 (   p_Price_Break_rec               IN  OE_Pricing_Cont_PUB.Price_Break_Rec_Type
23 ,   p_db_record                     IN  BOOLEAN := FALSE
24 );
25 
26 FUNCTION Get_Price_Break
27 (   p_db_record                     IN  BOOLEAN := FALSE
28 ,   p_discount_line_id              IN  NUMBER
29 ,   p_method_type_code        IN VARCHAR2
30 ,   p_price_break_high      IN NUMBER
31 ,   p_price_break_low       IN NUMBER
32 )
33 RETURN OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
34 
35 PROCEDURE Clear_Price_Break;
36 
37 --  Global variable holding performed operations.
38 
39 g_opr__tbl                    OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
40 
41 --  Procedure : Default_Attributes
42 --
43 
44 PROCEDURE Default_Attributes
45 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
46 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
47 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
48 ,   x_amount                        OUT NOCOPY /* file.sql.39 change */ NUMBER
49 ,   x_attribute1                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
50 ,   x_attribute10                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
51 ,   x_attribute11                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
52 ,   x_attribute12                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
53 ,   x_attribute13                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
54 ,   x_attribute14                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
55 ,   x_attribute15                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
56 ,   x_attribute2                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
57 ,   x_attribute3                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
58 ,   x_attribute4                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
59 ,   x_attribute5                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
60 ,   x_attribute6                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
61 ,   x_attribute7                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
62 ,   x_attribute8                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
63 ,   x_attribute9                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
64 ,   x_context                       OUT NOCOPY /* file.sql.39 change */ VARCHAR2
65 ,   x_discount_line_id              OUT NOCOPY /* file.sql.39 change */ NUMBER
66 ,   x_end_date_active               OUT NOCOPY /* file.sql.39 change */ DATE
67 ,   x_method_type_code              OUT NOCOPY /* file.sql.39 change */ VARCHAR2
68 ,   x_percent                       OUT NOCOPY /* file.sql.39 change */ NUMBER
69 ,   x_price                         OUT NOCOPY /* file.sql.39 change */ NUMBER
70 ,   x_price_break_high              OUT NOCOPY /* file.sql.39 change */ NUMBER
71 ,   x_price_break_low               OUT NOCOPY /* file.sql.39 change */ NUMBER
72 ,   x_start_date_active             OUT NOCOPY /* file.sql.39 change */ DATE
73 ,   x_unit_code                     OUT NOCOPY /* file.sql.39 change */ VARCHAR2
74 ,   x_discount_line                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
75 ,   x_method_type                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
76 ,   x_unit                          OUT NOCOPY /* file.sql.39 change */ VARCHAR2
77 )
78 IS
79 l_Price_Break_rec             OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
80 l_Price_Break_val_rec         OE_Pricing_Cont_PUB.Price_Break_Val_Rec_Type;
81 l_Price_Break_tbl             OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
82 l_control_rec                 OE_GLOBALS.Control_Rec_Type;
83 l_return_status               VARCHAR2(1);
84 l_x_Contract_rec              OE_Pricing_Cont_PUB.Contract_Rec_Type;
85 l_x_Agreement_rec             OE_Pricing_Cont_PUB.Agreement_Rec_Type;
86 l_x_Price_LHeader_rec         OE_Price_List_PUB.Price_List_Rec_Type;
87 l_x_Discount_Header_rec       OE_Pricing_Cont_PUB.Discount_Header_Rec_Type;
88 l_x_Price_LLine_rec           OE_Price_List_PUB.Price_List_Line_Rec_Type;
89 l_x_Price_LLine_tbl           OE_Price_List_PUB.Price_List_Line_Tbl_Type;
90 l_x_Discount_Cust_rec         OE_Pricing_Cont_PUB.Discount_Cust_Rec_Type;
91 l_x_Discount_Cust_tbl         OE_Pricing_Cont_PUB.Discount_Cust_Tbl_Type;
92 l_x_Discount_Line_rec         OE_Pricing_Cont_PUB.Discount_Line_Rec_Type;
93 l_x_Discount_Line_tbl         OE_Pricing_Cont_PUB.Discount_Line_Tbl_Type;
94 l_x_Price_Break_rec           OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
95 l_x_Price_Break_tbl           OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
96 BEGIN
97 
98     --  Set control flags.
99 
100         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
101         THEN
102             OE_MSG_PUB.Add_Exc_Msg
103             (   G_PKG_NAME
104             ,   'Geresh :: in Process Pricing '
105             );
106         END IF;
107     l_control_rec.controlled_operation := TRUE;
108     l_control_rec.default_attributes   := TRUE;
109 
110     l_control_rec.change_attributes    := FALSE;
111     l_control_rec.validate_entity      := FALSE;
112     l_control_rec.write_to_DB          := FALSE;
113     l_control_rec.process              := FALSE;
114 
115     --  Instruct API to retain its caches
116 
117     l_control_rec.clear_api_cache      := FALSE;
118     l_control_rec.clear_api_requests   := FALSE;
119 
120     --  Load IN parameters if any exist
121 
122 
123     --  Defaulting of flex values is currently done by the form.
124     --  Set flex attributes to NULL in order to avoid defaulting them.
125 
126     l_Price_Break_rec.attribute1                  := 'NULL';
127     l_Price_Break_rec.attribute10                 := 'NULL';
128     l_Price_Break_rec.attribute11                 := 'NULL';
129     l_Price_Break_rec.attribute12                 := 'NULL';
130     l_Price_Break_rec.attribute13                 := 'NULL';
131     l_Price_Break_rec.attribute14                 := 'NULL';
132     l_Price_Break_rec.attribute15                 := 'NULL';
133     l_Price_Break_rec.attribute2                  := 'NULL';
134     l_Price_Break_rec.attribute3                  := 'NULL';
135     l_Price_Break_rec.attribute4                  := 'NULL';
136     l_Price_Break_rec.attribute5                  := 'NULL';
137     l_Price_Break_rec.attribute6                  := 'NULL';
138     l_Price_Break_rec.attribute7                  := 'NULL';
139     l_Price_Break_rec.attribute8                  := 'NULL';
140     l_Price_Break_rec.attribute9                  := 'NULL';
141     l_Price_Break_rec.context                     := 'NULL';
142 
143     --  Set Operation to Create
144 
145     l_Price_Break_rec.operation := OE_GLOBALS.G_OPR_CREATE;
146 
147     --  Populate Price_Break table
148 
149     l_Price_Break_tbl(1) := l_Price_Break_rec;
150 
151     --  Call OE_Pricing_Cont_PVT.Process_Pricing_Cont
152 
153 
154         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
155         THEN
156             OE_MSG_PUB.Add_Exc_Msg
157             (   G_PKG_NAME
158             ,   'Geresh :: Before Process Pricing in Default'
159             );
160         END IF;
161 
162     OE_Pricing_Cont_PVT.Process_Pricing_Cont
163     (   p_api_version_number          => 1.0
164     ,   p_init_msg_list               => FND_API.G_TRUE
165     ,   x_return_status               => l_return_status
166     ,   x_msg_count                   => x_msg_count
167     ,   x_msg_data                    => x_msg_data
168     ,   p_control_rec                 => l_control_rec
169     ,   p_Price_Break_tbl             => l_Price_Break_tbl
170     ,   x_Contract_rec                => l_x_Contract_rec
171     ,   x_Agreement_rec               => l_x_Agreement_rec
172     ,   x_Price_LHeader_rec           => l_x_Price_LHeader_rec
173     ,   x_Discount_Header_rec         => l_x_Discount_Header_rec
174     ,   x_Price_LLine_tbl             => l_x_Price_LLine_tbl
175     ,   x_Discount_Cust_tbl           => l_x_Discount_Cust_tbl
176     ,   x_Discount_Line_tbl           => l_x_Discount_Line_tbl
177     ,   x_Price_Break_tbl             => l_x_Price_Break_tbl
178     );
179 
180     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
181         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
182     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
183         RAISE FND_API.G_EXC_ERROR;
184     END IF;
185 
186 
187     --  Unload out tbl
188 
189     l_x_Price_Break_rec := l_x_Price_Break_tbl(1);
190 
191     --  Load OUT parameters.
192 
193     x_amount                       := l_x_Price_Break_rec.amount;
194     x_attribute1                   := l_x_Price_Break_rec.attribute1;
195     x_attribute10                  := l_x_Price_Break_rec.attribute10;
196     x_attribute11                  := l_x_Price_Break_rec.attribute11;
197     x_attribute12                  := l_x_Price_Break_rec.attribute12;
198     x_attribute13                  := l_x_Price_Break_rec.attribute13;
199     x_attribute14                  := l_x_Price_Break_rec.attribute14;
200     x_attribute15                  := l_x_Price_Break_rec.attribute15;
201     x_attribute2                   := l_x_Price_Break_rec.attribute2;
202     x_attribute3                   := l_x_Price_Break_rec.attribute3;
203     x_attribute4                   := l_x_Price_Break_rec.attribute4;
204     x_attribute5                   := l_x_Price_Break_rec.attribute5;
205     x_attribute6                   := l_x_Price_Break_rec.attribute6;
206     x_attribute7                   := l_x_Price_Break_rec.attribute7;
207     x_attribute8                   := l_x_Price_Break_rec.attribute8;
208     x_attribute9                   := l_x_Price_Break_rec.attribute9;
209     x_context                      := l_x_Price_Break_rec.context;
210     x_discount_line_id             := l_x_Price_Break_rec.discount_line_id;
211     x_end_date_active              := l_x_Price_Break_rec.end_date_active;
212     x_method_type_code             := l_x_Price_Break_rec.method_type_code;
213     x_percent                      := l_x_Price_Break_rec.percent;
214     x_price                        := l_x_Price_Break_rec.price;
215     x_price_break_high             := l_x_Price_Break_rec.price_break_high;
216     x_price_break_low              := l_x_Price_Break_rec.price_break_low;
217     x_start_date_active            := l_x_Price_Break_rec.start_date_active;
218     x_unit_code                    := l_x_Price_Break_rec.unit_code;
219 
220     --  Load display out parameters if any
221 
222     l_Price_Break_val_rec := OE_Price_Break_Util.Get_Values
223     (   p_Price_Break_rec             => l_x_Price_Break_rec
224     );
225     x_discount_line                := l_Price_Break_val_rec.discount_line;
226     x_method_type                  := l_Price_Break_val_rec.method_type;
227     x_unit                         := l_Price_Break_val_rec.unit;
228 
229     --  Write to cache.
230     --  Set db_flag to False before writing to cache
231 
232     l_x_Price_Break_rec.db_flag := FND_API.G_FALSE;
233 
234     Write_Price_Break
235     (   p_Price_Break_rec             => l_x_Price_Break_rec
236     );
237 
238     --  Set return status.
239 
240     x_return_status := FND_API.G_RET_STS_SUCCESS;
241 
242     --  Get message count and data
243 
244     OE_MSG_PUB.Count_And_Get
245     (   p_count                       => x_msg_count
246     ,   p_data                        => x_msg_data
247     );
248 
249 
250 EXCEPTION
251 
252     WHEN FND_API.G_EXC_ERROR THEN
253 
254         x_return_status := FND_API.G_RET_STS_ERROR;
255 
256         --  Get message count and data
257 
258         OE_MSG_PUB.Count_And_Get
259         (   p_count                       => x_msg_count
260         ,   p_data                        => x_msg_data
261         );
262 
263     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
264 
265         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
266 
267         --  Get message count and data
268 
269         OE_MSG_PUB.Count_And_Get
270         (   p_count                       => x_msg_count
271         ,   p_data                        => x_msg_data
272         );
273 
274     WHEN OTHERS THEN
275 
276         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
277 
278         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
279         THEN
280             OE_MSG_PUB.Add_Exc_Msg
281             (   G_PKG_NAME
282             ,   'Default_Attributes'
283             );
284         END IF;
285 
286         --  Get message count and data
287 
288         OE_MSG_PUB.Count_And_Get
289         (   p_count                       => x_msg_count
290         ,   p_data                        => x_msg_data
291         );
292 
293 END Default_Attributes;
294 
295 --  Procedure   :   Change_Attribute
296 --
297 
298 PROCEDURE Change_Attribute
299 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
300 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
301 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
302 ,   p_discount_line_id              IN  NUMBER
303 ,   p_method_type_code              IN  VARCHAR2
304 ,   p_price_break_high              IN  NUMBER
305 ,   p_price_break_low               IN  NUMBER
306 ,   p_attr_id                       IN  NUMBER
307 ,   p_attr_value                    IN  VARCHAR2
308 ,   p_attribute1                    IN  VARCHAR2
309 ,   p_attribute10                   IN  VARCHAR2
310 ,   p_attribute11                   IN  VARCHAR2
311 ,   p_attribute12                   IN  VARCHAR2
312 ,   p_attribute13                   IN  VARCHAR2
313 ,   p_attribute14                   IN  VARCHAR2
314 ,   p_attribute15                   IN  VARCHAR2
315 ,   p_attribute2                    IN  VARCHAR2
316 ,   p_attribute3                    IN  VARCHAR2
317 ,   p_attribute4                    IN  VARCHAR2
318 ,   p_attribute5                    IN  VARCHAR2
319 ,   p_attribute6                    IN  VARCHAR2
320 ,   p_attribute7                    IN  VARCHAR2
321 ,   p_attribute8                    IN  VARCHAR2
322 ,   p_attribute9                    IN  VARCHAR2
323 ,   p_context                       IN  VARCHAR2
324 ,   x_amount                        OUT NOCOPY /* file.sql.39 change */ NUMBER
325 ,   x_attribute1                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
326 ,   x_attribute10                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
327 ,   x_attribute11                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
328 ,   x_attribute12                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
329 ,   x_attribute13                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
330 ,   x_attribute14                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
331 ,   x_attribute15                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
332 ,   x_attribute2                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
333 ,   x_attribute3                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
334 ,   x_attribute4                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
335 ,   x_attribute5                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
336 ,   x_attribute6                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
337 ,   x_attribute7                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
338 ,   x_attribute8                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
339 ,   x_attribute9                    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
340 ,   x_context                       OUT NOCOPY /* file.sql.39 change */ VARCHAR2
341 ,   x_discount_line_id              OUT NOCOPY /* file.sql.39 change */ NUMBER
342 ,   x_end_date_active               OUT NOCOPY /* file.sql.39 change */ DATE
343 ,   x_method_type_code              OUT NOCOPY /* file.sql.39 change */ VARCHAR2
344 ,   x_percent                       OUT NOCOPY /* file.sql.39 change */ NUMBER
345 ,   x_price                         OUT NOCOPY /* file.sql.39 change */ NUMBER
346 ,   x_price_break_high              OUT NOCOPY /* file.sql.39 change */ NUMBER
347 ,   x_price_break_low               OUT NOCOPY /* file.sql.39 change */ NUMBER
348 ,   x_start_date_active             OUT NOCOPY /* file.sql.39 change */ DATE
349 ,   x_unit_code                     OUT NOCOPY /* file.sql.39 change */ VARCHAR2
350 ,   x_discount_line                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
351 ,   x_method_type                   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
352 ,   x_unit                          OUT NOCOPY /* file.sql.39 change */ VARCHAR2
353 )
354 IS
355 l_Price_Break_rec             OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
356 l_old_Price_Break_rec         OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
357 l_Price_Break_val_rec         OE_Pricing_Cont_PUB.Price_Break_Val_Rec_Type;
358 l_Price_Break_tbl             OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
359 l_old_Price_Break_tbl         OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
360 l_control_rec                 OE_GLOBALS.Control_Rec_Type;
361 l_return_status               VARCHAR2(1);
362 l_x_Contract_rec              OE_Pricing_Cont_PUB.Contract_Rec_Type;
363 l_x_Agreement_rec             OE_Pricing_Cont_PUB.Agreement_Rec_Type;
364 l_x_Price_LHeader_rec         OE_Price_List_PUB.Price_List_Rec_Type;
365 l_x_Discount_Header_rec       OE_Pricing_Cont_PUB.Discount_Header_Rec_Type;
366 l_x_Price_LLine_rec           OE_Price_List_PUB.Price_List_Line_Rec_Type;
367 l_x_Price_LLine_tbl           OE_Price_List_PUB.Price_List_Line_Tbl_Type;
368 l_x_Discount_Cust_rec         OE_Pricing_Cont_PUB.Discount_Cust_Rec_Type;
369 l_x_Discount_Cust_tbl         OE_Pricing_Cont_PUB.Discount_Cust_Tbl_Type;
370 l_x_Discount_Line_rec         OE_Pricing_Cont_PUB.Discount_Line_Rec_Type;
371 l_x_Discount_Line_tbl         OE_Pricing_Cont_PUB.Discount_Line_Tbl_Type;
372 l_x_Price_Break_rec           OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
373 l_x_Price_Break_tbl           OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
374 BEGIN
375 
376     --  Set control flags.
377 
378     l_control_rec.controlled_operation := TRUE;
379     l_control_rec.change_attributes    := TRUE;
380 
381     l_control_rec.default_attributes   := FALSE;
382     l_control_rec.validate_entity      := FALSE;
383     l_control_rec.write_to_DB          := FALSE;
384     l_control_rec.process              := FALSE;
385 
386     --  Instruct API to retain its caches
387 
388     l_control_rec.clear_api_cache      := FALSE;
389     l_control_rec.clear_api_requests   := FALSE;
390 
391     --  Read Price_Break from cache
392 
393     l_Price_Break_rec := Get_Price_Break
394     (   p_db_record                   => FALSE
395     ,   p_discount_line_id            => p_discount_line_id
396 	   ,   p_method_type_code        => p_method_type_code
397 	   ,   p_price_break_high      => p_price_break_high
398 	   ,   p_price_break_low       => p_price_break_low
399     );
400 
401     l_old_Price_Break_rec          := l_Price_Break_rec;
402 
403     IF p_attr_id = OE_Price_Break_Util.G_AMOUNT THEN
404         l_Price_Break_rec.amount := TO_NUMBER(p_attr_value);
405     ELSIF p_attr_id = OE_Price_Break_Util.G_DISCOUNT_LINE THEN
406         l_Price_Break_rec.discount_line_id := TO_NUMBER(p_attr_value);
407     ELSIF p_attr_id = OE_Price_Break_Util.G_END_DATE_ACTIVE THEN
408         l_Price_Break_rec.end_date_active := TO_DATE(p_attr_value,'DD/MM/YYYY');
409     ELSIF p_attr_id = OE_Price_Break_Util.G_METHOD_TYPE THEN
410         l_Price_Break_rec.method_type_code := p_attr_value;
411     ELSIF p_attr_id = OE_Price_Break_Util.G_PERCENT THEN
412         l_Price_Break_rec.percent := TO_NUMBER(p_attr_value);
413     ELSIF p_attr_id = OE_Price_Break_Util.G_PRICE THEN
414         l_Price_Break_rec.price := TO_NUMBER(p_attr_value);
415     ELSIF p_attr_id = OE_Price_Break_Util.G_PRICE_BREAK_HIGH THEN
416         l_Price_Break_rec.price_break_high := TO_NUMBER(p_attr_value);
417     ELSIF p_attr_id = OE_Price_Break_Util.G_PRICE_BREAK_LOW THEN
418         l_Price_Break_rec.price_break_low := TO_NUMBER(p_attr_value);
419     ELSIF p_attr_id = OE_Price_Break_Util.G_START_DATE_ACTIVE THEN
420         l_Price_Break_rec.start_date_active := TO_DATE(p_attr_value,'DD/MM/YYYY');
421     ELSIF p_attr_id = OE_Price_Break_Util.G_UNIT THEN
422         l_Price_Break_rec.unit_code := p_attr_value;
423     ELSIF p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE1
424     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE10
425     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE12
426     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE13
427     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE14
428     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE15
429     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE2
430     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE3
431     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE4
432     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE5
433     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE6
434     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE7
435     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE8
436     OR     p_attr_id = OE_Price_Break_Util.G_ATTRIBUTE9
437     OR     p_attr_id = OE_Price_Break_Util.G_CONTEXT
438     THEN
439 
440         l_Price_Break_rec.attribute1   := p_attribute1;
441         l_Price_Break_rec.attribute10  := p_attribute10;
442         l_Price_Break_rec.attribute12  := p_attribute12;
443         l_Price_Break_rec.attribute13  := p_attribute13;
444         l_Price_Break_rec.attribute14  := p_attribute14;
445         l_Price_Break_rec.attribute15  := p_attribute15;
446         l_Price_Break_rec.attribute2   := p_attribute2;
447         l_Price_Break_rec.attribute3   := p_attribute3;
448         l_Price_Break_rec.attribute4   := p_attribute4;
449         l_Price_Break_rec.attribute5   := p_attribute5;
450         l_Price_Break_rec.attribute6   := p_attribute6;
451         l_Price_Break_rec.attribute7   := p_attribute7;
452         l_Price_Break_rec.attribute8   := p_attribute8;
453         l_Price_Break_rec.attribute9   := p_attribute9;
454         l_Price_Break_rec.context      := p_context;
455 
456     ELSE
457 
458         --  Unexpected error, unrecognized attribute
459 
460         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
461         THEN
462             OE_MSG_PUB.Add_Exc_Msg
463             (   G_PKG_NAME
464             ,   'Change_Attribute'
465             ,   'Unrecognized attribute'
466             );
467         END IF;
468 
469         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
470 
471     END IF;
472 
473     --  Set Operation.
474 
475     IF FND_API.To_Boolean(l_Price_Break_rec.db_flag) THEN
476         l_Price_Break_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
477     ELSE
478         l_Price_Break_rec.operation := OE_GLOBALS.G_OPR_CREATE;
479     END IF;
480 
481     --  Populate Price_Break table
482 
483     l_Price_Break_tbl(1) := l_Price_Break_rec;
484     l_old_Price_Break_tbl(1) := l_old_Price_Break_rec;
485 
486     --  Call OE_Pricing_Cont_PVT.Process_Pricing_Cont
487 
488     OE_Pricing_Cont_PVT.Process_Pricing_Cont
489     (   p_api_version_number          => 1.0
490     ,   p_init_msg_list               => FND_API.G_TRUE
491     ,   p_validation_level            => FND_API.G_VALID_LEVEL_NONE
492     ,   x_return_status               => l_return_status
493     ,   x_msg_count                   => x_msg_count
494     ,   x_msg_data                    => x_msg_data
495     ,   p_control_rec                 => l_control_rec
496     ,   p_Price_Break_tbl             => l_Price_Break_tbl
497     ,   p_old_Price_Break_tbl         => l_old_Price_Break_tbl
498     ,   x_Contract_rec                => l_x_Contract_rec
499     ,   x_Agreement_rec               => l_x_Agreement_rec
500     ,   x_Price_LHeader_rec           => l_x_Price_LHeader_rec
501     ,   x_Discount_Header_rec         => l_x_Discount_Header_rec
502     ,   x_Price_LLine_tbl             => l_x_Price_LLine_tbl
503     ,   x_Discount_Cust_tbl           => l_x_Discount_Cust_tbl
504     ,   x_Discount_Line_tbl           => l_x_Discount_Line_tbl
505     ,   x_Price_Break_tbl             => l_x_Price_Break_tbl
506     );
507 
508     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
509         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
510     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
511         RAISE FND_API.G_EXC_ERROR;
512     END IF;
513 
514 
515     --  Unload out tbl
516 
517     l_x_Price_Break_rec := l_x_Price_Break_tbl(1);
518 
519     --  Init OUT parameters to missing.
520 
521     x_amount                       := FND_API.G_MISS_NUM;
522     x_attribute1                   := FND_API.G_MISS_CHAR;
523     x_attribute10                  := FND_API.G_MISS_CHAR;
524     x_attribute11                  := FND_API.G_MISS_CHAR;
525     x_attribute12                  := FND_API.G_MISS_CHAR;
526     x_attribute13                  := FND_API.G_MISS_CHAR;
527     x_attribute14                  := FND_API.G_MISS_CHAR;
528     x_attribute15                  := FND_API.G_MISS_CHAR;
529     x_attribute2                   := FND_API.G_MISS_CHAR;
530     x_attribute3                   := FND_API.G_MISS_CHAR;
531     x_attribute4                   := FND_API.G_MISS_CHAR;
532     x_attribute5                   := FND_API.G_MISS_CHAR;
533     x_attribute6                   := FND_API.G_MISS_CHAR;
534     x_attribute7                   := FND_API.G_MISS_CHAR;
535     x_attribute8                   := FND_API.G_MISS_CHAR;
536     x_attribute9                   := FND_API.G_MISS_CHAR;
537     x_context                      := FND_API.G_MISS_CHAR;
538     x_discount_line_id             := FND_API.G_MISS_NUM;
539     x_end_date_active              := FND_API.G_MISS_DATE;
540     x_method_type_code             := FND_API.G_MISS_CHAR;
541     x_percent                      := FND_API.G_MISS_NUM;
542     x_price                        := FND_API.G_MISS_NUM;
543     x_price_break_high             := FND_API.G_MISS_NUM;
544     x_price_break_low              := FND_API.G_MISS_NUM;
545     x_start_date_active            := FND_API.G_MISS_DATE;
546     x_unit_code                    := FND_API.G_MISS_CHAR;
547     x_discount_line                := FND_API.G_MISS_CHAR;
548     x_method_type                  := FND_API.G_MISS_CHAR;
549     x_unit                         := FND_API.G_MISS_CHAR;
550 
551     --  Load display out parameters if any
552 
553     l_Price_Break_val_rec := OE_Price_Break_Util.Get_Values
554     (   p_Price_Break_rec             => l_x_Price_Break_rec
555     ,   p_old_Price_Break_rec         => l_Price_Break_rec
556     );
557 
558     --  Return changed attributes.
559 
560     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.amount,
561                             l_Price_Break_rec.amount)
562     THEN
563         x_amount := l_x_Price_Break_rec.amount;
564     END IF;
565 
566     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute1,
567                             l_Price_Break_rec.attribute1)
568     THEN
569         x_attribute1 := l_x_Price_Break_rec.attribute1;
570     END IF;
571 
572     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute10,
573                             l_Price_Break_rec.attribute10)
574     THEN
575         x_attribute10 := l_x_Price_Break_rec.attribute10;
576     END IF;
577 
578     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute11,
579                             l_Price_Break_rec.attribute11)
580     THEN
581         x_attribute11 := l_x_Price_Break_rec.attribute11;
582     END IF;
583 
584     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute12,
585                             l_Price_Break_rec.attribute12)
586     THEN
587         x_attribute12 := l_x_Price_Break_rec.attribute12;
588     END IF;
589 
590     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute13,
591                             l_Price_Break_rec.attribute13)
592     THEN
593         x_attribute13 := l_x_Price_Break_rec.attribute13;
594     END IF;
595 
596     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute14,
597                             l_Price_Break_rec.attribute14)
598     THEN
599         x_attribute14 := l_x_Price_Break_rec.attribute14;
600     END IF;
601 
602     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute15,
603                             l_Price_Break_rec.attribute15)
604     THEN
605         x_attribute15 := l_x_Price_Break_rec.attribute15;
606     END IF;
607 
608     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute2,
609                             l_Price_Break_rec.attribute2)
610     THEN
611         x_attribute2 := l_x_Price_Break_rec.attribute2;
612     END IF;
613 
614     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute3,
615                             l_Price_Break_rec.attribute3)
616     THEN
617         x_attribute3 := l_x_Price_Break_rec.attribute3;
618     END IF;
619 
620     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute4,
621                             l_Price_Break_rec.attribute4)
622     THEN
623         x_attribute4 := l_x_Price_Break_rec.attribute4;
624     END IF;
625 
626     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute5,
627                             l_Price_Break_rec.attribute5)
628     THEN
629         x_attribute5 := l_x_Price_Break_rec.attribute5;
630     END IF;
631 
632     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute6,
633                             l_Price_Break_rec.attribute6)
634     THEN
635         x_attribute6 := l_x_Price_Break_rec.attribute6;
636     END IF;
637 
638     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute7,
639                             l_Price_Break_rec.attribute7)
640     THEN
641         x_attribute7 := l_x_Price_Break_rec.attribute7;
642     END IF;
643 
644     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute8,
645                             l_Price_Break_rec.attribute8)
646     THEN
647         x_attribute8 := l_x_Price_Break_rec.attribute8;
648     END IF;
649 
650     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.attribute9,
651                             l_Price_Break_rec.attribute9)
652     THEN
653         x_attribute9 := l_x_Price_Break_rec.attribute9;
654     END IF;
655 
656     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.context,
657                             l_Price_Break_rec.context)
658     THEN
659         x_context := l_x_Price_Break_rec.context;
660     END IF;
661 
662     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.discount_line_id,
663                             l_Price_Break_rec.discount_line_id)
664     THEN
665         x_discount_line_id := l_x_Price_Break_rec.discount_line_id;
666         x_discount_line := l_Price_Break_val_rec.discount_line;
667     END IF;
668 
669     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.end_date_active,
670                             l_Price_Break_rec.end_date_active)
671     THEN
672         x_end_date_active := l_x_Price_Break_rec.end_date_active;
673     END IF;
674 
675     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.method_type_code,
676                             l_Price_Break_rec.method_type_code)
677     THEN
678         x_method_type_code := l_x_Price_Break_rec.method_type_code;
679         x_method_type := l_Price_Break_val_rec.method_type;
680     END IF;
681 
682     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.percent,
683                             l_Price_Break_rec.percent)
684     THEN
685         x_percent := l_x_Price_Break_rec.percent;
686     END IF;
687 
688     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.price,
689                             l_Price_Break_rec.price)
690     THEN
691         x_price := l_x_Price_Break_rec.price;
692     END IF;
693 
694     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.price_break_high,
695                             l_Price_Break_rec.price_break_high)
696     THEN
697         x_price_break_high := l_x_Price_Break_rec.price_break_high;
698     END IF;
699 
700     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.price_break_low,
701                             l_Price_Break_rec.price_break_low)
702     THEN
703         x_price_break_low := l_x_Price_Break_rec.price_break_low;
704     END IF;
705 
706     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.start_date_active,
707                             l_Price_Break_rec.start_date_active)
708     THEN
709         x_start_date_active := l_x_Price_Break_rec.start_date_active;
710     END IF;
711 
712     IF NOT OE_GLOBALS.Equal(l_x_Price_Break_rec.unit_code,
713                             l_Price_Break_rec.unit_code)
714     THEN
715         x_unit_code := l_x_Price_Break_rec.unit_code;
716         x_unit := l_Price_Break_val_rec.unit;
717     END IF;
718 
719 
720     --  Write to cache.
721 
722     Write_Price_Break
723     (   p_Price_Break_rec             => l_x_Price_Break_rec
724     );
725 
726     --  Set return status.
727 
728     x_return_status := FND_API.G_RET_STS_SUCCESS;
729 
730     --  Get message count and data
731 
732     OE_MSG_PUB.Count_And_Get
733     (   p_count                       => x_msg_count
734     ,   p_data                        => x_msg_data
735     );
736 
737 
738 EXCEPTION
739 
740     WHEN FND_API.G_EXC_ERROR THEN
741 
742         x_return_status := FND_API.G_RET_STS_ERROR;
743 
744         --  Get message count and data
745 
746         OE_MSG_PUB.Count_And_Get
747         (   p_count                       => x_msg_count
748         ,   p_data                        => x_msg_data
749         );
750 
751     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
752 
753         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
754 
755         --  Get message count and data
756 
757         OE_MSG_PUB.Count_And_Get
758         (   p_count                       => x_msg_count
759         ,   p_data                        => x_msg_data
760         );
761 
762     WHEN OTHERS THEN
763 
764         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
765 
766         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
767         THEN
768             OE_MSG_PUB.Add_Exc_Msg
769             (   G_PKG_NAME
770             ,   'Change_Attribute'
771             );
772         END IF;
773 
774         --  Get message count and data
775 
776         OE_MSG_PUB.Count_And_Get
777         (   p_count                       => x_msg_count
778         ,   p_data                        => x_msg_data
779         );
780 
781 END Change_Attribute;
782 
783 --  Procedure       Validate_And_Write
784 --
785 
786 PROCEDURE Validate_And_Write
787 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
788 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
789 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
790 ,   p_price_list_line_id              IN  NUMBER
791 ,   p_price_list_id				 IN  NUMBER
792 ,   p_method_type_code              IN  VARCHAR2
793 ,   p_price_break_high              IN  NUMBER
794 ,   p_price_break_low               IN  NUMBER
795 ,   p_list_price		   	   IN NUMBER
796 ,   x_creation_date                 OUT NOCOPY /* file.sql.39 change */ DATE
797 ,   x_created_by                    OUT NOCOPY /* file.sql.39 change */ NUMBER
798 ,   x_last_update_date              OUT NOCOPY /* file.sql.39 change */ DATE
799 ,   x_last_updated_by               OUT NOCOPY /* file.sql.39 change */ NUMBER
800 ,   x_last_update_login             OUT NOCOPY /* file.sql.39 change */ NUMBER
801 )
802 IS
803 l_Price_Break_rec             OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
804 l_old_Price_Break_rec         OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
805 l_Price_Break_tbl             OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
806 l_old_Price_Break_tbl         OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
807 l_control_rec                 OE_GLOBALS.Control_Rec_Type;
808 l_return_status               VARCHAR2(1);
809 l_x_Contract_rec              OE_Pricing_Cont_PUB.Contract_Rec_Type;
810 l_x_Agreement_rec             OE_Pricing_Cont_PUB.Agreement_Rec_Type;
811 l_x_Price_LHeader_rec         OE_Price_List_PUB.Price_List_Rec_Type;
812 l_x_Discount_Header_rec       OE_Pricing_Cont_PUB.Discount_Header_Rec_Type;
813 l_x_Price_LLine_rec           OE_Price_List_PUB.Price_List_Line_Rec_Type;
814 l_x_Price_LLine_tbl           OE_Price_List_PUB.Price_List_Line_Tbl_Type;
815 l_x_Discount_Cust_rec         OE_Pricing_Cont_PUB.Discount_Cust_Rec_Type;
816 l_x_Discount_Cust_tbl         OE_Pricing_Cont_PUB.Discount_Cust_Tbl_Type;
817 l_x_Discount_Line_rec         OE_Pricing_Cont_PUB.Discount_Line_Rec_Type;
818 l_x_Discount_Line_tbl         OE_Pricing_Cont_PUB.Discount_Line_Tbl_Type;
819 l_x_Price_Break_rec           OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
820 l_x_Price_Break_tbl           OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
821 
822 l_Price_LLine_rec           OE_Price_List_PUB.Price_List_Line_Rec_Type;
823 l_old_Price_LLine_rec           OE_Price_List_PUB.Price_List_Line_Rec_Type;
824 l_Price_LLine_tbl		   OE_Price_List_PUB.Price_list_Line_Tbl_Type;
825 l_old_Price_LLine_tbl		   OE_Price_List_PUB.Price_list_Line_Tbl_Type;
826 
827 I NUMBER := 1;
828 l_attribute_grouping_no number := 0;
829 l_pricing_attribute_id number := 0;
830 l_old_customer_item_id NUMBER ;
831 l_old_inventory_item_id NUMBER ;
832 
833 BEGIN
834 
835 
836    oe_debug_pub.initialize;
837    oe_debug_pub.debug_on;
838 
839    oe_debug_pub.add ( 'Geresh  In Procedure Validate and write' );
840 
841     l_control_rec.controlled_operation := TRUE;
842     l_control_rec.validate_entity      := TRUE;
843     l_control_rec.write_to_DB          := TRUE;
844 
845     l_control_rec.default_attributes   := FALSE;
846     l_control_rec.change_attributes    := FALSE;
847     l_control_rec.process              := FALSE;
848 
849     --  Instruct API to retain its caches
850 
851     l_control_rec.clear_api_cache      := FALSE;
852     l_control_rec.clear_api_requests   := FALSE;
853 
854 
855 
856     l_old_Price_LLine_rec := Get_Price_Id
857 		(  	p_db_record 	=> TRUE
858 	 ,	p_price_list_line_id => p_price_list_line_id
859 		 );
860 
861     l_Price_LLine_rec := Get_Price_Id
862 		(  	p_db_record 	=> FALSE
863 		 ,	p_price_list_line_id => p_price_list_line_id
864 		 );
865 
866 
867 
868 ---------------------------------------------------
869 -- generarting new price list line id for price break lines
870 --------------------------------------------------
871     select qp_list_lines_s.nextval into l_Price_LLine_rec.price_list_line_id
872     from dual;
873 ---------------------------------------------
874 -- Load Price List Line records for price breaks
875 ---------------------------------------------
876 
877     l_Price_LLine_rec.operation := OE_GLOBALS.G_OPR_CREATE;
878     l_Price_LLine_rec.db_flag := FND_API.G_FALSE;
879 
880     select sysdate into l_Price_LLine_rec.creation_date
881     from dual;
882 
883    oe_debug_pub.add ( 'Geresh 3:: In Procedure Validate and write' );
884 
885 
886  l_Price_LLine_rec.price_break_parent_line := p_price_list_line_id;
887     l_Price_LLine_rec.price_list_id := p_price_list_id;
888     l_Price_LLine_rec.list_line_type_code := 'PLL';
889     l_Price_LLine_rec.list_price := p_list_price;
890 
891     l_Price_LLine_rec.method_type_code := p_method_type_code;
892     l_Price_LLine_rec.price_break_low := p_price_break_low;
893     l_Price_LLine_rec.price_break_high := p_price_break_high;
894 
895 
896     l_Price_LLine_tbl(1) := l_Price_LLine_rec;
897     l_old_Price_LLine_tbl(1) := l_old_Price_LLine_rec;
898 
899     l_old_Price_LLine_rec.operation := l_Price_LLine_rec.operation;
900 
901 -------------------------------------
902 -- Insert / Update Records
903 -------------------------------------
904 oe_debug_pub.add('Price List IDS' || p_price_list_line_id );
905 oe_debug_pub.add('Price List IDS' || l_Price_LLine_rec.price_list_line_id );
906 
907     OE_Pricing_Cont_PVT.Process_Pricing_Cont
908 	(   		p_api_version_number          => 1.0
909 		,   	p_init_msg_list               => FND_API.G_TRUE
910 		,   x_return_status               => l_return_status
911 		,   x_msg_count                   => x_msg_count
912 		,   x_msg_data                    => x_msg_data
913 		,   p_control_rec                 => l_control_rec
914 		,   p_Price_LLine_tbl             => l_Price_LLine_tbl
915 		,   p_old_Price_LLine_tbl         => l_old_Price_LLine_tbl
916 		,   x_Contract_rec                => l_x_Contract_rec
917 		,   x_Agreement_rec               => l_x_Agreement_rec
918 		,   x_Price_LHeader_rec           => l_x_Price_LHeader_rec
919 		,   x_Discount_Header_rec         => l_x_Discount_Header_rec
920 		,   x_Price_LLine_tbl             => l_x_Price_LLine_tbl
921 		,   x_Discount_Cust_tbl           => l_x_Discount_Cust_tbl
922 		, x_Discount_Line_tbl           => l_x_Discount_Line_tbl
923 		,   x_Price_Break_tbl             => l_x_Price_Break_tbl
924 	);
925 
926 
927    oe_debug_pub.add ( 'Geresh ::Ednd  Proicees Pricing ' || x_return_status );
928     --  Load OUT parameters.
929 
930     l_x_Price_Break_rec := l_x_Price_Break_tbl(1);
931 
932     x_creation_date                := l_x_Price_Break_rec.creation_date;
933     x_created_by                   := l_x_Price_Break_rec.created_by;
934     x_last_update_date             := l_x_Price_Break_rec.last_update_date;
935     x_last_updated_by              := l_x_Price_Break_rec.last_updated_by;
936     x_last_update_login            := l_x_Price_Break_rec.last_update_login;
937 
938 
939 
940     --  Set return status.
941 
942     x_return_status := FND_API.G_RET_STS_SUCCESS;
943 
944     --  Get message count and data
945 
946     OE_MSG_PUB.Count_And_Get
947     (   p_count                       => x_msg_count
948     ,   p_data                        => x_msg_data
949     );
950 
951 
952 EXCEPTION
953 
954     WHEN FND_API.G_EXC_ERROR THEN
955 
956         x_return_status := FND_API.G_RET_STS_ERROR;
957 
958         --  Get message count and data
959 
960         OE_MSG_PUB.Count_And_Get
961         (   p_count                       => x_msg_count
962         ,   p_data                        => x_msg_data
963         );
964 
965     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
966 
967         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
968 
969         --  Get message count and data
970 
971         OE_MSG_PUB.Count_And_Get
972         (   p_count                       => x_msg_count
973         ,   p_data                        => x_msg_data
974         );
975 
976     WHEN OTHERS THEN
977 
978 	  null;
979 /*        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
980 
981         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
982         THEN
983             OE_MSG_PUB.Add_Exc_Msg
984             (   G_PKG_NAME
985             ,   'Validate_And_Write'
986             );
987         END IF;   */
988 
989         --  Get message count and data
990 
991         OE_MSG_PUB.Count_And_Get
992         (   p_count                       => x_msg_count
993         ,   p_data                        => x_msg_data
994         );
995 
996 END Validate_And_Write;
997 
998 
999 FUNCTION Get_Price_Id
1000 (   p_db_record                     IN  BOOLEAN := FALSE
1001 ,   p_price_list_line_id            IN  NUMBER
1002 )
1003 RETURN OE_Price_List_PUB.Price_List_Line_Rec_Type
1004 IS
1005 l_Price_LLine_rec         OE_Price_List_PUB.Price_List_Line_Rec_Type;
1006 BEGIN
1007 
1008 
1009         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1010         THEN
1011             OE_MSG_PUB.Add_Exc_Msg
1012             (   G_PKG_NAME
1013             ,   'Validate_And_Write' || p_price_list_line_id
1014             );
1015         END IF;
1016   IF  p_price_list_line_id is not null
1017   THEN
1018 		--  Query row from DB
1019  SELECT  ATTRIBUTE1
1020 ,       ATTRIBUTE10
1021 ,       ATTRIBUTE11
1022 ,       ATTRIBUTE12
1023 ,       ATTRIBUTE13
1024 ,       ATTRIBUTE14
1025 ,       ATTRIBUTE15
1026 ,       ATTRIBUTE2
1027 ,       ATTRIBUTE3
1028 ,       ATTRIBUTE4
1029 ,       ATTRIBUTE5
1030 ,       ATTRIBUTE6
1031 ,       ATTRIBUTE7
1032 ,       ATTRIBUTE8
1033 ,       ATTRIBUTE9
1034 ,       COMMENTS
1035 ,       CONTEXT
1036 ,       CREATED_BY
1037 ,       CREATION_DATE
1038 ,       CUSTOMER_ITEM_ID
1039 ,       END_DATE_ACTIVE
1040 ,       INVENTORY_ITEM_ID
1041 ,       LAST_UPDATED_BY
1042 ,       LAST_UPDATE_DATE
1043 ,       LAST_UPDATE_LOGIN
1044 ,       LIST_PRICE
1045 ,       METHOD_CODE
1046 ,       PRICE_LIST_ID
1047 ,       PRICE_LIST_LINE_ID
1048 ,       PRICING_ATTRIBUTE1
1049 ,       PRICING_ATTRIBUTE10
1050 ,       PRICING_ATTRIBUTE11
1051 ,       PRICING_ATTRIBUTE12
1052 ,       PRICING_ATTRIBUTE13
1053 ,       PRICING_ATTRIBUTE14
1054 ,       PRICING_ATTRIBUTE15
1055 ,       PRICING_ATTRIBUTE2
1056 ,       PRICING_ATTRIBUTE3
1057 ,       PRICING_ATTRIBUTE4
1058 ,       PRICING_ATTRIBUTE5
1059 ,       PRICING_ATTRIBUTE6
1060 ,       PRICING_ATTRIBUTE7
1061 ,       PRICING_ATTRIBUTE8
1062 ,       PRICING_ATTRIBUTE9
1063 ,       PRICING_CONTEXT
1064 ,       PRICING_RULE_ID
1065 ,       PRIMARY
1066 ,       PROGRAM_APPLICATION_ID
1067 ,       PROGRAM_ID
1068 ,       PROGRAM_UPDATE_DATE
1069 ,       REPRICE_FLAG
1070 ,       REQUEST_ID
1071 ,       REVISION
1072 ,       REVISION_DATE
1073 ,       REVISION_REASON_CODE
1074 ,       START_DATE_ACTIVE
1075 ,       UNIT_CODE
1076 INTO        l_Price_LLine_rec.ATTRIBUTE1
1077 ,       l_Price_LLine_rec.ATTRIBUTE10
1078 ,       l_Price_LLine_rec.ATTRIBUTE11
1079 ,       l_Price_LLine_rec.ATTRIBUTE12
1080 ,       l_Price_LLine_rec.ATTRIBUTE13
1081 ,       l_Price_LLine_rec.ATTRIBUTE14
1082 ,       l_Price_LLine_rec.ATTRIBUTE15
1083 ,       l_Price_LLine_rec.ATTRIBUTE2
1084 ,       l_Price_LLine_rec.ATTRIBUTE3
1085 ,       l_Price_LLine_rec.ATTRIBUTE4
1086 ,       l_Price_LLine_rec.ATTRIBUTE5
1087 ,       l_Price_LLine_rec.ATTRIBUTE6
1088 ,       l_Price_LLine_rec.ATTRIBUTE7
1089 ,       l_Price_LLine_rec.ATTRIBUTE8
1090 ,       l_Price_LLine_rec.ATTRIBUTE9
1091 ,       l_Price_LLine_rec.COMMENTS
1092 ,       l_Price_LLine_rec.CONTEXT
1093 ,       l_Price_LLine_rec.CREATED_BY
1094 ,       l_Price_LLine_rec.CREATION_DATE
1095 ,       l_Price_LLine_rec.CUSTOMER_ITEM_ID
1096 ,       l_Price_LLine_rec.END_DATE_ACTIVE
1097 ,       l_Price_LLine_rec.INVENTORY_ITEM_ID
1098 ,       l_Price_LLine_rec.LAST_UPDATED_BY
1099 ,       l_Price_LLine_rec.LAST_UPDATE_DATE
1100 ,       l_Price_LLine_rec.LAST_UPDATE_LOGIN
1101 ,       l_Price_LLine_rec.LIST_PRICE
1102 ,       l_Price_LLine_rec.METHOD_CODE
1103 ,       l_Price_LLine_rec.PRICE_LIST_ID
1104 ,       l_Price_LLine_rec.PRICE_LIST_LINE_ID
1105 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE1
1106 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE10
1107 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE11
1108 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE12
1109 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE13
1110 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE14
1111 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE15
1112 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE2
1113 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE3
1114 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE4
1115 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE5
1116 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE6
1117 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE7
1118 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE8
1119 ,       l_Price_LLine_rec.PRICING_ATTRIBUTE9
1120 ,       l_Price_LLine_rec.PRICING_CONTEXT
1121 ,       l_Price_LLine_rec.PRICING_RULE_ID
1122 ,       l_Price_LLine_rec.PRIMARY
1123 ,       l_Price_LLine_rec.PROGRAM_APPLICATION_ID
1124 ,       l_Price_LLine_rec.PROGRAM_ID
1125 ,       l_Price_LLine_rec.PROGRAM_UPDATE_DATE
1126 ,       l_Price_LLine_rec.REPRICE_FLAG
1127 ,       l_Price_LLine_rec.REQUEST_ID
1128 ,       l_Price_LLine_rec.REVISION
1129 ,       l_Price_LLine_rec.REVISION_DATE
1130 ,       l_Price_LLine_rec.REVISION_REASON_CODE
1131 ,       l_Price_LLine_rec.START_DATE_ACTIVE
1132 ,       l_Price_LLine_rec.UNIT_CODE
1133 
1134 FROM    	qp_price_list_lines_v WHERE ( PRICE_LIST_LINE_ID = p_price_list_line_id);
1135 -- FROM    OE_PRICE_LIST_LINES WHERE ( PRICE_LIST_LINE_ID = p_price_list_line_id);
1136 
1137  END IF;
1138 
1139 --   g_Price_LLine_rec := l_Price_LLine_rec;
1140 
1141 	IF p_db_record THEN
1142 	   RETURN l_Price_LLine_rec;
1143 	ELSE
1144 --	   RETURN g_Price_LLine_rec;
1145 	 RETURN l_Price_LLine_rec;
1146 
1147     END IF;
1148 END Get_Price_Id;
1149 
1150 --  Procedure       Delete_Row
1151 --
1152 PROCEDURE Delete_Row
1153 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1154 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
1155 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1156 ,   p_discount_line_id              IN  NUMBER
1157 ,   p_method_type_code              IN  VARCHAR2
1158 ,   p_price_break_high              IN  NUMBER
1159 ,   p_price_break_low               IN  NUMBER
1160 )
1161 IS
1162 l_Price_Break_rec             OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
1163 l_Price_Break_tbl             OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
1164 l_control_rec                 OE_GLOBALS.Control_Rec_Type;
1165 l_return_status               VARCHAR2(1);
1166 l_x_Contract_rec              OE_Pricing_Cont_PUB.Contract_Rec_Type;
1167 l_x_Agreement_rec             OE_Pricing_Cont_PUB.Agreement_Rec_Type;
1168 l_x_Price_LHeader_rec         OE_Price_List_PUB.Price_List_Rec_Type;
1169 l_x_Discount_Header_rec       OE_Pricing_Cont_PUB.Discount_Header_Rec_Type;
1170 l_x_Price_LLine_rec           OE_Price_List_PUB.Price_List_Line_Rec_Type;
1171 l_x_Price_LLine_tbl           OE_Price_List_PUB.Price_List_Line_Tbl_Type;
1172 l_x_Discount_Cust_rec         OE_Pricing_Cont_PUB.Discount_Cust_Rec_Type;
1173 l_x_Discount_Cust_tbl         OE_Pricing_Cont_PUB.Discount_Cust_Tbl_Type;
1174 l_x_Discount_Line_rec         OE_Pricing_Cont_PUB.Discount_Line_Rec_Type;
1175 l_x_Discount_Line_tbl         OE_Pricing_Cont_PUB.Discount_Line_Tbl_Type;
1176 l_x_Price_Break_rec           OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
1177 l_x_Price_Break_tbl           OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
1178 BEGIN
1179 
1180     --  Set control flags.
1181 
1182     l_control_rec.controlled_operation := TRUE;
1183     l_control_rec.validate_entity      := TRUE;
1184     l_control_rec.write_to_DB          := TRUE;
1185 
1186     l_control_rec.default_attributes   := FALSE;
1187     l_control_rec.change_attributes    := FALSE;
1188     l_control_rec.process              := FALSE;
1189 
1190     --  Instruct API to retain its caches
1191 
1192     l_control_rec.clear_api_cache      := FALSE;
1193     l_control_rec.clear_api_requests   := FALSE;
1194 
1195     --  Read DB record from cache
1196 
1197     l_Price_Break_rec := Get_Price_Break
1198     (   p_db_record                   => TRUE
1199     ,   p_discount_line_id            => p_discount_line_id
1200     ,   p_method_type_code            => p_method_type_code
1201     ,   p_price_break_high            => p_price_break_high
1202     ,   p_price_break_low             => p_price_break_low
1203     );
1204 
1205     --  Set Operation.
1206 
1207     l_Price_Break_rec.operation := OE_GLOBALS.G_OPR_DELETE;
1208 
1209     --  Populate Price_Break table
1210 
1211     l_Price_Break_tbl(1) := l_Price_Break_rec;
1212 
1213     --  Call OE_Pricing_Cont_PVT.Process_Pricing_Cont
1214 
1215     OE_Pricing_Cont_PVT.Process_Pricing_Cont
1216     (   p_api_version_number          => 1.0
1217     ,   p_init_msg_list               => FND_API.G_TRUE
1218     ,   x_return_status               => l_return_status
1219     ,   x_msg_count                   => x_msg_count
1220     ,   x_msg_data                    => x_msg_data
1221     ,   p_control_rec                 => l_control_rec
1222     ,   p_Price_Break_tbl             => l_Price_Break_tbl
1223     ,   x_Contract_rec                => l_x_Contract_rec
1224     ,   x_Agreement_rec               => l_x_Agreement_rec
1225     ,   x_Price_LHeader_rec           => l_x_Price_LHeader_rec
1226     ,   x_Discount_Header_rec         => l_x_Discount_Header_rec
1227     ,   x_Price_LLine_tbl             => l_x_Price_LLine_tbl
1228     ,   x_Discount_Cust_tbl           => l_x_Discount_Cust_tbl
1229     ,   x_Discount_Line_tbl           => l_x_Discount_Line_tbl
1230     ,   x_Price_Break_tbl             => l_x_Price_Break_tbl
1231     );
1232 
1233     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1234         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1235     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1236         RAISE FND_API.G_EXC_ERROR;
1237     END IF;
1238 
1239 
1240     --  Clear Price_Break record cache
1241 
1242     Clear_Price_Break;
1243 
1244     --  Set return status.
1245 
1246     x_return_status := FND_API.G_RET_STS_SUCCESS;
1247 
1248     --  Get message count and data
1249 
1250     OE_MSG_PUB.Count_And_Get
1251     (   p_count                       => x_msg_count
1252     ,   p_data                        => x_msg_data
1253     );
1254 
1255 
1256 EXCEPTION
1257 
1258     WHEN FND_API.G_EXC_ERROR THEN
1259 
1260         x_return_status := FND_API.G_RET_STS_ERROR;
1261 
1262         --  Get message count and data
1263 
1264         OE_MSG_PUB.Count_And_Get
1265         (   p_count                       => x_msg_count
1266         ,   p_data                        => x_msg_data
1267         );
1268 
1269     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1270 
1271         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1272 
1273         --  Get message count and data
1274 
1275         OE_MSG_PUB.Count_And_Get
1276         (   p_count                       => x_msg_count
1277         ,   p_data                        => x_msg_data
1278         );
1279 
1280     WHEN OTHERS THEN
1281 
1282         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1283 
1284         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1285         THEN
1286             OE_MSG_PUB.Add_Exc_Msg
1287             (   G_PKG_NAME
1288             ,   'Delete_Row'
1289             );
1290         END IF;
1291 
1292         --  Get message count and data
1293 
1294         OE_MSG_PUB.Count_And_Get
1295         (   p_count                       => x_msg_count
1296         ,   p_data                        => x_msg_data
1297         );
1298 
1299 END Delete_Row;
1300 
1301 --  Procedure       Process_Entity
1302 --
1303 
1304 PROCEDURE Process_Entity
1305 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1306 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
1307 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1308 )
1309 IS
1310 l_control_rec                 OE_GLOBALS.Control_Rec_Type;
1311 l_return_status               VARCHAR2(1);
1312 l_x_Contract_rec              OE_Pricing_Cont_PUB.Contract_Rec_Type;
1313 l_x_Agreement_rec             OE_Pricing_Cont_PUB.Agreement_Rec_Type;
1314 l_x_Price_LHeader_rec         OE_Price_List_PUB.Price_List_Rec_Type;
1315 l_x_Discount_Header_rec       OE_Pricing_Cont_PUB.Discount_Header_Rec_Type;
1316 l_x_Price_LLine_rec           OE_Price_List_PUB.Price_List_Line_Rec_Type;
1317 l_x_Price_LLine_tbl           OE_Price_List_PUB.Price_List_Line_Tbl_Type;
1318 l_x_Discount_Cust_rec         OE_Pricing_Cont_PUB.Discount_Cust_Rec_Type;
1319 l_x_Discount_Cust_tbl         OE_Pricing_Cont_PUB.Discount_Cust_Tbl_Type;
1320 l_x_Discount_Line_rec         OE_Pricing_Cont_PUB.Discount_Line_Rec_Type;
1321 l_x_Discount_Line_tbl         OE_Pricing_Cont_PUB.Discount_Line_Tbl_Type;
1322 l_x_Price_Break_rec           OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
1323 l_x_Price_Break_tbl           OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
1324 BEGIN
1325 
1326     --  Set control flags.
1327 
1328     l_control_rec.controlled_operation := TRUE;
1329     l_control_rec.process              := TRUE;
1330     l_control_rec.process_entity       := OE_GLOBALS.G_ENTITY_PRICE_BREAK;
1331 
1332     l_control_rec.default_attributes   := FALSE;
1333     l_control_rec.change_attributes    := FALSE;
1334     l_control_rec.validate_entity      := FALSE;
1335     l_control_rec.write_to_DB          := FALSE;
1336 
1337     --  Instruct API to clear its request table
1338 
1339     l_control_rec.clear_api_cache      := FALSE;
1340     l_control_rec.clear_api_requests   := FALSE;
1341 
1342     --  Call OE_Pricing_Cont_PVT.Process_Pricing_Cont
1343 
1344     OE_Pricing_Cont_PVT.Process_Pricing_Cont
1345     (   p_api_version_number          => 1.0
1346     ,   p_init_msg_list               => FND_API.G_TRUE
1347     ,   x_return_status               => l_return_status
1348     ,   x_msg_count                   => x_msg_count
1349     ,   x_msg_data                    => x_msg_data
1350     ,   p_control_rec                 => l_control_rec
1351     ,   x_Contract_rec                => l_x_Contract_rec
1352     ,   x_Agreement_rec               => l_x_Agreement_rec
1353     ,   x_Price_LHeader_rec           => l_x_Price_LHeader_rec
1354     ,   x_Discount_Header_rec         => l_x_Discount_Header_rec
1355     ,   x_Price_LLine_tbl             => l_x_Price_LLine_tbl
1356     ,   x_Discount_Cust_tbl           => l_x_Discount_Cust_tbl
1357     ,   x_Discount_Line_tbl           => l_x_Discount_Line_tbl
1358     ,   x_Price_Break_tbl             => l_x_Price_Break_tbl
1359     );
1360 
1361     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1362         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1363     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1364         RAISE FND_API.G_EXC_ERROR;
1365     END IF;
1366 
1367 
1368     --  Set return status.
1369 
1370     x_return_status := FND_API.G_RET_STS_SUCCESS;
1371 
1372     --  Get message count and data
1373 
1374     OE_MSG_PUB.Count_And_Get
1375     (   p_count                       => x_msg_count
1376     ,   p_data                        => x_msg_data
1377     );
1378 
1379 
1380 EXCEPTION
1381 
1382     WHEN FND_API.G_EXC_ERROR THEN
1383 
1384         x_return_status := FND_API.G_RET_STS_ERROR;
1385 
1386         --  Get message count and data
1387 
1388         OE_MSG_PUB.Count_And_Get
1389         (   p_count                       => x_msg_count
1390         ,   p_data                        => x_msg_data
1391         );
1392 
1393     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1394 
1395         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1396 
1397         --  Get message count and data
1398 
1399         OE_MSG_PUB.Count_And_Get
1400         (   p_count                       => x_msg_count
1401         ,   p_data                        => x_msg_data
1402         );
1403 
1404     WHEN OTHERS THEN
1405 
1406         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1407 
1408         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1409         THEN
1410             OE_MSG_PUB.Add_Exc_Msg
1411             (   G_PKG_NAME
1412             ,   'Process_Entity'
1413             );
1414         END IF;
1415 
1416         --  Get message count and data
1417 
1418         OE_MSG_PUB.Count_And_Get
1419         (   p_count                       => x_msg_count
1420         ,   p_data                        => x_msg_data
1421         );
1422 
1423 END Process_Entity;
1424 
1425 --  Procedure       lock_Row
1426 --
1427 
1428 PROCEDURE Lock_Row
1429 (   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1430 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
1431 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1432 ,   p_amount                        IN  NUMBER
1433 ,   p_attribute1                    IN  VARCHAR2
1434 ,   p_attribute10                   IN  VARCHAR2
1435 ,   p_attribute11                   IN  VARCHAR2
1436 ,   p_attribute12                   IN  VARCHAR2
1437 ,   p_attribute13                   IN  VARCHAR2
1438 ,   p_attribute14                   IN  VARCHAR2
1439 ,   p_attribute15                   IN  VARCHAR2
1440 ,   p_attribute2                    IN  VARCHAR2
1441 ,   p_attribute3                    IN  VARCHAR2
1442 ,   p_attribute4                    IN  VARCHAR2
1443 ,   p_attribute5                    IN  VARCHAR2
1444 ,   p_attribute6                    IN  VARCHAR2
1445 ,   p_attribute7                    IN  VARCHAR2
1446 ,   p_attribute8                    IN  VARCHAR2
1447 ,   p_attribute9                    IN  VARCHAR2
1448 ,   p_context                       IN  VARCHAR2
1449 ,   p_created_by                    IN  NUMBER
1450 ,   p_creation_date                 IN  DATE
1451 ,   p_discount_line_id              IN  NUMBER
1452 ,   p_end_date_active               IN  DATE
1453 ,   p_last_updated_by               IN  NUMBER
1454 ,   p_last_update_date              IN  DATE
1455 ,   p_last_update_login             IN  NUMBER
1456 ,   p_method_type_code              IN  VARCHAR2
1457 ,   p_percent                       IN  NUMBER
1458 ,   p_price                         IN  NUMBER
1459 ,   p_price_break_high              IN  NUMBER
1460 ,   p_price_break_low               IN  NUMBER
1461 ,   p_program_application_id        IN  NUMBER
1462 ,   p_program_id                    IN  NUMBER
1463 ,   p_program_update_date           IN  DATE
1464 ,   p_request_id                    IN  NUMBER
1465 ,   p_start_date_active             IN  DATE
1466 ,   p_unit_code                     IN  VARCHAR2
1467 )
1468 IS
1469 l_return_status               VARCHAR2(1);
1470 l_Price_Break_rec             OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
1471 l_Price_Break_tbl             OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
1472 l_x_Contract_rec              OE_Pricing_Cont_PUB.Contract_Rec_Type;
1473 l_x_Agreement_rec             OE_Pricing_Cont_PUB.Agreement_Rec_Type;
1474 l_x_Price_LHeader_rec         OE_Price_List_PUB.Price_List_Rec_Type;
1475 l_x_Discount_Header_rec       OE_Pricing_Cont_PUB.Discount_Header_Rec_Type;
1476 l_x_Price_LLine_rec           OE_Price_List_PUB.Price_List_Line_Rec_Type;
1477 l_x_Price_LLine_tbl           OE_Price_List_PUB.Price_List_Line_Tbl_Type;
1478 l_x_Discount_Cust_rec         OE_Pricing_Cont_PUB.Discount_Cust_Rec_Type;
1479 l_x_Discount_Cust_tbl         OE_Pricing_Cont_PUB.Discount_Cust_Tbl_Type;
1480 l_x_Discount_Line_rec         OE_Pricing_Cont_PUB.Discount_Line_Rec_Type;
1481 l_x_Discount_Line_tbl         OE_Pricing_Cont_PUB.Discount_Line_Tbl_Type;
1482 l_x_Price_Break_rec           OE_Pricing_Cont_PUB.Price_Break_Rec_Type;
1483 l_x_Price_Break_tbl           OE_Pricing_Cont_PUB.Price_Break_Tbl_Type;
1484 BEGIN
1485 
1486     --  Load Price_Break record
1487 
1488     l_Price_Break_rec.amount       := p_amount;
1489     l_Price_Break_rec.attribute1   := p_attribute1;
1490     l_Price_Break_rec.attribute10  := p_attribute10;
1491     l_Price_Break_rec.attribute11  := p_attribute11;
1492     l_Price_Break_rec.attribute12  := p_attribute12;
1493     l_Price_Break_rec.attribute13  := p_attribute13;
1494     l_Price_Break_rec.attribute14  := p_attribute14;
1495     l_Price_Break_rec.attribute15  := p_attribute15;
1496     l_Price_Break_rec.attribute2   := p_attribute2;
1497     l_Price_Break_rec.attribute3   := p_attribute3;
1498     l_Price_Break_rec.attribute4   := p_attribute4;
1499     l_Price_Break_rec.attribute5   := p_attribute5;
1500     l_Price_Break_rec.attribute6   := p_attribute6;
1501     l_Price_Break_rec.attribute7   := p_attribute7;
1502     l_Price_Break_rec.attribute8   := p_attribute8;
1503     l_Price_Break_rec.attribute9   := p_attribute9;
1504     l_Price_Break_rec.context      := p_context;
1505     l_Price_Break_rec.created_by   := p_created_by;
1506     l_Price_Break_rec.creation_date := p_creation_date;
1507     l_Price_Break_rec.discount_line_id := p_discount_line_id;
1508     l_Price_Break_rec.end_date_active := p_end_date_active;
1509     l_Price_Break_rec.last_updated_by := p_last_updated_by;
1510     l_Price_Break_rec.last_update_date := p_last_update_date;
1511     l_Price_Break_rec.last_update_login := p_last_update_login;
1512     l_Price_Break_rec.method_type_code := p_method_type_code;
1513     l_Price_Break_rec.percent      := p_percent;
1514     l_Price_Break_rec.price        := p_price;
1515     l_Price_Break_rec.price_break_high := p_price_break_high;
1516     l_Price_Break_rec.price_break_low := p_price_break_low;
1517     l_Price_Break_rec.program_application_id := p_program_application_id;
1518     l_Price_Break_rec.program_id   := p_program_id;
1519     l_Price_Break_rec.program_update_date := p_program_update_date;
1520     l_Price_Break_rec.request_id   := p_request_id;
1521     l_Price_Break_rec.start_date_active := p_start_date_active;
1522     l_Price_Break_rec.unit_code    := p_unit_code;
1523 
1524     --  Populate Price_Break table
1525 
1526     l_Price_Break_tbl(1) := l_Price_Break_rec;
1527 
1528     --  Call OE_Pricing_Cont_PVT.Lock_Pricing_Cont
1529 
1530     OE_Pricing_Cont_PVT.Lock_Pricing_Cont
1531     (   p_api_version_number          => 1.0
1532     ,   p_init_msg_list               => FND_API.G_TRUE
1533     ,   x_return_status               => l_return_status
1534     ,   x_msg_count                   => x_msg_count
1535     ,   x_msg_data                    => x_msg_data
1536     ,   p_Price_Break_tbl             => l_Price_Break_tbl
1537     ,   x_Contract_rec                => l_x_Contract_rec
1538     ,   x_Agreement_rec               => l_x_Agreement_rec
1539     ,   x_Price_LHeader_rec           => l_x_Price_LHeader_rec
1540     ,   x_Discount_Header_rec         => l_x_Discount_Header_rec
1541     ,   x_Price_LLine_tbl             => l_x_Price_LLine_tbl
1542     ,   x_Discount_Cust_tbl           => l_x_Discount_Cust_tbl
1543     ,   x_Discount_Line_tbl           => l_x_Discount_Line_tbl
1544     ,   x_Price_Break_tbl             => l_x_Price_Break_tbl
1545     );
1546 
1547     IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
1548 
1549         --  Set DB flag and write record to cache.
1550 
1551         l_x_Price_Break_rec.db_flag := FND_API.G_TRUE;
1552 
1553         Write_Price_Break
1554         (   p_Price_Break_rec             => l_x_Price_Break_rec
1555         ,   p_db_record                   => TRUE
1556         );
1557 
1558     END IF;
1559 
1560     --  Set return status.
1561 
1562     x_return_status := l_return_status;
1563 
1564     --  Get message count and data
1565 
1566     OE_MSG_PUB.Count_And_Get
1567     (   p_count                       => x_msg_count
1568     ,   p_data                        => x_msg_data
1569     );
1570 
1571 
1572 EXCEPTION
1573 
1574     WHEN OTHERS THEN
1575 
1576         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1577         THEN
1578             OE_MSG_PUB.Add_Exc_Msg
1579             (   G_PKG_NAME
1580             ,   'Lock_Row'
1581             );
1582         END IF;
1583 
1584         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1585 
1586         --  Get message count and data
1587 
1588         OE_MSG_PUB.Count_And_Get
1589         (   p_count                       => x_msg_count
1590         ,   p_data                        => x_msg_data
1591         );
1592 
1593 
1594 
1595 END Lock_Row;
1596 
1597 --  Procedures maintaining Price_Break record cache.
1598 
1599 PROCEDURE Write_Price_Break
1600 (   p_Price_Break_rec               IN  OE_Pricing_Cont_PUB.Price_Break_Rec_Type
1601 ,   p_db_record                     IN  BOOLEAN := FALSE
1602 )
1603 IS
1604 BEGIN
1605 
1606     g_Price_Break_rec := p_Price_Break_rec;
1607 
1608     IF p_db_record THEN
1609 
1610         g_db_Price_Break_rec := p_Price_Break_rec;
1611 
1612     END IF;
1613 
1614 END Write_Price_Break;
1615 
1616 FUNCTION Get_Price_Break
1617 (   p_db_record                     IN  BOOLEAN := FALSE
1618 ,   p_discount_line_id              IN  NUMBER
1619 ,   p_method_type_code              IN  VARCHAR2
1620 ,   p_price_break_high              IN  NUMBER
1621 ,   p_price_break_low               IN  NUMBER
1622 )
1623 RETURN OE_Pricing_Cont_PUB.Price_Break_Rec_Type
1624 IS
1625 BEGIN
1626 
1627     IF  p_discount_line_id <> g_Price_Break_rec.discount_line_id
1628     THEN
1629 
1630         --  Query row from DB
1631         g_Price_Break_rec := OE_Price_Break_Util.Query_Row
1632         (   p_discount_line_id            => p_discount_line_id
1633 	   ,   p_method_type_code          => p_method_type_code
1634 	   ,   p_price_break_high         => p_price_break_high
1635 	   ,   p_price_break_low           => p_price_break_low
1636         );
1637 
1638         g_Price_Break_rec.db_flag      := FND_API.G_TRUE;
1639 
1640         --  Load DB record
1641 
1642         g_db_Price_Break_rec           := g_Price_Break_rec;
1643 
1644     END IF;
1645 
1646     IF p_db_record THEN
1647 
1648         RETURN g_db_Price_Break_rec;
1649 
1650     ELSE
1651 
1652         RETURN g_Price_Break_rec;
1653 
1654     END IF;
1655 
1656 END Get_Price_Break;
1657 
1658 PROCEDURE Clear_Price_Break
1659 IS
1660 BEGIN
1661 
1662     g_Price_Break_rec              := OE_Pricing_Cont_PUB.G_MISS_PRICE_BREAK_REC;
1663     g_db_Price_Break_rec           := OE_Pricing_Cont_PUB.G_MISS_PRICE_BREAK_REC;
1664 
1665 END Clear_Price_Break;
1666 
1667 END OE_OE_Form_Price_Break;