DBA Data[Home] [Help]

PACKAGE BODY: APPS.QP_DEFAULT_PRICING_ATTR

Source


1 PACKAGE BODY QP_Default_Pricing_Attr AS
2 /* $Header: QPXDPRAB.pls 120.2 2005/07/07 04:05:40 appldev ship $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'QP_Default_Pricing_Attr';
7 
8 --  Package global used within the package.
9 
10 g_PRICING_ATTR_rec            QP_Modifiers_PUB.Pricing_Attr_Rec_Type;
11 
12 --  Get functions.
13 
14 /* changes made by spgopal to include columns list_header_id and pricing_phase_id in pricing attr for performance problems*/
15 
16 FUNCTION Get_List_Header(p_list_line_id IN NUMBER)
17 RETURN VARCHAR2
18 IS
19 l_list_header_id NUMBER	:= FND_API.G_MISS_NUM;
20 BEGIN
21 
22 /*
23 	IF p_list_line_id <> FND_API.G_MISS_NUM THEN
24 
25 	select list_header_id into l_list_header_id from qp_list_lines where list_line_id = p_list_line_id;
26 
27 	RETURN l_list_header_id;
28 
29 	ELSE
30 
31 	RETURN NULL;
32 
33 	END IF;
34 	*/
35 	RETURN NULL;
36 
37 EXCEPTION
38     When NO_DATA_FOUND Then
39 
40     RETURN NULL;
41 
42 END Get_List_Header;
43 
44 FUNCTION Get_Pricing_Phase(p_list_line_id IN NUMBER)
45 RETURN VARCHAR2
46 IS
47 l_pricing_phase_id NUMBER	:= FND_API.G_MISS_NUM;
48 BEGIN
49 
50 /*
51 	IF p_list_line_id <> FND_API.G_MISS_NUM THEN
52 
53 	select pricing_phase_id into l_pricing_phase_id from qp_list_lines where list_line_id = p_list_line_id;
54 
55 	RETURN l_pricing_phase_id;
56 
57 	ELSE
58 
59 	RETURN NULL;
60 
61 	END IF;
62 */
63 	RETURN NULL;
64 EXCEPTION
65     When NO_DATA_FOUND Then
66 
67     RETURN NULL;
68 
69 END Get_Pricing_Phase;
70 
71 
72 FUNCTION Get_Comparison_Operator
73 RETURN VARCHAR2
74 IS
75 BEGIN
76 
77     RETURN NULL;
78 
79 END Get_Comparison_Operator;
80 
81 FUNCTION Get_Accumulate
82 RETURN VARCHAR2
83 IS
84 BEGIN
85 
86     RETURN 'N';
87 
88 END Get_Accumulate;
89 
90 FUNCTION Get_Attribute_Grouping_No
91 RETURN NUMBER
92 IS
93 l_attribute_grouping_no NUMBER := FND_API.G_MISS_NUM;
94 BEGIN
95 
96 
97    select QP_PRICING_ATTR_GROUP_NO_S.nextval
98    into   l_attribute_grouping_no
99    from   dual;
100 
101     RETURN l_attribute_grouping_no;
102 
103 END Get_Attribute_Grouping_No;
104 
105 FUNCTION Get_Excluder
106 RETURN VARCHAR2
107 IS
108 BEGIN
109 
110     RETURN 'N';
111 
112 END Get_Excluder;
113 
114 FUNCTION Get_List_Line
115 RETURN NUMBER
116 IS
117 BEGIN
118 
119     RETURN NULL;
120 
121 END Get_List_Line;
122 
123 FUNCTION Get_Pricing_Attribute
124 RETURN VARCHAR2
125 IS
126 l_pricing_attribute_id NUMBER := FND_API.G_MISS_NUM;
127 BEGIN
128 
129     select QP_PRICING_ATTRIBUTES_S.nextval
130     into   l_pricing_attribute_id
131     from   dual;
132 
133     RETURN l_pricing_attribute_id;
134 
135 END Get_Pricing_Attribute;
136 
137 FUNCTION Get_Pricing_Attribute_Context
138 RETURN VARCHAR2
139 IS
140 BEGIN
141 
142     RETURN NULL;
143 
144 END Get_Pricing_Attribute_Context;
145 
146 /*
147 FUNCTION Get_Pricing_Attribute
148 RETURN NUMBER
149 IS
150 BEGIN
151 
152     RETURN NULL;
153 
154 END Get_Pricing_Attribute;
155 */
156 
157 FUNCTION Get_Pricing_Attr_Value_From
158 RETURN VARCHAR2
159 IS
160 BEGIN
161 
162     RETURN NULL;
163 
164 END Get_Pricing_Attr_Value_From;
165 
166 FUNCTION Get_Pricing_Attr_Value_To
167 RETURN VARCHAR2
168 IS
169 BEGIN
170 
171     RETURN NULL;
172 
173 END Get_Pricing_Attr_Value_To;
174 
175 FUNCTION Get_Product_Attribute
176 RETURN VARCHAR2
177 IS
178 BEGIN
179 
180     RETURN NULL;
181 
182 END Get_Product_Attribute;
183 
184 FUNCTION Get_Product_Attribute_Context
185 RETURN VARCHAR2
186 IS
187 BEGIN
188 
189     RETURN NULL;
190 
191 END Get_Product_Attribute_Context;
192 
193 FUNCTION Get_Product_Attr_Value
194 RETURN VARCHAR2
195 IS
196 BEGIN
197 
198     RETURN NULL;
199 
200 END Get_Product_Attr_Value;
201 
202 FUNCTION Get_Product_Uom
203 RETURN VARCHAR2
204 IS
205 BEGIN
206 
207     RETURN NULL;
208 
209 END Get_Product_Uom;
210 
211 FUNCTION Get_Product_Attribute_Datatype( prod_attribute_context  IN VARCHAR2,
212                                          prod_attribute  IN VARCHAR2,
213                                          prod_attr_value   IN VARCHAR2)
214 RETURN VARCHAR2
215 IS
216 
217 l_context_flag                VARCHAR2(1);
218 l_attribute_flag              VARCHAR2(1);
219 l_value_flag                  VARCHAR2(1);
220 l_datatype                    VARCHAR2(1);
221 l_precedence                  NUMBER;
222 l_error_code                  NUMBER := 0;
223 
224 BEGIN
225 
226     QP_UTIL.validate_qp_flexfield(flexfield_name         =>'QP_ATTR_DEFNS_PRICING'
227 			 ,context                        =>prod_attribute_context
228 			 ,attribute                      =>prod_attribute
229 			 ,value                          =>prod_attr_value
230                 ,application_short_name         => 'QP'
231 			 ,context_flag                   =>l_context_flag
232 			 ,attribute_flag                 =>l_attribute_flag
233 			 ,value_flag                     =>l_value_flag
234 			 ,datatype                       =>l_datatype
235 			 ,precedence                      =>l_precedence
236 			 ,error_code                     =>l_error_code
237 			 );
238 
239 oe_debug_pub.add('error code = '|| to_char(l_error_code));
240 
241        IF l_error_code = 0
242 	  THEN
243 
244          RETURN l_datatype;
245 
246        ELSE
247 
248          RETURN NULL;
249 
250       END IF;
251 
252 END Get_Product_Attribute_Datatype;
253 
254 FUNCTION Get_Pricing_Attribute_Datatype( pric_attribute_context  IN VARCHAR2,
255                                          pric_attribute  IN VARCHAR2,
256                                          pric_attr_value   IN VARCHAR2)
257 RETURN VARCHAR2
258 IS
259 
260 l_context_flag                VARCHAR2(1);
261 l_attribute_flag              VARCHAR2(1);
262 l_value_flag                  VARCHAR2(1);
263 l_datatype                    VARCHAR2(1);
264 l_precedence                  NUMBER;
265 l_error_code                  NUMBER := 0;
266 
267 BEGIN
268 
269     QP_UTIL.validate_qp_flexfield(flexfield_name         =>'QP_ATTR_DEFNS_PRICING'
270 			 ,context                        =>pric_attribute_context
271 			 ,attribute                      =>pric_attribute
272 			 ,value                          =>pric_attr_value
273                 ,application_short_name         => 'QP'
274 			 ,context_flag                   =>l_context_flag
275 			 ,attribute_flag                 =>l_attribute_flag
276 			 ,value_flag                     =>l_value_flag
277 			 ,datatype                       =>l_datatype
278 			 ,precedence                      =>l_precedence
279 			 ,error_code                     =>l_error_code
280 			 );
281 
282 oe_debug_pub.add('error code = '|| to_char(l_error_code));
283        IF l_error_code = 0
284 	  THEN
285 
286          RETURN l_datatype;
287 
288        ELSE
289 
290          RETURN NULL;
291 
292       END IF;
293 
294 END Get_Pricing_Attribute_Datatype;
295 
296 PROCEDURE Get_Flex_Pricing_Attr
297 IS
298 BEGIN
299 
300 oe_debug_pub.add('BEGIN Get_Flex_Pricing_Attr in QPXDPRAB');
301 
302     --  In the future call Flex APIs for defaults
303 
304     IF g_PRICING_ATTR_rec.attribute1 = FND_API.G_MISS_CHAR THEN
305         g_PRICING_ATTR_rec.attribute1  := NULL;
306     END IF;
307 
308     IF g_PRICING_ATTR_rec.attribute10 = FND_API.G_MISS_CHAR THEN
309         g_PRICING_ATTR_rec.attribute10 := NULL;
310     END IF;
311 
312     IF g_PRICING_ATTR_rec.attribute11 = FND_API.G_MISS_CHAR THEN
313         g_PRICING_ATTR_rec.attribute11 := NULL;
314     END IF;
315 
316     IF g_PRICING_ATTR_rec.attribute12 = FND_API.G_MISS_CHAR THEN
317         g_PRICING_ATTR_rec.attribute12 := NULL;
318     END IF;
319 
320     IF g_PRICING_ATTR_rec.attribute13 = FND_API.G_MISS_CHAR THEN
321         g_PRICING_ATTR_rec.attribute13 := NULL;
322     END IF;
323 
324     IF g_PRICING_ATTR_rec.attribute14 = FND_API.G_MISS_CHAR THEN
325         g_PRICING_ATTR_rec.attribute14 := NULL;
326     END IF;
327 
328     IF g_PRICING_ATTR_rec.attribute15 = FND_API.G_MISS_CHAR THEN
329         g_PRICING_ATTR_rec.attribute15 := NULL;
330     END IF;
331 
332     IF g_PRICING_ATTR_rec.attribute2 = FND_API.G_MISS_CHAR THEN
333         g_PRICING_ATTR_rec.attribute2  := NULL;
334     END IF;
335 
336     IF g_PRICING_ATTR_rec.attribute3 = FND_API.G_MISS_CHAR THEN
337         g_PRICING_ATTR_rec.attribute3  := NULL;
338     END IF;
339 
340     IF g_PRICING_ATTR_rec.attribute4 = FND_API.G_MISS_CHAR THEN
341         g_PRICING_ATTR_rec.attribute4  := NULL;
342     END IF;
343 
344     IF g_PRICING_ATTR_rec.attribute5 = FND_API.G_MISS_CHAR THEN
345         g_PRICING_ATTR_rec.attribute5  := NULL;
346     END IF;
347 
348     IF g_PRICING_ATTR_rec.attribute6 = FND_API.G_MISS_CHAR THEN
349         g_PRICING_ATTR_rec.attribute6  := NULL;
350     END IF;
351 
352     IF g_PRICING_ATTR_rec.attribute7 = FND_API.G_MISS_CHAR THEN
353         g_PRICING_ATTR_rec.attribute7  := NULL;
354     END IF;
355 
356     IF g_PRICING_ATTR_rec.attribute8 = FND_API.G_MISS_CHAR THEN
357         g_PRICING_ATTR_rec.attribute8  := NULL;
358     END IF;
359 
360     IF g_PRICING_ATTR_rec.attribute9 = FND_API.G_MISS_CHAR THEN
361         g_PRICING_ATTR_rec.attribute9  := NULL;
362     END IF;
363 
364     IF g_PRICING_ATTR_rec.context = FND_API.G_MISS_CHAR THEN
365         g_PRICING_ATTR_rec.context     := NULL;
366     END IF;
367 
368 oe_debug_pub.add('END Get_Flex_Pricing_Attr in QPXDPRAB');
369 
370 END Get_Flex_Pricing_Attr;
371 
372 --  Procedure Attributes
373 
374 PROCEDURE Attributes
375 (   p_PRICING_ATTR_rec              IN  QP_Modifiers_PUB.Pricing_Attr_Rec_Type :=
376                                         QP_Modifiers_PUB.G_MISS_PRICING_ATTR_REC
377 ,   p_iteration                     IN  NUMBER := 1
378 ,   x_PRICING_ATTR_rec              OUT NOCOPY /* file.sql.39 change */ QP_Modifiers_PUB.Pricing_Attr_Rec_Type
379 )
380 IS
381  g_p_PRICING_ATTR_rec         QP_Modifiers_PUB.Pricing_Attr_Rec_Type;
382 BEGIN
383 
384 oe_debug_pub.add('BEGIN Attributes in QPXDPRAB');
385 
386     --  Check number of iterations.
387 
388     IF p_iteration > QP_GLOBALS.G_MAX_DEF_ITERATIONS THEN
389 
390         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
391         THEN
392 
393             FND_MESSAGE.SET_NAME('QP','OE_DEF_MAX_ITERATION');
394             OE_MSG_PUB.Add;
395 
396         END IF;
397 
398         RAISE FND_API.G_EXC_ERROR;
399 
400     END IF;
401 
402     --  Initialize g_PRICING_ATTR_rec
403 
404     g_PRICING_ATTR_rec := p_PRICING_ATTR_rec;
405 
406     --  Default missing attributes.
407 
408     IF g_PRICING_ATTR_rec.accumulate_flag = FND_API.G_MISS_CHAR THEN
409 
410         g_PRICING_ATTR_rec.accumulate_flag := Get_Accumulate;
411 
412         IF g_PRICING_ATTR_rec.accumulate_flag IS NOT NULL THEN
413 
414             IF QP_Validate.Accumulate(g_PRICING_ATTR_rec.accumulate_flag)
415             THEN
416                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
417                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
418                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_ACCUMULATE
419                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
420                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
421                 );
422             ELSE
423                 g_PRICING_ATTR_rec.accumulate_flag := NULL;
424             END IF;
425 
426         END IF;
427 
428     END IF;
429 
430     IF g_PRICING_ATTR_rec.attribute_grouping_no = FND_API.G_MISS_NUM THEN
431 
432         g_PRICING_ATTR_rec.attribute_grouping_no := Get_Attribute_Grouping_No;
433 
434         IF g_PRICING_ATTR_rec.attribute_grouping_no IS NOT NULL THEN
435 
436             IF QP_Validate.Attribute_Grouping_No(g_PRICING_ATTR_rec.attribute_grouping_no)
437             THEN
438                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
439                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
440                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_ATTRIBUTE_GROUPING_NO
441                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
442                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
443                 );
444             ELSE
445                 g_PRICING_ATTR_rec.attribute_grouping_no := NULL;
446             END IF;
447 
448         END IF;
449 
450     END IF;
451 
452     IF g_PRICING_ATTR_rec.excluder_flag = FND_API.G_MISS_CHAR THEN
453 
454         g_PRICING_ATTR_rec.excluder_flag := Get_Excluder;
455 
456         IF g_PRICING_ATTR_rec.excluder_flag IS NOT NULL THEN
457 
458             IF QP_Validate.Excluder(g_PRICING_ATTR_rec.excluder_flag)
459             THEN
460                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
461                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
462                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_EXCLUDER
463                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
464                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
465                 );
466             ELSE
467                 g_PRICING_ATTR_rec.excluder_flag := NULL;
468             END IF;
469 
470         END IF;
471 
472     END IF;
473 
474     IF g_PRICING_ATTR_rec.list_header_id = FND_API.G_MISS_NUM  OR
475 		g_PRICING_ATTR_rec.list_header_id IS NULL THEN
476 
477         g_PRICING_ATTR_rec.list_header_id := Get_List_Header(p_PRICING_ATTR_rec.list_line_id);
478 
479         IF g_PRICING_ATTR_rec.list_header_id IS NOT NULL THEN
480 
481             IF QP_Validate.List_Header(g_PRICING_ATTR_rec.list_header_id)
482             THEN
483                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
484                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
485                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_LIST_HEADER
486                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
487                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
488                 );
489             ELSE
490                 g_PRICING_ATTR_rec.list_header_id := NULL;
491             END IF;
492 
493         END IF;
494 
495     END IF;
496 
497     IF g_PRICING_ATTR_rec.pricing_phase_id = FND_API.G_MISS_NUM OR
498 		g_PRICING_ATTR_rec.list_header_id IS NULL THEN
499 
500         g_PRICING_ATTR_rec.pricing_phase_id := Get_Pricing_phase(p_PRICING_ATTR_rec.pricing_phase_id);
501 
502         IF g_PRICING_ATTR_rec.pricing_phase_id IS NOT NULL THEN
503 
504             IF QP_Validate.Pricing_Phase(g_PRICING_ATTR_rec.pricing_phase_id)
505             THEN
506                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
507                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
508                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRICING_PHASE
509                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
510                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
511                 );
512             ELSE
513                 g_PRICING_ATTR_rec.pricing_phase_id := NULL;
514             END IF;
515 
516         END IF;
517 
518     END IF;
519 
520     IF g_PRICING_ATTR_rec.list_line_id = FND_API.G_MISS_NUM THEN
521 
522         g_PRICING_ATTR_rec.list_line_id := Get_List_Line;
523 
524         IF g_PRICING_ATTR_rec.list_line_id IS NOT NULL THEN
525 
526             IF QP_Validate.List_Line(g_PRICING_ATTR_rec.list_line_id)
527             THEN
528                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
529                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
530                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_LIST_LINE
531                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
532                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
533                 );
534             ELSE
535                 g_PRICING_ATTR_rec.list_line_id := NULL;
536             END IF;
537 
538         END IF;
539 
540     END IF;
541 
542     IF g_PRICING_ATTR_rec.pricing_attribute = FND_API.G_MISS_CHAR THEN
543 
544         g_PRICING_ATTR_rec.pricing_attribute := NULL;
545 
546         IF g_PRICING_ATTR_rec.pricing_attribute IS NOT NULL THEN
547 
548             IF QP_Validate.Pricing_Attribute(g_PRICING_ATTR_rec.pricing_attribute)
549             THEN
550                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
551                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
552                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRICING_ATTRIBUTE
553                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
554                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
555                 );
556             ELSE
557                 g_PRICING_ATTR_rec.pricing_attribute := NULL;
558             END IF;
559 
560         END IF;
561 
562     END IF;
563 
564     IF g_PRICING_ATTR_rec.pricing_attribute_context = FND_API.G_MISS_CHAR THEN
565 
566         g_PRICING_ATTR_rec.pricing_attribute_context := Get_Pricing_Attribute_Context;
567 
568         IF g_PRICING_ATTR_rec.pricing_attribute_context IS NOT NULL THEN
569 
570             IF QP_Validate.Pricing_Attribute_Context(g_PRICING_ATTR_rec.pricing_attribute_context)
571             THEN
572                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
573                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
574                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRICING_ATTRIBUTE_CONTEXT
575                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
576                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
577                 );
578             ELSE
579                 g_PRICING_ATTR_rec.pricing_attribute_context := NULL;
580             END IF;
581 
582         END IF;
583 
584     END IF;
585 
586     IF g_PRICING_ATTR_rec.pricing_attribute_id = FND_API.G_MISS_NUM THEN
587 
588         g_PRICING_ATTR_rec.pricing_attribute_id := Get_Pricing_Attribute;
589 
590         IF g_PRICING_ATTR_rec.pricing_attribute_id IS NOT NULL THEN
591 
592             IF QP_Validate.Pricing_Attribute(g_PRICING_ATTR_rec.pricing_attribute_id)
593             THEN
594                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
595                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
596                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRICING_ATTRIBUTE
597                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
598                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
599                 );
600             ELSE
601                 g_PRICING_ATTR_rec.pricing_attribute_id := NULL;
602             END IF;
603 
604         END IF;
605 
606     END IF;
607 
608     IF g_PRICING_ATTR_rec.pricing_attr_value_from = FND_API.G_MISS_CHAR THEN
609 
610         g_PRICING_ATTR_rec.pricing_attr_value_from := Get_Pricing_Attr_Value_From;
611 
612         IF g_PRICING_ATTR_rec.pricing_attr_value_from IS NOT NULL THEN
613 
614             IF QP_Validate.Pricing_Attr_Value_From(g_PRICING_ATTR_rec.pricing_attr_value_from)
615             THEN
616                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
617                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
618                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRICING_ATTR_VALUE_FROM
619                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
620                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
621                 );
622             ELSE
623                 g_PRICING_ATTR_rec.pricing_attr_value_from := NULL;
624             END IF;
625 
626         END IF;
627 
628     END IF;
629 
630     IF g_PRICING_ATTR_rec.pricing_attr_value_to = FND_API.G_MISS_CHAR THEN
631 
632         g_PRICING_ATTR_rec.pricing_attr_value_to := Get_Pricing_Attr_Value_To;
633 
634         IF g_PRICING_ATTR_rec.pricing_attr_value_to IS NOT NULL THEN
635 
636             IF QP_Validate.Pricing_Attr_Value_To(g_PRICING_ATTR_rec.pricing_attr_value_to)
637             THEN
638                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
639                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
640                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRICING_ATTR_VALUE_TO
641                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
642                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
643                 );
644             ELSE
645                 g_PRICING_ATTR_rec.pricing_attr_value_to := NULL;
646             END IF;
647 
648         END IF;
649 
650     END IF;
651 
652     IF g_PRICING_ATTR_rec.product_attribute = FND_API.G_MISS_CHAR THEN
653 
654         g_PRICING_ATTR_rec.product_attribute := Get_Product_Attribute;
655 
656         IF g_PRICING_ATTR_rec.product_attribute IS NOT NULL THEN
657 
658             IF QP_Validate.Product_Attribute(g_PRICING_ATTR_rec.product_attribute)
659             THEN
660                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
661                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
662                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRODUCT_ATTRIBUTE
663                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
664                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
665                 );
666             ELSE
667                 g_PRICING_ATTR_rec.product_attribute := NULL;
668             END IF;
669 
670         END IF;
671 
672     END IF;
673 
674     IF g_PRICING_ATTR_rec.product_attribute_context = FND_API.G_MISS_CHAR THEN
675 
676         g_PRICING_ATTR_rec.product_attribute_context := Get_Product_Attribute_Context;
677 
678         IF g_PRICING_ATTR_rec.product_attribute_context IS NOT NULL THEN
679 
680             IF QP_Validate.Product_Attribute_Context(g_PRICING_ATTR_rec.product_attribute_context)
681             THEN
682                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
683                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
684                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRODUCT_ATTRIBUTE_CONTEXT
685                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
686                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
687                 );
688             ELSE
689                 g_PRICING_ATTR_rec.product_attribute_context := NULL;
690             END IF;
691 
692         END IF;
693 
694     END IF;
695 
696     IF g_PRICING_ATTR_rec.product_attr_value = FND_API.G_MISS_CHAR THEN
697 
698         g_PRICING_ATTR_rec.product_attr_value := Get_Product_Attr_Value;
699 
700         IF g_PRICING_ATTR_rec.product_attr_value IS NOT NULL THEN
701 
702             IF QP_Validate.Product_Attr_Value(g_PRICING_ATTR_rec.product_attr_value)
703             THEN
704                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
705                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
706                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRODUCT_ATTR_VALUE
707                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
708                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
709                 );
710             ELSE
711                 g_PRICING_ATTR_rec.product_attr_value := NULL;
712             END IF;
713 
714         END IF;
715 
716     END IF;
717 
718     IF g_PRICING_ATTR_rec.product_uom_code = FND_API.G_MISS_CHAR THEN
719 
720         g_PRICING_ATTR_rec.product_uom_code := Get_Product_Uom;
721 
722         IF g_PRICING_ATTR_rec.product_uom_code IS NOT NULL THEN
723 
724             IF QP_Validate.Product_Uom(g_PRICING_ATTR_rec.product_uom_code)
725             THEN
726                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
727                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
728                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRODUCT_UOM
729                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
730                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
731                 );
732             ELSE
733                 g_PRICING_ATTR_rec.product_uom_code := NULL;
734             END IF;
735 
736         END IF;
737 
738     END IF;
739 
740     IF g_PRICING_ATTR_rec.product_attribute_datatype = FND_API.G_MISS_CHAR THEN
741 
742         g_PRICING_ATTR_rec.product_attribute_datatype :=
743 	   Get_Product_Attribute_Datatype(p_PRICING_ATTR_rec.product_attribute_context,
744 	                                  p_PRICING_ATTR_rec.product_attribute,
745 	                                  p_PRICING_ATTR_rec.product_attr_value);
746 
747         IF g_PRICING_ATTR_rec.product_attribute_datatype IS NOT NULL THEN
748 
749             IF QP_Validate.Product_Attribute_Datatype(g_PRICING_ATTR_rec.product_attribute_datatype)
750             THEN
751                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
752                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
753                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRODUCT_ATTRIBUTE_DATATYPE
754                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
755                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
756                 );
757             ELSE
758                 g_PRICING_ATTR_rec.product_attribute_datatype := NULL;
759             END IF;
760 
761         END IF;
762 
763     END IF;
764 
765     IF g_PRICING_ATTR_rec.pricing_attribute_datatype = FND_API.G_MISS_CHAR THEN
766 
767         g_PRICING_ATTR_rec.pricing_attribute_datatype :=
768 	   Get_Pricing_Attribute_Datatype(p_PRICING_ATTR_rec.pricing_attribute_context,
769 	                                  p_PRICING_ATTR_rec.pricing_attribute,
770 	                                  p_PRICING_ATTR_rec.pricing_attr_value_from);
771 
772         IF g_PRICING_ATTR_rec.pricing_attribute_datatype IS NOT NULL THEN
773 
774             IF QP_Validate.Pricing_Attribute_Datatype(g_PRICING_ATTR_rec.pricing_attribute_datatype)
775             THEN
776                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
777                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
778                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_PRICING_ATTRIBUTE_DATATYPE
779                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
780                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
781                 );
782             ELSE
783                 g_PRICING_ATTR_rec.pricing_attribute_datatype := NULL;
784             END IF;
785 
786         END IF;
787 
788     END IF;
789 
790     IF g_PRICING_ATTR_rec.comparison_operator_code = FND_API.G_MISS_CHAR THEN
791 
792         g_PRICING_ATTR_rec.comparison_operator_code := Get_Comparison_Operator;
793 
794         IF g_PRICING_ATTR_rec.comparison_operator_code IS NOT NULL THEN
795 
796             IF QP_Validate.Comparison_Operator_Code(g_PRICING_ATTR_rec.comparison_operator_code)
797             THEN
798                 g_p_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
799                 QP_Pricing_Attr_Util.Clear_Dependent_Attr
800                 (   p_attr_id                     => QP_Pricing_Attr_Util.G_COMPARISON_OPERATOR
801                 ,   p_PRICING_ATTR_rec            => g_p_PRICING_ATTR_rec
802                 ,   x_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
803                 );
804             ELSE
805                 g_PRICING_ATTR_rec.comparison_operator_code := NULL;
806             END IF;
807 
808         END IF;
809 
810     END IF;
811 
812 OE_Debug_Pub.add('In if loop in Attributes QPXDPRAB.pls');
813     IF g_PRICING_ATTR_rec.attribute1 = FND_API.G_MISS_CHAR
814     OR  g_PRICING_ATTR_rec.attribute10 = FND_API.G_MISS_CHAR
815     OR  g_PRICING_ATTR_rec.attribute11 = FND_API.G_MISS_CHAR
816     OR  g_PRICING_ATTR_rec.attribute12 = FND_API.G_MISS_CHAR
817     OR  g_PRICING_ATTR_rec.attribute13 = FND_API.G_MISS_CHAR
818     OR  g_PRICING_ATTR_rec.attribute14 = FND_API.G_MISS_CHAR
819     OR  g_PRICING_ATTR_rec.attribute15 = FND_API.G_MISS_CHAR
820     OR  g_PRICING_ATTR_rec.attribute2 = FND_API.G_MISS_CHAR
821     OR  g_PRICING_ATTR_rec.attribute3 = FND_API.G_MISS_CHAR
822     OR  g_PRICING_ATTR_rec.attribute4 = FND_API.G_MISS_CHAR
823     OR  g_PRICING_ATTR_rec.attribute5 = FND_API.G_MISS_CHAR
824     OR  g_PRICING_ATTR_rec.attribute6 = FND_API.G_MISS_CHAR
825     OR  g_PRICING_ATTR_rec.attribute7 = FND_API.G_MISS_CHAR
826     OR  g_PRICING_ATTR_rec.attribute8 = FND_API.G_MISS_CHAR
827     OR  g_PRICING_ATTR_rec.attribute9 = FND_API.G_MISS_CHAR
828     OR  g_PRICING_ATTR_rec.context = FND_API.G_MISS_CHAR
829     THEN
830 
831         Get_Flex_Pricing_Attr;
832 
833     END IF;
834 
835     IF g_PRICING_ATTR_rec.created_by = FND_API.G_MISS_NUM THEN
836 
837         g_PRICING_ATTR_rec.created_by := NULL;
838 
839     END IF;
840 
841     IF g_PRICING_ATTR_rec.creation_date = FND_API.G_MISS_DATE THEN
842 
843         g_PRICING_ATTR_rec.creation_date := NULL;
844 
845     END IF;
846 
847     IF g_PRICING_ATTR_rec.last_updated_by = FND_API.G_MISS_NUM THEN
848 
849         g_PRICING_ATTR_rec.last_updated_by := NULL;
850 
851     END IF;
852 
853     IF g_PRICING_ATTR_rec.last_update_date = FND_API.G_MISS_DATE THEN
854 
855         g_PRICING_ATTR_rec.last_update_date := NULL;
856 
857     END IF;
858 
859     IF g_PRICING_ATTR_rec.last_update_login = FND_API.G_MISS_NUM THEN
860 
861         g_PRICING_ATTR_rec.last_update_login := NULL;
862 
863     END IF;
864 
865     IF g_PRICING_ATTR_rec.program_application_id = FND_API.G_MISS_NUM THEN
866 
867         g_PRICING_ATTR_rec.program_application_id := NULL;
868 
869     END IF;
870 
871     IF g_PRICING_ATTR_rec.program_id = FND_API.G_MISS_NUM THEN
872 
873         g_PRICING_ATTR_rec.program_id := NULL;
874 
875     END IF;
876 
877     IF g_PRICING_ATTR_rec.program_update_date = FND_API.G_MISS_DATE THEN
878 
879         g_PRICING_ATTR_rec.program_update_date := NULL;
880 
881     END IF;
882 
883     IF g_PRICING_ATTR_rec.request_id = FND_API.G_MISS_NUM THEN
884 
885         g_PRICING_ATTR_rec.request_id := NULL;
886 
887     END IF;
888 
889     --  Redefault if there are any missing attributes.
890 
891     IF  g_PRICING_ATTR_rec.accumulate_flag = FND_API.G_MISS_CHAR
892     OR  g_PRICING_ATTR_rec.attribute1 = FND_API.G_MISS_CHAR
893     OR  g_PRICING_ATTR_rec.attribute10 = FND_API.G_MISS_CHAR
894     OR  g_PRICING_ATTR_rec.attribute11 = FND_API.G_MISS_CHAR
895     OR  g_PRICING_ATTR_rec.attribute12 = FND_API.G_MISS_CHAR
896     OR  g_PRICING_ATTR_rec.attribute13 = FND_API.G_MISS_CHAR
897     OR  g_PRICING_ATTR_rec.attribute14 = FND_API.G_MISS_CHAR
898     OR  g_PRICING_ATTR_rec.attribute15 = FND_API.G_MISS_CHAR
899     OR  g_PRICING_ATTR_rec.attribute2 = FND_API.G_MISS_CHAR
900     OR  g_PRICING_ATTR_rec.attribute3 = FND_API.G_MISS_CHAR
901     OR  g_PRICING_ATTR_rec.attribute4 = FND_API.G_MISS_CHAR
902     OR  g_PRICING_ATTR_rec.attribute5 = FND_API.G_MISS_CHAR
903     OR  g_PRICING_ATTR_rec.attribute6 = FND_API.G_MISS_CHAR
904     OR  g_PRICING_ATTR_rec.attribute7 = FND_API.G_MISS_CHAR
905     OR  g_PRICING_ATTR_rec.attribute8 = FND_API.G_MISS_CHAR
906     OR  g_PRICING_ATTR_rec.attribute9 = FND_API.G_MISS_CHAR
907     OR  g_PRICING_ATTR_rec.attribute_grouping_no = FND_API.G_MISS_NUM
908     OR  g_PRICING_ATTR_rec.context = FND_API.G_MISS_CHAR
909     OR  g_PRICING_ATTR_rec.created_by = FND_API.G_MISS_NUM
910     OR  g_PRICING_ATTR_rec.creation_date = FND_API.G_MISS_DATE
911     OR  g_PRICING_ATTR_rec.excluder_flag = FND_API.G_MISS_CHAR
912     OR  g_PRICING_ATTR_rec.last_updated_by = FND_API.G_MISS_NUM
913     OR  g_PRICING_ATTR_rec.last_update_date = FND_API.G_MISS_DATE
914     OR  g_PRICING_ATTR_rec.last_update_login = FND_API.G_MISS_NUM
915     OR  g_PRICING_ATTR_rec.list_line_id = FND_API.G_MISS_NUM
916     OR  g_PRICING_ATTR_rec.pricing_attribute = FND_API.G_MISS_CHAR
917     OR  g_PRICING_ATTR_rec.pricing_attribute_context = FND_API.G_MISS_CHAR
918     OR  g_PRICING_ATTR_rec.pricing_attribute_id = FND_API.G_MISS_NUM
919     OR  g_PRICING_ATTR_rec.pricing_attr_value_from = FND_API.G_MISS_CHAR
920     OR  g_PRICING_ATTR_rec.pricing_attr_value_to = FND_API.G_MISS_CHAR
921     OR  g_PRICING_ATTR_rec.product_attribute = FND_API.G_MISS_CHAR
922     OR  g_PRICING_ATTR_rec.product_attribute_context = FND_API.G_MISS_CHAR
923     OR  g_PRICING_ATTR_rec.product_attr_value = FND_API.G_MISS_CHAR
924     OR  g_PRICING_ATTR_rec.product_uom_code = FND_API.G_MISS_CHAR
925     OR  g_PRICING_ATTR_rec.comparison_operator_code = FND_API.G_MISS_CHAR
926     OR  g_PRICING_ATTR_rec.pricing_phase_id = FND_API.G_MISS_NUM
927     OR  g_PRICING_ATTR_rec.list_header_id = FND_API.G_MISS_NUM
928     OR  g_PRICING_ATTR_rec.product_attribute_datatype = FND_API.G_MISS_CHAR
929     OR  g_PRICING_ATTR_rec.pricing_attribute_datatype = FND_API.G_MISS_CHAR
930     OR  g_PRICING_ATTR_rec.program_application_id = FND_API.G_MISS_NUM
931     OR  g_PRICING_ATTR_rec.program_id = FND_API.G_MISS_NUM
932     OR  g_PRICING_ATTR_rec.program_update_date = FND_API.G_MISS_DATE
933     OR  g_PRICING_ATTR_rec.request_id = FND_API.G_MISS_NUM
934     THEN
935 
936         QP_Default_Pricing_Attr.Attributes
937         (   p_PRICING_ATTR_rec            => g_PRICING_ATTR_rec
938         ,   p_iteration                   => p_iteration + 1
939         ,   x_PRICING_ATTR_rec            => x_PRICING_ATTR_rec
940         );
941 
942     ELSE
943 
944         --  Done defaulting attributes
945 
946         x_PRICING_ATTR_rec := g_PRICING_ATTR_rec;
947 
948     END IF;
949 
950 oe_debug_pub.add('END Attributes in QPXDPRAB');
951 
952 END Attributes;
953 
954 END QP_Default_Pricing_Attr;