[Home] [Help]
PACKAGE BODY: APPS.OE_OE_AVAILABILITY
Source
1 PACKAGE BODY oe_oe_availability AS
2 /* $Header: OEXFAVAB.pls 120.0.12010000.2 2008/08/04 14:59:27 amallik ship $ */
3
4 --Global variables
5
6 G_PKG_NAME CONSTANT VARCHAR2(30) := 'oe_oe_availability';
7 G_ATP_TBL OE_ATP.atp_tbl_type;
8 G_line_id CONSTANT NUMBER :=1234;
9 G_atp_line_id CONSTANT NUMBER := -9987;
10 g_header_id CONSTANT NUMBER :=2345;
11 g_hsecs number;
12 g_place varchar2(100);
13 g_total number :=0;
14 g_total2 number ;
15
16 -- Things from her would go
17 /*
18 g_inventory_item_id number;
19 g_qty number;
20 g_uom varchar2(20);
21 g_request_date date;
22 g_customer_id number;
23 g_item_identifier_type varchar2(40);
24 g_agreement_id number;
25 g_price_list_id number;
26 g_ship_to_org_id number;
27 g_invoice_to_org_id number;
28 g_ship_from_org_id number;
29 g_pricing_date date;
30 g_order_type_id number;
31 g_currency varchar2(20);
32 g_pricing_context varchar2(30);
33 g_pricing_attribute1 varchar2(240);
34 g_pricing_attribute2 varchar2(240);
35 g_pricing_attribute3 varchar2(240);
36 g_pricing_attribute4 varchar2(240);
37 g_pricing_attribute5 varchar2(240);
38 g_pricing_attribute6 varchar2(240);
39 g_pricing_attribute7 varchar2(240);
40 g_pricing_attribute8 varchar2(240);
41 g_pricing_attribute9 varchar2(240);
42 g_pricing_attribute10 varchar2(240);
43 g_pricing_attribute11 varchar2(240);
44 g_pricing_attribute12 varchar2(240);
45 g_pricing_attribute13 varchar2(240);
46 g_pricing_attribute14 varchar2(240);
47 g_pricing_attribute15 varchar2(240);
48 g_pricing_attribute16 varchar2(240);
49 g_pricing_attribute17 varchar2(240);
50 g_pricing_attribute18 varchar2(240);
51 g_pricing_attribute19 varchar2(240);
52 g_pricing_attribute20 varchar2(240);
53 g_pricing_attribute21 varchar2(240);
54 g_pricing_attribute22 varchar2(240);
55 g_pricing_attribute23 varchar2(240);
56 g_pricing_attribute24 varchar2(240);
57 g_pricing_attribute25 varchar2(240);
58 g_pricing_attribute26 varchar2(240);
59 g_pricing_attribute27 varchar2(240);
60 g_pricing_attribute28 varchar2(240);
61 g_pricing_attribute29 varchar2(240);
62 g_pricing_attribute30 varchar2(240);
63 g_pricing_attribute31 varchar2(240);
64 g_pricing_attribute32 varchar2(240);
65 g_pricing_attribute33 varchar2(240);
66 g_pricing_attribute34 varchar2(240);
67 g_pricing_attribute35 varchar2(240);
68 g_pricing_attribute36 varchar2(240);
69 g_pricing_attribute37 varchar2(240);
70 g_pricing_attribute38 varchar2(240);
71 g_pricing_attribute39 varchar2(240);
72 g_pricing_attribute40 varchar2(240);
73 g_pricing_attribute41 varchar2(240);
74 g_pricing_attribute42 varchar2(240);
75 g_pricing_attribute43 varchar2(240);
76 g_pricing_attribute44 varchar2(240);
77 g_pricing_attribute45 varchar2(240);
78 g_pricing_attribute46 varchar2(240);
79 g_pricing_attribute47 varchar2(240);
80 g_pricing_attribute48 varchar2(240);
81 g_pricing_attribute49 varchar2(240);
82 g_pricing_attribute50 varchar2(240);
83 g_pricing_attribute51 varchar2(240);
84 g_pricing_attribute52 varchar2(240);
85 g_pricing_attribute53 varchar2(240);
86 g_pricing_attribute54 varchar2(240);
87 g_pricing_attribute55 varchar2(240);
88 g_pricing_attribute56 varchar2(240);
89 g_pricing_attribute57 varchar2(240);
90 g_pricing_attribute58 varchar2(240);
91 g_pricing_attribute59 varchar2(240);
92 g_pricing_attribute60 varchar2(240);
93 g_pricing_attribute61 varchar2(240);
94 g_pricing_attribute62 varchar2(240);
95 g_pricing_attribute63 varchar2(240);
96 g_pricing_attribute64 varchar2(240);
97 g_pricing_attribute65 varchar2(240);
98 g_pricing_attribute66 varchar2(240);
99 g_pricing_attribute67 varchar2(240);
100 g_pricing_attribute68 varchar2(240);
101 g_pricing_attribute69 varchar2(240);
102 g_pricing_attribute70 varchar2(240);
103 g_pricing_attribute71 varchar2(240);
104 g_pricing_attribute72 varchar2(240);
105 g_pricing_attribute73 varchar2(240);
106 g_pricing_attribute74 varchar2(240);
107 g_pricing_attribute75 varchar2(240);
108 g_pricing_attribute76 varchar2(240);
109 g_pricing_attribute77 varchar2(240);
110 g_pricing_attribute78 varchar2(240);
111 g_pricing_attribute79 varchar2(240);
112 g_pricing_attribute80 varchar2(240);
113 g_pricing_attribute81 varchar2(240);
114 g_pricing_attribute82 varchar2(240);
115 g_pricing_attribute83 varchar2(240);
116 g_pricing_attribute84 varchar2(240);
117 g_pricing_attribute85 varchar2(240);
118 g_pricing_attribute86 varchar2(240);
119 g_pricing_attribute87 varchar2(240);
120 g_pricing_attribute88 varchar2(240);
121 g_pricing_attribute89 varchar2(240);
122 g_pricing_attribute90 varchar2(240);
123 g_pricing_attribute91 varchar2(240);
124 g_pricing_attribute92 varchar2(240);
125 g_pricing_attribute93 varchar2(240);
126 g_pricing_attribute94 varchar2(240);
127 g_pricing_attribute95 varchar2(240);
128 g_pricing_attribute96 varchar2(240);
129 g_pricing_attribute97 varchar2(240);
130 g_pricing_attribute98 varchar2(240);
131 g_pricing_attribute99 varchar2(240);
132 g_pricing_attribute100 varchar2(240);
133 */
134 -- Till here it would go
135 --Global Tables required for temp_table population.
136
137 G_LINE_INDEX_tbl QP_PREQ_GRP.pls_integer_type;
138 G_LINE_TYPE_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
139 G_PRICING_EFFECTIVE_DATE_TBL QP_PREQ_GRP.DATE_TYPE ;
140 G_ACTIVE_DATE_FIRST_TBL QP_PREQ_GRP.DATE_TYPE ;
141 G_ACTIVE_DATE_FIRST_TYPE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
142 G_ACTIVE_DATE_SECOND_TBL QP_PREQ_GRP.DATE_TYPE ;
143 G_ACTIVE_DATE_SECOND_TYPE_TBL QP_PREQ_GRP.VARCHAR_TYPE ;
144 G_LINE_QUANTITY_TBL QP_PREQ_GRP.NUMBER_TYPE ;
145 G_LINE_UOM_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
146 G_REQUEST_TYPE_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
147 G_PRICED_QUANTITY_TBL QP_PREQ_GRP.NUMBER_TYPE;
148 G_UOM_QUANTITY_TBL QP_PREQ_GRP.NUMBER_TYPE;
149 G_PRICED_UOM_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
150 G_CURRENCY_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
151 G_UNIT_PRICE_TBL QP_PREQ_GRP.NUMBER_TYPE;
152 G_PERCENT_PRICE_TBL QP_PREQ_GRP.NUMBER_TYPE;
153 G_ADJUSTED_UNIT_PRICE_TBL QP_PREQ_GRP.NUMBER_TYPE;
154 G_UPD_ADJUSTED_UNIT_PRICE_TBL QP_PREQ_GRP.NUMBER_TYPE;
155 G_PROCESSED_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
156 G_PRICE_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
157 G_LINE_ID_TBL QP_PREQ_GRP.NUMBER_TYPE;
158 G_PROCESSING_ORDER_TBL QP_PREQ_GRP.PLS_INTEGER_TYPE;
159 G_ROUNDING_FACTOR_TBL QP_PREQ_GRP.PLS_INTEGER_TYPE;
160 G_ROUNDING_FLAG_TBL QP_PREQ_GRP.FLAG_TYPE;
161 G_QUALIFIERS_EXIST_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
162 G_PRICING_ATTRS_EXIST_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
163 G_PRICE_LIST_ID_TBL QP_PREQ_GRP.NUMBER_TYPE;
164 G_PL_VALIDATED_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
165 G_PRICE_REQUEST_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
166 G_USAGE_PRICING_TYPE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
167 G_LINE_CATEGORY_TBL QP_PREQ_GRP.VARCHAR_TYPE;
168 G_PRICING_STATUS_CODE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
169 G_PRICING_STATUS_TEXT_tbl QP_PREQ_GRP.VARCHAR_TYPE;
170 G_ATTR_LINE_INDEX_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
171 G_ATTR_LINE_DETAIL_INDEX_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
172 G_ATTR_VALIDATED_FLAG_tbl QP_PREQ_GRP.VARCHAR_TYPE;
173 G_ATTR_PRICING_CONTEXT_tbl QP_PREQ_GRP.VARCHAR_TYPE;
174 G_ATTR_PRICING_ATTRIBUTE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
175 G_ATTR_ATTRIBUTE_LEVEL_tbl QP_PREQ_GRP.VARCHAR_TYPE;
176 G_ATTR_ATTRIBUTE_TYPE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
177 G_ATTR_APPLIED_FLAG_tbl QP_PREQ_GRP.VARCHAR_TYPE;
178 G_ATTR_PRICING_STATUS_CODE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
179 G_ATTR_PRICING_ATTR_FLAG_tbl QP_PREQ_GRP.VARCHAR_TYPE;
180 G_ATTR_LIST_HEADER_ID_tbl QP_PREQ_GRP.NUMBER_TYPE;
181 G_ATTR_LIST_LINE_ID_tbl QP_PREQ_GRP.NUMBER_TYPE;
182 G_ATTR_VALUE_FROM_tbl QP_PREQ_GRP.VARCHAR_TYPE;
183 G_ATTR_SETUP_VALUE_FROM_tbl QP_PREQ_GRP.VARCHAR_TYPE;
184 G_ATTR_VALUE_TO_tbl QP_PREQ_GRP.VARCHAR_TYPE;
185 G_ATTR_SETUP_VALUE_TO_tbl QP_PREQ_GRP.VARCHAR_TYPE;
186 G_ATTR_GROUPING_NUMBER_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
187 G_ATTR_NO_QUAL_IN_GRP_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
188 G_ATTR_COMP_OPERATOR_TYPE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
189 G_ATTR_PRICING_STATUS_TEXT_tbl QP_PREQ_GRP.VARCHAR_TYPE;
190 G_ATTR_QUAL_PRECEDENCE_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
191 G_ATTR_DATATYPE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
192 G_ATTR_QUALIFIER_TYPE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
193 G_ATTR_PRODUCT_UOM_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
194 G_ATTR_EXCLUDER_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
195 G_ATTR_PRICING_PHASE_ID_TBL QP_PREQ_GRP.PLS_INTEGER_TYPE;
196 G_ATTR_INCOM_GRP_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
197 G_ATTR_LDET_TYPE_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
198 G_ATTR_MODIFIER_LEVEL_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
199 G_ATTR_PRIMARY_UOM_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
200 G_CATCHWEIGHT_QTY_TBL QP_PREQ_GRP.NUMBER_TYPE;
201 G_ACTUAL_ORDER_QTY_TBL QP_PREQ_GRP.NUMBER_TYPE;
202 G_IS_THERE_FREEZE_OVERRIDE Boolean:=TRUE;
203
204
205 --g_panda_rec_table panda_rec_table;
206
207
208 Procedure Call_MRP_ATP(
209 in_global_orgs in varchar2,
210 in_ship_from_org_id in number,
211 out_available_qty out nocopy varchar2,
212
213 out_ship_from_org_id out nocopy number,
214
215 out_available_date out nocopy date,
216
217 out_qty_uom out nocopy varchar2,
218
219 x_out_message out nocopy varchar2,
220
221 x_return_status OUT NOCOPY VARCHAR2,
222
223 x_msg_count OUT NOCOPY NUMBER,
224
225 x_msg_data OUT NOCOPY VARCHAR2,
226
227 x_error_message out nocopy varchar2
228
229 ) IS
230
231 l_session_id NUMBER := 0;
232 l_mrp_atp_rec MRP_ATP_PUB.ATP_Rec_Typ;
233 l_atp_supply_demand MRP_ATP_PUB.ATP_Supply_Demand_Typ;
234 l_atp_period MRP_ATP_PUB.ATP_Period_Typ;
235 l_atp_details MRP_ATP_PUB.ATP_Details_Typ;
236 x_atp_rec MRP_ATP_PUB.ATP_Rec_Typ;
237 in_atp_rec MRP_ATP_PUB.ATP_Rec_Typ;
238 I NUMBER := 1;
239
240
241 --
242 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
243 --
244 BEGIN
245
246 IF l_debug_level > 0 THEN
247 oe_debug_pub.add( 'ENTERING CALL ATP' ) ;
248 END IF;
249
250 Initialize_mrp_record
251 ( p_x_atp_rec => in_atp_rec
252 ,l_count =>1 );
253
254
255 IF l_debug_level > 0 THEN
256 oe_debug_pub.add( 'INVENTORY_ITEM_ID='||g_panda_rec_table(1).P_INVENTORY_ITEM_ID
257 || ' SHIP_FORM_ORG_ID='||G_panda_rec_table(1).p_SHIP_FROM_ORG_ID
258 || ' IN_GLOBAL_ORGS='||IN_GLOBAL_ORGS);
259 oe_debug_pub.add(' CUST_ID='||G_panda_rec_table(1).p_CUSTOMER_ID|| ' SHIP_TO_ORG_ID='
260 ||G_panda_rec_table(1).p_SHIP_TO_ORG_ID||' QTY='||G_panda_rec_table(1).p_QTY
261 || ' UOM='||G_panda_rec_table(1).p_UOM||' REQ DATE='||
262 G_panda_rec_table(1).p_REQUEST_DATE ) ;
263 END IF;
264
265 --if the call is made for GA then the org_id is passed
266 IF in_global_orgs = 'Y' and
267 in_ship_from_org_id is not null then
268
269 in_atp_rec.Source_Organization_Id(1) := in_ship_from_org_id;
270 ELSE
271
272 in_atp_rec.Source_Organization_Id(1) := g_panda_rec_table(1).p_ship_from_org_id;
273 END IF;
274
275 /*SELECT OE_ORDER_LINES_S.NEXTVAL
276 INTO l_line_id
277 FROM DUAL;
278 */
279 IF l_debug_level > 0 THEN
280 oe_debug_pub.add( 'LINE_ID='||G_ATP_LINE_ID ) ;
281 END IF;
282
283 in_atp_rec.Identifier(I) := g_atp_line_id;
284 in_atp_rec.Action(I) := 100;
285 in_atp_rec.calling_module(I) := 660;
286 in_atp_rec.customer_id(I) := g_panda_rec_table(1).p_customer_id;
287 in_atp_rec.customer_site_id(I) := g_panda_rec_table(1).p_ship_to_org_id;
288 in_atp_rec.inventory_item_id(I) := g_panda_rec_table(1).p_inventory_item_id;
289 in_atp_rec.quantity_ordered(I) := g_panda_rec_table(1).p_qty;
290 in_atp_rec.quantity_uom(I) := g_panda_rec_table(1).p_uom;
291 in_atp_rec.Earliest_Acceptable_Date(I):= null;
292 in_atp_rec.Requested_Ship_Date(I) := g_panda_rec_table(1).p_request_date;
293 in_atp_rec.Requested_Arrival_Date(I) := null;
294 in_atp_rec.Delivery_Lead_Time(I) := Null;
295 in_atp_rec.Freight_Carrier(I) := null;
296 in_atp_rec.Ship_Method(I) := null;
297 in_atp_rec.Demand_Class(I) := null;
298 in_atp_rec.Ship_Set_Name(I) := null;
299 in_atp_rec.Arrival_Set_Name(I) := null;
300 in_atp_rec.Override_Flag(I) := 'N';
301 in_atp_rec.Ship_Date(I) := null;
302 in_atp_rec.Available_Quantity(I) := null;
303 in_atp_rec.Requested_Date_Quantity(I) := null;
304 in_atp_rec.Group_Ship_Date(I) := null;
305 in_atp_rec.Group_Arrival_Date(I) := null;
306 in_atp_rec.Vendor_Id(I) := null;
307 in_atp_rec.Vendor_Site_Id(I) := null;
308 in_atp_rec.Insert_Flag(I) := 1; -- it can be 0 or 1
309 in_atp_rec.Error_Code(I) := null;
310 in_atp_rec.Message(I) := null;
311 in_atp_rec.atp_lead_time(I) := 0;
312
313 SELECT mrp_atp_schedule_temp_s.nextval
314 INTO l_session_id
315 FROM dual;
316
317 -- Call ATP
318
319 IF l_debug_level > 0 THEN
320 oe_debug_pub.add('1.CALLING MRP API WITH SESSION ID '||L_SESSION_ID);
321 END IF;
322
323 IF l_debug_level > 0 THEN
324 print_time('Calling MRP');
325 END IF;
326
327 MRP_ATP_PUB.Call_ATP (
328 p_session_id => l_session_id
329 , p_atp_rec => in_atp_rec
330 , x_atp_rec => x_atp_rec
331 , x_atp_supply_demand => l_atp_supply_demand
332 , x_atp_period => l_atp_period
333 , x_atp_details => l_atp_details
334 , x_return_status => x_return_status
335 , x_msg_data => x_msg_data
336 , x_msg_count => x_msg_count
337 );
338
339 IF l_debug_level > 0 THEN
340 print_time('After Calling MRP');
341 END IF;
342
343 IF l_debug_level > 0 THEN
344 oe_debug_pub.add( 'AFTER CALL MRP_ATP_PUB.CALL_ATP STS='||X_RETURN_STATUS|| ' MSG COUNT='||X_MSG_COUNT);
345
346 IF x_atp_rec.available_quantity.COUNT > 0 AND
347 x_atp_rec.source_organization_id.COUNT > 0 then
348 oe_debug_pub.add( ' MSG DATA='||X_MSG_DATA|| 'AVL QTY='|| X_ATP_REC.AVAILABLE_QUANTITY ( 1 ) ||
349 'SHIP_FROM_ORG_ID =' ||X_ATP_REC.SOURCE_ORGANIZATION_ID ( 1 ) ) ;
350 END IF;
351 END IF;
352
353 IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
354 IF l_debug_level > 0 THEN
355 oe_debug_pub.add( 'ERROR IS' || X_MSG_DATA , 1 ) ;
356 END IF;
357 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
358 END IF;
359
360
361 Check_Results_from_rec(
362 in_global_orgs =>in_global_orgs
363 ,p_atp_rec => x_atp_rec
364 ,x_return_status => x_return_status
365 ,x_msg_count =>x_msg_count
366 ,x_msg_data =>x_msg_data
367 ,x_error_message =>x_error_message
368 );
369
370 IF l_debug_level > 0 THEN
371 oe_debug_pub.add( 'STATUS='||X_RETURN_STATUS|| ' X_ERROR_MESSAGE ='
372 ||X_ERROR_MESSAGE|| ' MSG DATA='||X_MSG_DATA ) ;
373 END IF;
374
375 /* Commented the following code to fix fp bug 3498932 */
376 /*
377
378 IF nvl(x_return_status,'E') <> 'P' then
379
380 IF l_debug_level > 0 THEN
381 oe_debug_pub.add( 'RETURN_STATUS<>P' ) ;
382 END IF;
383
384 IF nvl(x_return_status,'E') <> 'E' THEN
385 IF nvl(x_atp_rec.available_quantity(1),0) = 0 then
386
387 IF l_debug_level > 0 THEN
388 oe_debug_pub.add( 'AVAILABLE QUANTITY IS 0' ) ;
389 END IF;
390 out_available_date := null;
391 out_available_qty := 0;
392
393 ELSE
394 IF x_atp_rec.available_quantity.COUNT > 0 THEN
395 out_available_qty := x_atp_rec.available_quantity(1);
396 END IF;
397 IF x_atp_rec.ship_date.COUNT > 0 THEN
398 out_available_date := x_atp_rec.ship_date(1);
399 END IF;
400 IF x_atp_rec.group_ship_date.COUNT > 0 THEN
401 IF x_atp_rec.group_ship_date(1) is not null THEN
402 out_available_date := x_atp_rec.group_ship_date(1);
403 END IF;
404 END IF;
405
406 END IF;
407 ELSE
408 out_available_date := null;
409 out_available_qty := 0;
410
411 END IF; -- if status is not E
412
413 ELSE -- if status is P
414
415 IF l_debug_level > 0 THEN
416 oe_debug_pub.add( 'RETURN_STATUS=P MESG='||X_ERROR_MESSAGE ) ;
417 END IF;
418 out_available_qty := x_error_message;
419 out_available_date := null;
420 x_error_message := null;
421
422 END IF; -- if return status is not P
423 */
424 /* End of code commented to fix the bug 3498932 */
425 /* Added the following code to fix the bug 3498932 */
426
427 IF x_atp_rec.available_quantity.COUNT > 0 THEN
428 out_available_qty := x_atp_rec.available_quantity(1);
429 END IF;
430 IF x_atp_rec.ship_date.COUNT > 0 THEN
431 out_available_date := x_atp_rec.ship_date(1);
432 END IF;
433 IF x_atp_rec.group_ship_date.COUNT > 0 THEN
434 IF x_atp_rec.group_ship_date(1) is not null THEN
435 out_available_date := x_atp_rec.group_ship_date(1);
436 END IF;
437 END IF;
438 IF x_atp_rec.error_code(1) = 53 then
439 out_available_qty := x_atp_rec.requested_date_quantity(1);
440 END IF;
441
442 /* End of new code added to fix the bug 3498932 */
443
444 IF x_atp_rec.source_organization_id.COUNT > 0 THEN
445 out_ship_from_org_id := x_atp_rec.source_organization_id(1);
446 END IF;
447 IF x_atp_rec.quantity_uom.COUNT > 0 THEN
448 out_qty_uom := x_atp_rec.quantity_uom(1);
449 END IF;
450
451
452 IF l_debug_level > 0 THEN
453 oe_debug_pub.add( 'OUT_AVAL_QTY='||OUT_AVAILABLE_QTY|| ' SHIP_FORM_ORG_ID='||
454 OUT_SHIP_FROM_ORG_ID|| ' UOM='||OUT_QTY_UOM);
455
456
457 IF x_atp_rec.ship_date.COUNT > 0 THEN
458 oe_debug_pub.add(' OUT SHIP DATE='||X_ATP_REC.SHIP_DATE(1));
459 END IF;
460
461 IF x_atp_rec.group_ship_date.COUNT > 0 THEN
462 oe_debug_pub.add(' OUT GRP SHIP DATE='||X_ATP_REC.GROUP_SHIP_DATE(1));
463 END IF;
464
465 IF x_atp_rec.arrival_date.COUNT > 0 THEN
466 oe_debug_pub.add(' OUT ARRIVAL DATE='||X_ATP_REC.ARRIVAL_DATE(1));
467 END IF;
468
469 IF x_atp_rec.requested_date_quantity.COUNT > 0 THEN
470 oe_debug_pub.add('REQ DATE QTY='||X_ATP_REC.REQUESTED_DATE_QUANTITY(1));
471 END IF;
472 IF x_atp_rec.available_quantity.COUNT > 0 THEN
473 oe_debug_pub.add(' AVAILABLE QTY='||X_ATP_REC.AVAILABLE_QUANTITY(1));
474 END IF;
475
476 END IF; -- if debug is on
477
478
479 IF l_debug_level > 0 THEN
480 oe_debug_pub.add( 'EXITING CALL ATP' , 1 ) ;
481 END IF;
482
483
484 EXCEPTION
485
486 WHEN OTHERS THEN
487
488 IF l_debug_level > 0 THEN
489 oe_debug_pub.add( 'WHEN OTHERS OF CALL_MRP_ATP' ) ;
490 END IF;
491 IF l_debug_level > 0 THEN
492 oe_debug_pub.add( 'CODE='||SQLCODE||' MSG='||SQLERRM ) ;
493 END IF;
494 x_return_status := 'E';
495 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
496 -- Get message count and data
497 OE_MSG_PUB.Count_And_Get
498 ( p_count => x_msg_count
499 , p_data => x_msg_data
500 );
501
502 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
503 OE_MSG_PUB.Add_Exc_Msg
504 ( G_PKG_NAME,
505 'Call_MRP_ATP');
506 END IF;
507
508 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
509
510 END Call_MRP_ATP;
511
512
513
514 PROCEDURE defaulting(
515 in_source in varchar2
516 ,in_org_id in varchar2
517 ,in_item_id in number
518 ,in_customer_id in number
519 ,in_ship_to_org_id in number
520 ,in_bill_to_org_id in number
521 ,in_agreement_id in number
522 ,in_order_type_id in number
523 ,out_wsh_id out nocopy number
524 ,out_uom out nocopy varchar2
525 ,out_item_type_code out nocopy varchar2
526 ,out_price_list_id out nocopy number
527 ,out_conversion_type out nocopy varchar2
528
529 ) IS
530
531 x_msg_count number;
532 tmp_var varchar2(2000);
533 tmp_var1 varchar2(2000);
534 x_msg_data varchar2(2000);
535 x_return_status varchar2(2000);
536
537 l_old_rec oe_ak_order_lines_v%ROWTYPE;
538 l_rec oe_ak_order_lines_v%ROWTYPE;
539 l_out_rec oe_ak_order_lines_v%ROWTYPE;
540 l_old_header_rec OE_AK_ORDER_HEADERS_V%ROWTYPE;
541 l_record OE_AK_ORDER_HEADERS_V%ROWTYPE;
542 l_out_record OE_AK_ORDER_HEADERS_V%ROWTYPE;
543
544 --
545 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
546 --
547 l_bom_item_type Varchar2(1);
548 l_pick_components_flag Varchar2(1);
549 BEGIN
550
551
552 IF l_debug_level > 0 THEN
553 oe_debug_pub.add( 'ENTERING OE_AVAILABILITY.DEFAULTING '|| ' ITEM_ID='||
554 IN_ITEM_ID|| ' SOURCE TYPE ='||IN_SOURCE|| ' ORG ID TYPE ='||IN_ORG_ID);
555 oe_debug_pub.add( ' CUSTOMER_ID ='||IN_CUSTOMER_ID|| ' SHIP_TO_ORG_ID ='||
556 IN_SHIP_TO_ORG_ID|| ' IN_BILL_TO_ORG_ID ='||IN_BILL_TO_ORG_ID
557 || ' IN_AGREEMENT_ID ='||IN_AGREEMENT_ID|| ' IN_ORDER_TYPE_ID ='
558 ||IN_ORDER_TYPE_ID ) ;
559 END IF;
560
561
562
563 IF in_source = 'ITEM' then
564
565 l_rec.inventory_item_id := in_item_id;
566 l_rec.org_id := in_org_id;
567 l_rec.sold_to_org_id := in_customer_id;
568 l_rec.ship_to_org_id := in_ship_to_org_id;
569 l_rec.ship_from_org_id := FND_API.G_MISS_NUM;
570 l_rec.order_quantity_uom := FND_API.G_MISS_CHAR;
571 --l_rec.price_list_id := FND_API.G_MISS_NUM;
572
573 l_out_rec := l_rec;
574
575 ONT_LINE_DEF_HDLR.Default_record(
576 p_x_rec => l_out_rec,
577 p_initial_rec =>l_rec,
578 p_in_old_rec => l_old_rec
579 );
580 out_wsh_id := l_out_rec.ship_from_org_id;
581 out_uom := l_out_rec.order_quantity_uom;
582 out_price_list_id := null;
583 BEGIN
584 SELECT BOM_ITEM_TYPE,PICK_COMPONENTS_FLAG
585 INTO l_bom_item_type,l_pick_components_flag
586 FROM MTL_SYSTEM_ITEMS
587 WHERE INVENTORY_ITEM_ID= in_item_id
588 AND ORGANIZATION_ID=in_org_id;
589 IF l_bom_item_type=4 AND l_pick_components_flag='N' THEN
590 out_item_type_code := 'STANDARD';
591 END IF;
592 EXCEPTION
593 WHEN NO_DATA_FOUND THEN
594 Null;
595 WHEN TOO_MANY_ROWS THEN
596 Null;
597 WHEN OTHERS THEN
598 Null;
599 END;
600
601 IF l_debug_level > 0 THEN
602 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM|| ' PRICE_LIST_ID='||
603 OUT_PRICE_LIST_ID ) ;
604 END IF;
605
606 ELSIF in_source = 'CUSTOMER' then
607
608 IF l_debug_level > 0 THEN
609 oe_debug_pub.add( 'SOURCE = CUSTOMER' ) ;
610 END IF;
611 l_record.sold_to_org_id := in_customer_id;
612 l_record.org_id := in_org_id;
613 l_record.ship_to_org_id := in_ship_to_org_id;
614 l_record.agreement_id := in_agreement_id;
615 l_record.invoice_to_org_id := in_bill_to_org_id;
616 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
617 l_record.price_list_id := FND_API.G_MISS_NUM;
618
619 l_out_record := l_record;
620
621 ONT_HEADER_Def_Hdlr.Default_Record
622 ( p_x_rec => l_out_record
623 , p_initial_rec => l_record
624 , p_in_old_rec => l_old_header_rec
625 , p_iteration => 1
626 );
627
628 out_wsh_id := l_out_record.ship_from_org_id;
629 out_price_list_id := l_out_record.price_list_id;
630
631 IF l_debug_level > 0 THEN
632 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM|| ' PRICE_LIST_ID='
633 ||OUT_PRICE_LIST_ID ) ;
634 END IF;
635
636 ELSIF in_source = 'SHIP_TO' then
637
638 l_record.sold_to_org_id := in_customer_id;
639 l_record.org_id := in_org_id;
640 l_record.ship_to_org_id := in_ship_to_org_id;
641 l_record.agreement_id := in_agreement_id;
642 l_record.invoice_to_org_id := in_bill_to_org_id;
643 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
644 l_record.price_list_id := FND_API.G_MISS_NUM;
645
646 l_out_record := l_record;
647
648 ONT_HEADER_Def_Hdlr.Default_Record
649 ( p_x_rec => l_out_record
650 , p_initial_rec => l_record
651 , p_in_old_rec => l_old_header_rec
652 , p_iteration => 1
653 );
654
655 out_wsh_id := l_out_record.ship_from_org_id;
656 out_price_list_id := l_out_record.price_list_id;
657
658 IF l_debug_level > 0 THEN
659 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM||
660 ' PRICE_LIST_ID='||OUT_PRICE_LIST_ID ) ;
661 END IF;
662
663 ELSIF in_source = 'BILL_TO' then
664
665 l_record.sold_to_org_id := in_customer_id;
666 l_record.org_id := in_org_id;
667 l_record.ship_to_org_id := in_ship_to_org_id;
668 l_record.agreement_id := in_agreement_id;
669 l_record.invoice_to_org_id := in_bill_to_org_id;
670 l_record.price_list_id := FND_API.G_MISS_NUM;
671
672 l_out_record := l_record;
673
674 ONT_HEADER_Def_Hdlr.Default_Record
675 ( p_x_rec => l_out_record
676 , p_initial_rec => l_record
677 , p_in_old_rec => l_old_header_rec
678 , p_iteration => 1
679 );
680
681 out_wsh_id := null;
682 out_uom := null;
683 out_price_list_id := l_out_record.price_list_id;
684
685 IF l_debug_level > 0 THEN
686 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM
687 || ' PRICE_LIST_ID='||OUT_PRICE_LIST_ID ) ;
688 END IF;
689
690 ELSIF in_source = 'AGREEMENT' then
691
692 l_rec.agreement_id := in_agreement_id;
693 l_rec.ship_to_org_id := in_ship_to_org_id;
694 l_rec.invoice_to_org_id := in_bill_to_org_id;
695 l_rec.sold_to_org_id := in_customer_id;
696 l_rec.org_id := in_org_id;
697 l_rec.price_list_id := FND_API.G_MISS_NUM;
698
699 l_out_rec := l_rec;
700
701 ONT_LINE_DEF_HDLR.Default_record(
702 p_x_rec => l_out_rec,
703 p_initial_rec =>l_rec,
704 p_in_old_rec => l_old_rec
705 );
706 out_wsh_id := null;
707 out_uom := null;
708 out_price_list_id := l_out_rec.price_list_id;
709
710 IF l_debug_level > 0 THEN
711 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||
712 OUT_UOM|| ' PRICE_LIST_ID='||OUT_PRICE_LIST_ID ) ;
713 END IF;
714
715 ELSIF in_source = 'ORDER_TYPE' then
716
717 l_record.org_id := in_org_id;
718 l_record.order_type_id := in_order_type_id;
719 l_record.conversion_type_code := FND_API.G_MISS_CHAR;
720
721 l_out_record := l_record;
722
723
724 ONT_HEADER_Def_Hdlr.Default_Record
725 ( p_x_rec => l_out_record
726 , p_initial_rec => l_record
727 , p_in_old_rec => l_old_header_rec
728 , p_iteration => 1
729 );
730
731 out_conversion_type := l_out_record.conversion_type_code;
732 out_uom := null;
733 out_price_list_id := null;
734 out_wsh_id := null;
735
736 IF l_debug_level > 0 THEN
737 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM
738 || ' CONVERSION_TYPE_CODE='||OUT_CONVERSION_TYPE ) ;
739 END IF;
740
741 ELSIF in_source = 'STARTUP' then
742
743 l_record.org_id := in_org_id;
744
745 l_record.conversion_type_code := FND_API.G_MISS_CHAR;
746 l_record.price_list_id := FND_API.G_MISS_NUM;
747 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
748
749 l_out_record := l_record;
750
751 ONT_HEADER_Def_Hdlr.Default_Record
752 ( p_x_rec => l_out_record
753 , p_initial_rec => l_record
754 , p_in_old_rec => l_old_header_rec
755 , p_iteration => 1
756 );
757
758 out_wsh_id := l_out_rec.ship_from_org_id;
759 out_uom := l_out_rec.order_quantity_uom;
760 out_price_list_id := l_out_record.price_list_id;
761 out_conversion_type := l_out_record.conversion_type_code;
762
763 END IF; -- in source_type
764
765 IF l_debug_level > 0 THEN
766 oe_debug_pub.add( 'EXITING OE_AVAILABILITY.DEFAULTING' ) ;
767 END IF;
768
769 EXCEPTION
770
771 WHEN FND_API.G_EXC_ERROR THEN
772
773 x_return_status := FND_API.G_RET_STS_ERROR;
774
775 -- Get message count and data
776
777 OE_MSG_PUB.Count_And_Get
778 ( p_count => x_msg_count
779 , p_data => x_msg_data
780 );
781
782 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
783
784 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
785
786 -- Get message count and data
787
788 OE_MSG_PUB.Count_And_Get
789 ( p_count => x_msg_count
790 , p_data => x_msg_data
791 );
792
793 WHEN OTHERS THEN
794
795 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
796
797 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
798 THEN
799 OE_MSG_PUB.Add_Exc_Msg
800 ( G_PKG_NAME
801 , 'defaulting'
802 );
803 END IF;
804
805 -- Get message count and data
806
807 OE_MSG_PUB.Count_And_Get
808 ( p_count => x_msg_count
809 , p_data => x_msg_data
810 );
811
812 END defaulting;
813
814
815 Procedure Check_Results_from_rec (
816 in_global_orgs in varchar2
817 ,p_atp_rec IN MRP_ATP_PUB.ATP_Rec_Typ
818 ,x_return_status OUT NOCOPY VARCHAR2
819
820 ,x_msg_count OUT NOCOPY NUMBER
821
822 ,x_msg_data OUT NOCOPY VARCHAR2
823
824 ,x_error_message OUT NOCOPY varchar2
825
826 )IS
827
828 atp_count NUMBER := 1;
829 J NUMBER := 1;
830 l_explanation VARCHAR2(80);
831 l_type_code VARCHAR2(30);
832 l_ship_set_name VARCHAR2(30);
833 l_arrival_set_name VARCHAR2(30);
834 l_arrival_date DATE := NULL;
835 l_sch_action varchar2(100) := 'OESCH_ACT_ATP_CHECK';
836 --
837 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
838 --
839 BEGIN
840
841 x_return_status := 'S';
842 IF l_debug_level > 0 AND
843 p_atp_rec.error_code.COUNT > 0 THEN
844 oe_debug_pub.add( '2. ENTERING CHECK_RESULTS ERROR_CODE='|| P_ATP_REC.ERROR_CODE ( J ) ||
845 ' IN_GLOBAL_ORGS='||IN_GLOBAL_ORGS ) ;
846 END IF;
847
848 IF p_atp_rec.error_code.COUNT > 0 AND
849 p_atp_rec.error_code(J) <> 0 AND
850 p_atp_rec.error_code(J) <> -99 AND -- Multi org changes.
851 p_atp_rec.error_code(J) <> 150 -- to fix bug 1880166
852
853 THEN
854
855 IF l_debug_level > 0 THEN
856 oe_debug_pub.add( 'ERROR FROM MRP: ' || P_ATP_REC.ERROR_CODE ( J ) , 1 ) ;
857 END IF;
858
859 IF p_atp_rec.error_code(J) = 80 THEN
860
861 l_explanation := null;
862
863 select meaning
864 into l_explanation
865 from mfg_lookups
866 where lookup_type = 'MTL_DEMAND_INTERFACE_ERRORS'
867 and lookup_code = 80;
868
869 IF l_debug_level > 0 THEN
870 oe_debug_pub.add( 'SETTING THE MESSAGE FOR OE_SCH_NO_SOURCE' ) ;
871 END IF;
872 --FND_MESSAGE.SET_NAME('ONT','OE_SCH_NO_SOURCE');
873 IF in_global_orgs = 'N' then
874
875 FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_NO_SOURCES');
876 OE_MSG_PUB.Add;
877 ELSE
878 x_error_message := l_explanation;
879 END IF;
880
881 ELSE
882
883 IF l_debug_level > 0 THEN
884 oe_debug_pub.add( 'SCH FAILED ERROR CODE='||P_ATP_REC.ERROR_CODE ( J ) ) ;
885 END IF;
886
887 l_explanation := null;
888
889 select meaning
890 into l_explanation
891 from mfg_lookups
892 where lookup_type = 'MTL_DEMAND_INTERFACE_ERRORS'
893 and lookup_code = p_atp_rec.error_code(J) ;
894
895 IF p_atp_rec.error_code(J) = 19 THEN
896 -- This error code is given for those lines which are
897 -- in a group and whose scheduling failed due to some other lines.
898 -- We do not want to give this out as a message.
899 null;
900
901 ELSIF p_atp_rec.error_code(J) = 61 THEN
902
903 -- setting the status flag to partial for ATP not applicable
904 IF l_debug_level > 0 THEN
905 oe_debug_pub.add( 'ERROR CODE = 61' ) ;
906 END IF;
907
908 x_return_status := 'P';
909 x_error_message := l_explanation;
910
911 /* Added the following code to fix the bug 3498932 */
912
913 ELSIF p_atp_rec.error_code(J) = 53 THEN
914
915 x_return_status := 'E';
916 IF l_debug_level > 0 THEN
917 oe_debug_pub.add( 'ERROR CODE = 53' ) ;
918 END IF;
919
920 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_AVA_NO_REQUESTED_QTY');
921 FND_MESSAGE.SET_TOKEN('PARTIAL_QUANTITY', p_atp_rec.requested_date_quantity(J));
922 FND_MESSAGE.SET_TOKEN('REQUEST_DATE', p_atp_rec.requested_ship_date(J));
923 FND_MESSAGE.SET_TOKEN('EARLIEST_DATE', p_atp_rec.ship_date(J));
924
925 IF in_global_orgs = 'N' then
926 OE_MSG_PUB.Add;
927 ELSE
928 x_error_message := fnd_message.get;
929 END IF;
930
931 /* End of code added to fix the bug 3498932 */
932
933
934 ELSIF p_atp_rec.Ship_Set_Name(J) is not null OR
935 p_atp_rec.Arrival_Set_Name(J) is not null THEN
936
937 -- This line belongs to a scheduling group. We do not want
938 -- to give out individual messages for each line.
939 null;
940
941 ELSE
942 IF l_debug_level > 0 THEN
943 oe_debug_pub.add( 'ADDING MESSAGE TO THE STACK' , 1 ) ;
944 END IF;
945 --FND_MESSAGE.SET_NAME('ONT','OE_SCH_OE_ORDER_FAILED');
946 --FND_MESSAGE.SET_TOKEN('EXPLANATION',l_explanation);
947
948 IF in_global_orgs = 'N' then
949 FND_MESSAGE.SET_NAME('ONT','ONT_INLNE_CUSTOMER');
950 FND_MESSAGE.SET_TOKEN('TEXT',l_explanation);
951 OE_MSG_PUB.Add;
952 ELSE
953 x_error_message := l_explanation;
954 END IF;
955
956 END IF;
957
958 END IF; -- 80
959
960 IF l_debug_level > 0 THEN
961 oe_debug_pub.add( 'SETTING ERROR' , 1 ) ;
962 END IF;
963 IF x_return_status <> 'P' then
964 x_return_status := 'E';
965 END IF;
966
967 ELSE
968
969 IF l_debug_level > 0 THEN
970 oe_debug_pub.add( ' ELSE '||P_ATP_REC.SOURCE_ORGANIZATION_ID ( 1 ) ||
971 ' ERROR CODE : ' || P_ATP_REC.ERROR_CODE ( J ) ) ;
972 END IF;
973
974 -- Muti org changes.
975 IF (p_atp_rec.error_code(J) <> -99 ) THEN
976
977 IF l_debug_level > 0 THEN
978 oe_debug_pub.add( 'ERROR CODE : ' || P_ATP_REC.ERROR_CODE ( J ) || 'IDENTIFIER : ' ||
979 P_ATP_REC.IDENTIFIER ( J ) || 'ITEM : ' ||
980 P_ATP_REC.INVENTORY_ITEM_ID ( J ));
981 oe_debug_pub.add( 'REQUEST SHIP DATE :' ||
982 TO_CHAR ( P_ATP_REC.REQUESTED_SHIP_DATE ( J ) , 'DD-MON-RR:HH:MM:SS' )
983 || 'REQUEST ARRIVAL DATE :' || P_ATP_REC.REQUESTED_ARRIVAL_DATE ( J ));
984 oe_debug_pub.add( 'ARRIVAL DATE :' ||
985 TO_CHAR ( P_ATP_REC.ARRIVAL_DATE ( J ) , 'DD-MON-RR:HH:MM:SS' ) ||
986 'SHIP DATE :' ||
987 TO_CHAR ( P_ATP_REC.SHIP_DATE ( J ) , 'DD-MON-RR:HH:MM:SS' ));
988 oe_debug_pub.add( 'LEAD TIME :' ||P_ATP_REC.DELIVERY_LEAD_TIME ( J ) ||
989 'GROUP SHIP DATE :'||P_ATP_REC.GROUP_SHIP_DATE ( J ) ||
990 'GROUP ARR DATE :'||P_ATP_REC.GROUP_ARRIVAL_DATE ( J ) ) ;
991 END IF;
992
993 l_explanation := null;
994
995 IF (p_atp_rec.error_code(J) <> 0) THEN
996
997 BEGIN
998 select meaning
999 into l_explanation
1000 from mfg_lookups
1001 where lookup_type = 'MTL_DEMAND_INTERFACE_ERRORS'
1002 and lookup_code = p_atp_rec.error_code(J) ;
1003
1004 g_atp_tbl(atp_count).error_message := l_explanation;
1005 IF l_debug_level > 0 THEN
1006 oe_debug_pub.add( 'EXPLANATION IS : ' || L_EXPLANATION , 1 ) ;
1007 END IF;
1008 x_error_message := l_explanation;
1009
1010 IF p_atp_rec.error_code(J) = 150 THEN
1011 OE_MSG_PUB.add_text(l_explanation);
1012 END IF;
1013
1014 EXCEPTION
1015 WHEN OTHERS THEN
1016 Null;
1017 END;
1018
1019 END IF;
1020
1021 END IF; --Check for -99.
1022
1023 END IF; -- Main If;
1024
1025 -- umcomment for testing the error handling
1026 --x_return_status := 'E';
1027 --FND_MESSAGE.SET_NAME('ONT','OE_SCH_NO_SOURCE');
1028 --OE_MSG_PUB.Add;
1029
1030 IF x_return_status ='E' and in_global_orgs = 'N' then
1031 IF l_debug_level > 0 THEN
1032 oe_debug_pub.add( 'DOING COUNT_AND_GET' ) ;
1033 END IF;
1034 oe_msg_pub.count_and_get(p_encoded=>fnd_api.G_TRUE,
1035 p_count => x_msg_count,
1036 p_data=>x_msg_data
1037 );
1038 IF l_debug_level > 0 THEN
1039 oe_debug_pub.add( 'COUNT = '||X_MSG_COUNT||' MSG='||X_MSG_DATA ) ;
1040 END IF;
1041 END IF;
1042
1043 IF l_debug_level > 0 THEN
1044 oe_debug_pub.add( 'EXITING CHECK_RESULTS: ' || X_RETURN_STATUS , 1 ) ;
1045 END IF;
1046
1047 EXCEPTION
1048 WHEN OTHERS THEN
1049 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1050 THEN
1051 OE_MSG_PUB.Add_Exc_Msg
1052 ( G_PKG_NAME
1053 , 'Check_Results'
1054 );
1055 END IF;
1056 IF l_debug_level > 0 THEN
1057 oe_debug_pub.add( 'UNEXPECTED ERROR IN CHECK_RESULTS' ) ;
1058 END IF;
1059 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1060
1061 END Check_Results_from_rec;
1062
1063
1064 Procedure Initialize_mrp_record
1065 ( p_x_atp_rec IN OUT NOCOPY MRP_ATP_PUB.ATP_Rec_Typ
1066 ,l_count IN NUMBER) IS
1067
1068 l_return_status varchar2(10);
1069
1070 --
1071 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1072 --
1073 BEGIN
1074
1075 IF l_debug_level > 0 THEN
1076 oe_debug_pub.add( 'EXTENDING THE TABLE BY ' || L_COUNT , 5 ) ;
1077 END IF;
1078
1079 MSC_SATP_FUNC.Extend_ATP
1080 (p_atp_tab => p_x_atp_rec,
1081 p_index => l_count,
1082 x_return_status => l_return_status);
1083
1084 /*p_x_atp_rec.Inventory_Item_Id.extend(l_count);
1085 p_x_atp_rec.Source_Organization_Id.extend(l_count);
1086 p_x_atp_rec.Identifier.extend(l_count);
1087 p_x_atp_rec.Order_Number.extend(l_count);
1088 p_x_atp_rec.Calling_Module.extend(l_count);
1089 p_x_atp_rec.Customer_Id.extend(l_count);
1090 p_x_atp_rec.Customer_Site_Id.extend(l_count);
1091 p_x_atp_rec.Destination_Time_Zone.extend(l_count);
1092 p_x_atp_rec.Quantity_Ordered.extend(l_count);
1093 p_x_atp_rec.Quantity_UOM.extend(l_count);
1094 p_x_atp_rec.Requested_Ship_Date.extend(l_count);
1095 p_x_atp_rec.Requested_Arrival_Date.extend(l_count);
1096 p_x_atp_rec.Earliest_Acceptable_Date.extend(l_count);
1097 p_x_atp_rec.Latest_Acceptable_Date.extend(l_count);
1098 p_x_atp_rec.Delivery_Lead_Time.extend(l_count);
1099 p_x_atp_rec.Atp_Lead_Time.extend(l_count);
1100 p_x_atp_rec.Freight_Carrier.extend(l_count);
1101 p_x_atp_rec.Ship_Method.extend(l_count);
1102 p_x_atp_rec.Demand_Class.extend(l_count);
1103 p_x_atp_rec.Ship_Set_Name.extend(l_count);
1104 p_x_atp_rec.Arrival_Set_Name.extend(l_count);
1105 p_x_atp_rec.Override_Flag.extend(l_count);
1106 p_x_atp_rec.Action.extend(l_count);
1107 p_x_atp_rec.ship_date.extend(l_count);
1108 p_x_atp_rec.Available_Quantity.extend(l_count);
1109 p_x_atp_rec.Requested_Date_Quantity.extend(l_count);
1110 p_x_atp_rec.Group_Ship_Date.extend(l_count);
1111 p_x_atp_rec.Group_Arrival_Date.extend(l_count);
1112 p_x_atp_rec.Vendor_Id.extend(l_count);
1113 p_x_atp_rec.Vendor_Site_Id.extend(l_count);
1114 p_x_atp_rec.Insert_Flag.extend(l_count);
1115 p_x_atp_rec.Error_Code.extend(l_count);
1116 p_x_atp_rec.Message.extend(l_count);
1117 p_x_atp_rec.Old_Source_Organization_Id.extend(l_count);
1118 p_x_atp_rec.Old_Demand_Class.extend(l_count);
1119 p_x_atp_rec.oe_flag.extend(l_count);
1120 p_x_atp_rec.ato_delete_flag.extend(l_count);
1121 p_x_atp_rec.attribute_01.extend(l_count);
1122 p_x_atp_rec.attribute_05.extend(l_count);*/
1123
1124
1125 EXCEPTION
1126
1127 WHEN OTHERS THEN
1128
1129 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1130 OE_MSG_PUB.Add_Exc_Msg
1131 ( G_PKG_NAME,
1132 'Initialize_mrp_record');
1133 END IF;
1134
1135 END Initialize_mrp_record;
1136
1137
1138
1139 Procedure Query_Qty_Tree(p_org_id IN NUMBER,
1140 p_item_id IN NUMBER,
1141 p_sch_date IN DATE DEFAULT NULL,
1142 x_on_hand_qty OUT NOCOPY NUMBER,
1143
1144 x_avail_to_reserve OUT NOCOPY NUMBER
1145
1146 ) IS
1147
1148 l_return_status VARCHAR2(1);
1149 l_msg_count NUMBER;
1150 l_msg_data VARCHAR2(2000);
1151 l_qoh NUMBER;
1152 l_rqoh NUMBER;
1153 l_qr NUMBER;
1154 l_qs NUMBER;
1155 l_att NUMBER;
1156 l_atr NUMBER;
1157 l_msg_index NUMBER;
1158 l_lot_control_flag BOOLEAN;
1159 l_lot_control_code NUMBER;
1160 l_org_id NUMBER;
1161
1162 --
1163 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1164 --
1165 BEGIN
1166
1167 IF l_debug_level > 0 THEN
1168 oe_debug_pub.add( 'ENTERING QUERY_QTY_TREE'|| 'ORG IS : ' || P_ORG_ID
1169 || 'ITEM IS : ' || P_ITEM_ID ) ;
1170 END IF;
1171
1172 BEGIN
1173 IF p_org_id is null THEN
1174 l_org_id := OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
1175 END IF;
1176
1177 SELECT msi.lot_control_code
1178 INTO l_lot_control_code
1179 FROM mtl_system_items msi
1180 WHERE msi.inventory_item_id = p_item_id
1181 AND msi.organization_id = nvl(p_org_id,l_org_id);
1182
1183 IF l_lot_control_code = 2 THEN
1184 l_lot_control_flag := TRUE;
1185 ELSE
1186 l_lot_control_flag := FALSE;
1187 END IF;
1188
1189 EXCEPTION
1190 WHEN OTHERS THEN
1191 l_lot_control_flag := FALSE;
1192 END;
1193
1194 inv_quantity_tree_pub.query_quantities
1195 ( p_api_version_number => 1.0
1196 , x_return_status => l_return_status
1197 , x_msg_count => l_msg_count
1198 , x_msg_data => l_msg_data
1199 , p_organization_id => p_org_id
1200 , p_inventory_item_id => p_item_id
1201 , p_tree_mode => 2
1202 , p_is_revision_control => false
1203 , p_is_lot_control => l_lot_control_flag
1204 , p_lot_expiration_date => nvl(p_sch_date,sysdate)
1205 , p_is_serial_control => false
1206 , p_revision => null
1207 , p_lot_number => null
1208 , p_subinventory_code => null
1209 , p_locator_id => null
1210 , x_qoh => l_qoh
1211 , x_rqoh => l_rqoh
1212 , x_qr => l_qr
1213 , x_qs => l_qs
1214 , x_att => l_att
1215 , x_atr => l_atr
1216 );
1217
1218 IF l_debug_level > 0 THEN
1219 oe_debug_pub.add( 'RR: L_QOH ' || L_QOH|| 'RR: L_QOH ' || L_ATR ) ;
1220 END IF;
1221
1222 x_on_hand_qty := l_qoh;
1223 x_avail_to_reserve := l_atr;
1224
1225 IF l_debug_level > 0 THEN
1226 oe_debug_pub.add( 'EXITING QUERY_QTY_TREE ' , 1 ) ;
1227 END IF;
1228
1229 END Query_Qty_Tree;
1230
1231
1232
1233 PROCEDURE get_ship_from_org(in_org_id in number,
1234 out_code out nocopy varchar2,
1235
1236 out_name out nocopy varchar2
1237
1238 )IS
1239
1240 --
1241 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1242 --
1243 BEGIN
1244 SELECT organization_code,
1245 name
1246 INTO out_code,
1247 out_name
1248 FROM oe_ship_from_orgs_v
1249 WHERE organization_id = in_org_id;
1250
1251 EXCEPTION
1252
1253 WHEN OTHERS THEN
1254 IF l_debug_level > 0 THEN
1255 oe_debug_pub.add( 'GET_SHIP_FROM_ORG WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1256 END IF;
1257
1258 END get_ship_From_org;
1259
1260
1261
1262 procedure copy_Header_to_request(
1263 p_request_type_code in varchar2
1264 ,p_calculate_price_flag in varchar2
1265 ,px_req_line_tbl in out nocopy QP_PREQ_GRP.LINE_TBL_TYPE
1266 ) is
1267
1268 l_line_index pls_integer := 0;
1269
1270 --
1271 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1272 --
1273 BEGIN
1274
1275 IF l_debug_level > 0 THEN
1276 oe_debug_pub.add( 'ENTERING OE_AVAILABILITY.COPY_HEADER_TO_REQUEST' , 1 ) ;
1277 END IF;
1278
1279 l_line_index := l_line_index+1;
1280 px_req_line_tbl(l_line_index).REQUEST_TYPE_CODE :=p_Request_Type_Code;
1281 px_req_line_tbl(l_line_index).LINE_INDEX := l_line_index;
1282 px_req_line_tbl(l_line_index).LINE_TYPE_CODE := 'ORDER';
1283 -- Hold the header_id in line_id for 'HEADER' Records
1284
1285 px_req_line_tbl(l_line_index).line_id := g_line_id;
1286
1287 if g_panda_rec_table(1).p_pricing_date is null or g_panda_rec_table(1).p_pricing_date = fnd_api.g_miss_date then
1288 px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE := trunc(sysdate);
1289 Else
1290 px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE := g_panda_rec_table(1).p_pricing_date;
1291 End If;
1292
1293 px_req_line_tbl(l_line_index).CURRENCY_CODE := g_panda_rec_table(1).p_currency;
1294 px_req_line_tbl(l_line_index).PRICE_FLAG := p_calculate_price_flag;
1295 px_req_line_tbl(l_line_index).Active_date_first_type := 'ORD';
1296 px_req_line_tbl(l_line_index).Active_date_first := g_panda_rec_table(1).p_request_date;
1297
1298
1299 --If G_ROUNDING_FLAG = 'Y' Then
1300 IF g_panda_rec_table(1).p_price_list_id is not null then
1301 px_req_line_tbl(l_line_index).Rounding_factor := Get_Rounding_factor(g_panda_rec_table(1).p_price_list_id);
1302 END IF;
1303 --End If;
1304 IF l_debug_level > 0 THEN
1305 oe_debug_pub.add( 'CURR='||G_panda_rec_table(1).p_CURRENCY||' REQ DATE='||
1306 G_panda_rec_table(1).p_REQUEST_DATE||' ROUNDING_FACTOR='||
1307 PX_REQ_LINE_TBL ( L_LINE_INDEX ) .ROUNDING_FACTOR ) ;
1308 END IF;
1309
1310 --px_req_line_tbl(l_line_index).price_request_code := p_header_rec.price_request_code; -- PROMOTIONS SEP/01
1311 --populating temp tables
1312 G_LINE_INDEX_TBL.delete;
1313 if l_debug_level > 0 then
1314 oe_debug_pub.add('********** POPULATING HEADER RECORD INTO TEMP TABLE *********************');
1315 --oe_debug_pub.add('line index is='||G_LINE_INDEX_TBL(l_line_index));
1316 end if;
1317 G_LINE_INDEX_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_INDEX;
1318 G_LINE_TYPE_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_TYPE_CODE;
1319 G_PRICING_EFFECTIVE_DATE_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE);
1320 G_ACTIVE_DATE_FIRST_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).ACTIVE_DATE_FIRST);
1321 G_ACTIVE_DATE_FIRST_TYPE_TBL(l_line_index) := px_req_line_tbl(l_line_index).ACTIVE_DATE_FIRST_TYPE;
1322 G_ACTIVE_DATE_SECOND_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).ACTIVE_DATE_SECOND);
1323 G_ACTIVE_DATE_SECOND_TYPE_TBL(l_line_index):= px_req_line_tbl(l_line_index).ACTIVE_DATE_SECOND_TYPE;
1324 G_LINE_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_QUANTITY;
1325 G_LINE_UOM_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_UOM_CODE;
1326 G_REQUEST_TYPE_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).REQUEST_TYPE_CODE;
1327 G_PRICED_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICED_QUANTITY;
1328 G_UOM_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).UOM_QUANTITY;
1329 G_PRICED_UOM_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICED_UOM_CODE;
1330 G_CURRENCY_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).CURRENCY_CODE;
1331 G_UNIT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).unit_price; -- AG
1332 G_PERCENT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).PERCENT_PRICE;
1333 G_ADJUSTED_UNIT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).ADJUSTED_UNIT_PRICE;
1334 G_PROCESSED_FLAG_TBL(l_line_index) := QP_PREQ_GRP.G_NOT_PROCESSED;
1335 G_PRICE_FLAG_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICE_FLAG;
1336 G_LINE_ID_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_ID;
1337 if l_debug_level >0 then
1338 oe_debug_pub.add('the order line id'||G_LINE_ID_TBL(l_line_index));
1339 end if;
1340 G_ROUNDING_FLAG_TBL(l_line_index) := NULL;
1341 G_ROUNDING_FACTOR_TBL(l_line_index) := px_req_line_tbl(l_line_index).ROUNDING_FACTOR;
1342 G_PROCESSING_ORDER_TBL(l_line_index) := NULL;
1343 G_PRICING_STATUS_CODE_tbl(l_line_index) := QP_PREQ_GRP.G_STATUS_UNCHANGED;
1344 G_PRICING_STATUS_TEXT_tbl(l_line_index) := NULL;
1345
1346 G_QUALIFIERS_EXIST_FLAG_TBL(l_line_index) :='N';
1347 G_PRICING_ATTRS_EXIST_FLAG_TBL(l_line_index) :='N';
1348 G_PRICE_LIST_ID_TBL(l_line_index) :=g_panda_rec_table(1).p_price_list_id;
1349 G_PL_VALIDATED_FLAG_TBL(l_line_index) := 'N';
1350 G_PRICE_REQUEST_CODE_TBL(l_line_index) := NULL;
1351 G_USAGE_PRICING_TYPE_TBL(l_line_index) :='REGULAR';
1352 G_UPD_ADJUSTED_UNIT_PRICE_TBL(l_line_index) :=NULL;
1353 G_LINE_CATEGORY_TBL(l_line_index) :=NULL;
1354 G_CATCHWEIGHT_QTY_TBL(l_line_index) := NULL;
1355 G_ACTUAL_ORDER_QTY_TBL(l_line_index) :=NULL;
1356
1357 --Temp Table population done
1358
1359 IF l_debug_level > 0 THEN
1360 oe_debug_pub.add( 'EXITING OE_OE_AVAILABILITY.COPY_HEADER_TO_REQUEST' ) ;
1361 END IF;
1362
1363 END copy_Header_to_request;
1364
1365
1366 PROCEDURE copy_Line_to_request(
1367 px_req_line_tbl in out nocopy QP_PREQ_GRP.LINE_TBL_TYPE
1368 ,p_pricing_event in varchar2
1369 ,p_Request_Type_Code in varchar2
1370 ,p_honor_price_flag in VARCHAR2 Default 'Y'
1371 ,p_line_index in number
1372 ) IS
1373
1374 l_line_index pls_integer := nvl(px_req_line_tbl.count,0);
1375 l_uom_rate NUMBER;
1376 v_discounting_privilege VARCHAR2(30);
1377 l_item_type_code VARCHAR2(30);
1378
1379 --
1380 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1381 --
1382 begin
1383
1384 IF l_debug_level > 0 THEN
1385 oe_debug_pub.add( 'ENTERING OE_ORDER_ADJ_PVT.COPY_LINE_TO_REQUEST' , 1 ) ;
1386 END IF;
1387
1388 l_line_index := l_line_index+1;
1389 px_req_line_tbl(l_line_index).Line_id := g_line_id;
1390 px_req_line_tbl(l_line_index).REQUEST_TYPE_CODE := p_Request_Type_Code;
1391 px_req_line_tbl(l_line_index).LINE_INDEX := l_line_index;
1392 px_req_line_tbl(l_line_index).LINE_TYPE_CODE := 'LINE';
1393
1394 IF g_panda_rec_table(p_line_index).p_pricing_date is null or
1395 g_panda_rec_table(p_line_index).p_pricing_date = fnd_api.g_miss_date then
1396 px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE := trunc(sysdate);
1397 ELSE
1398 px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE := g_panda_rec_table(p_line_index).p_pricing_date;
1399 END IF;
1400
1401 px_req_line_tbl(l_line_index).LINE_QUANTITY := g_panda_rec_table(p_line_index).p_qty ;
1402 px_req_line_tbl(l_line_index).LINE_UOM_CODE := g_panda_rec_table(p_line_index).p_uom;
1403 px_req_line_tbl(l_line_index).PRICED_QUANTITY := g_panda_rec_table(p_line_index).p_qty;
1404 px_req_line_tbl(l_line_index).PRICED_UOM_CODE := g_panda_rec_table(p_line_index).p_uom;
1405 px_req_line_tbl(l_line_index).CURRENCY_CODE :=g_panda_rec_table(p_line_index).p_currency;
1406 px_req_line_tbl(l_line_index).UNIT_PRICE := Null;
1407 --px_req_line_tbl(l_line_index).PERCENT_PRICE := p_Line_rec.unit_list_percent;
1408 IF l_debug_level > 0 THEN
1409 oe_debug_pub.add( 'QTY='||G_panda_rec_table(p_line_index).p_QTY||' UOM ='||
1410 G_panda_rec_table(p_line_index).p_UOM||' CURR='||G_panda_rec_table(p_line_index).p_CURRENCY ) ;
1411 END IF;
1412
1413 /*If (p_Line_rec.service_period = p_Line_rec.Order_quantity_uom) Then
1414 px_req_line_tbl(l_line_index).UOM_QUANTITY := p_Line_rec.service_duration;
1415 Else
1416 INV_CONVERT.INV_UM_CONVERSION(From_Unit => p_Line_rec.service_period
1417 ,To_Unit => p_Line_rec.Order_quantity_uom
1418 ,Item_ID => p_Line_rec.Inventory_item_id
1419 ,Uom_Rate => l_Uom_rate);
1420 px_req_line_tbl(l_line_index).UOM_QUANTITY := p_Line_rec.service_duration * l_uom_rate;
1421 End If; */
1422
1423 --If G_ROUNDING_FLAG = 'Y' Then
1424 px_req_line_tbl(l_line_index).Rounding_factor :=
1425 Get_Rounding_factor(g_panda_rec_table(p_line_index).p_price_list_id);
1426 --End If;
1427
1428 px_req_line_tbl(l_line_index).PRICE_FLAG := 'Y';
1429
1430
1431 -- Get Discounting Privilege Profile Option value
1432 fnd_profile.get('ONT_DISCOUNTING_PRIVILEGE', v_discounting_privilege);
1433
1434 -- Execute the pricing phase if the list price is null
1435
1436 IF p_pricing_event = 'PRICE' and
1437
1438
1439 px_req_line_tbl(l_line_index).UNIT_PRICE is null then
1440
1441 px_req_line_tbl(l_line_index).PRICE_FLAG := 'Y' ;
1442
1443 END IF;
1444
1445 --l_item_type_code := oe_line_util.Get_Return_Item_Type_Code(p_Line_rec);
1446 l_item_type_code := 'STANDARD';
1447
1448 px_req_line_tbl(l_line_index).Active_date_first_type := 'ORD';
1449 px_req_line_tbl(l_line_index).Active_date_first := g_panda_rec_table(p_line_index).p_request_date;
1450
1451 IF g_panda_rec_table(p_line_index).p_request_date is not null then
1452 px_req_line_tbl(l_line_index).Active_date_Second_type := 'SHIP';
1453 px_req_line_tbl(l_line_index).Active_date_Second := g_panda_rec_table(p_line_index).p_request_date;
1454 End If;
1455
1456 --px_req_line_tbl(l_line_index).price_request_code := p_line_rec.price_request_code; -- PROMOTIONS SEP/01
1457 --px_req_line_tbl(l_line_index).line_category :=p_line_rec.line_category_code;
1458
1459 oe_debug_pub.add('********Temp tables population for lines **************');
1460 oe_debug_pub.add('LINE INDEX'||l_line_index);
1461
1462 G_LINE_INDEX_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_INDEX;
1463 G_LINE_TYPE_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_TYPE_CODE;
1464 G_PRICING_EFFECTIVE_DATE_TBL(l_line_index):= TRUNC(px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE);
1465 G_ACTIVE_DATE_FIRST_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).ACTIVE_DATE_FIRST);
1466 G_ACTIVE_DATE_FIRST_TYPE_TBL(l_line_index):= px_req_line_tbl(l_line_index).ACTIVE_DATE_FIRST_TYPE;
1467 G_ACTIVE_DATE_SECOND_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).ACTIVE_DATE_SECOND);
1468 G_ACTIVE_DATE_SECOND_TYPE_TBL(l_line_index):= px_req_line_tbl(l_line_index).ACTIVE_DATE_SECOND_TYPE;
1469 --px_req_line_tbl(l_line_index).priced_quantity := NULL;
1470 IF l_debug_level > 0 THEN
1471 oe_debug_pub.add( 'QUANTITY'||PX_REQ_LINE_TBL(L_LINE_INDEX).LINE_QUANTITY||' '||
1472 PX_REQ_LINE_TBL(L_LINE_INDEX).PRICED_QUANTITY , 3 ) ;
1473 END IF;
1474 IF l_debug_level > 0 THEN
1475 oe_debug_pub.add( 'PRICE FLAG'||PX_REQ_LINE_TBL(L_LINE_INDEX).PRICE_FLAG ) ;
1476 END IF;
1477 G_LINE_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_QUANTITY;
1478
1479 G_LINE_UOM_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_UOM_CODE;
1480 G_REQUEST_TYPE_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).REQUEST_TYPE_CODE;
1481 G_PRICED_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICED_QUANTITY;
1482 G_UOM_QUANTITY_TBL(l_line_index) := NULL;
1483 G_PRICED_UOM_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICED_UOM_CODE;
1484 G_CURRENCY_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).CURRENCY_CODE;
1485 IF l_debug_level > 0 THEN
1486 oe_debug_pub.add( 'UNIT PRICE'||PX_REQ_LINE_TBL(L_LINE_INDEX).UNIT_PRICE||' '||
1487 PX_REQ_LINE_TBL(L_LINE_INDEX).ADJUSTED_UNIT_PRICE ) ;
1488 END IF;
1489 G_UNIT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).unit_price; -- AG
1490 G_PERCENT_PRICE_TBL(l_line_index) := NULL;
1491 G_ADJUSTED_UNIT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).ADJUSTED_UNIT_PRICE;
1492 G_PROCESSED_FLAG_TBL(l_line_index) := QP_PREQ_GRP.G_NOT_PROCESSED;
1493 G_PRICE_FLAG_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICE_FLAG;
1494 G_LINE_ID_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_ID;
1495 IF l_debug_level > 0 THEN
1496 oe_debug_pub.add( 'LINE ID IN G_LINE_ID_TBL:'|| G_LINE_ID_TBL ( L_LINE_INDEX ) ) ;
1497 END IF;
1498 G_ROUNDING_FLAG_TBL(l_line_index) := NULL; -- AG
1499 G_ROUNDING_FACTOR_TBL(l_line_index) := px_req_line_tbl(l_line_index).ROUNDING_FACTOR;
1500 G_PROCESSING_ORDER_TBL(l_line_index) := NULL;
1501 G_PRICING_STATUS_CODE_tbl(l_line_index) := QP_PREQ_GRP.G_STATUS_UNCHANGED; -- AG
1502 G_PRICING_STATUS_TEXT_tbl(l_line_index) := NULL;
1503 G_QUALIFIERS_EXIST_FLAG_TBL(l_line_index) :='N';
1504 G_PRICING_ATTRS_EXIST_FLAG_TBL(l_line_index) :='N';
1505 G_PRICE_LIST_ID_TBL(l_line_index) :=g_panda_rec_table(1).p_price_list_id;
1506 G_PL_VALIDATED_FLAG_TBL(l_line_index) := 'N';
1507 G_PRICE_REQUEST_CODE_TBL(l_line_index) := NULL;
1508 G_USAGE_PRICING_TYPE_TBL(l_line_index) :='REGULAR';
1509 G_UPD_ADJUSTED_UNIT_PRICE_TBL(l_line_index) :=NULL;
1510 G_LINE_CATEGORY_TBL(l_line_index) := NULL;
1511
1512
1513 IF l_debug_level > 0 THEN
1514 oe_debug_pub.add( 'EXITING OE_OE_AVAILABILITY.COPY_LINE_TO_REQUEST' , 1 ) ;
1515 END IF;
1516
1517 END copy_Line_to_request;
1518
1519
1520
1521 PROCEDURE set_pricing_control_record (
1522 l_Control_Rec in out nocopy QP_PREQ_GRP.CONTROL_RECORD_TYPE
1523 ,in_pricing_event in varchar2)IS
1524
1525 --
1526 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1527 --
1528 BEGIN
1529
1530 l_control_rec.pricing_event := in_pricing_event;
1531 l_Control_Rec.calculate_flag := QP_PREQ_GRP.G_SEARCH_N_CALCULATE;
1532 --l_control_rec.simulation_flag := 'Y';
1533 l_control_rec.simulation_flag :='Y';
1534 l_control_rec.gsa_check_flag := 'Y';
1535 l_control_rec.gsa_dup_check_flag := 'Y';
1536 --newly added
1537 l_control_rec.temp_table_insert_flag := 'N';
1538 l_control_rec.request_type_code := 'ONT';
1539 l_control_rec.rounding_flag := 'Q';
1540 l_control_rec.use_multi_currency:='Y';
1541
1542 END set_pricing_control_record;
1543
1544
1545
1546 PROCEDURE build_context_for_line(
1547 p_req_line_tbl_count in number,
1548 p_price_request_code in varchar2,
1549 p_item_type_code in varchar2,
1550 p_Req_line_attr_tbl in out nocopy QP_PREQ_GRP.LINE_ATTR_TBL_TYPE,
1551 p_Req_qual_tbl in out nocopy QP_PREQ_GRP.QUAL_TBL_TYPE,
1552 p_line_index in number
1553 )IS
1554
1555 qp_attr_mapping_error exception;
1556 --l_org_id Number:= OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
1557 l_org_id Number := to_number( fnd_profile.value('ORG_ID'));
1558 l_master_org_id Number:= OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
1559 p_pricing_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type;
1560 p_qualifier_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type;
1561
1562 --
1563 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1564 l_pass_line VARCHAR2(1) :='N';
1565 --
1566 BEGIN
1567
1568 IF l_debug_level > 0 THEN
1569 oe_debug_pub.add( 'BEFORE QP_ATTR_MAPPING_PUB.BUILD_CONTEXTS FOR LINE' , 1 ) ;
1570 END IF;
1571
1572 IF l_debug_level > 0 THEN
1573 oe_debug_pub.add( 'ORG_ID='||L_ORG_ID|| ' PRICING_DATE='||
1574 G_panda_rec_table(p_line_index).p_PRICING_DATE|| ' INV ITEM_IE='
1575 ||' master_org='||l_master_org_id
1576 ||G_panda_rec_table(p_line_index).p_INVENTORY_ITEM_ID);
1577 oe_debug_pub.add( ' AGREEMENT_ID='||G_panda_rec_table(p_line_index).p_AGREEMENT_ID||
1578 ' REQ DATE='||G_panda_rec_table(p_line_index).p_REQUEST_DATE||
1579 ' SHIP_TO_ORG_ID='||G_panda_rec_table(p_line_index).p_SHIP_TO_ORG_ID||
1580 ' INVOICE_TO_ORG_ID='||G_panda_rec_table(p_line_index).p_INVOICE_TO_ORG_ID ) ;
1581 END IF;
1582
1583 IF l_debug_level > 0 THEN
1584 oe_debug_pub.add( 'QTY='||G_panda_rec_table(p_line_index).p_QTY||
1585 ' ITEM_TYPE_CODE='||P_ITEM_TYPE_CODE||
1586 ' PRICE_LIST_ID='||G_panda_rec_table(p_line_index).p_PRICE_LIST_ID||
1587 ' CUST_ID='||G_panda_rec_table(p_line_index).p_CUSTOMER_ID||
1588 ' PRICE REQ CODE='||P_PRICE_REQUEST_CODE||
1589 ' UOM='||G_panda_rec_table(p_line_index).p_UOM ) ;
1590 END IF;
1591
1592 oe_order_pub.g_line.org_id := l_org_id;
1593 oe_order_pub.g_line.pricing_date := g_panda_rec_table(p_line_index).p_pricing_date;
1594 oe_order_pub.g_line.inventory_item_id := g_panda_rec_table(p_line_index).p_inventory_item_id;
1595 oe_order_pub.g_line.agreement_id := g_panda_rec_table(p_line_index).p_agreement_id;
1596 --oe_order_pub.g_line.ordered_date := g_request_date;
1597 oe_order_pub.g_line.ship_to_org_id := g_panda_rec_table(p_line_index).p_ship_to_org_id;
1598 oe_order_pub.g_line.invoice_to_org_id := g_panda_rec_table(p_line_index).p_invoice_to_org_id;
1599 oe_order_pub.g_line.ordered_quantity := g_panda_rec_table(p_line_index).p_qty;
1600 oe_order_pub.g_line.item_identifier_type := g_panda_rec_table(p_line_index).p_item_identifier_type; -- 3661905
1601 oe_order_pub.g_line.ordered_item_id := g_panda_rec_table(p_line_index).p_ordered_item_id; -- 3661905
1602 oe_order_pub.g_line.line_id := g_line_id;
1603 oe_order_pub.g_line.header_id := g_header_id;
1604 oe_order_pub.g_line.item_type_code := p_item_type_code;
1605 oe_order_pub.g_line.price_list_id := g_panda_rec_table(p_line_index).p_price_list_id;
1606 oe_order_pub.g_line.sold_to_org_id := g_panda_rec_table(p_line_index).p_customer_id;
1607 oe_order_pub.g_line.price_request_code := p_price_request_code;
1608 oe_order_pub.g_line.order_quantity_uom := g_panda_rec_table(p_line_index).p_uom;
1609
1610 --Bug 6697648/6759791 --copy header level attribute, Index should be 1(for header) and NOT p_line_index
1611 oe_order_pub.g_hdr.order_type_id := g_panda_rec_table(1).p_order_type_id;
1612
1613 IF g_panda_rec_table(p_line_index).p_item_identifier_type ='INT' then
1614
1615 SELECT concatenated_segments
1616 INTO oe_order_pub.g_line.ordered_item
1617 FROM mtl_system_items_kfv
1618 WHERE inventory_item_id = g_panda_rec_table(p_line_index).p_inventory_item_id
1619 AND organization_id = l_master_org_id;
1620
1621 End IF;
1622
1623 QP_Attr_Mapping_PUB.Build_Contexts(
1624 p_request_type_code => 'ONT',
1625 p_line_index =>2,
1626 p_pricing_type_code =>'L',
1627 p_check_line_flag => 'N',
1628 p_pricing_event =>'BATCH',
1629 x_pass_line =>l_pass_line);
1630
1631 -- x_price_contexts_result_tbl => p_pricing_contexts_Tbl,
1632 -- x_qual_contexts_result_tbl => p_qualifier_Contexts_Tbl
1633 -- );
1634
1635 /*copy_attribs_to_Req(
1636 p_line_index => p_req_line_tbl_count
1637 ,px_Req_line_attr_tbl =>p_Req_line_attr_tbl
1638 ,px_Req_qual_tbl =>p_Req_qual_tbl
1639 ,p_pricing_contexts_tbl => p_pricing_contexts_Tbl
1640 ,p_qualifier_contexts_tbl => p_qualifier_Contexts_Tbl
1641 );*/
1642 IF l_debug_level > 0 THEN
1643 oe_debug_pub.add('l_PASS_LINE'||l_pass_line);
1644 END IF;
1645
1646 IF l_debug_level > 0 THEN
1647 oe_debug_pub.add( 'EXIT QP_ATTR_MAPPING_PUB.BUILD_CONTEXTS FOR LINE' , 1 ) ;
1648 END IF;
1649
1650 EXCEPTION
1651 when no_data_found then
1652 Null;
1653 when others then
1654 Raise QP_ATTR_MAPPING_ERROR;
1655
1656 END build_context_for_line;
1657
1658
1659
1660 PROCEDURE build_context_for_header(
1661 p_req_line_tbl_count in number,
1662 p_price_request_code in varchar2,
1663 p_item_type_code in varchar2,
1664 p_Req_line_attr_tbl in out nocopy QP_PREQ_GRP.LINE_ATTR_TBL_TYPE,
1665 p_Req_qual_tbl in out nocopy QP_PREQ_GRP.QUAL_TBL_TYPE
1666 )IS
1667
1668 qp_attr_mapping_error exception;
1669 --l_org_id Number:= OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
1670 l_org_id Number := to_number( fnd_profile.value('ORG_ID'));
1671 p_pricing_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type;
1672 p_qualifier_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type;
1673
1674 --
1675 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1676 --
1677 BEGIN
1678
1679 IF l_debug_level > 0 THEN
1680 oe_debug_pub.add( 'BEFORE QP_ATTR_MAPPING_PUB.BUILD_CONTEXTS FOR HEADER' , 1 ) ;
1681 END IF;
1682
1683
1684 IF l_debug_level > 0 THEN
1685 oe_debug_pub.add( 'ORG_ID='||L_ORG_ID|| ' PRICING_DATE='||
1686 G_panda_rec_table(1).p_PRICING_DATE|| ' AGREEMENT_ID='||
1687 G_panda_rec_table(1).p_AGREEMENT_ID|| ' REQ DATE='||
1688 G_panda_rec_table(1).p_REQUEST_DATE|| ' SHIP_TO_ORG_ID='||
1689 G_panda_rec_table(1).p_SHIP_TO_ORG_ID|| ' INVOICE_TO_ORG_ID='||
1690 G_panda_rec_table(1).p_INVOICE_TO_ORG_ID ) ;
1691 END IF;
1692
1693 IF l_debug_level > 0 THEN
1694 oe_debug_pub.add( 'QTY='||G_panda_rec_table(1).p_QTY||
1695 ' PRICE_LIST_ID='||G_panda_rec_table(1).p_PRICE_LIST_ID||
1696 ' CUST_ID='||G_panda_rec_table(1).p_CUSTOMER_ID|| ' PRICE REQ CODE='||
1697 P_PRICE_REQUEST_CODE ) ;
1698 END IF;
1699
1700 oe_order_pub.g_hdr.agreement_id := g_panda_rec_table(1).p_agreement_id;
1701 oe_order_pub.g_hdr.invoice_to_org_id := g_panda_rec_table(1).p_invoice_to_org_id;
1702 oe_order_pub.g_hdr.ordered_date := g_panda_rec_table(1).p_request_date;
1703 oe_order_pub.g_hdr.header_id := g_header_id;
1704 oe_order_pub.g_hdr.org_id := l_org_id;
1705 oe_order_pub.g_hdr.price_list_id := g_panda_rec_table(1).p_price_list_id;
1706 oe_order_pub.g_hdr.price_request_code := p_price_request_code;
1707 oe_order_pub.g_hdr.pricing_date := g_panda_rec_table(1).p_pricing_date;
1708 oe_order_pub.g_hdr.request_date := g_panda_rec_table(1).p_request_date;
1709 oe_order_pub.g_hdr.ship_to_org_id := g_panda_rec_table(1).p_ship_to_org_id;
1710 oe_order_pub.g_hdr.sold_to_org_id := g_panda_rec_table(1).p_customer_id;
1711 oe_order_pub.g_hdr.order_type_id := g_panda_rec_table(1).p_order_type_id;
1712 oe_order_pub.g_hdr.ship_from_org_id := g_panda_rec_table(1).p_ship_from_org_id;
1713 --oe_order_pub.g_line.inventory_item_id := p_inventory_item_id;
1714 --oe_order_pub.g_line.ordered_quantity := p_ordered_quantity;
1715 --oe_order_pub.g_line.line_id := g_line_id;
1716 --oe_order_pub.g_line.item_type_code := p_item_type_code;
1717 --oe_order_pub.g_line.order_quantity_uom := p_uom;
1718
1719
1720 /*If p_item_identifier_type ='INT' then
1721
1722 SELECT concatenated_segments
1723 INTO oe_order_pub.g_line.ordered_item
1724 FROM mtl_system_items_kfv
1725 WHERE inventory_item_id = g_inventory_item_id
1726 AND organization_id = l_org_id;
1727
1728 End If;*/
1729
1730 /*
1731 QP_Attr_Mapping_PUB.Build_Contexts(
1732 p_request_type_code => 'ONT',
1733 p_pricing_type =>'H',
1734 x_price_contexts_result_tbl => p_pricing_contexts_Tbl,
1735 x_qual_contexts_result_tbl => p_qualifier_Contexts_Tbl
1736 );*/
1737
1738 QP_ATTR_Mapping_PUB.Build_Contexts(
1739 p_request_type_code =>'ONT',
1740 p_line_index =>1,
1741 p_pricing_type_code =>'H');
1742
1743
1744 /*
1745 copy_attribs_to_Req(
1746 p_line_index => p_req_line_tbl_count
1747 ,px_Req_line_attr_tbl =>p_Req_line_attr_tbl
1748 ,px_Req_qual_tbl =>p_Req_qual_tbl
1749 ,p_pricing_contexts_tbl => p_pricing_contexts_Tbl
1750 ,p_qualifier_contexts_tbl => p_qualifier_Contexts_Tbl
1751 );*/
1752
1753 IF l_debug_level > 0 THEN
1754 oe_debug_pub.add( 'EXIT QP_ATTR_MAPPING_PUB.BUILD_CONTEXTS FOR HEADER' , 1 ) ;
1755 END IF;
1756
1757 EXCEPTION
1758 when no_data_found then
1759 Null;
1760 when others then
1761 Raise QP_ATTR_MAPPING_ERROR;
1762
1763 END build_context_for_header;
1764
1765
1766
1767 procedure Append_attributes(
1768 p_header_id number default null
1769 ,p_Line_id number default null
1770 ,p_line_index number
1771 ,px_Req_line_attr_tbl in out nocopy QP_PREQ_GRP.LINE_ATTR_TBL_TYPE
1772 ,px_Req_qual_tbl in out nocopy QP_PREQ_GRP.QUAL_TBL_TYPE
1773 ,p_g_line_index in number
1774
1775 ) is
1776
1777 i pls_integer;
1778
1779 --
1780 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1781
1782 --
1783 BEGIN
1784
1785 IF l_debug_level > 0 THEN
1786 oe_debug_pub.add( 'ENTERING OE_OE_AVAILABILITY.APPEND_ATTRIBUTES' , 1 ) ;
1787 END IF;
1788
1789 IF g_panda_rec_table(p_g_line_index).p_pricing_attribute1 is not null then
1790 i := px_Req_line_attr_tbl.count+1;
1791 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1792 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1793 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1794 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE1';
1795 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE1;
1796 END IF;
1797
1798 IF g_panda_rec_table(p_g_line_index).p_pricing_attribute2 is not null then
1799 i := px_Req_line_attr_tbl.count+1;
1800 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1801 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1802 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1803 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE2';
1804 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE2;
1805 END IF;
1806
1807 IF g_panda_rec_table(p_g_line_index).p_pricing_attribute3 is not null then
1808 i := px_Req_line_attr_tbl.count+1;
1809 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1810 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1811 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1812 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE3';
1813 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE3;
1814 END IF;
1815
1816 IF g_panda_rec_table(p_g_line_index).p_pricing_attribute4 is not null then
1817 i := px_Req_line_attr_tbl.count+1;
1818 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1819 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1820 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1821 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE4';
1822 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE4;
1823 END IF;
1824
1825 if g_panda_rec_table(p_g_line_index).p_pricing_attribute5 is not null then
1826 i := px_Req_line_attr_tbl.count+1;
1827 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1828 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1829 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1830 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE5';
1831 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE5;
1832 end if;
1833
1834 if g_panda_rec_table(p_g_line_index).p_pricing_attribute6 is not null then
1835 i := px_Req_line_attr_tbl.count+1;
1836 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1837 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1838 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1839 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE6';
1840 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE6;
1841 end if;
1842
1843 if g_panda_rec_table(p_g_line_index).p_pricing_attribute7 is not null then
1844 i := px_Req_line_attr_tbl.count+1;
1845 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1846 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1847 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1848 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE7';
1849 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE7;
1850 end if;
1851
1852 if g_panda_rec_table(p_g_line_index).p_pricing_attribute8 is not null then
1853 i := px_Req_line_attr_tbl.count+1;
1854 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1855 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1856 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1857 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE8';
1858 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE8;
1859 end if;
1860
1861 if g_panda_rec_table(p_g_line_index).p_pricing_attribute9 is not null then
1862 i := px_Req_line_attr_tbl.count+1;
1863 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1864 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1865 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1866 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE9';
1867 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE9;
1868 end if;
1869
1870 if g_panda_rec_table(p_g_line_index).p_pricing_attribute10 is not null then
1871 i := px_Req_line_attr_tbl.count+1;
1872 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1873 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1874 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1875 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE10';
1876 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE10;
1877 end if;
1878
1879 if g_panda_rec_table(p_g_line_index).p_pricing_attribute11 is not null then
1880 i := px_Req_line_attr_tbl.count+1;
1881 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1882 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1883 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1884 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE11';
1885 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE11;
1886 end if;
1887
1888 if g_panda_rec_table(p_g_line_index).p_pricing_attribute12 is not null then
1889 i := px_Req_line_attr_tbl.count+1;
1890 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1891 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1892 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1893 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE12';
1894 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE12;
1895 end if;
1896
1897 if g_panda_rec_table(p_g_line_index).p_pricing_attribute13 is not null then
1898 i := px_Req_line_attr_tbl.count+1;
1899 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1900 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1901 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1902 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE13';
1903 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE13;
1904 end if;
1905
1906 if g_panda_rec_table(p_g_line_index).p_pricing_attribute14 is not null then
1907 i := px_Req_line_attr_tbl.count+1;
1908 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1909 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1910 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1911 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE14';
1912 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE14;
1913 end if;
1914
1915 if g_panda_rec_table(p_g_line_index).p_pricing_attribute15 is not null then
1916 i := px_Req_line_attr_tbl.count+1;
1917 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1918 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1919 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1920 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE15';
1921 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE15;
1922 end if;
1923
1924 if g_panda_rec_table(p_g_line_index).p_pricing_attribute16 is not null then
1925 i := px_Req_line_attr_tbl.count+1;
1926 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1927 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1928 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1929 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE16';
1930 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE16;
1931 end if;
1932
1933 if g_panda_rec_table(p_g_line_index).p_pricing_attribute17 is not null then
1934 i := px_Req_line_attr_tbl.count+1;
1935 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1936 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1937 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1938 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE17';
1939 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE17;
1940 end if;
1941
1942 if g_panda_rec_table(p_g_line_index).p_pricing_attribute18 is not null then
1943 i := px_Req_line_attr_tbl.count+1;
1944 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1945 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1946 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1947 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE18';
1948 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE18;
1949 end if;
1950
1951 if g_panda_rec_table(p_g_line_index).p_pricing_attribute19 is not null then
1952 i := px_Req_line_attr_tbl.count+1;
1953 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1954 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1955 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1956 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE19';
1957 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE19;
1958 end if;
1959
1960 if g_panda_rec_table(p_g_line_index).p_pricing_attribute20 is not null then
1961 i := px_Req_line_attr_tbl.count+1;
1962 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1963 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1964 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1965 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE20';
1966 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE20;
1967 end if;
1968
1969 if g_panda_rec_table(p_g_line_index).p_pricing_attribute21 is not null then
1970 i := px_Req_line_attr_tbl.count+1;
1971 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1972 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1973 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1974 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE21';
1975 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE21;
1976 end if;
1977
1978 if g_panda_rec_table(p_g_line_index).p_pricing_attribute22 is not null then
1979 i := px_Req_line_attr_tbl.count+1;
1980 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1981 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1982 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1983 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE22';
1984 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE22;
1985 end if;
1986
1987 if g_panda_rec_table(p_g_line_index).p_pricing_attribute23 is not null then
1988 i := px_Req_line_attr_tbl.count+1;
1989 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1990 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
1991 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
1992 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE23';
1993 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE23;
1994 end if;
1995
1996 if g_panda_rec_table(p_g_line_index).p_pricing_attribute24 is not null then
1997 i := px_Req_line_attr_tbl.count+1;
1998 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
1999 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2000 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2001 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE24';
2002 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE24;
2003 end if;
2004
2005 if g_panda_rec_table(p_g_line_index).p_pricing_attribute25 is not null then
2006 i := px_Req_line_attr_tbl.count+1;
2007 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2008 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2009 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2010 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE25';
2011 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE25;
2012 end if;
2013
2014 if g_panda_rec_table(p_g_line_index).p_pricing_attribute26 is not null then
2015 i := px_Req_line_attr_tbl.count+1;
2016 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2017 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2018 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2019 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE26';
2020 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE26;
2021 end if;
2022
2023 if g_panda_rec_table(p_g_line_index).p_pricing_attribute27 is not null then
2024 i := px_Req_line_attr_tbl.count+1;
2025 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2026 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2027 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2028 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE27';
2029 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE27;
2030 end if;
2031
2032 if g_panda_rec_table(p_g_line_index).p_pricing_attribute28 is not null then
2033 i := px_Req_line_attr_tbl.count+1;
2034 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2035 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2036 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2037 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE28';
2038 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE28;
2039 end if;
2040
2041 if g_panda_rec_table(p_g_line_index).p_pricing_attribute29 is not null then
2042 i := px_Req_line_attr_tbl.count+1;
2043 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2044 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2045 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2046 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE29';
2047 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE29;
2048 end if;
2049
2050 if g_panda_rec_table(p_g_line_index).p_pricing_attribute30 is not null then
2051 i := px_Req_line_attr_tbl.count+1;
2052 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2053 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2054 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2055 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE30';
2056 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute30;
2057 end if;
2058
2059 if g_panda_rec_table(p_g_line_index).p_pricing_attribute31 is not null then
2060 i := px_Req_line_attr_tbl.count+1;
2061 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2062 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2063 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2064 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE31';
2065 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute31;
2066 end if;
2067
2068 if g_panda_rec_table(p_g_line_index).p_pricing_attribute32 is not null then
2069 i := px_Req_line_attr_tbl.count+1;
2070 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2071 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2072 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2073 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE32';
2074 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute32;
2075 end if;
2076
2077 if g_panda_rec_table(p_g_line_index).p_pricing_attribute33 is not null then
2078 i := px_Req_line_attr_tbl.count+1;
2079 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2080 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2081 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2082 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE33';
2083 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute33;
2084 end if;
2085
2086 if g_panda_rec_table(p_g_line_index).p_pricing_attribute34 is not null then
2087 i := px_Req_line_attr_tbl.count+1;
2088 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2089 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2090 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2091 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE34';
2092 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute34;
2093 end if;
2094
2095 if g_panda_rec_table(p_g_line_index).p_pricing_attribute35 is not null then
2096 i := px_Req_line_attr_tbl.count+1;
2097 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2098 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2099 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2100 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE35';
2101 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute35;
2102 end if;
2103
2104 if g_panda_rec_table(p_g_line_index).p_pricing_attribute36 is not null then
2105 i := px_Req_line_attr_tbl.count+1;
2106 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2107 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2108 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2109 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE36';
2110 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute36;
2111 end if;
2112
2113 if g_panda_rec_table(p_g_line_index).p_pricing_attribute37 is not null then
2114 i := px_Req_line_attr_tbl.count+1;
2115 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2116 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2117 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2118 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE37';
2119 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute37;
2120 end if;
2121
2122 if g_panda_rec_table(p_g_line_index).p_pricing_attribute38 is not null then
2123 i := px_Req_line_attr_tbl.count+1;
2124 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2125 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2126 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2127 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE38';
2128 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute38;
2129 end if;
2130
2131 if g_panda_rec_table(p_g_line_index).p_pricing_attribute39 is not null then
2132 i := px_Req_line_attr_tbl.count+1;
2133 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2134 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2135 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2136 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE39';
2137 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute39;
2138 end if;
2139
2140 if g_panda_rec_table(p_g_line_index).p_pricing_attribute40 is not null then
2141 i := px_Req_line_attr_tbl.count+1;
2142 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2143 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2144 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2145 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE40';
2146 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute40;
2147 end if;
2148
2149 if g_panda_rec_table(p_g_line_index).p_pricing_attribute41 is not null then
2150 i := px_Req_line_attr_tbl.count+1;
2151 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2152 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2153 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2154 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE41';
2155 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute41;
2156 end if;
2157
2158 if g_panda_rec_table(p_g_line_index).p_pricing_attribute42 is not null then
2159 i := px_Req_line_attr_tbl.count+1;
2160 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2161 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2162 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2163 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE42';
2164 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute42;
2165 end if;
2166
2167 if g_panda_rec_table(p_g_line_index).p_pricing_attribute43 is not null then
2168 i := px_Req_line_attr_tbl.count+1;
2169 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2170 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2171 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2172 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE43';
2173 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute43;
2174 end if;
2175
2176 if g_panda_rec_table(p_g_line_index).p_pricing_attribute44 is not null then
2177 i := px_Req_line_attr_tbl.count+1;
2178 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2179 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2180 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2181 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE44';
2182 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute44;
2183 end if;
2184
2185 if g_panda_rec_table(p_g_line_index).p_pricing_attribute45 is not null then
2186 i := px_Req_line_attr_tbl.count+1;
2187 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2188 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2189 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2190 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE45';
2191 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute45;
2192 end if;
2193
2194 if g_panda_rec_table(p_g_line_index).p_pricing_attribute46 is not null then
2195 i := px_Req_line_attr_tbl.count+1;
2196 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2197 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2198 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2199 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE46';
2200 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute46;
2201 end if;
2202
2203 if g_panda_rec_table(p_g_line_index).p_pricing_attribute47 is not null then
2204 i := px_Req_line_attr_tbl.count+1;
2205 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2206 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2207 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2208 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE47';
2209 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute47;
2210 end if;
2211
2212 if g_panda_rec_table(p_g_line_index).p_pricing_attribute48 is not null then
2213 i := px_Req_line_attr_tbl.count+1;
2214 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2215 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2216 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2217 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE48';
2218 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute48;
2219 end if;
2220
2221 if g_panda_rec_table(p_g_line_index).p_pricing_attribute49 is not null then
2222 i := px_Req_line_attr_tbl.count+1;
2223 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2224 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2225 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2226 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE49';
2227 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute49;
2228 end if;
2229
2230
2231 if g_panda_rec_table(p_g_line_index).p_pricing_attribute50 is not null then
2232 i := px_Req_line_attr_tbl.count+1;
2233 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2234 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2235 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2236 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE20';
2237 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute20;
2238 end if;
2239
2240 if g_panda_rec_table(p_g_line_index).p_pricing_attribute51 is not null then
2241 i := px_Req_line_attr_tbl.count+1;
2242 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2243 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2244 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2245 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE51';
2246 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute51;
2247 end if;
2248
2249 if g_panda_rec_table(p_g_line_index).p_pricing_attribute52 is not null then
2250 i := px_Req_line_attr_tbl.count+1;
2251 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2252 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2253 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2254 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE52';
2255 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute52;
2256 end if;
2257
2258 if g_panda_rec_table(p_g_line_index).p_pricing_attribute53 is not null then
2259 i := px_Req_line_attr_tbl.count+1;
2260 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2261 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2262 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2263 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE53';
2264 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute53;
2265 end if;
2266
2267 if g_panda_rec_table(p_g_line_index).p_pricing_attribute54 is not null then
2268 i := px_Req_line_attr_tbl.count+1;
2269 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2270 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2271 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2272 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE54';
2273 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute54;
2274 end if;
2275
2276 if g_panda_rec_table(p_g_line_index).p_pricing_attribute55 is not null then
2277 i := px_Req_line_attr_tbl.count+1;
2278 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2279 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2280 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2281 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE55';
2282 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute55;
2283 end if;
2284
2285 if g_panda_rec_table(p_g_line_index).p_pricing_attribute56 is not null then
2286 i := px_Req_line_attr_tbl.count+1;
2287 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2288 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2289 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2290 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE56';
2291 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute56;
2292 end if;
2293
2294 if g_panda_rec_table(p_g_line_index).p_pricing_attribute57 is not null then
2295 i := px_Req_line_attr_tbl.count+1;
2296 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2297 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2298 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2299 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE57';
2300 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute57;
2301 end if;
2302
2303 if g_panda_rec_table(p_g_line_index).p_pricing_attribute58 is not null then
2304 i := px_Req_line_attr_tbl.count+1;
2305 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2306 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2307 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2308 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE58';
2309 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute58;
2310 end if;
2311
2312 if g_panda_rec_table(p_g_line_index).p_pricing_attribute59 is not null then
2313 i := px_Req_line_attr_tbl.count+1;
2314 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2315 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2316 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2317 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE59';
2318 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute59;
2319 end if;
2320
2321
2322 if g_panda_rec_table(p_g_line_index).p_pricing_attribute60 is not null then
2323 i := px_Req_line_attr_tbl.count+1;
2324 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2325 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2326 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2327 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE60';
2328 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute60;
2329 end if;
2330
2331 if g_panda_rec_table(p_g_line_index).p_pricing_attribute61 is not null then
2332 i := px_Req_line_attr_tbl.count+1;
2333 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2334 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2335 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2336 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE61';
2337 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute61;
2338 end if;
2339
2340 if g_panda_rec_table(p_g_line_index).p_pricing_attribute62 is not null then
2341 i := px_Req_line_attr_tbl.count+1;
2342 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2343 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2344 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2345 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE62';
2346 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute62;
2347 end if;
2348
2349 if g_panda_rec_table(p_g_line_index).p_pricing_attribute63 is not null then
2350 i := px_Req_line_attr_tbl.count+1;
2351 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2352 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2353 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2354 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE63';
2355 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute63;
2356 end if;
2357
2358 if g_panda_rec_table(p_g_line_index).p_pricing_attribute64 is not null then
2359 i := px_Req_line_attr_tbl.count+1;
2360 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2361 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2362 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2363 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE64';
2364 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute64;
2365 end if;
2366
2367 if g_panda_rec_table(p_g_line_index).p_pricing_attribute65 is not null then
2368 i := px_Req_line_attr_tbl.count+1;
2369 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2370 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2371 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2372 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE65';
2373 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute65;
2374 end if;
2375
2376 if g_panda_rec_table(p_g_line_index).p_pricing_attribute66 is not null then
2377 i := px_Req_line_attr_tbl.count+1;
2378 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2379 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2380 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2381 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE66';
2382 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute66;
2383 end if;
2384
2385 if g_panda_rec_table(p_g_line_index).p_pricing_attribute67 is not null then
2386 i := px_Req_line_attr_tbl.count+1;
2387 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2388 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2389 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2390 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE67';
2391 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute67;
2392 end if;
2393
2394 if g_panda_rec_table(p_g_line_index).p_pricing_attribute68 is not null then
2395 i := px_Req_line_attr_tbl.count+1;
2396 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2397 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2398 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2399 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE68';
2400 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute68;
2401 end if;
2402
2403 if g_panda_rec_table(p_g_line_index).p_pricing_attribute69 is not null then
2404 i := px_Req_line_attr_tbl.count+1;
2405 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2406 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2407 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2408 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE69';
2409 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute69;
2410 end if;
2411
2412
2413 if g_panda_rec_table(p_g_line_index).p_pricing_attribute70 is not null then
2414 i := px_Req_line_attr_tbl.count+1;
2415 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2416 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2417 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2418 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE70';
2419 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute70;
2420 end if;
2421
2422 if g_panda_rec_table(p_g_line_index).p_pricing_attribute71 is not null then
2423 i := px_Req_line_attr_tbl.count+1;
2424 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2425 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2426 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2427 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE71';
2428 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute71;
2429 end if;
2430
2431 if g_panda_rec_table(p_g_line_index).p_pricing_attribute72 is not null then
2432 i := px_Req_line_attr_tbl.count+1;
2433 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2434 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2435 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2436 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE72';
2437 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute72;
2438 end if;
2439
2440 if g_panda_rec_table(p_g_line_index).p_pricing_attribute73 is not null then
2441 i := px_Req_line_attr_tbl.count+1;
2442 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2443 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2444 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2445 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE73';
2446 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute73;
2447 end if;
2448
2449 if g_panda_rec_table(p_g_line_index).p_pricing_attribute74 is not null then
2450 i := px_Req_line_attr_tbl.count+1;
2451 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2452 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2453 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2454 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE74';
2455 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute74;
2456 end if;
2457
2458 if g_panda_rec_table(p_g_line_index).p_pricing_attribute75 is not null then
2459 i := px_Req_line_attr_tbl.count+1;
2460 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2461 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2462 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2463 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE75';
2464 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute75;
2465 end if;
2466
2467 if g_panda_rec_table(p_g_line_index).p_pricing_attribute76 is not null then
2468 i := px_Req_line_attr_tbl.count+1;
2469 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2470 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2471 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2472 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE76';
2473 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute76;
2474 end if;
2475
2476 if g_panda_rec_table(p_g_line_index).p_pricing_attribute77 is not null then
2477 i := px_Req_line_attr_tbl.count+1;
2478 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2479 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2480 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2481 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE77';
2482 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute77;
2483 end if;
2484
2485 if g_panda_rec_table(p_g_line_index).p_pricing_attribute78 is not null then
2486 i := px_Req_line_attr_tbl.count+1;
2487 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2488 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2489 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2490 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE78';
2491 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute27;
2492 end if;
2493
2494 if g_panda_rec_table(p_g_line_index).p_pricing_attribute79 is not null then
2495 i := px_Req_line_attr_tbl.count+1;
2496 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2497 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2498 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2499 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE79';
2500 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute27;
2501 end if;
2502
2503
2504 if g_panda_rec_table(p_g_line_index).p_pricing_attribute80 is not null then
2505 i := px_Req_line_attr_tbl.count+1;
2506 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2507 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2508 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2509 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE80';
2510 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute80;
2511 end if;
2512
2513 if g_panda_rec_table(p_g_line_index).p_pricing_attribute81 is not null then
2514 i := px_Req_line_attr_tbl.count+1;
2515 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2516 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2517 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2518 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE81';
2519 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute81;
2520 end if;
2521
2522 if g_panda_rec_table(p_g_line_index).p_pricing_attribute82 is not null then
2523 i := px_Req_line_attr_tbl.count+1;
2524 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2525 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2526 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2527 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE82';
2528 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute82;
2529 end if;
2530
2531 if g_panda_rec_table(p_g_line_index).p_pricing_attribute83 is not null then
2532 i := px_Req_line_attr_tbl.count+1;
2533 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2534 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2535 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2536 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE83';
2537 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute83;
2538 end if;
2539
2540 if g_panda_rec_table(p_g_line_index).p_pricing_attribute84 is not null then
2541 i := px_Req_line_attr_tbl.count+1;
2542 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2543 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2544 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2545 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE84';
2546 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute84;
2547 end if;
2548
2549 if g_panda_rec_table(p_g_line_index).p_pricing_attribute85 is not null then
2550 i := px_Req_line_attr_tbl.count+1;
2551 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2552 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2553 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2554 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE85';
2555 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute85;
2556 end if;
2557
2558 if g_panda_rec_table(p_g_line_index).p_pricing_attribute86 is not null then
2559 i := px_Req_line_attr_tbl.count+1;
2560 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2561 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2562 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2563 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE86';
2564 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute86;
2565 end if;
2566
2567 if g_panda_rec_table(p_g_line_index).p_pricing_attribute87 is not null then
2568 i := px_Req_line_attr_tbl.count+1;
2569 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2570 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2571 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2572 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE87';
2573 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute87;
2574 end if;
2575
2576 if g_panda_rec_table(p_g_line_index).p_pricing_attribute88 is not null then
2577 i := px_Req_line_attr_tbl.count+1;
2578 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2579 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2580 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2581 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE88';
2582 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute88;
2583 end if;
2584
2585 if g_panda_rec_table(p_g_line_index).p_pricing_attribute89 is not null then
2586 i := px_Req_line_attr_tbl.count+1;
2587 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2588 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2589 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2590 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE89';
2591 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute89;
2592 end if;
2593
2594
2595 if g_panda_rec_table(p_g_line_index).p_pricing_attribute90 is not null then
2596 i := px_Req_line_attr_tbl.count+1;
2597 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2598 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2599 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2600 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE90';
2601 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute90;
2602 end if;
2603
2604 if g_panda_rec_table(p_g_line_index).p_pricing_attribute91 is not null then
2605 i := px_Req_line_attr_tbl.count+1;
2606 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2607 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2608 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2609 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE91';
2610 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute91;
2611 end if;
2612
2613 if g_panda_rec_table(p_g_line_index).p_pricing_attribute92 is not null then
2614 i := px_Req_line_attr_tbl.count+1;
2615 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2616 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2617 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2618 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE92';
2619 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute92;
2620 end if;
2621
2622 if g_panda_rec_table(p_g_line_index).p_pricing_attribute93 is not null then
2623 i := px_Req_line_attr_tbl.count+1;
2624 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2625 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2626 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2627 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE93';
2628 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute93;
2629 end if;
2630
2631 if g_panda_rec_table(p_g_line_index).p_pricing_attribute94 is not null then
2632 i := px_Req_line_attr_tbl.count+1;
2633 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2634 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2635 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2636 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE94';
2637 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute94;
2638 end if;
2639
2640 if g_panda_rec_table(p_g_line_index).p_pricing_attribute95 is not null then
2641 i := px_Req_line_attr_tbl.count+1;
2642 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2643 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2644 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2645 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE95';
2646 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute95;
2647 end if;
2648
2649 if g_panda_rec_table(p_g_line_index).p_pricing_attribute96 is not null then
2650 i := px_Req_line_attr_tbl.count+1;
2651 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2652 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2653 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2654 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE96';
2655 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute96;
2656 end if;
2657
2658 if g_panda_rec_table(p_g_line_index).p_pricing_attribute97 is not null then
2659 i := px_Req_line_attr_tbl.count+1;
2660 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2661 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2662 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2663 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE97';
2664 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute97;
2665 end if;
2666
2667 if g_panda_rec_table(p_g_line_index).p_pricing_attribute98 is not null then
2668 i := px_Req_line_attr_tbl.count+1;
2669 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2670 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2671 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2672 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE98';
2673 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute98;
2674 end if;
2675
2676 if g_panda_rec_table(p_g_line_index).p_pricing_attribute99 is not null then
2677 i := px_Req_line_attr_tbl.count+1;
2678 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2679 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2680 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2681 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE99';
2682 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute99;
2683 end if;
2684
2685 if g_panda_rec_table(p_g_line_index).p_pricing_attribute100 is not null then
2686 i := px_Req_line_attr_tbl.count+1;
2687 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2688 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2689 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2690 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE100';
2691 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From:=g_panda_rec_table(p_g_line_index).p_pricing_attribute100;
2692 end if;
2693
2694 IF l_debug_level > 0 THEN
2695 oe_debug_pub.add( 'EXITING OE_OE_AVAILABILITY.APPEND_ATTRIBUTES' , 1 ) ;
2696 END IF;
2697
2698 END Append_attributes;
2699
2700 PROCEDURE Append_attr_to_ttables(px_req_line_attr_tbl in out nocopy QP_PREQ_GRP.LINE_ATTR_TBL_TYPE
2701 )
2702 IS
2703 i number;
2704 k number;
2705 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2706 l_attribute_type VARCHAR2(30);
2707 BEGIN
2708 --Temp Tables
2709 k:=G_ATTR_PRICING_ATTRIBUTE_TBL.count;
2710 i := px_req_line_attr_tbl.first;
2711 if l_debug_level >0 then
2712 oe_debug_pub.add('****populating attributes in to temp table **********');
2713 end if;
2714
2715 if l_debug_level > 0 then
2716
2717 oe_debug_pub.add('k='||k||'i='||i);
2718 end if;
2719
2720 while i is not null loop
2721 k:=k+1;
2722 IF l_debug_level > 0 THEN
2723 oe_debug_pub.add( 'POPULATE LINE ATTRS'||K||' '||PX_REQ_LINE_ATTR_TBL ( I ) .PRICING_CONTEXT , 3 ) ;
2724 END IF;
2725
2726 IF (px_req_line_attr_tbl(I).PRICING_CONTEXT = QP_PREQ_GRP.G_ITEM_CONTEXT) THEN
2727 l_attribute_type := QP_PREQ_GRP.G_PRODUCT_TYPE;
2728 ELSIF (px_req_line_attr_tbl(I).PRICING_CONTEXT = 'MODLIST') THEN
2729 l_attribute_type := QP_PREQ_GRP.G_QUALIFIER_TYPE;
2730 ELSE
2731 l_attribute_type := QP_PREQ_GRP.G_PRICING_TYPE;
2732 END IF;
2733 G_ATTR_LINE_INDEX_tbl(k) := px_req_line_attr_tbl(i).line_index;
2734 IF l_debug_level > 0 THEN
2735 oe_debug_pub.add( 'LINE_INDEX:'||G_ATTR_LINE_INDEX_TBL ( K ) ) ;
2736 END IF;
2737 G_ATTR_LINE_DETAIL_INDEX_tbl(k) := NULL;
2738 G_ATTR_ATTRIBUTE_LEVEL_tbl(k) := QP_PREQ_GRP.G_LINE_LEVEL;
2739 G_ATTR_VALIDATED_FLAG_tbl(k) := 'N';
2740 G_ATTR_ATTRIBUTE_TYPE_tbl(k) := l_attribute_type;
2741 G_ATTR_PRICING_CONTEXT_tbl(k)
2742 := px_req_line_attr_tbl(i).pricing_context;
2743 G_ATTR_PRICING_ATTRIBUTE_tbl(k)
2744 := px_req_line_attr_tbl(i).pricing_attribute;
2745 G_ATTR_APPLIED_FLAG_tbl(k) := QP_PREQ_GRP.G_LIST_NOT_APPLIED;--NULL;
2746 G_ATTR_PRICING_STATUS_CODE_tbl(k) := QP_PREQ_GRP.G_STATUS_UNCHANGED;
2747 G_ATTR_PRICING_ATTR_FLAG_tbl (k) := QP_PREQ_GRP.G_YES;--NULL;
2748 G_ATTR_LIST_HEADER_ID_tbl(k) := NULL;
2749 G_ATTR_LIST_LINE_ID_tbl(k) := NULL;
2750 G_ATTR_VALUE_FROM_tbl(k) :=px_req_line_attr_tbl(i).pricing_attr_value_from;
2751 G_ATTR_SETUP_VALUE_FROM_tbl(k):=NULL;
2752 G_ATTR_VALUE_TO_tbl(k) :=NULL;
2753 G_ATTR_SETUP_VALUE_TO_tbl(k) := NULL;
2754 G_ATTR_GROUPING_NUMBER_tbl(k) := NULL;
2755 G_ATTR_NO_QUAL_IN_GRP_tbl(k) :=NULL;
2756 G_ATTR_COMP_OPERATOR_TYPE_tbl(k):= NULL;
2757 G_ATTR_PRICING_STATUS_TEXT_tbl(k) :=NULL;
2758 G_ATTR_QUAL_PRECEDENCE_tbl(k):=NULL;
2759 G_ATTR_DATATYPE_tbl(k) := NULL;
2760 G_ATTR_QUALIFIER_TYPE_tbl(k) := NULL;
2761 G_ATTR_PRODUCT_UOM_CODE_TBL(k) := NULL;
2762 G_ATTR_EXCLUDER_FLAG_TBL(k) := NULL;
2763 G_ATTR_PRICING_PHASE_ID_TBL(k) := NULL;
2764 G_ATTR_INCOM_GRP_CODE_TBL(k):=NULL;
2765 G_ATTR_LDET_TYPE_CODE_TBL(k):=NULL;
2766 G_ATTR_MODIFIER_LEVEL_CODE_TBL(k):=NULL;
2767 G_ATTR_PRIMARY_UOM_FLAG_TBL(k):=NULL;
2768 i:= px_req_line_attr_tbl.next(i);
2769 END LOOP;
2770
2771
2772 --G_ATTR_LINE_INDEX_tbl(G_ATTR_LINE_INDEX_tbl.count+1):=2;
2773 --G_ATTR_ATTRIBUTE_LEVEL_tbl(G_ATTR_LINE_INDEX_tbl.count):=QP_PREQ_GRP.G_LINE_LEVEL;
2774
2775 --Temp_tables population ends
2776
2777 end append_attr_to_TTables;
2778
2779 PROCEDURE Reset_All_Tbls
2780 AS
2781
2782
2783 l_routine VARCHAR2(240):='QP_PREQ_GRP.Reset_All_Tbls';
2784 --
2785 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2786 --
2787 BEGIN
2788 G_LINE_INDEX_tbl.delete;
2789 G_LINE_TYPE_CODE_TBL.delete ;
2790 G_PRICING_EFFECTIVE_DATE_TBL.delete ;
2791 G_ACTIVE_DATE_FIRST_TBL.delete ;
2792 G_ACTIVE_DATE_FIRST_TYPE_TBL.delete ;
2793 G_ACTIVE_DATE_SECOND_TBL.delete ;
2794 G_ACTIVE_DATE_SECOND_TYPE_TBL.delete ;
2795 G_LINE_QUANTITY_TBL.delete ;
2796 G_LINE_UOM_CODE_TBL.delete ;
2797 G_REQUEST_TYPE_CODE_TBL.delete ;
2798 G_PRICED_QUANTITY_TBL.delete ;
2799 G_UOM_QUANTITY_TBL.delete ;
2800 G_PRICED_UOM_CODE_TBL.delete ;
2801 G_CURRENCY_CODE_TBL.delete ;
2802 G_UNIT_PRICE_TBL.delete ;
2803 G_PERCENT_PRICE_TBL.delete ;
2804 G_ADJUSTED_UNIT_PRICE_TBL.delete ;
2805 G_PROCESSED_FLAG_TBL.delete ;
2806 G_PRICE_FLAG_TBL.delete ;
2807 G_LINE_ID_TBL.delete ;
2808 G_PROCESSING_ORDER_TBL.delete ;
2809 G_ROUNDING_FLAG_TBL.delete;
2810 G_ROUNDING_FACTOR_TBL.delete ;
2811 G_PRICING_STATUS_CODE_TBL.delete ;
2812 G_PRICING_STATUS_TEXT_TBL.delete ;
2813 G_ATTR_LINE_INDEX_tbl.delete;
2814 G_ATTR_ATTRIBUTE_LEVEL_tbl.delete;
2815 G_ATTR_VALIDATED_FLAG_tbl.delete;
2816 G_ATTR_ATTRIBUTE_TYPE_tbl.delete;
2817 G_ATTR_PRICING_CONTEXT_tbl.delete;
2818 G_ATTR_PRICING_ATTRIBUTE_tbl.delete;
2819 G_ATTR_APPLIED_FLAG_tbl.delete;
2820 G_ATTR_PRICING_STATUS_CODE_tbl.delete;
2821 G_ATTR_PRICING_ATTR_FLAG_tbl.delete;
2822 G_ATTR_LIST_HEADER_ID_tbl.delete;
2823 G_ATTR_LIST_LINE_ID_tbl.delete;
2824 G_ATTR_VALUE_FROM_tbl.delete;
2825 G_ATTR_SETUP_VALUE_FROM_tbl.delete;
2826 G_ATTR_VALUE_TO_tbl.delete;
2827 G_ATTR_SETUP_VALUE_TO_tbl.delete;
2828 G_ATTR_GROUPING_NUMBER_tbl.delete;
2829 G_ATTR_NO_QUAL_IN_GRP_tbl.delete;
2830 G_ATTR_COMP_OPERATOR_TYPE_tbl.delete;
2831 G_ATTR_VALIDATED_FLAG_tbl.delete;
2832 G_ATTR_APPLIED_FLAG_tbl.delete;
2833 G_ATTR_PRICING_STATUS_CODE_tbl.delete;
2834 G_ATTR_PRICING_STATUS_TEXT_tbl.delete;
2835 G_ATTR_QUAL_PRECEDENCE_tbl.delete;
2836 G_ATTR_DATATYPE_tbl.delete;
2837 G_ATTR_PRICING_ATTR_FLAG_tbl.delete ;
2838 G_ATTR_QUALIFIER_TYPE_tbl.delete;
2839 G_ATTR_PRODUCT_UOM_CODE_TBL.delete;
2840 G_ATTR_EXCLUDER_FLAG_TBL.delete;
2841 G_ATTR_PRICING_PHASE_ID_TBL.delete;
2842 G_ATTR_INCOM_GRP_CODE_TBL.delete;
2843 G_ATTR_LDET_TYPE_CODE_TBL.delete;
2844 G_ATTR_MODIFIER_LEVEL_CODE_TBL.delete;
2845 G_ATTR_PRIMARY_UOM_FLAG_TBL.delete;
2846 EXCEPTION
2847 WHEN OTHERS THEN
2848 IF l_debug_level > 0 THEN
2849 oe_debug_pub.add( L_ROUTINE||': '||SQLERRM , 1 ) ;
2850 END IF;
2851 END reset_all_tbls;
2852
2853
2854 procedure Populate_Temp_Table
2855 IS
2856 l_return_status varchar2(1) := FND_API.G_RET_STS_SUCCESS;
2857 l_return_status_Text varchar2(240) ;
2858 --
2859 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2860 --
2861 BEGIN
2862 IF l_debug_level > 0 THEN
2863 oe_debug_pub.add( 'BEFORE DIRECT INSERT INTO TEMP TABLE: BULK INSERT'||G_LINE_INDEX_TBL.COUNT , 1 ) ;
2864 END IF;
2865 QP_PREQ_GRP.INSERT_LINES2
2866 (p_LINE_INDEX => G_LINE_INDEX_TBL,
2867 p_LINE_TYPE_CODE => G_LINE_TYPE_CODE_TBL,
2868 p_PRICING_EFFECTIVE_DATE =>G_PRICING_EFFECTIVE_DATE_TBL,
2869 p_ACTIVE_DATE_FIRST =>G_ACTIVE_DATE_FIRST_TBL,
2870 p_ACTIVE_DATE_FIRST_TYPE =>G_ACTIVE_DATE_FIRST_TYPE_TBL,
2871 p_ACTIVE_DATE_SECOND =>G_ACTIVE_DATE_SECOND_TBL,
2872 p_ACTIVE_DATE_SECOND_TYPE =>G_ACTIVE_DATE_SECOND_TYPE_TBL,
2873 p_LINE_QUANTITY => G_LINE_QUANTITY_TBL,
2874 p_LINE_UOM_CODE => G_LINE_UOM_CODE_TBL,
2875 p_REQUEST_TYPE_CODE => G_REQUEST_TYPE_CODE_TBL,
2876 p_PRICED_QUANTITY => G_PRICED_QUANTITY_TBL,
2877 p_PRICED_UOM_CODE => G_PRICED_UOM_CODE_TBL,
2878 p_CURRENCY_CODE => G_CURRENCY_CODE_TBL,
2879 p_UNIT_PRICE => G_UNIT_PRICE_TBL,
2880 p_PERCENT_PRICE => G_PERCENT_PRICE_TBL,
2881 p_UOM_QUANTITY => G_UOM_QUANTITY_TBL,
2882 p_ADJUSTED_UNIT_PRICE =>G_ADJUSTED_UNIT_PRICE_TBL,
2883 p_UPD_ADJUSTED_UNIT_PRICE =>G_UPD_ADJUSTED_UNIT_PRICE_TBL,
2884 p_PROCESSED_FLAG =>G_PROCESSED_FLAG_TBL,
2885 p_PRICE_FLAG =>G_PRICE_FLAG_TBL,
2886 p_LINE_ID =>G_LINE_ID_TBL,
2887 p_PROCESSING_ORDER =>G_PROCESSING_ORDER_TBL,
2888 p_PRICING_STATUS_CODE =>G_PRICING_STATUS_CODE_tbl,
2889 p_PRICING_STATUS_TEXT =>G_PRICING_STATUS_TEXT_tbl,
2890 p_ROUNDING_FLAG =>G_ROUNDING_FLAG_TBL,
2891 p_ROUNDING_FACTOR =>G_ROUNDING_FACTOR_TBL,
2892 p_QUALIFIERS_EXIST_FLAG => G_QUALIFIERS_EXIST_FLAG_TBL,
2893 p_PRICING_ATTRS_EXIST_FLAG =>G_PRICING_ATTRS_EXIST_FLAG_TBL,
2894 p_PRICE_LIST_ID => G_PRICE_LIST_ID_TBL,
2895 p_VALIDATED_FLAG => G_PL_VALIDATED_FLAG_TBL,
2896 p_PRICE_REQUEST_CODE => G_PRICE_REQUEST_CODE_TBL,
2897 p_USAGE_PRICING_TYPE => G_USAGE_PRICING_TYPE_tbl,
2898 p_line_category => G_LINE_CATEGORY_tbl,
2899 --p_catchweight_qty => G_CATCHWEIGHT_QTY_tbl,
2900 --p_actual_order_qty => G_ACTUAL_ORDER_QTY_TBL,
2901 x_status_code =>l_return_status,
2902 x_status_text =>l_return_status_text);
2903
2904 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2905 IF l_debug_level > 0 THEN
2906 oe_debug_pub.add( 'WRONG IN INSERT_LINES2'||L_RETURN_STATUS_TEXT , 1 ) ;
2907 END IF;
2908 FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
2909 FND_MESSAGE.SET_TOKEN('ERR_TEXT',l_return_status_text);
2910 OE_MSG_PUB.Add;
2911 RAISE FND_API.G_EXC_ERROR;
2912 END IF;
2913
2914 IF G_ATTR_LINE_INDEX_tbl.count > 0 THEN
2915 QP_PREQ_GRP.INSERT_LINE_ATTRS2
2916 ( G_ATTR_LINE_INDEX_tbl,
2917 G_ATTR_LINE_DETAIL_INDEX_tbl ,
2918 G_ATTR_ATTRIBUTE_LEVEL_tbl ,
2919 G_ATTR_ATTRIBUTE_TYPE_tbl ,
2920 G_ATTR_LIST_HEADER_ID_tbl ,
2921 G_ATTR_LIST_LINE_ID_tbl ,
2922 G_ATTR_PRICING_CONTEXT_tbl ,
2923 G_ATTR_PRICING_ATTRIBUTE_tbl ,
2924 G_ATTR_VALUE_FROM_tbl ,
2925 G_ATTR_SETUP_VALUE_FROM_tbl ,
2926 G_ATTR_VALUE_TO_tbl ,
2927 G_ATTR_SETUP_VALUE_TO_tbl ,
2928 G_ATTR_GROUPING_NUMBER_tbl ,
2929 G_ATTR_NO_QUAL_IN_GRP_tbl ,
2930 G_ATTR_COMP_OPERATOR_TYPE_tbl ,
2931 G_ATTR_VALIDATED_FLAG_tbl ,
2932 G_ATTR_APPLIED_FLAG_tbl ,
2933 G_ATTR_PRICING_STATUS_CODE_tbl ,
2934 G_ATTR_PRICING_STATUS_TEXT_tbl ,
2935 G_ATTR_QUAL_PRECEDENCE_tbl ,
2936 G_ATTR_DATATYPE_tbl ,
2937 G_ATTR_PRICING_ATTR_FLAG_tbl ,
2938 G_ATTR_QUALIFIER_TYPE_tbl ,
2939 G_ATTR_PRODUCT_UOM_CODE_TBL ,
2940 G_ATTR_EXCLUDER_FLAG_TBL ,
2941 G_ATTR_PRICING_PHASE_ID_TBL ,
2942 G_ATTR_INCOM_GRP_CODE_TBL,
2943 G_ATTR_LDET_TYPE_CODE_TBL,
2944 G_ATTR_MODIFIER_LEVEL_CODE_TBL,
2945 G_ATTR_PRIMARY_UOM_FLAG_TBL,
2946 l_return_status ,
2947 l_return_status_text );
2948
2949 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2950 IF l_debug_level > 0 THEN
2951 oe_debug_pub.add( 'ERROR INSERTING INTO LINE ATTRS'||SQLERRM ) ;
2952 END IF;
2953 FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
2954 FND_MESSAGE.SET_TOKEN('ERR_TEXT',l_return_status_text);
2955 OE_MSG_PUB.Add;
2956 raise fnd_api.g_exc_unexpected_error;
2957 END IF;
2958
2959 END IF;
2960 IF l_debug_level > 0 THEN
2961 oe_debug_pub.add( 'AFTER DIRECT INSERT INTO TEMP TABLE: BULK INSERT' , 1 ) ;
2962 END IF;
2963
2964 EXCEPTION
2965 WHEN OTHERS THEN
2966 RAISE FND_API.G_EXC_ERROR;
2967 END POPULATE_TEMP_TABLE;
2968
2969
2970 PROCEDURE Populate_results
2971 (x_line_tbl OUT nocopy QP_PREQ_GRP.LINE_TBL_TYPE,
2972 x_line_qual_tbl OUT nocopy QP_PREQ_GRP.QUAL_TBL_TYPE,
2973 x_line_attr_tbl OUT nocopy QP_PREQ_GRP.LINE_ATTR_TBL_TYPE,
2974 x_line_detail_tbl OUT nocopy QP_PREQ_GRP.LINE_DETAIL_TBL_TYPE,
2975 x_line_detail_qual_tbl OUT nocopy QP_PREQ_GRP.LINE_DETAIL_QUAL_TBL_TYPE,
2976 x_line_detail_attr_tbl OUT nocopy QP_PREQ_GRP.LINE_DETAIL_ATTR_TBL_TYPE,
2977 x_related_lines_tbl OUT nocopy QP_PREQ_GRP.RELATED_LINES_TBL_TYPE)
2978 AS
2979
2980 CURSOR l_lines_cur IS
2981 SELECT LINE_INDEX,
2982 LINE_ID,
2983 PRICE_LIST_HEADER_ID, -- shu, print out this
2984 LINE_TYPE_CODE,
2985 LINE_QUANTITY,
2986 LINE_UOM_CODE,
2987 LINE_UNIT_PRICE, -- shu
2988 ROUNDING_FACTOR, -- shu
2989 PRICED_QUANTITY,
2990 UOM_QUANTITY,
2991 PRICED_UOM_CODE,
2992 CURRENCY_CODE,
2993 UNIT_PRICE,
2994 PERCENT_PRICE,
2995 PARENT_PRICE,
2996 PARENT_QUANTITY,
2997 PARENT_UOM_CODE,
2998 PRICE_FLAG,
2999 ADJUSTED_UNIT_PRICE,
3000 UPDATED_ADJUSTED_UNIT_PRICE,
3001 PROCESSING_ORDER,
3002 PROCESSED_CODE,
3003 PRICING_STATUS_CODE,
3004 PRICING_STATUS_TEXT,
3005 HOLD_CODE,
3006 HOLD_TEXT,
3007 PRICE_REQUEST_CODE,
3008 PRICING_EFFECTIVE_DATE,
3009 EXTENDED_PRICE, /* block pricing */
3010 ORDER_UOM_SELLING_PRICE
3011 FROM QP_PREQ_LINES_TMP;
3012
3013
3014 CURSOR l_qual_cur (L_ATTRIBUTE_LEVEL VARCHAR2)IS
3015 SELECT QPLAT.LINE_INDEX,
3016 QPLAT.LINE_DETAIL_INDEX,
3017 QPLAT.CONTEXT,
3018 QPLAT.ATTRIBUTE,
3019 QPLAT.SETUP_VALUE_FROM,
3020 QPLAT.SETUP_VALUE_TO,
3021 QPLAT.COMPARISON_OPERATOR_TYPE_CODE,
3022 QPLAT.VALIDATED_FLAG,
3023 QPLAT.PRICING_STATUS_CODE,
3024 QPLAT.PRICING_STATUS_TEXT
3025 FROM QP_PREQ_LDETS_TMP QPLD ,
3026 QP_PREQ_LINE_ATTRS_TMP QPLAT
3027 WHERE QPLD.LINE_DETAIL_INDEX = QPLAT.LINE_DETAIL_INDEX
3028 AND QPLD.PRICING_STATUS_CODE = QP_PREQ_GRP.G_STATUS_NEW
3029 AND QPLAT.ATTRIBUTE_TYPE = 'QUALIFIER';
3030 --AND QPLAT.PRICING_STATUS_CODE = G_STATUS_NEW;
3031
3032
3033 CURSOR l_pricing_attr_cur IS
3034 SELECT QPLAT_PRICING.CONTEXT PRICING_CONTEXT,
3035 QPLAT_PRICING.ATTRIBUTE PRICING_ATTRIBUTE,
3036 nvl(QPLAT_PRICING.SETUP_VALUE_FROM,QPLAT_PRICING.VALUE_FROM) PRICING_ATTR_VALUE_FROM,
3037 QPLAT_PRICING.SETUP_VALUE_TO PRICING_ATTR_VALUE_TO,
3038 QPLAT_PRICING.COMPARISON_OPERATOR_TYPE_CODE,
3039 QPLAT_PRICING.LINE_DETAIL_INDEX,
3040 QPLAT_PRICING.LINE_INDEX,
3041 QPLAT_PRICING.VALIDATED_FLAG
3042 FROM QP_PREQ_LDETS_TMP QPLD ,
3043 QP_PREQ_LINE_ATTRS_TMP QPLAT_PRICING
3044 WHERE QPLD.LINE_DETAIL_INDEX = QPLAT_PRICING.LINE_DETAIL_INDEX
3045 AND QPLD.PRICING_STATUS_CODE = QP_PREQ_GRP.G_STATUS_NEW
3046 AND QPLAT_PRICING.ATTRIBUTE_TYPE IN ('PRICING','PRODUCT');
3047 --AND QPLAT_PRICING.PRICING_STATUS_CODE = G_STATUS_NEW;
3048
3049
3050 CURSOR l_ldets_cur IS
3051
3052 SELECT /*+ ORDERED USE_NL(A B C) l_ldets_cur */
3053
3054 a.LINE_DETAIL_INDEX,
3055 a.LINE_DETAIL_TYPE_CODE,
3056 a.LINE_INDEX,
3057 a.CREATED_FROM_LIST_HEADER_ID LIST_HEADER_ID,
3058 a.CREATED_FROM_LIST_LINE_ID LIST_LINE_ID,
3059 a.CREATED_FROM_LIST_LINE_TYPE LIST_LINE_TYPE_CODE,
3060 a.PRICE_BREAK_TYPE_CODE,
3061 a.LINE_QUANTITY,
3062 a.ADJUSTMENT_AMOUNT,
3063 a.AUTOMATIC_FLAG,
3064 a.PRICING_PHASE_ID,
3065 a.OPERAND_CALCULATION_CODE,
3066 a.OPERAND_VALUE,
3067 a.PRICING_GROUP_SEQUENCE,
3068 a.CREATED_FROM_LIST_TYPE_CODE,
3069 a.APPLIED_FLAG,
3070 a.PRICING_STATUS_CODE,
3071 a.PRICING_STATUS_TEXT,
3072 a.LIMIT_CODE,
3073 a.LIMIT_TEXT,
3074 a.LIST_LINE_NO,
3075 a.GROUP_QUANTITY,
3076 a.GROUP_AMOUNT, -- 2388011_new
3077 a.UPDATED_FLAG,
3078 a.PROCESS_CODE,
3079 a.CALCULATION_CODE,
3080 a.CHANGE_REASON_CODE,
3081 a.CHANGE_REASON_TEXT,
3082 a.ORDER_QTY_ADJ_AMT,
3083 b.SUBSTITUTION_VALUE SUBSTITUTION_VALUE_TO,
3084 b.SUBSTITUTION_ATTRIBUTE,
3085 b.ACCRUAL_FLAG,
3086 b.modifier_level_code,
3087 b.ESTIM_GL_VALUE,
3088 b.ACCRUAL_CONVERSION_RATE,
3089 --Pass throuh components
3090 b.OVERRIDE_FLAG,
3091 b.PRINT_ON_INVOICE_FLAG,
3092 b.INVENTORY_ITEM_ID,
3093 b.ORGANIZATION_ID,
3094 b.RELATED_ITEM_ID,
3095 b.RELATIONSHIP_TYPE_ID,
3096 b.ESTIM_ACCRUAL_RATE,
3097 b.EXPIRATION_DATE,
3098 b.BENEFIT_PRICE_LIST_LINE_ID,
3099 b.RECURRING_FLAG,
3100 b.RECURRING_VALUE,
3101 b.BENEFIT_LIMIT,
3102 b.CHARGE_TYPE_CODE,
3103 b.CHARGE_SUBTYPE_CODE,
3104 b.BENEFIT_QTY,
3105 b.BENEFIT_UOM_CODE,
3106 b.PRORATION_TYPE_CODE,
3107 b.INCLUDE_ON_RETURNS_FLAG,
3108 b.REBATE_TRANSACTION_TYPE_CODE,
3109 b.NUMBER_EXPIRATION_PERIODS,
3110 b.EXPIRATION_PERIOD_UOM,
3111 b.COMMENTS
3112 FROM QP_PREQ_LDETS_TMP a,
3113 QP_LIST_LINES b
3114 WHERE a.CREATED_FROM_LIST_LINE_ID = b.LIST_LINE_ID
3115 AND a.PRICING_STATUS_CODE = QP_PREQ_GRP.G_STATUS_NEW;
3116
3117
3118 CURSOR l_rltd_lines_cur IS
3119 SELECT LINE_INDEX,
3120 LINE_DETAIL_INDEX,
3121 RELATIONSHIP_TYPE_CODE,
3122 RELATED_LINE_INDEX,
3123 RELATED_LINE_DETAIL_INDEX,
3124 PRICING_STATUS_CODE,
3125 PRICING_STATUS_TEXT
3126 FROM QP_PREQ_RLTD_LINES_TMP
3127 WHERE PRICING_STATUS_CODE = QP_PREQ_GRP.G_STATUS_NEW
3128 ORDER BY SETUP_VALUE_FROM;
3129
3130
3131 I PLS_INTEGER :=1;
3132 J PLS_INTEGER :=1;
3133 l_expiration_period_end_date Date;
3134 l_status_code VARCHAR2(30);
3135 l_status_text VARCHAR2(30);
3136 E_ROUTINE_ERROR EXCEPTION;
3137 l_routine VARCHAR2(240):='QP_PREQ_GRP.POPULATE_OUTPUT';
3138
3139 BEGIN
3140
3141
3142 oe_debug_pub.add('----Before populate l_line_tbl-----');
3143 oe_debug_pub.add('----Line information return back to caller----');
3144
3145 FOR l_line IN l_lines_cur LOOP
3146 --requirement from Jay, will cause holes in pl/sql table.
3147 I := l_line.LINE_INDEX;
3148 x_line_tbl(I).LINE_INDEX := l_line.LINE_INDEX;
3149 x_line_tbl(I).LINE_ID := l_line.LINE_ID;
3150 x_line_tbl(I).HEADER_ID := l_line.PRICE_LIST_HEADER_ID;
3151 x_line_tbl(I).LINE_TYPE_CODE := l_line.LINE_TYPE_CODE;
3152 x_line_tbl(I).PRICED_QUANTITY := l_line.PRICED_QUANTITY;
3153 x_line_tbl(I).CURRENCY_CODE := l_line.CURRENCY_CODE;
3154 x_line_tbl(I).ROUNDING_FACTOR := l_line.ROUNDING_FACTOR;
3155 x_line_tbl(I).PRICED_UOM_CODE := l_line.PRICED_UOM_CODE;
3156 x_line_tbl(I).UNIT_PRICE := l_line.UNIT_PRICE; --shu_latest
3157 x_line_tbl(I).LINE_QUANTITY:=l_line.LINE_QUANTITY;
3158 x_line_tbl(I).LINE_UOM_CODE:=l_line.LINE_UOM_CODE;
3159 x_line_tbl(I).LINE_UNIT_PRICE := l_line.LINE_UNIT_PRICE; --shu_latest
3160 x_line_tbl(I).UOM_QUANTITY := l_line.UOM_QUANTITY; --shu_latest
3161 x_line_tbl(I).PERCENT_PRICE := l_line.PERCENT_PRICE;
3162 -- x_line_tbl(I).ADJUSTED_UNIT_PRICE := l_line.ADJUSTED_UNIT_PRICE;
3163 x_line_tbl(I).ADJUSTED_UNIT_PRICE:= l_line.ORDER_UOM_SELLING_PRICE;
3164 x_line_tbl(I).UPDATED_ADJUSTED_UNIT_PRICE := l_line.UPDATED_ADJUSTED_UNIT_PRICE;
3165 x_line_tbl(I).PARENT_PRICE := l_line.PARENT_PRICE;
3166 x_line_tbl(I).PARENT_QUANTITY := l_line.PARENT_QUANTITY;
3167 x_line_tbl(I).PARENT_UOM_CODE := l_line.PARENT_UOM_CODE;
3168 x_line_tbl(I).PROCESSED_CODE := l_line.PROCESSED_CODE;
3169 x_line_tbl(I).PRICE_FLAG := l_line.PRICE_FLAG;
3170 x_line_tbl(I).STATUS_CODE := l_line.PRICING_STATUS_CODE;
3171 x_line_tbl(I).STATUS_TEXT := substr(l_line.PRICING_STATUS_TEXT,1,2000); -- shulin, fix bug 1745788
3172 x_line_tbl(I).HOLD_CODE := l_line.HOLD_CODE;
3173 x_line_tbl(I).HOLD_TEXT := substr(l_line.HOLD_TEXT,1,240);
3174 x_line_tbl(I).PRICE_REQUEST_CODE := l_line.PRICE_REQUEST_CODE;
3175 x_line_tbl(I).PRICING_EFFECTIVE_DATE := l_line.PRICING_EFFECTIVE_DATE;
3176 x_line_tbl(I).EXTENDED_PRICE := l_line.EXTENDED_PRICE; -- block pricing
3177
3178
3179 END LOOP;
3180 I:=1;
3181
3182
3183 --Populate Line detail
3184
3185 oe_debug_pub.add('----Line detail information return back to caller----');
3186
3187 FOR l_dets IN l_ldets_cur LOOP
3188
3189 oe_debug_pub.add('----populating line detail output------');
3190 --requirement by Jay, will cause holes in pl/sql tbl
3191 I := l_dets.line_detail_index;
3192 x_line_detail_tbl(I).LINE_DETAIL_INDEX := l_dets.LINE_DETAIL_INDEX;
3193 x_line_detail_tbl(I).LINE_DETAIL_TYPE_CODE:=l_dets.LINE_DETAIL_TYPE_CODE;
3194 x_line_detail_tbl(I).LINE_INDEX:=l_dets.LINE_INDEX;
3195 x_line_detail_tbl(I).LIST_HEADER_ID:=l_dets.LIST_HEADER_ID;
3196 x_line_detail_tbl(I).LIST_LINE_ID:=l_dets.LIST_LINE_ID;
3197 x_line_detail_tbl(I).LIST_LINE_TYPE_CODE:=l_dets.LIST_LINE_TYPE_CODE;
3198 x_line_detail_tbl(I).SUBSTITUTION_TO:=l_dets.SUBSTITUTION_VALUE_TO;
3199 x_line_detail_tbl(I).LINE_QUANTITY :=l_dets.LINE_QUANTITY;
3200 --x_line_detail_tbl(I).ADJUSTMENT_AMOUNT := l_dets.ADJUSTMENT_AMOUNT;
3201 x_line_detail_tbl(I).ADJUSTMENT_AMOUNT:= nvl(l_dets.ORDER_QTY_ADJ_AMT,l_dets.ADJUSTMENT_AMOUNT);
3202 -- nvl(ldets.order_qty_adj_amt, ldets.adjustment_amount*nvl(lines.priced_quantity,1)/nvl(lines.line_quantity,1))
3203 x_line_detail_tbl(I).AUTOMATIC_FLAG := l_dets.AUTOMATIC_FLAG;
3204 x_line_detail_tbl(I).APPLIED_FLAG := l_dets.APPLIED_FLAG;
3205 x_line_detail_tbl(I).PRICING_GROUP_SEQUENCE := l_dets.PRICING_GROUP_SEQUENCE;
3206 x_line_detail_tbl(I).CREATED_FROM_LIST_TYPE_CODE:=l_dets.CREATED_FROM_LIST_TYPE_CODE;
3207 x_line_detail_tbl(I).PRICE_BREAK_TYPE_CODE := l_dets.PRICE_BREAK_TYPE_CODE;
3208 x_line_detail_tbl(I).OVERRIDE_FLAG := L_Dets.override_flag;
3209 x_line_detail_tbl(I).PRINT_ON_INVOICE_FLAG :=l_dets.print_on_invoice_flag;
3210 x_line_detail_tbl(I).PRICING_PHASE_ID := l_dets.PRICING_PHASE_ID;
3211 x_line_detail_tbl(I).APPLIED_FLAG := l_dets.APPLIED_FLAG;
3212 x_line_detail_tbl(I).OPERAND_CALCULATION_CODE := l_dets.OPERAND_CALCULATION_CODE;
3213 x_line_detail_tbl(I).OPERAND_VALUE := l_dets.OPERAND_VALUE;
3214 x_line_detail_tbl(I).STATUS_CODE:=l_dets.PRICING_STATUS_CODE;
3215 x_line_detail_tbl(I).STATUS_TEXT:=substr(l_dets.PRICING_STATUS_TEXT,1,240);
3216 x_line_detail_tbl(I).SUBSTITUTION_ATTRIBUTE:=l_dets.SUBSTITUTION_ATTRIBUTE;
3217 x_line_detail_tbl(I).ACCRUAL_FLAG:=l_dets.ACCRUAL_FLAG;
3218 x_line_detail_tbl(I).LIST_LINE_NO:=l_dets.LIST_LINE_NO;
3219 x_line_detail_tbl(I).ESTIM_GL_VALUE:=l_dets.ESTIM_GL_VALUE;
3220 x_line_detail_tbl(I).ACCRUAL_CONVERSION_RATE:=l_dets.ACCRUAL_CONVERSION_RATE;
3221 --Pass throuh components
3222 x_line_detail_tbl(I).OVERRIDE_FLAG:= l_dets.OVERRIDE_FLAG;
3223 x_line_detail_tbl(I).PRINT_ON_INVOICE_FLAG:=l_dets.PRINT_ON_INVOICE_FLAG;
3224 x_line_detail_tbl(I).INVENTORY_ITEM_ID:=l_dets.INVENTORY_ITEM_ID;
3225 x_line_detail_tbl(I).ORGANIZATION_ID:=l_dets.ORGANIZATION_ID;
3226 x_line_detail_tbl(I).RELATED_ITEM_ID:= l_dets.RELATED_ITEM_ID;
3227 x_line_detail_tbl(I).RELATIONSHIP_TYPE_ID:=l_dets.RELATIONSHIP_TYPE_ID;
3228 x_line_detail_tbl(I).ESTIM_ACCRUAL_RATE:=l_dets.ESTIM_ACCRUAL_RATE;
3229
3230 x_line_detail_tbl(I).BENEFIT_PRICE_LIST_LINE_ID:=l_dets.BENEFIT_PRICE_LIST_LINE_ID;
3231 x_line_detail_tbl(I).RECURRING_FLAG:= l_dets.RECURRING_FLAG;
3232 x_line_detail_tbl(I).RECURRING_VALUE:= l_dets.RECURRING_VALUE;
3233 x_line_detail_tbl(I).BENEFIT_LIMIT:= l_dets.BENEFIT_LIMIT;
3234 x_line_detail_tbl(I).CHARGE_TYPE_CODE:= l_dets.CHARGE_TYPE_CODE;
3235 x_line_detail_tbl(I).CHARGE_SUBTYPE_CODE:=l_dets.CHARGE_SUBTYPE_CODE;
3236 x_line_detail_tbl(I).BENEFIT_QTY:=l_dets.BENEFIT_QTY;
3237 x_line_detail_tbl(I).BENEFIT_UOM_CODE:=l_dets.BENEFIT_UOM_CODE;
3238 x_line_detail_tbl(I).PRORATION_TYPE_CODE:=l_dets.PRORATION_TYPE_CODE;
3239 x_line_detail_tbl(I).INCLUDE_ON_RETURNS_FLAG := l_dets.INCLUDE_ON_RETURNS_FLAG;
3240 x_line_detail_tbl(I).LIST_LINE_NO := l_dets.LIST_LINE_NO;
3241 x_line_detail_tbl(I).MODIFIER_LEVEL_CODE := l_dets.MODIFIER_LEVEL_CODE;
3242 x_line_detail_tbl(I).GROUP_VALUE := nvl(l_dets.GROUP_QUANTITY,l_dets.GROUP_AMOUNT); -- 2388011_new
3243 x_line_detail_tbl(I).COMMENTS := l_dets.COMMENTS;
3244 x_line_detail_tbl(I).UPDATED_FLAG := l_dets.UPDATED_FLAG;
3245 x_line_detail_tbl(I).PROCESS_CODE := l_dets.PROCESS_CODE;
3246 x_line_detail_tbl(I).LIMIT_CODE := l_dets.LIMIT_CODE;
3247 x_line_detail_tbl(I).LIMIT_TEXT := substr(l_dets.LIMIT_TEXT,1,240);
3248 x_line_detail_tbl(I).CALCULATION_CODE := l_dets.CALCULATION_CODE;
3249 x_line_detail_tbl(I).CHANGE_REASON_CODE := l_dets.CHANGE_REASON_CODE;
3250 x_line_detail_tbl(I).CHANGE_REASON_CODE := substr(l_dets.CHANGE_REASON_CODE,1,240);
3251
3252 IF l_status_code = FND_API.G_RET_STS_ERROR THEN
3253 -- IF G_DEBUG_ENGINE = FND_API.G_TRUE THEN
3254 oe_debug_pub.add(l_routine||':'||substr(l_status_text,1,240));
3255 --END IF;
3256 END IF;
3257
3258 x_line_detail_tbl(I).EXPIRATION_DATE :=l_expiration_period_end_date;
3259 END LOOP;
3260 I:=1;
3261
3262 --Populate Qualifier detail
3263 --IF G_DEBUG_ENGINE = FND_API.G_TRUE THEN
3264 oe_debug_pub.add('----Before populate x_qual_tbl-----');
3265 --END IF;
3266 FOR l_qual IN l_qual_cur(QP_PREQ_GRP.G_DETAIL_LEVEL) LOOP
3267 x_line_detail_qual_tbl(I).LINE_DETAIL_INDEX := l_qual.LINE_DETAIL_INDEX;
3268 x_line_detail_qual_tbl(I).QUALIFIER_CONTEXT := l_qual.CONTEXT;
3269 x_line_detail_qual_tbl(I).QUALIFIER_ATTRIBUTE := l_qual.ATTRIBUTE;
3270 x_line_detail_qual_tbl(I).QUALIFIER_ATTR_VALUE_FROM := l_qual.SETUP_VALUE_FROM;
3271 x_line_detail_qual_tbl(I).QUALIFIER_ATTR_VALUE_TO := l_qual.SETUP_VALUE_TO;
3272 x_line_detail_qual_tbl(I).COMPARISON_OPERATOR_CODE := l_qual.COMPARISON_OPERATOR_TYPE_CODE;
3273 x_line_detail_qual_tbl(I).status_code := l_qual.PRICING_STATUS_CODE;
3274 x_line_detail_qual_tbl(I).VALIDATED_FLAG :=l_qual.VALIDATED_FLAG;
3275
3276 I:=I+1;
3277 END LOOP;
3278 I:=1;
3279
3280 --LINE ATTRIBUTE DETAIL NEEDED
3281 --IF G_DEBUG_ENGINE = FND_API.G_TRUE THEN
3282 oe_debug_pub.add('----Before populate attr_tbl-----');
3283 --END IF;
3284 FOR l_prc IN l_pricing_attr_cur LOOP
3285 --IF G_DEBUG_ENGINE = FND_API.G_TRUE THEN
3286 oe_debug_pub.add('--------populating x_line_detail_attr----------');
3287 oe_debug_pub.add('Line Detail Index: '||l_prc.LINE_DETAIL_INDEX);
3288 --END IF;
3289 x_line_detail_attr_tbl(I).LINE_DETAIL_INDEX := l_prc.LINE_DETAIL_INDEX;
3290 x_line_detail_attr_tbl(I).PRICING_CONTEXT := l_prc.PRICING_CONTEXT;
3291 x_line_detail_attr_tbl(I).PRICING_ATTRIBUTE := l_prc.PRICING_ATTRIBUTE;
3292 x_line_detail_attr_tbl(I).PRICING_ATTR_VALUE_FROM :=l_prc.PRICING_ATTR_VALUE_FROM;
3293 x_line_detail_attr_tbl(I).PRICING_ATTR_VALUE_TO :=l_prc.PRICING_ATTR_VALUE_TO;
3294 x_line_detail_attr_tbl(I).VALIDATED_FLAG :=l_prc.VALIDATED_FLAG;
3295 --x_line_attr_tbl(I).PRICING_STATUS_CODE := l_prc.PRICING_STATUS_CODE;
3296 --x_line_attr_tbl(I).PRICING_STATUS_TEXT := l_prc.PRICING_STATUS_TEXT;
3297 I:=I+1;
3298 END LOOP;
3299
3300 I:=1;
3301
3302 --IF G_DEBUG_ENGINE = FND_API.G_TRUE THEN
3303 oe_debug_pub.add('----Before populate l_rltd_lines_tbl-----');
3304 --END IF;
3305 FOR l_rltd IN l_rltd_lines_cur LOOP
3306 x_related_lines_tbl(I).LINE_INDEX := l_rltd.Line_index;
3307 x_related_lines_tbl(I).LINE_DETAIL_INDEX := l_rltd.LINE_DETAIL_INDEX;
3308 x_related_lines_tbl(I).RELATIONSHIP_TYPE_CODE :=l_rltd.RELATIONSHIP_TYPE_CODE;
3309 x_related_lines_tbl(I).RELATED_LINE_INDEX :=l_rltd.RELATED_LINE_INDEX;
3310 x_related_lines_tbl(I).RELATED_LINE_DETAIL_INDEX :=l_rltd.RELATED_LINE_DETAIL_INDEX;
3311 x_related_lines_tbl(I).STATUS_CODE :=l_rltd.PRICING_STATUS_CODE;
3312 x_related_lines_tbl(I).STATUS_TEXT :=l_rltd.PRICING_STATUS_TEXT;
3313 I:=I+1;
3314 END LOOP;
3315
3316 EXCEPTION
3317 WHEN E_ROUTINE_ERROR THEN
3318 -- IF G_DEBUG_ENGINE = FND_API.G_TRUE THEN
3319 oe_debug_pub.add(l_routine||':'||substr(l_status_text,1,240));
3320 -- END IF;
3321
3322 END Populate_results;
3323
3324
3325
3326
3327 PROCEDURE price_item(out_req_line_tbl in out NOCOPY /* file.sql.39 change */ QP_PREQ_GRP.LINE_TBL_TYPE,
3328 out_Req_line_attr_tbl in out nocopy QP_PREQ_GRP.LINE_ATTR_TBL_TYPE,
3329 out_Req_LINE_DETAIL_attr_tbl in out nocopy QP_PREQ_GRP.LINE_DETAIL_ATTR_TBL_TYPE,
3330 out_Req_LINE_DETAIL_tbl in out nocopy QP_PREQ_GRP.LINE_DETAIL_TBL_TYPE,
3331 out_Req_related_lines_tbl in out nocopy QP_PREQ_GRP.RELATED_LINES_TBL_TYPE,
3332 out_Req_qual_tbl in out nocopy QP_PREQ_GRP.QUAL_TBL_TYPE,
3333 out_Req_LINE_DETAIL_qual_tbl in out nocopy QP_PREQ_GRP.LINE_DETAIL_QUAL_TBL_TYPE,
3334 out_child_detail_type out nocopy varchar2
3335
3336 ) IS
3337
3338 l_return_status varchar2(10);
3339 l_return_status_Text varchar2(240) ;
3340 l_Control_Rec QP_PREQ_GRP.CONTROL_RECORD_TYPE;
3341 l_req_line_tbl QP_PREQ_GRP.LINE_TBL_TYPE;
3342 l_Req_qual_tbl QP_PREQ_GRP.QUAL_TBL_TYPE;
3343 l_Req_line_attr_tbl QP_PREQ_GRP.LINE_ATTR_TBL_TYPE;
3344 l_Req_LINE_DETAIL_tbl QP_PREQ_GRP.LINE_DETAIL_TBL_TYPE;
3345 l_Req_LINE_DETAIL_qual_tbl QP_PREQ_GRP.LINE_DETAIL_QUAL_TBL_TYPE;
3346 l_Req_LINE_DETAIL_attr_tbl QP_PREQ_GRP.LINE_DETAIL_ATTR_TBL_TYPE;
3347 l_Req_related_lines_tbl QP_PREQ_GRP.RELATED_LINES_TBL_TYPE;
3348
3349 --
3350 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3351 --
3352 BEGIN
3353
3354 out_child_detail_type := qp_preq_grp.G_CHILD_DETAIL_TYPE;
3355 reset_all_tbls;
3356
3357 IF l_debug_level > 0 THEN
3358 oe_debug_pub.add( 'SETTING REQUEST ID' , 1 ) ;
3359 END IF;
3360
3361 qp_price_request_context.set_request_id;
3362
3363 IF l_debug_level > 0 THEN
3364 oe_debug_pub.add('REQUEST ID IS : ' || QP_PREQ_GRP.G_REQUEST_ID , 1 ) ;
3365 END IF;
3366
3367
3368 OE_ORDER_PUB.G_HDR:=NULL;
3369 OE_ORDER_PUB.G_LINE:=NULL;
3370
3371 copy_Header_to_request(
3372 p_request_type_code => 'ONT'
3373 ,p_calculate_price_flag => 'Y'
3374 ,px_req_line_tbl => l_req_line_tbl
3375 );
3376
3377 set_pricing_control_record (
3378 l_Control_Rec => l_control_rec
3379 ,in_pricing_event => 'BATCH'
3380 );
3381
3382
3383 for l_line_index in g_panda_rec_table.first..g_panda_rec_table.last
3384 LOOP
3385 copy_Line_to_request(
3386 px_req_line_tbl => l_req_line_tbl
3387 ,p_pricing_event => 'BATCH'
3388 ,p_Request_Type_Code => 'ONT'
3389 ,p_honor_price_flag => 'Y'
3390 ,p_line_index=>l_line_index
3391 );
3392
3393 build_context_for_line(
3394 p_req_line_tbl_count =>l_req_line_tbl.count,
3395 p_price_request_code => null,
3396 p_item_type_code => null,
3397 p_Req_line_attr_tbl =>l_req_line_attr_tbl,
3398 p_Req_qual_tbl =>l_req_qual_tbl,
3399 p_line_index=>l_line_index
3400 );
3401
3402 Append_attributes(
3403 p_header_id => g_header_id
3404 ,p_Line_id => g_line_id
3405 ,p_line_index =>l_req_line_tbl.count
3406 ,px_Req_line_attr_tbl => l_req_line_attr_tbl
3407 ,px_Req_qual_tbl => l_req_qual_tbl
3408 ,p_g_line_index =>l_line_index
3409 );
3410
3411 end loop; -- Looping for each line
3412
3413
3414 build_context_for_header(
3415 p_req_line_tbl_count =>l_req_line_tbl.count,
3416 p_price_request_code => null,
3417 p_item_type_code => null,
3418 p_Req_line_attr_tbl =>l_req_line_attr_tbl,
3419 p_Req_qual_tbl =>l_req_qual_tbl
3420 );
3421
3422
3423 Append_attributes(
3424 p_header_id => g_header_id
3425 ,p_Line_id => g_line_id
3426 ,p_line_index => l_req_line_tbl.count
3427 ,px_Req_line_attr_tbl => l_req_line_attr_tbl
3428 ,px_Req_qual_tbl => l_req_qual_tbl
3429 ,p_g_line_index =>1
3430 );
3431
3432 oe_Debug_pub.add(' Populating the attr tables');
3433 append_attr_to_TTables(px_req_line_attr_tbl=>l_req_line_attr_tbl);
3434
3435 out_req_line_tbl(1).status_Code := null;
3436 out_req_line_tbl(1).status_text := null;
3437
3438 IF l_debug_level > 0 THEN
3439 print_time('Calling PE');
3440 END IF;
3441
3442 oe_Debug_pub.add(' Populating the temp tables');
3443 populate_temp_table;
3444
3445 QP_PREQ_PUB.PRICE_REQUEST
3446 (p_control_rec =>l_control_rec,
3447 x_return_status =>l_return_status,
3448 x_return_status_Text =>l_return_status_Text
3449 );
3450
3451 IF l_debug_level > 0 THEN
3452 print_time('After Calling PE');
3453 END IF;
3454 oe_debug_pub.add('After caling the pricing engine');
3455
3456 populate_results(
3457 x_line_tbl =>out_req_line_tbl
3458 ,x_line_qual_tbl =>out_Req_qual_tbl
3459 ,x_line_attr_tbl =>out_Req_line_attr_tbl
3460 ,x_line_detail_tbl =>out_req_line_detail_tbl
3461 ,x_line_detail_qual_tbl=>out_req_line_detail_qual_tbl
3462 ,x_line_detail_attr_tbl =>out_req_line_detail_attr_tbl
3463 ,x_related_lines_tbl=>out_req_related_lines_tbl);
3464
3465 IF l_debug_level > 0 THEN
3466 print_time('After populating the pl/sql records');
3467 END IF;
3468
3469 IF l_debug_level > 0 THEN
3470 oe_debug_pub.add( '******AFTER CALLING PRICING ENGINE' ) ;
3471 oe_debug_pub.add( 'MAIN STATUS ='||L_RETURN_STATUS ) ;
3472 oe_debug_pub.add( 'MAIN TEXT ='||L_RETURN_STATUS_TEXT ) ;
3473 oe_debug_pub.add( 'COUNT LINE TABLE='||OUT_REQ_LINE_TBL.COUNT ) ;
3474 END IF;
3475
3476 if out_req_line_tbl.count > 0 then
3477 for i in out_req_line_tbl.first..out_req_line_tbl.last
3478 loop
3479
3480 IF l_debug_level > 0 THEN
3481 oe_debug_pub.add( '*******************************' ) ;
3482 oe_debug_pub.add( 'REQUEST_TYPE_CODE ='|| OUT_REQ_LINE_TBL ( I ) .REQUEST_TYPE_CODE ) ;
3483 oe_debug_pub.add( 'PRICING_EVENT ='||OUT_REQ_LINE_TBL ( I ) .PRICING_EVENT ) ;
3484 oe_debug_pub.add( 'HEADER_ID ='||OUT_REQ_LINE_TBL ( I ) .HEADER_ID ) ;
3485 oe_debug_pub.add( 'LINE_TYPE_CODE='||OUT_REQ_LINE_TBL ( I ) .LINE_TYPE_CODE ) ;
3486 oe_debug_pub.add( 'LINE_QUANTITY ='||OUT_REQ_LINE_TBL ( I ) .LINE_QUANTITY ) ;
3487 oe_debug_pub.add( 'LINE_UOM_CODE ='||OUT_REQ_LINE_TBL ( I ) .LINE_UOM_CODE ) ;
3488 oe_debug_pub.add( 'UOM_QUANTITY ='||OUT_REQ_LINE_TBL ( I ) .UOM_QUANTITY ) ;
3489 oe_debug_pub.add( 'PRI_QUANTITY='||OUT_REQ_LINE_TBL ( I ) .PRICED_QUANTITY ) ;
3490 oe_debug_pub.add( 'PR_UOM_CODE ='||OUT_REQ_LINE_TBL ( I ) .PRICED_UOM_CODE ) ;
3491 oe_debug_pub.add( 'CURRENCY_CODE ='||OUT_REQ_LINE_TBL ( I ) .CURRENCY_CODE ) ;
3492 oe_debug_pub.add( 'UNIT_PRICE ='||OUT_REQ_LINE_TBL ( I ) .UNIT_PRICE ) ;
3493 oe_debug_pub.add( 'PERCENT_PRICE ='||OUT_REQ_LINE_TBL ( I ) .PERCENT_PRICE ) ;
3494 oe_debug_pub.add( 'ADJ_UNIT_PRICE='|| OUT_REQ_LINE_TBL ( I ) .ADJUSTED_UNIT_PRICE ) ;
3495 oe_debug_pub.add( 'UPDATED_ADJUSTED_UNIT_PRICE ='|| OUT_REQ_LINE_TBL ( I ) .UPDATED_ADJUSTED_UNIT_PRICE ) ;
3496 oe_debug_pub.add( 'ROUNDING_FAC='||OUT_REQ_LINE_TBL ( I ) .ROUNDING_FACTOR ) ;
3497 oe_debug_pub.add( 'PRICE_FLAG ='||OUT_REQ_LINE_TBL ( I ) .PRICE_FLAG ) ;
3498 oe_debug_pub.add( 'PRICE_REQUEST_CODE ='|| OUT_REQ_LINE_TBL ( I ) .PRICE_REQUEST_CODE ) ;
3499 oe_debug_pub.add( 'HOLD_CODE ='||OUT_REQ_LINE_TBL ( I ) .HOLD_CODE ) ;
3500 oe_debug_pub.add( 'HOLD_TEXT ='||OUT_REQ_LINE_TBL ( I ) .HOLD_TEXT ) ;
3501 oe_debug_pub.add( 'STATUS_CODE ='||OUT_REQ_LINE_TBL ( I ) .STATUS_CODE ) ;
3502 oe_debug_pub.add( 'STATUS_TEXT ='||OUT_REQ_LINE_TBL ( I ) .STATUS_TEXT ) ;
3503 oe_debug_pub.add( 'USAGE_PRICING_TYPE ='|| OUT_REQ_LINE_TBL ( I ) .USAGE_PRICING_TYPE ) ;
3504 oe_debug_pub.add( 'LINE_CATEGORY ='||OUT_REQ_LINE_TBL ( I ) .LINE_CATEGORY ) ;
3505 oe_debug_pub.add( 'PRICING EFFECTIVE DATE='|| OUT_REQ_LINE_TBL ( I ) .PRICING_EFFECTIVE_DATE ) ;
3506 oe_debug_pub.add( 'ACTIVE_DATE_FIRST ='|| OUT_REQ_LINE_TBL ( I ) .ACTIVE_DATE_FIRST ) ;
3507 oe_debug_pub.add( 'ACTIVE_DATE_FIRST_TYPE ='|| OUT_REQ_LINE_TBL ( I ) .ACTIVE_DATE_FIRST_TYPE ) ;
3508 oe_debug_pub.add( 'ACTIVE_DATE_SECOND ='|| OUT_REQ_LINE_TBL ( I ) .ACTIVE_DATE_SECOND ) ;
3509 oe_debug_pub.add( 'ACTIVE_DATE_SECOND_TYPE ='|| OUT_REQ_LINE_TBL ( I ) .ACTIVE_DATE_SECOND_TYPE ) ;
3510 END IF;
3511 end loop;
3512 end if;
3513
3514 IF l_debug_level > 0 THEN
3515 oe_debug_pub.add( 'COUNT LINE DETAIL TABLE='||OUT_REQ_LINE_DETAIL_TBL.COUNT ) ;
3516 END IF;
3517
3518 if out_req_line_detail_tbl.count > 0 then
3519
3520 for i in out_req_line_detail_tbl.first..out_req_line_detail_tbl.last
3521 loop
3522
3523 IF l_debug_level > 0 THEN
3524 oe_debug_pub.add( 'LINE DETAIL TABLE RECORD='||I ) ;
3525 END IF;
3526
3527 IF out_req_line_detail_tbl.exists(i) then
3528
3529 IF l_debug_level > 0 THEN
3530 oe_debug_pub.add( '*******************************' ) ;
3531 oe_debug_pub.add( 'LIN_INDEX='||OUT_REQ_LINE_DETAIL_TBL ( I ) .LINE_INDEX ) ;
3532 oe_debug_pub.add( 'LIST_LINE_TYPE_CODE='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .LIST_LINE_TYPE_CODE ) ;
3533 oe_debug_pub.add( 'LINE_DETAIL_TYPE_CODE='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .LINE_DETAIL_TYPE_CODE ) ;
3534 oe_debug_pub.add( 'CREATED_FROM_LIST_TYPE_CODE='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .CREATED_FROM_LIST_TYPE_CODE ) ;
3535 oe_debug_pub.add( 'AUTOMATIC_FLAG='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .AUTOMATIC_FLAG ) ;
3536 oe_debug_pub.add( 'ACCRUAL='||OUT_REQ_LINE_DETAIL_TBL ( I ) .ACCRUAL_FLAG ) ;
3537 oe_debug_pub.add( 'STATUS='||OUT_REQ_LINE_DETAIL_TBL ( I ) .STATUS_CODE ) ;
3538 oe_debug_pub.add( 'STS_TEXT='||OUT_REQ_LINE_DETAIL_TBL ( I ) .STATUS_TEXT ) ;
3539 oe_debug_pub.add( 'LIST_HEADER_ID='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .LIST_HEADER_ID ) ;
3540 oe_debug_pub.add( 'LIST_LINE_ID='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .LIST_LINE_ID ) ;
3541 oe_debug_pub.add( 'PRICE_BREAK_TYPE_CODE='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .PRICE_BREAK_TYPE_CODE ) ;
3542 oe_debug_pub.add( 'OPERAND_CALCULATION_CODE='||OUT_REQ_LINE_DETAIL_TBL(I).OPERAND_CALCULATION_CODE);
3543 oe_debug_pub.add( 'LST_PRICE='||OUT_REQ_LINE_DETAIL_TBL ( I ) .LIST_PRICE ) ;
3544 oe_debug_pub.add( 'ADJUSTMENT_AMOUNT='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .ADJUSTMENT_AMOUNT ) ;
3545 oe_debug_pub.add( 'LINE_QUANTITY='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .LINE_QUANTITY ) ;
3546 oe_debug_pub.add( 'MODIFIER_LEVEL_CODE='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .MODIFIER_LEVEL_CODE ) ;
3547 oe_debug_pub.add( 'INVENTORY_ITEM_ID='|| OUT_REQ_LINE_DETAIL_TBL ( I ) .INVENTORY_ITEM_ID ) ;
3548 oe_debug_pub.add( 'RECURRING_FLAG='||OUT_REQ_LINE_DETAIL_TBL (I).RECURRING_FLAG );
3549 oe_debug_pub.add( 'RECURRING_VALUE='||OUT_REQ_LINE_DETAIL_TBL(I).RECURRING_VALUE);
3550 end if;
3551 end if;
3552 end loop;
3553
3554 end if;
3555
3556
3557 IF l_debug_level > 0 THEN
3558 oe_debug_pub.add( 'COUNT LINE DETAIL ATTR TBL='|| OUT_REQ_LINE_DETAIL_ATTR_TBL.COUNT ) ;
3559 END IF;
3560
3561 if out_req_line_detail_attr_tbl.count > 0 then
3562 for i in out_req_line_detail_attr_tbl.first..out_req_line_detail_attr_tbl.last
3563 loop
3564 IF l_debug_level > 0 THEN
3565 oe_debug_pub.add( '*******************************' ) ;
3566 oe_debug_pub.add( 'LINE DETAIL ATTR_TABLE RECORD='||I ) ;
3567 oe_debug_pub.add( 'LINE_DETAIL_INDEX='|| OUT_REQ_LINE_DETAIL_ATTR_TBL ( I ) .LINE_DETAIL_INDEX ) ;
3568 oe_debug_pub.add( 'PRICING_CONTEXT='|| OUT_REQ_LINE_DETAIL_ATTR_TBL ( I ) .PRICING_CONTEXT ) ;
3569 oe_debug_pub.add( 'PRICING_ATTRIBUTE='|| OUT_REQ_LINE_DETAIL_ATTR_TBL ( I ) .PRICING_ATTRIBUTE ) ;
3570 oe_debug_pub.add( 'PRICING_ATTR_VALUE_FROM='|| OUT_REQ_LINE_DETAIL_ATTR_TBL ( I ) .PRICING_ATTR_VALUE_FROM ) ;
3571 oe_debug_pub.add( 'PRICING_ATTR_VALUE_TO='|| OUT_REQ_LINE_DETAIL_ATTR_TBL ( I ) .PRICING_ATTR_VALUE_TO ) ;
3572 END IF;
3573
3574 end loop;
3575 end if;
3576
3577
3578 IF l_debug_level > 0 THEN
3579 oe_debug_pub.add( 'COUNT LINE ATTR TBL='||OUT_REQ_LINE_ATTR_TBL.COUNT ) ;
3580 END IF;
3581
3582 if out_req_line_attr_tbl.count > 0 then
3583 for i in out_req_line_attr_tbl.first..out_req_line_attr_tbl.last
3584 loop
3585 IF l_debug_level > 0 THEN
3586 oe_debug_pub.add( '*******************************' ) ;
3587 oe_debug_pub.add( 'LINE ATTR_TABLE RECORD='||I ) ;
3588 oe_debug_pub.add( 'LINE_INDEX='||OUT_REQ_LINE_ATTR_TBL ( I ) .LINE_INDEX ) ;
3589 oe_debug_pub.add( 'PRICING_CONTEXT='|| OUT_REQ_LINE_ATTR_TBL ( I ) .PRICING_CONTEXT ) ;
3590 oe_debug_pub.add( 'PRICING_ATTRIBUTE='|| OUT_REQ_LINE_ATTR_TBL ( I ) .PRICING_ATTRIBUTE ) ;
3591 oe_debug_pub.add( 'PRICING_ATTR_VALUE_FROM='|| OUT_REQ_LINE_ATTR_TBL ( I ) .PRICING_ATTR_VALUE_FROM ) ;
3592 oe_debug_pub.add( 'PRICING_ATTR_VALUE_TO='|| OUT_REQ_LINE_ATTR_TBL ( I ) .PRICING_ATTR_VALUE_TO ) ;
3593 END IF;
3594
3595 end loop;
3596 end if;
3597
3598
3599 IF l_debug_level > 0 THEN
3600 oe_debug_pub.add( 'COUNT RELATED LINES TBL='|| OUT_REQ_RELATED_LINES_TBL.COUNT ) ;
3601 END IF;
3602
3603 if out_req_related_lines_tbl.count > 0 then
3604 for i in out_req_related_lines_tbl.first..out_req_related_lines_tbl.last
3605 loop
3606 IF l_debug_level > 0 THEN
3607 oe_debug_pub.add( '*******************************' ) ;
3608 oe_debug_pub.add( 'RELATD LINES RECORD='||I ) ;
3609 oe_debug_pub.add( 'LIN_INDEX='||OUT_REQ_RELATED_LINES_TBL ( I ) .LINE_INDEX ) ;
3610 oe_debug_pub.add( 'LINE_DETAIL_INDEX='|| OUT_REQ_RELATED_LINES_TBL ( I ) .LINE_DETAIL_INDEX ) ;
3611 oe_debug_pub.add( 'RELATIONSHIP_TYPE_CODE='|| OUT_REQ_RELATED_LINES_TBL ( I ) .RELATIONSHIP_TYPE_CODE ) ;
3612 oe_debug_pub.add( 'RELATED_LINE_INDEX='|| OUT_REQ_RELATED_LINES_TBL ( I ) .RELATED_LINE_INDEX ) ;
3613 oe_debug_pub.add( 'RELATED_LINE_DETAIL_INDEX='|| OUT_REQ_RELATED_LINES_TBL ( I ) .RELATED_LINE_DETAIL_INDEX ) ;
3614 END IF;
3615
3616 end loop;
3617 end if;
3618
3619
3620 IF l_debug_level > 0 THEN
3621 oe_debug_pub.add( 'COUNT LINE QUAL TBL='||OUT_REQ_QUAL_TBL.COUNT ) ;
3622 END IF;
3623
3624 if out_req_qual_tbl.count > 0 then
3625 for i in out_req_qual_tbl.first..out_req_qual_tbl.last
3626 loop
3627 IF l_debug_level > 0 THEN
3628 oe_debug_pub.add('*******************************' ) ;
3629 oe_debug_pub.add('QUAL TABLE RECORD='||I ) ;
3630 oe_debug_pub.add('LINE_INDEX='||OUT_REQ_QUAL_TBL ( I ) .LINE_INDEX ) ;
3631 oe_debug_pub.add('QUALIFIER_CONTEXT='|| OUT_REQ_QUAL_TBL ( I ) .QUALIFIER_CONTEXT ) ;
3632 oe_debug_pub.add( 'QUALIFIER_ATTRIBUTE='|| OUT_REQ_QUAL_TBL ( I ) .QUALIFIER_ATTRIBUTE ) ;
3633 oe_debug_pub.add( 'QUALIFIER_ATTR_VALUE_FROM='|| OUT_REQ_QUAL_TBL ( I ) .QUALIFIER_ATTR_VALUE_FROM ) ;
3634 oe_debug_pub.add( 'QUALIFIER_ATTR_VALUE_TO='|| OUT_REQ_QUAL_TBL ( I ) .QUALIFIER_ATTR_VALUE_TO ) ;
3635 oe_debug_pub.add( 'COMPARISON_OPERATOR_CODE='|| OUT_REQ_QUAL_TBL ( I ) .COMPARISON_OPERATOR_CODE ) ;
3636 oe_debug_pub.add( 'VALIDATED_FLAG='||OUT_REQ_QUAL_TBL ( I ) .VALIDATED_FLAG ) ;
3637 END IF;
3638
3639 end loop;
3640 end if;
3641
3642
3643 IF l_debug_level > 0 THEN
3644 oe_debug_pub.add( 'COUNT LINE DETAIL QUAL TBL='|| OUT_REQ_LINE_DETAIL_QUAL_TBL.COUNT ) ;
3645 END IF;
3646
3647 if out_req_line_detail_qual_tbl.count > 0 then
3648 for i in out_req_line_detail_qual_tbl.first..out_req_line_detail_qual_tbl.last
3649 loop
3650 IF l_debug_level > 0 THEN
3651 oe_debug_pub.add( '*******************************' ) ;
3652 oe_debug_pub.add( 'LINE DETAIL QUAL TABLE RECORD='||I ) ;
3653 oe_debug_pub.add( 'LINE_DETAIL_INDEX='|| OUT_REQ_LINE_DETAIL_QUAL_TBL ( I ) .LINE_DETAIL_INDEX ) ;
3654 oe_debug_pub.add( 'QUALIFIER_CONTEXT='|| OUT_REQ_LINE_DETAIL_QUAL_TBL ( I ) .QUALIFIER_CONTEXT ) ;
3655 oe_debug_pub.add( 'QUALIFIER_ATTRIBUTE='|| OUT_REQ_LINE_DETAIL_QUAL_TBL ( I ) .QUALIFIER_ATTRIBUTE ) ;
3656 oe_debug_pub.add( 'QUALIFIER_ATTR_VALUE_FROM='|| OUT_REQ_LINE_DETAIL_QUAL_TBL ( I ) .QUALIFIER_ATTR_VALUE_FROM ) ;
3657 oe_debug_pub.add( 'QUALIFIER_ATTR_VALUE_TO='|| OUT_REQ_LINE_DETAIL_QUAL_TBL ( I ) .QUALIFIER_ATTR_VALUE_TO ) ;
3658 oe_debug_pub.add( 'COMPARISON_OPERATOR_CODE='|| OUT_REQ_LINE_DETAIL_QUAL_TBL ( I ) .COMPARISON_OPERATOR_CODE ) ;
3659 oe_debug_pub.add( 'VALIDATED_FLAG='|| OUT_REQ_LINE_DETAIL_QUAL_TBL ( I ) .VALIDATED_FLAG ) ;
3660 END IF;
3661
3662 end loop;
3663 end if;
3664
3665
3666 IF l_debug_level > 0 THEN
3667 oe_debug_pub.add( 'EXITING PRICE_ITEM*******************************' ) ;
3668 END IF;
3669
3670 EXCEPTION
3671 when others then
3672
3673 IF l_debug_level > 0 THEN
3674 oe_debug_pub.add( 'PRICE ITEM EXCEPTION WHEN OTHERS CODE='|| SQLCODE||' MESSAGE='||SQLERRM ) ;
3675 END IF;
3676
3677 END price_item;
3678
3679 PROCEDURE pass_values_to_backend (
3680 in_panda_rec_table in panda_rec_table)
3681 IS
3682
3683 BEGIN
3684
3685 g_panda_rec_table.delete;
3686 for i in in_panda_rec_table.first..in_panda_rec_table.last
3687 loop
3688 oe_debug_pub.add(' Line Record Nbr='||i);
3689
3690 g_panda_rec_table(i):=in_panda_rec_table(i);
3691 oe_debug_pub.add('*******IT STARTS HERE*****');
3692 oe_debug_pub.add('index is'||i||' item is='||g_panda_rec_table(i).p_inventory_item_id);
3693
3694 end loop;
3695
3696 END pass_values_to_backend;
3697
3698
3699
3700 PROCEDURE copy_attribs_to_Req(
3701 p_line_index number
3702 ,px_Req_line_attr_tbl in out nocopy QP_PREQ_GRP.LINE_ATTR_TBL_TYPE
3703 ,px_Req_qual_tbl in out nocopy QP_PREQ_GRP.QUAL_TBL_TYPE
3704 ,p_pricing_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type
3705 ,p_qualifier_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type
3706 ) IS
3707
3708 i pls_integer := 0;
3709 l_attr_index pls_integer := nvl(px_Req_line_attr_tbl.last,0);
3710 l_qual_index pls_integer := nvl(px_Req_qual_tbl.last,0);
3711
3712 --
3713 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3714 --
3715 BEGIN
3716
3717 IF l_debug_level > 0 THEN
3718 oe_debug_pub.add( 'ENTERING OE_OE_AVAILABILITY.COPY_ATTRIBS_TO_REQ' , 1 ) ;
3719 END IF;
3720 i := p_pricing_contexts_Tbl.First;
3721 While i is not null loop
3722 l_attr_index := l_attr_index +1;
3723 px_Req_line_attr_tbl(l_attr_index).VALIDATED_FLAG := 'N';
3724 px_Req_line_attr_tbl(l_attr_index).line_index := p_line_index;
3725
3726 -- Product and Pricing Contexts go into pricing contexts...
3727 px_Req_line_attr_tbl(l_attr_index).PRICING_CONTEXT :=
3728 p_pricing_contexts_Tbl(i).context_name;
3729 px_Req_line_attr_tbl(l_attr_index).PRICING_ATTRIBUTE :=
3730 p_pricing_contexts_Tbl(i).Attribute_Name;
3731 px_Req_line_attr_tbl(l_attr_index).PRICING_ATTR_VALUE_FROM :=
3732 p_pricing_contexts_Tbl(i).attribute_value;
3733
3734 i := p_pricing_contexts_Tbl.Next(i);
3735 end loop;
3736
3737 -- Copy the qualifiers
3738 i := p_qualifier_contexts_Tbl.First;
3739 While i is not null loop
3740 l_qual_index := l_qual_index +1;
3741
3742 If p_qualifier_contexts_Tbl(i).context_name ='MODLIST' and
3743 p_qualifier_contexts_Tbl(i).Attribute_Name ='QUALIFIER_ATTRIBUTE4' then
3744
3745 If OE_Order_PUB.G_Line.agreement_id is not null and
3746 OE_Order_PUB.G_Line.agreement_id <> fnd_api.g_miss_num then
3747 px_Req_Qual_Tbl(l_qual_index).Validated_Flag := 'Y';
3748 Else
3749 px_Req_Qual_Tbl(l_qual_index).Validated_Flag := 'N';
3750 End If;
3751
3752 Else
3753 px_Req_Qual_Tbl(l_qual_index).Validated_Flag := 'N';
3754 End If;
3755
3756 px_Req_qual_tbl(l_qual_index).line_index := p_line_index;
3757
3758 px_Req_qual_tbl(l_qual_index).QUALIFIER_CONTEXT :=
3759 p_qualifier_contexts_Tbl(i).context_name;
3760 px_Req_qual_tbl(l_qual_index).QUALIFIER_ATTRIBUTE :=
3761 p_qualifier_contexts_Tbl(i).Attribute_Name;
3762 px_Req_qual_tbl(l_qual_index).QUALIFIER_ATTR_VALUE_FROM :=
3763 p_qualifier_contexts_Tbl(i).attribute_value;
3764
3765 i := p_qualifier_contexts_Tbl.Next(i);
3766 end loop;
3767
3768 IF l_debug_level > 0 THEN
3769 oe_debug_pub.add( 'EXITING OE_OE_AVAILABILITY.COPY_ATTRIBS_TO_REQ' , 1 ) ;
3770 END IF;
3771
3772 END copy_attribs_to_Req;
3773
3774
3775
3776
3777 PROCEDURE process_pricing_errors(in_line_type_code in varchar2,
3778 in_status_code in varchar2,
3779 in_status_text in varchar2,
3780 in_ordered_item in varchar2,
3781 in_uom in varchar2,
3782 in_unit_price in number,
3783 in_adjusted_unit_price in number,
3784 in_process_code in varchar2 ,
3785 in_price_flag in varchar2,
3786 in_price_list_id in number,
3787 l_return_status out nocopy varchar2,
3788
3789 l_msg_count out nocopy number,
3790
3791 l_msg_data out nocopy varchar2
3792
3793 ) IS
3794
3795 l_price_list varchar2(200);
3796 l_allow_negative_price varchar2(10):= nvl(OE_Sys_Parameters.VALUE('ONT_NEGATIVE_PRICING'),'N');
3797 l_gsa_violation_action Varchar2(30) :=fnd_profile.value('ONT_GSA_VIOLATION_ACTION');
3798 l_org_id Number:= OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
3799
3800
3801 Cursor get_gsa_list_lines is
3802 Select/*+ ordered use_nl(qpq qppa qpll qplh) */ min(qpll.operand)
3803 From
3804 qp_qualifiers qpq
3805 , qp_pricing_attributes qppa
3806 , qp_list_lines qpll
3807 , qp_list_headers_b qplh
3808 , qp_price_req_sources qpprs
3809 where
3810 qpq.qualifier_context='CUSTOMER'
3811 and qpq.qualifier_attribute='QUALIFIER_ATTRIBUTE15'
3812 and qpq.qualifier_attr_value='Y'
3813 and qppa.list_header_id=qplh.list_header_id
3814 and qplh.Active_flag='Y'
3815 and qpprs.request_type_code = 'ONT'
3816 and qpprs.source_system_code=qplh.source_system_code
3817 and qppa.pricing_phase_id = 2
3818 and qppa.qualification_ind = 6
3819 and qppa.product_attribute_context ='ITEM'
3820 and qppa.product_attribute='PRICING_ATTRIBUTE1'
3821 and qppa.product_attr_value= g_panda_rec_table(1).p_inventory_item_id
3822 and qppa.excluder_flag = 'N'
3823 and qppa.list_header_id=qpq.list_header_id
3824 and qppa.list_line_id=qpll.list_line_id
3825 and g_panda_rec_table(1).p_pricing_date between nvl(trunc(qplh.start_date_active),g_panda_rec_table(1).p_pricing_date)
3826 and nvl(trunc(qplh.End_date_active),g_panda_rec_table(1).p_pricing_date);
3827
3828 l_operand number;
3829 l_msg_text Varchar2(2000);
3830
3831 --
3832 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3833 --
3834 BEGIN
3835
3836 IF l_debug_level > 0 THEN
3837 oe_debug_pub.add( 'ENTERING PROCESS_PRICING_ERRORS' ) ;
3838 END IF;
3839 IF l_debug_level > 0 THEN
3840 oe_debug_pub.add( 'LINE_TYPE_CODE='||IN_LINE_TYPE_CODE|| ' STATUS CODE='||IN_STATUS_CODE|| ' NEGATIVE PRICE ='||L_ALLOW_NEGATIVE_PRICE|| ' IN_UNIT_PRICE ='||IN_UNIT_PRICE|| ' IN_ADJUSTED_UNIT_PRICE ='||IN_ADJUSTED_UNIT_PRICE ) ;
3841 END IF;
3842
3843
3844 IF in_line_Type_code ='LINE' and
3845 in_status_code in ( QP_PREQ_GRP.G_STATUS_INVALID_PRICE_LIST,
3846 QP_PREQ_GRP.G_STS_LHS_NOT_FOUND,
3847 QP_PREQ_GRP.G_STATUS_FORMULA_ERROR,
3848 QP_PREQ_GRP.G_STATUS_OTHER_ERRORS,
3849 FND_API.G_RET_STS_UNEXP_ERROR,
3850 FND_API.G_RET_STS_ERROR,
3851 QP_PREQ_GRP.G_STATUS_CALC_ERROR,
3852 QP_PREQ_GRP.G_STATUS_UOM_FAILURE,
3853 QP_PREQ_GRP.G_STATUS_INVALID_UOM,
3854 QP_PREQ_GRP.G_STATUS_DUP_PRICE_LIST,
3855 QP_PREQ_GRP.G_STATUS_INVALID_UOM_CONV,
3856 QP_PREQ_GRP.G_STATUS_INVALID_INCOMP,
3857 QP_PREQ_GRP.G_STATUS_BEST_PRICE_EVAL_ERROR)
3858 then
3859
3860 l_return_status := 'E';
3861
3862 IF in_price_list_id is not null then
3863 Begin
3864 Select name into l_price_list
3865 from qp_list_headers_vl
3866 where list_header_id = in_price_list_id;
3867 Exception When No_data_found then
3868 l_price_list := in_price_list_id;
3869 End;
3870 END IF;
3871
3872 IF in_status_code = QP_PREQ_GRP.G_STATUS_INVALID_PRICE_LIST then
3873
3874 IF l_debug_level > 0 THEN
3875 oe_debug_pub.add( 'INVALID PRICE LIST'|| ' PRICE_LIST_ID='||G_panda_rec_table(1).p_PRICE_LIST_ID ) ;
3876 END IF;
3877 IF g_panda_rec_table(1).p_price_list_id is null then
3878
3879 FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_GENERIC');
3880 FND_MESSAGE.SET_TOKEN('TEXT',in_status_text);
3881 IF l_debug_level > 0 THEN
3882 oe_debug_pub.add( 'INVALID PL ERR TXT='||IN_STATUS_TEXT ) ;
3883 END IF;
3884 OE_MSG_PUB.Add;
3885
3886 ELSE
3887 IF l_debug_level > 0 THEN
3888 oe_debug_pub.add( 'INVALID PRICE LIST' ) ;
3889 END IF;
3890 FND_MESSAGE.SET_NAME('ONT','OE_PRC_NO_LIST_PRICE');
3891 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
3892 FND_MESSAGE.SET_TOKEN('UNIT',in_uom);
3893 FND_MESSAGE.SET_TOKEN('PRICE_LIST',l_Price_List);
3894 OE_MSG_PUB.Add;
3895
3896 END IF;
3897
3898 ELSIF in_status_code = QP_PREQ_GRP.G_STS_LHS_NOT_FOUND Then
3899
3900 FND_MESSAGE.SET_NAME('ONT','ONT_NO_PRICE_LIST_FOUND');
3901 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
3902 FND_MESSAGE.SET_TOKEN('UOM',in_uom);
3903 OE_MSG_PUB.Add;
3904
3905 ELSIF in_status_code = QP_PREQ_GRP.G_STATUS_FORMULA_ERROR then
3906 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_ERROR_IN_FORMULA');
3907 OE_MSG_PUB.Add;
3908
3909 ELSIF in_status_code in
3910 ( QP_PREQ_GRP.G_STATUS_OTHER_ERRORS , FND_API.G_RET_STS_UNEXP_ERROR,
3911 FND_API.G_RET_STS_ERROR) then
3912 FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
3913 FND_MESSAGE.SET_TOKEN('ERR_TEXT',in_status_text);
3914 OE_MSG_PUB.Add;
3915
3916 ELSIF in_status_code = QP_PREQ_GRP.G_STATUS_INVALID_UOM then
3917 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_UOM');
3918 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
3919 FND_MESSAGE.SET_TOKEN('UOM',in_uom);
3920 OE_MSG_PUB.Add;
3921
3922 ElSIF in_status_code = QP_PREQ_GRP.G_STATUS_DUP_PRICE_LIST then
3923 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_DUPLICATE_PRICE_LIST');
3924
3925 IF l_debug_level > 0 THEN
3926 oe_debug_pub.add( 'DUPLICATE PRICE LIST ERROR' ) ;
3927 END IF;
3928 Begin
3929 Select name into l_price_list
3930 from qp_list_headers_vl a,qp_list_lines b where
3931 b.list_line_id = to_number(substr(in_status_text,1,
3932 instr(in_status_text,',')-1))
3933 and a.list_header_id=b.list_header_id ;
3934 Exception When No_data_found then
3935 l_price_list := to_number(substr(in_status_text,1,
3936 instr(in_status_text,',')-1));
3937 When invalid_number then
3938 l_price_list := substr(in_status_text,1,
3939 instr(in_status_text,',')-1);
3940 End;
3941
3942 IF l_debug_level > 0 THEN
3943 oe_debug_pub.add( 'PRICE LIST 1='||L_PRICE_LIST ) ;
3944 END IF;
3945 FND_MESSAGE.SET_TOKEN('PRICE_LIST1','( '||in_Ordered_Item||' ) '|| l_price_list);
3946 Begin
3947 Select name into l_price_list
3948 from qp_list_headers_vl a,qp_list_lines b where
3949 b.list_line_id = to_number(substr(in_status_text,
3950 instr(in_status_text,',')+1))
3951 and a.list_header_id=b.list_header_id ;
3952 Exception When No_data_found then
3953 l_price_list := to_number(substr(in_status_text,
3954 instr(in_status_text,',')+1));
3955 When invalid_number then
3956 l_price_list := substr(in_status_text,
3957 instr(in_status_text,',')+1);
3958 End;
3959 IF l_debug_level > 0 THEN
3960 oe_debug_pub.add( 'PRICE LIST 2='||L_PRICE_LIST ) ;
3961 END IF;
3962
3963 FND_MESSAGE.SET_TOKEN('PRICE_LIST2',l_price_list);
3964 OE_MSG_PUB.Add;
3965
3966 ELSIF in_status_code = QP_PREQ_GRP.G_STATUS_INVALID_UOM_CONV then
3967 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_UOM_CONVERSION');
3968 FND_MESSAGE.SET_TOKEN('UOM_TEXT','( '||in_Ordered_Item||' ) '||
3969 in_status_text);
3970 OE_MSG_PUB.Add;
3971
3972 ElSIF in_status_code = QP_PREQ_GRP.G_STATUS_INVALID_INCOMP then
3973 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_INCOMP');
3974 FND_MESSAGE.SET_TOKEN('ERR_TEXT','( '||in_Ordered_Item||' ) '||
3975 in_status_text);
3976 OE_MSG_PUB.Add;
3977
3978 ELSIF in_status_code = QP_PREQ_GRP.G_STATUS_BEST_PRICE_EVAL_ERROR then
3979 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_BEST_PRICE_ERROR');
3980 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
3981 FND_MESSAGE.SET_TOKEN('ERR_TEXT',in_status_text);
3982 OE_MSG_PUB.Add;
3983 END IF;
3984
3985
3986 /*elsif ( in_unit_price < 0 or in_Adjusted_unit_price < 0) and
3987 l_allow_negative_price = 'N' then
3988
3989 oe_debug_pub.add('Error as Negative Pricing is not Allowed');
3990 FND_MESSAGE.SET_NAME('ONT','ONT_NEGATIVE_PRICE');
3991 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
3992 FND_MESSAGE.SET_TOKEN('LIST_PRICE',in_unit_price);
3993 FND_MESSAGE.SET_TOKEN('SELLING_PRICE',in_Adjusted_unit_price);
3994 OE_MSG_PUB.Add;
3995 --FND_MESSAGE.SET_NAME('ONT','ONT_NEGATIVE_MODIFIERS');
3996 --FND_MESSAGE.SET_TOKEN('LIST_LINE_NO',get_list_lines(g_line_id));
3997 --OE_MSG_PUB.Add;
3998 l_return_status := 'E';
3999 --RAISE FND_API.G_EXC_ERROR;*/
4000
4001 ELSIF in_line_Type_code ='LINE' and
4002 in_status_code = QP_PREQ_GRP.G_STATUS_OTHER_ERRORS Then
4003
4004 IF l_debug_level > 0 THEN
4005 oe_debug_pub.add( 'OE_PRICING_ERROR' ) ;
4006 END IF;
4007 FND_MESSAGE.SET_NAME('ONT','OE_PRICING_ERROR');
4008 FND_MESSAGE.SET_TOKEN('ERR_TEXT','( '||in_Ordered_Item||' ) '||in_STATUS_TEXT);
4009 OE_MSG_PUB.Add;
4010
4011 ELSIF in_line_Type_code ='LINE' and in_status_code in
4012 --( QP_PREQ_GRP.G_STATUS_UPDATED,
4013 (QP_PREQ_GRP.G_STATUS_GSA_VIOLATION) and
4014 -- QP_PREQ_GRP.G_STATUS_UNCHANGED) and
4015 nvl(in_process_code,'0') <> QP_PREQ_GRP.G_BY_ENGINE
4016 and in_price_flag IN ('Y','P')
4017 --we do not want to go in this loop if price_flag is set up 'N' because
4018 --engine doesn't look at the line and will not return adjustments. In this
4019 --case we DON't want to remove the adjustments that engine doesn't return.
4020 then
4021 IF l_debug_level > 0 THEN
4022 oe_debug_pub.add( 'OE_PRICING_ERROR 2' ) ;
4023 END IF;
4024
4025 IF in_status_text is not null then
4026 l_return_status := 'E';
4027 FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
4028 FND_MESSAGE.SET_TOKEN('ERR_TEXT',in_status_text);
4029 OE_MSG_PUB.Add;
4030 END IF;
4031
4032 -- we need to do this check in UPDATED code or do the gsa check through
4033 -- the control record of Pricing
4034 /*OPEN get_gsa_list_lines;
4035 FETCH get_gsa_list_lines
4036 INTO l_operand;
4037 CLOSE get_gsa_list_lines;
4038 oe_debug_pub.add('After select OE_PRICING_ERROR 2');
4039 oe_debug_pub.add('Adj price='||in_adjusted_unit_price||
4040 ' Operand='||l_operand);
4041
4042 IF in_adjusted_unit_price <= l_operand then
4043 oe_debug_pub.add('If unit price less than operand violation='||
4044 l_gsa_violation_action);
4045 --Check if the GSA check needs to be done.
4046 If l_gsa_violation_action in ('WARNING','ERROR') then
4047
4048 oe_debug_pub.add('GSA warning or error');
4049 Begin
4050 SELECT concatenated_segments
4051 INTO l_msg_text
4052 FROM mtl_system_items_kfv
4053 WHERE inventory_item_id = g_inventory_item_id
4054 AND organization_id = l_org_id;
4055 Exception
4056 when no_data_found then
4057 Null;
4058 End;
4059
4060 l_return_status := 'E';
4061 oe_debug_pub.add('GSA warning or error 2 msg_Text='||l_msg_text);
4062 FND_MESSAGE.SET_NAME('ONT','OE_GSA_VIOLATION');
4063 l_msg_text := l_operand||' ( '||l_msg_text||' )';
4064 FND_MESSAGE.SET_TOKEN('GSA_PRICE',l_msg_text);
4065 OE_MSG_PUB.Add;
4066 END IF;
4067 END IF; */
4068
4069
4070 ELSIF -- Process header level adjustments
4071 in_line_type_code ='ORDER' and
4072 (in_status_code in ( QP_PREQ_GRP.G_STATUS_UPDATED ,
4073 QP_PREQ_GRP.G_STATUS_GSA_VIOLATION)
4074 --In this case even engine doesn't update the order (status = UNCHANGED)
4075 --because of one of the lined is frozen,
4076 --there can be some order level adjustments in database which
4077 --need to be pulled out by append_adjustment_lines routine
4078 or (in_status_code = QP_PREQ_GRP.G_STATUS_UNCHANGED))
4079 Then
4080 IF l_debug_level > 0 THEN
4081 oe_debug_pub.add( 'OE_PRICING_ERROR 3' ) ;
4082 END IF;
4083 null;
4084
4085 ELSIF in_line_Type_code ='LINE' and in_status_code = 'UPDATED' then
4086
4087 IF l_debug_level > 0 THEN
4088 oe_debug_pub.add( 'STATUS = UPDATED' ) ;
4089 END IF;
4090
4091 END IF;-- Status_Code
4092
4093
4094 IF l_debug_level > 0 THEN
4095 oe_debug_pub.add( 'PROCESS PRICING ERROR AFTER ERR CHK ST='||L_RETURN_STATUS ) ;
4096 END IF;
4097
4098 IF l_return_status ='E' then
4099 IF l_debug_level > 0 THEN
4100 oe_debug_pub.add( 'DOING COUNT_AND_GET' ) ;
4101 END IF;
4102 oe_msg_pub.count_and_get(p_encoded=>fnd_api.G_TRUE,
4103 p_count => l_msg_count,
4104 p_data=>l_msg_data
4105 );
4106 END IF;
4107
4108 IF l_debug_level > 0 THEN
4109 oe_debug_pub.add( 'EXITING PROCESS_PRICING_ERRORS' ) ;
4110 END IF;
4111
4112 EXCEPTION
4113
4114 when others then
4115 IF l_debug_level > 0 THEN
4116 oe_debug_pub.add( 'PROCESS PRICING ERRORS WHEN OTHERS EXCEPTION CODE='|| SQLCODE||' MESSAGE='||SQLERRM ) ;
4117 END IF;
4118
4119 END process_pricing_errors;
4120
4121
4122
4123 FUNCTION Get_Rounding_factor(p_list_header_id number) return number is
4124
4125 l_rounding_factor number;
4126
4127 --
4128 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4129 --
4130 BEGIN
4131
4132 select rounding_factor
4133 into l_rounding_factor
4134 from qp_list_headers_b
4135 where list_header_id = p_list_header_id;
4136
4137 If l_rounding_factor = fnd_api.g_miss_num then
4138 l_rounding_factor:= Null;
4139 End If;
4140
4141 Return l_rounding_factor;
4142
4143
4144 EXCEPTION
4145 when no_data_found then
4146 Return Null;
4147 END Get_Rounding_factor;
4148
4149
4150
4151 PROCEDURE Get_modifier_name( in_list_header_id in number
4152 ,out_name out nocopy varchar2
4153
4154 ,out_description out nocopy varchar2
4155
4156 ,out_end_date out nocopy date
4157
4158 ,out_start_date out nocopy date
4159
4160 ,out_currency out nocopy varchar2
4161
4162 ,out_ask_for_flag out nocopy varchar2
4163
4164 ) IS
4165
4166
4167 l_list_type_code varchar2(300);
4168
4169 --
4170 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4171 --
4172 BEGIN
4173
4174 SELECT name,
4175 description,
4176 list_type_code,
4177 end_date_active,
4178 start_date_active,
4179 currency_code,
4180 ask_for_flag
4181 INTO out_name,
4182 out_description,
4183 l_list_type_code,
4184 out_end_date,
4185 out_start_date,
4186 out_currency,
4187 out_ask_for_flag
4188
4189 FROM qp_list_headers_vl
4190 WHERE list_header_id = in_list_header_id;
4191
4192
4193 IF l_debug_level > 0 THEN
4194 oe_debug_pub.add( 'END_DATE='||OUT_END_DATE|| ' START_DATE='||OUT_START_DATE ) ;
4195 END IF;
4196 IF l_debug_level > 0 THEN
4197 oe_debug_pub.add( 'EXITING OE_AVA.GET_MODIFIER_NAME TYP='||L_LIST_TYPE_CODE ) ;
4198 END IF;
4199
4200 EXCEPTION
4201 when no_data_found then
4202 IF l_debug_level > 0 THEN
4203 oe_debug_pub.add( 'OE_AVAILABILITY.GET_MODIFIER_NAME NO DATA FOUND' ) ;
4204 END IF;
4205 when others then
4206 IF l_debug_level > 0 THEN
4207 oe_debug_pub.add( 'OE_AVAILABILITY.GET_MODIFIER_NAME WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
4208 END IF;
4209
4210 END get_modifier_name;
4211
4212
4213
4214 PROCEDURE Get_list_line_details( in_list_line_id in number
4215 ,out_end_date out nocopy date
4216
4217 ,out_start_date out nocopy date
4218
4219 ,out_list_line_type_Code out nocopy varchar2
4220
4221 ,out_modifier_level_code out nocopy varchar2
4222
4223 ) IS
4224
4225 --
4226 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4227 --
4228 BEGIN
4229
4230 SELECT
4231 list_line_type_code,
4232 end_date_active,
4233 start_date_active,
4234 modifier_level_code
4235 INTO
4236 out_list_line_type_code,
4237 out_end_date,
4238 out_start_date,
4239 out_modifier_level_code
4240
4241 FROM qp_list_lines
4242 WHERE list_line_id = in_list_line_id;
4243
4244
4245 IF l_debug_level > 0 THEN
4246 oe_debug_pub.add( 'EXITING OE_AVA.GET_LINE_DETAILS TYPE='|| 'LIST_LINE_TYPE_CODE='|| OUT_LIST_LINE_TYPE_CODE|| 'END_DATE='||OUT_END_DATE|| ' START_DATE='||OUT_START_DATE ) ;
4247 END IF;
4248
4249 EXCEPTION
4250 when no_data_found then
4251 IF l_debug_level > 0 THEN
4252 oe_debug_pub.add( 'OE_AVAILABILITY.GET_LIST_LINE_DETAILS NO DATA FOUND' ) ;
4253 END IF;
4254 when others then
4255 IF l_debug_level > 0 THEN
4256 oe_debug_pub.add( 'OE_AVAILABILITY.GET_LIST_LINE_DETAILS WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
4257 END IF;
4258
4259 END get_list_line_details;
4260
4261
4262 FUNCTION Get_qp_lookup_meaning( in_lookup_code in varchar2,
4263 in_lookup_type in varchar2) return varchar2 IS
4264
4265 l_meaning varchar2(300);
4266
4267 --
4268 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4269 --
4270 BEGIN
4271
4272 IF l_debug_level > 0 THEN
4273 oe_debug_pub.add( 'CODE='||IN_LOOKUP_CODE||' TYPE='||IN_LOOKUP_TYPE ) ;
4274 END IF;
4275
4276 SELECT meaning
4277 INTO l_meaning
4278 FROM qp_lookups
4279 WHERE lookup_type = in_lookup_type
4280 AND lookup_code = in_lookup_code;
4281
4282 IF l_meaning = fnd_api.g_miss_char then
4283 l_meaning:= Null;
4284 END IF;
4285
4286 Return l_meaning;
4287
4288 EXCEPTION
4289 when no_data_found then
4290 IF l_debug_level > 0 THEN
4291 oe_debug_pub.add( 'OE_AVAILABILITY.GET_QP_LOOKUP_MEANING NO DATA FOUND' ) ;
4292 END IF;
4293 Return Null;
4294
4295 END get_qp_lookup_meaning;
4296
4297
4298 FUNCTION get_pricing_attribute(
4299 in_CONTEXT_NAME in varchar2,
4300 in_ATTRIBUTE_NAME in varchar2
4301 ) return varchar2 IS
4302 l_pricing_attribute varchar2(300);
4303
4304 --
4305 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4306 --
4307 BEGIN
4308
4309 IF l_debug_level > 0 THEN
4310 oe_debug_pub.add( 'GET_PRICING_ATTRIBUTE '|| 'IN_CONTEXT = '||IN_CONTEXT_NAME|| 'IN_ATTRIBUTE_NAME='||IN_ATTRIBUTE_NAME ) ;
4311 END IF;
4312 l_pricing_attribute := QP_UTIL.get_attribute_name(
4313 p_application_short_name=> 'QP',
4314 P_FLEXFIELD_NAME =>'QP_ATTR_DEFNS_PRICING',
4315 P_CONTEXT_NAME =>in_context_name,
4316 P_ATTRIBUTE_NAME =>in_attribute_name
4317 );
4318 IF l_debug_level > 0 THEN
4319 oe_debug_pub.add( 'EXITING GET_PRICING_ATTRIBUTE ='||L_PRICING_ATTRIBUTE ) ;
4320 END IF;
4321
4322 return l_pricing_attribute;
4323
4324 EXCEPTION
4325
4326 WHEN others then
4327 IF l_debug_level > 0 THEN
4328 oe_debug_pub.add( 'WHEN OTHERS FOR GET_PRICING_ATTRIBUTE'|| SQLCODE||SQLERRM ) ;
4329 END IF;
4330 return null;
4331
4332 END get_pricing_attribute;
4333
4334
4335
4336 PROCEDURE get_Price_List_info(
4337 p_price_list_id IN NUMBER,
4338 out_name out nocopy varchar2,
4339
4340 out_end_date out nocopy date,
4341
4342 out_start_date out nocopy date,
4343
4344 out_automatic_flag out nocopy varchar2,
4345
4346 out_rounding_factor out nocopy varchar2,
4347
4348 out_terms_id out nocopy number,
4349
4350 out_gsa_indicator out nocopy varchar2,
4351
4352 out_currency out nocopy varchar2,
4353
4354 out_freight_terms_code out nocopy varchar2
4355
4356 ) IS
4357
4358 --
4359 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4360 --
4361 BEGIN
4362
4363 IF l_debug_level > 0 THEN
4364 oe_debug_pub.add( 'GET PRICE_LIST ID='||P_PRICE_LIST_ID ) ;
4365 END IF;
4366
4367 IF p_price_list_id IS NOT NULL THEN
4368
4369 SELECT NAME,
4370 end_date_active,
4371 start_date_active,
4372 automatic_flag,
4373 rounding_factor,
4374 terms_id,
4375 gsa_indicator,
4376 currency_code,
4377 freight_terms_code
4378 INTO out_name,
4379 out_end_date,
4380 out_start_date,
4381 out_automatic_flag,
4382 out_rounding_factor,
4383 out_terms_id,
4384 out_gsa_indicator,
4385 out_currency,
4386 out_freight_terms_code
4387
4388 FROM qp_list_headers_vl
4389 WHERE list_header_id = p_price_list_id
4390 and list_type_code in ('PRL', 'AGR');
4391
4392 END IF;
4393
4394 IF l_debug_level > 0 THEN
4395 oe_debug_pub.add( 'END_DATE='||OUT_END_DATE|| ' START_DATE='||OUT_START_DATE ) ;
4396 END IF;
4397
4398 EXCEPTION
4399
4400 WHEN NO_DATA_FOUND THEN
4401 IF l_debug_level > 0 THEN
4402 oe_debug_pub.add( 'NO DATA FOUND GET PRICE LIST_INFO' ) ;
4403 END IF;
4404
4405 WHEN OTHERS THEN
4406 IF l_debug_level > 0 THEN
4407 oe_debug_pub.add( 'WHEN OTHERS GET PRICE LIST_INFO'|| SQLCODE||SQLERRM ) ;
4408 END IF;
4409
4410 END get_Price_List_info;
4411
4412
4413
4414
4415 PROCEDURE get_item_information(
4416 in_inventory_item_id in number
4417 ,in_org_id in number
4418 ,out_item_status out nocopy varchar2
4419
4420 ,out_wsh out nocopy varchar2
4421
4422 ,out_wsh_name out nocopy varchar2
4423
4424 ,out_category out nocopy varchar2
4425
4426 ,out_lead_time out nocopy number
4427
4428 ,out_cost out nocopy number
4429
4430 ,out_primary_uom out nocopy varchar2
4431
4432 ,out_user_item_type out nocopy varchar2
4433
4434 ,out_make_or_buy out nocopy varchar2
4435
4436 ,out_weight_uom out nocopy varchar2
4437
4438 ,out_unit_weight out nocopy number
4439
4440 ,out_volume_uom out nocopy varchar2
4441
4442 ,out_unit_volume out nocopy number
4443
4444 ,out_min_order_quantity out nocopy number
4445
4446 ,out_max_order_quantity out nocopy number
4447
4448 ,out_fixed_order_quantity out nocopy number
4449
4450 ,out_customer_order_flag out nocopy varchar2
4451
4452 ,out_internal_order_flag out nocopy varchar2
4453
4454 ,out_stockable out nocopy varchar2
4455
4456 ,out_reservable out nocopy varchar2
4457
4458 ,out_returnable out nocopy varchar2
4459
4460 ,out_shippable out nocopy varchar2
4461
4462 ,out_orderable_on_web out nocopy varchar2
4463
4464 ,out_taxable out nocopy varchar2
4465
4466 ,out_serviceable out nocopy varchar2
4467
4468 ,out_atp_flag out nocopy varchar2
4469
4470 ) IS
4471
4472 CURSOR c_item_info IS
4473 SELECT shippable_item_flag,
4474 customer_order_enabled_flag,
4475 internal_order_enabled_flag,
4476 stock_enabled_flag,
4477 default_shipping_org,
4478 returnable_flag,
4479 source_organization_id,
4480 unit_weight,
4481 weight_uom_code,
4482 unit_volume,
4483 volume_uom_code,
4484 cum_manufacturing_lead_time,
4485 cumulative_total_lead_time,
4486 primary_unit_of_measure,
4487 inventory_item_status_code,
4488 full_lead_time,
4489 order_cost,
4490 minimum_order_quantity,
4491 maximum_order_quantity,
4492 fixed_order_quantity,
4493 reservable_type,
4494 item_type,
4495 orderable_on_web_flag,
4496 planning_make_buy_code,
4497 taxable_flag ,
4498 serviceable_product_flag,
4499 atp_flag
4500 FROM mtl_system_items
4501 WHERE inventory_item_id = in_inventory_item_id
4502 AND organization_id = in_org_id;
4503
4504 l_default_shipping_org number;
4505 l_source_organization_id number;
4506 l_weight_uom_code varchar2(3);
4507 l_volumne_uom_code varchar2(3);
4508 l_cum_manufactureing_lead_time number;
4509 l_cummulative_total_lead_time number;
4510 l_inventory_item_status_code varchar2(10);
4511 l_full_lead_time number;
4512 l_order_cost number;
4513 l_reservable_type number;
4514 l_user_item_type varchar2(30);
4515 l_ship_from_org varchar2(200);
4516 l_ship_from_org_name varchar2(200);
4517 l_make_buy number;
4518
4519 --
4520 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4521 --
4522 BEGIN
4523
4524 IF l_debug_level > 0 THEN
4525 oe_debug_pub.add( 'ENTERING OE_OE_AVAILABILITY.GET_ITEM_INFO'||
4526 'INV_ITEM_ID='||IN_INVENTORY_ITEM_ID|| 'ORG_ID='||IN_ORG_ID ) ;
4527 END IF;
4528
4529 OPEN c_item_info;
4530 FETCH c_item_info
4531 INTO out_shippable,
4532 out_customer_order_flag,
4533 out_internal_order_flag,
4534 out_stockable,
4535 l_default_shipping_org,
4536 out_returnable,
4537 l_source_organization_id,
4538 out_unit_weight,
4539 l_weight_uom_code,
4540 out_unit_volume,
4541 l_volumne_uom_code,
4542 l_cum_manufactureing_lead_time,
4543 l_cummulative_total_lead_time,
4544 out_primary_uom,
4545 l_inventory_item_status_code,
4546 l_full_lead_time,
4547 l_order_cost,
4548 out_min_order_quantity,
4549 out_max_order_quantity,
4550 out_fixed_order_quantity,
4551 l_reservable_type,
4552 l_user_item_type,
4553 out_orderable_on_web,
4554 l_make_buy,
4555 out_taxable,
4556 out_serviceable,
4557 out_atp_flag;
4558
4559 CLOSE c_item_Info;
4560
4561 out_item_status := l_inventory_item_status_code;
4562
4563 IF l_make_buy = 1 then
4564 out_make_or_buy := 'Make';
4565 ELSE
4566 out_make_or_buy := 'Buy';
4567 END IF;
4568
4569
4570 oe_oe_availability.get_Ship_From_Org
4571 ( in_org_id => in_org_id
4572 , out_code=>out_wsh
4573 , out_name =>out_wsh_name
4574 );
4575
4576 IF l_debug_level > 0 THEN
4577 oe_debug_pub.add( 'USER_ITEM_TYPE='||L_USER_ITEM_TYPE ) ;
4578 END IF;
4579
4580 out_lead_time := l_cummulative_total_lead_time;
4581 out_cost := l_order_cost;
4582
4583 IF l_reservable_type = 1 then
4584 out_reservable := 'Y';
4585 ELSE
4586 out_reservable := 'N';
4587
4588 END IF;
4589
4590 IF l_user_item_type is NOT NULL then
4591 select meaning
4592 into out_user_item_type
4593 from fnd_common_lookups
4594 where lookup_type = 'ITEM_TYPE'
4595 and lookup_code = l_user_item_type;
4596 ELSE
4597 out_user_item_type := null;
4598
4599 END IF;
4600 IF l_debug_level > 0 THEN
4601 oe_debug_pub.add( 'EXITING OE_OE_AVAILABILITY.GET_ITEM_INFO'||
4602 ' ITEM_STATUS ='||OUT_ITEM_STATUS ) ;
4603 END IF;
4604
4605 EXCEPTION
4606
4607 WHEN OTHERS THEN
4608 IF c_item_info%ISOPEN then
4609 CLOSE c_item_info;
4610 END IF;
4611
4612 IF l_debug_level > 0 THEN
4613 oe_debug_pub.add( 'WHEN OTHERS OE_OE_AVAILABILITY.GET_ITEM_INFO '||
4614 'INV_ITEM_ID='||IN_INVENTORY_ITEM_ID|| 'ORG_ID='||IN_ORG_ID||
4615 'SQLCODE='||SQLCODE|| 'SQLERRM='||SQLERRM ) ;
4616 END IF;
4617
4618 END get_item_information;
4619
4620
4621
4622 PROCEDURE print_time(in_place in varchar2) IS
4623
4624 cursor c_hsecs is
4625 select hsecs
4626 from v$timer;
4627
4628 l_hsecs number;
4629 l_total number;
4630
4631 --
4632 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4633 --
4634 BEGIN
4635
4636 --print_time2;
4637 OPEN c_hsecs;
4638 FETCH c_hsecs
4639 INTO l_hsecs;
4640 CLOSE c_hsecs;
4641
4642 IF g_hsecs is null then
4643
4644 g_hsecs := l_hsecs;
4645 g_place := in_place;
4646 IF l_debug_level > 0 THEN
4647 oe_debug_pub.add( 'TIME STARTING AT PLACE '||G_PLACE||' TIME='||G_HSECS ) ;
4648 END IF;
4649
4650 ELSE
4651 l_total := (l_hsecs - g_hsecs)/100;
4652 g_total := g_total + l_total;
4653 IF l_debug_level > 0 THEN
4654 oe_debug_pub.add( 'TIME FROM ' ||G_PLACE||' TO '||IN_PLACE||
4655 ' TIME DIFF='|| L_TOTAL||' SECONDS'||' TOTAL SO FAR='||G_TOTAL ) ;
4656 END IF;
4657 g_hsecs := l_hsecs;
4658 g_place := in_place;
4659
4660 END IF;
4661 --print_time2;
4662
4663 END print_time;
4664
4665
4666 PROCEDURE print_time2 IS
4667
4668 cursor c2_hsecs is
4669 select hsecs
4670 from v$timer;
4671
4672 l_hsecs number;
4673 l_total number;
4674
4675 --
4676 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4677 --
4678 BEGIN
4679
4680 OPEN c2_hsecs;
4681 FETCH c2_hsecs
4682 INTO l_hsecs;
4683 CLOSE c2_hsecs;
4684
4685 IF g_total2 is null then
4686 IF l_debug_level > 0 THEN
4687 oe_debug_pub.add( 'G_TOTAL2 IS NULL L_HSECS='||L_HSECS ) ;
4688 END IF;
4689 g_total2 := l_hsecs;
4690 ELSE
4691 IF l_debug_level > 0 THEN
4692 oe_debug_pub.add( 'L_HSECS='||L_HSECS||' TOTAL2='||G_TOTAL2 ) ;
4693 END IF;
4694 l_total := (l_hsecs - g_total2)/100;
4695 IF l_debug_level > 0 THEN
4696 oe_debug_pub.add( 'G_TOTAL2='||L_TOTAL ) ;
4697 END IF;
4698 g_total2 := l_hsecs;
4699 END IF;
4700
4701 END print_time2;
4702
4703
4704 PROCEDURE get_global_availability (
4705 in_customer_id in number
4706 ,in_customer_site_id in number
4707 ,in_inventory_item_id in number
4708 ,in_org_id in number
4709 ,x_return_status out nocopy varchar2
4710 ,x_msg_data out nocopy varchar2
4711 ,x_msg_count out nocopy number
4712 ,l_source_orgs_table out nocopy source_orgs_table
4713 )IS
4714
4715 l_instance_id number;
4716 CURSOR c_instance_id IS
4717 SELECT instance_id,
4718 instance_code
4719 FROM mrp_ap_apps_instances;
4720
4721 l_mrp_atp_database_link varchar2(300);
4722 x_assignment_set_id number;
4723 x_assignment_set_name varchar2(300);
4724 x_plan_id number;
4725 x_plan_name varchar2(300);
4726 x_ret_code varchar2(300);
4727 x_err_mesg varchar2(2000);
4728 l_session_id number;
4729 --l_item_arr mrp_atp_pub.number_arr := mrp_atp_pub.number_arr(1);
4730 l_organization_id number;
4731 x_sources mrp_atp_pvt.atp_source_typ;
4732 l_calling_module number;
4733 x_error_mesg varchar2(2000);
4734 l_other_cols order_sch_wb.other_cols_typ;
4735 --l_source_orgs_table source_orgs_table;
4736 l_count number := 1;
4737 l_on_hand_qty number;
4738 l_reservable_qty number;
4739 l_available_qty number;
4740 l_ship_from_org_id number;
4741 l_available_date date;
4742 l_qty_uom varchar2(25);
4743 l_out_message varchar2(300);
4744 l_return_status VARCHAR2(1);
4745 l_msg_count NUMBER;
4746 l_msg_data VARCHAR2(2000);
4747 l_error_message varchar2(2000);
4748 l_org_id number;
4749 l_customer_id number;
4750 l_customer_site_id number;
4751 l_ship_method varchar2(30);
4752 l_dynstring VARCHAR2(500) := NULL;
4753 l_instance_code varchar2(100);
4754
4755 l_inv_ctp number;
4756
4757 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4758
4759 CURSOR c_temp_table(in_session_id in number) IS
4760 SELECT source_organization_id,
4761 sr_instance_id,
4762 ship_method,
4763 delivery_lead_time,
4764 freight_carrier
4765 FROM mrp_atp_schedule_temp
4766 WHERE session_id = in_session_id
4767 --AND status_flag = -99;
4768 AND status_flag = 22;
4769
4770 sql_stmt VARCHAR2(3200);
4771
4772 BEGIN
4773
4774 IF l_debug_level > 0 THEN
4775 oe_debug_pub.add( 'ENTERING GA IN_ORG_ID='||IN_ORG_ID|| ' IN_CUSTOMER_ID='||IN_CUSTOMER_ID
4776 || ' IN_SITE_ID ='||IN_CUSTOMER_SITE_ID|| ' IN_ITEM_ID ='||IN_INVENTORY_ITEM_ID ) ;
4777 END IF;
4778
4779 OPEN c_instance_id;
4780 FETCH c_instance_id
4781 INTO l_instance_id,
4782 l_instance_code;
4783 CLOSE c_instance_id;
4784
4785
4786 x_return_status := 'S';
4787 l_mrp_atp_database_link := fnd_profile.value('MRP_ATP_DATABASE_LINK');
4788
4789 IF l_debug_level > 0 THEN
4790 oe_debug_pub.add( 'L_INSTANCE_ID='||L_INSTANCE_ID|| ' DB LINK='
4791 ||L_MRP_ATP_DATABASE_LINK ||' Ins Code='||l_instance_code) ;
4792 END IF;
4793
4794 msc_sch_wb.get_assignment_set(
4795 x_dblink => l_mrp_atp_database_link
4796 ,x_assignment_set_id=>x_assignment_set_id
4797 ,x_assignment_set_name=>x_assignment_set_name
4798 ,x_plan_id =>x_plan_id
4799 ,x_plan_name =>x_plan_name
4800 ,x_sr_instance_id=>l_instance_id
4801 ,x_inst =>'APPS'
4802 ,x_ret_code =>x_return_status
4803 ,x_err_mesg =>x_err_mesg
4804 );
4805
4806 IF l_debug_level > 0 THEN
4807 oe_debug_pub.add( 'ASSIGNMENT_SET_ID='||X_ASSIGNMENT_SET_ID|| ' SET NAME='||
4808 X_ASSIGNMENT_SET_NAME|| ' PLAN ID='||X_PLAN_ID|| ' PLAN NAME='
4809 ||X_PLAN_NAME|| ' RET CODE='||X_RETURN_STATUS|| ' ERR MESG='||X_ERR_MESG ) ;
4810 END IF;
4811
4812 IF nvl(x_return_status,'E') = 'E'
4813 and x_assignment_set_id is null then
4814
4815 x_msg_data := x_err_mesg;
4816 IF l_debug_level > 0 THEN
4817 oe_debug_pub.add( 'RETURNING IN GA 1' ) ;
4818 END IF;
4819
4820 IF x_msg_data is not null then
4821
4822 IF l_debug_level > 0 THEN
4823 oe_debug_pub.add( 'MSG DATA IS NOT NULL' ) ;
4824 END IF;
4825 x_return_status := 'E';
4826 FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_GENERIC');
4827 IF l_debug_level > 0 THEN
4828 oe_debug_pub.add( 'MSG DATA IS NOT NULL 2' ) ;
4829 END IF;
4830 FND_MESSAGE.SET_TOKEN('TEXT',x_msg_data);
4831 OE_MSG_PUB.Add;
4832
4833 END IF;
4834
4835
4836 ELSE -- if get_assignment_set was sucessful
4837
4838
4839 SELECT mrp_atp_schedule_temp_s.nextval
4840 INTO l_session_id
4841 FROM dual;
4842
4843 x_return_status := 'S';
4844
4845 IF in_customer_site_id is not null and in_customer_id is not null then
4846 l_customer_id := in_customer_id;
4847 l_customer_site_id := in_customer_site_id;
4848 l_org_id := null;
4849 ELSE
4850 l_org_id := in_org_id;
4851 l_customer_id := null;
4852 l_customer_site_id := null;
4853 END IF;
4854
4855
4856 /*fnd_profile.get('INV_CTP',l_inv_ctp);
4857 IF l_debug_level > 0 THEN
4858 oe_debug_pub.add(' Inventory Capable to Promise='||l_inv_ctp);
4859 END IF;
4860
4861 --Profile Inventory Capable to Prmise
4862 -- 4= PDS and we need to select a plan_id for org-org sourcing
4863 -- 5= ODS and we need to pass -1 as plan_id
4864 IF l_inv_ctp = 5 then
4865 x_plan_id := -1;
4866 END IF;
4867
4868 -- if destination is the org, then for looking at the sourcing rule
4869 -- we need to pass the plan_id from the planning server
4870 -- get_assignment_set currently does not return plan_id
4871 IF l_inv_ctp <> 5 AND
4872 l_org_id is not null and
4873 (l_customer_id is null and l_customer_site_id is null) then
4874
4875 IF l_mrp_atp_database_link IS NOT NULL THEN
4876 l_dynstring := '@'||l_mrp_atp_database_link;
4877 END IF;
4878
4879 IF l_debug_level > 0 THEN
4880 oe_debug_pub.add('Getting Plan Id dynamic string='||l_dynstring);
4881 END IF;
4882
4883 sql_stmt :=
4884 ' SELECT '||
4885 ' mast.plan_id '||
4886 ' FROM msc_atp_plan_sn'||l_dynstring||' mast '||
4887 ' WHERE mast.sr_instance_id = :in_instance_id '||
4888 ' AND mast.sr_inventory_item_id = :in_inventory_item_id'||
4889 ' AND mast.organization_id = :in_org_id';
4890
4891 IF l_debug_level > 0 THEN
4892 oe_debug_pub.add('Planning Sql='||sql_stmt);
4893 END IF;
4894
4895
4896 EXECUTE IMMEDIATE sql_stmt INTO x_plan_id
4897 using l_instance_id,in_inventory_item_id,l_org_id;
4898
4899
4900 IF x_plan_id is null then
4901 fnd_message.set_name('MSC', 'MSC_NO_PLANS_DEFINED');
4902 oe_msg_pub.add;
4903 x_return_status := 'E';
4904 oe_debug_pub.add('Plan Id NOT FOUND');
4905 END IF;
4906
4907 END IF; -- if plan_id needs to be fetched */
4908
4909
4910 IF x_plan_id is null then
4911 x_plan_id := -1;
4912 END IF;
4913
4914 -- if the plan was fetched and found then continue
4915 IF nvl(x_return_status,'E') <> 'E' then
4916
4917 IF l_debug_level > 0 THEN
4918 oe_debug_pub.add(' Before inserting into temp table '||
4919 ' instance_id='||l_instance_id||
4920 ' session_id='||l_session_id||
4921 ' inv_item_id='||in_inventory_item_id||
4922 ' customer_id='||l_customer_id||
4923 ' customer_site_id='||l_customer_site_id||
4924 ' org_id='||l_org_id||
4925 ' ship_method='||l_ship_method
4926 );
4927 END IF;
4928
4929 -- insert into mrp_atp_schedule_Temp
4930 INSERT INTO MRP_ATP_SCHEDULE_TEMP(
4931 sr_instance_id,
4932 session_id,
4933 inventory_item_id,
4934 organization_id,
4935 scenario_id,
4936 customer_id,
4937 customer_site_id,
4938 ship_method,
4939 status_flag)
4940 VALUES
4941 (l_instance_id,
4942 l_session_id,
4943 in_inventory_item_id,
4944 l_org_id,
4945 -1,
4946 l_customer_id,
4947 l_customer_site_id,
4948 l_ship_method,
4949 4
4950 );
4951
4952
4953 IF l_debug_level > 0 THEN
4954 print_time('Calling Get Supply Sources');
4955 END IF;
4956
4957 msc_sch_wb.get_supply_sources_local(
4958 x_dblink=>l_mrp_atp_database_link,
4959 x_session_id=>l_session_id,
4960 x_sr_instance_id=>l_instance_id,
4961 x_assignment_set_id=>x_assignment_set_id,
4962 x_plan_id=>x_plan_id,
4963 x_calling_inst=>'APPS',
4964 x_ret_status=>x_return_status,
4965 x_error_mesg=>x_err_mesg);
4966
4967 IF l_debug_level > 0 THEN
4968 print_time('After Calling Get Supply Sources');
4969
4970 oe_debug_pub.add( ' After CALLing get_supply_sources_local '||
4971 ' status='||x_return_status||
4972 ' message='||x_err_mesg);
4973
4974 END IF;
4975
4976 IF nvl(x_return_status,'S') <> 'S' THEN
4977 IF l_debug_level > 0 THEN
4978 oe_debug_pub.add( ' ERROR IN CALL TO get_supply_sources_local');
4979 END IF;
4980 fnd_message.set_name('MSC', x_err_mesg);
4981 oe_msg_pub.add;
4982
4983 ELSE
4984
4985 IF x_return_status IS NULL THEN
4986 x_return_status := 'S';
4987 END IF;
4988
4989 IF l_debug_level > 0 THEN
4990 oe_debug_pub.add( ' SUCCESS IN CALL TO get_supply_sources_local');
4991 END IF;
4992
4993 -- Read from mrp_atp_schedule_Temp
4994 -- Insert into l_sources_orgs_table org_id and instance_id
4995 -- delete from mrp_atp_schedule_temp
4996
4997 FOR l_temp_rec in c_temp_table(l_session_id)
4998 LOOP
4999 IF l_debug_level > 0 THEN
5000 oe_debug_pub.add( ' Reading data from temp table');
5001 END IF;
5002 l_source_orgs_table(l_count).org_id:=l_temp_rec.source_organization_id;
5003 l_source_orgs_table(l_count).instance_id:=l_temp_rec.sr_instance_id;
5004 l_source_orgs_table(l_count).ship_method:=l_temp_rec.ship_method;
5005 l_source_orgs_table(l_count).delivery_lead_time:=l_temp_rec.delivery_lead_time;
5006 l_source_orgs_table(l_count).freight_carrier:=l_temp_rec.freight_carrier;
5007 l_source_orgs_table(l_count).instance_code:=l_instance_code;
5008 l_count := l_count + 1;
5009
5010 END LOOP;
5011
5012 IF l_debug_level > 0 THEN
5013 oe_debug_pub.add( ' After Reading data from temp table');
5014 END IF;
5015
5016 IF l_source_orgs_table.COUNT > 0 then
5017 FOR i in l_source_orgs_table.FIRST..l_source_orgs_table.LAST
5018 LOOP
5019 IF l_debug_level > 0 THEN
5020 oe_debug_pub.add(' Record = '||i||
5021 ' org_id ='||l_source_orgs_table(i).org_id||
5022 ' instance_id ='||l_source_orgs_table(i).instance_id||
5023 ' ship_method ='||l_source_orgs_table(i).ship_method||
5024 ' del_lead_time ='||l_source_orgs_table(i).delivery_lead_time||
5025 ' Instance_Code ='||l_source_orgs_table(i).Instance_Code
5026 );
5027
5028 END IF;
5029
5030 END LOOP;
5031 ELSE
5032
5033 IF l_debug_level > 0 THEN
5034 oe_debug_pub.add( ' THERE ARE NO SOURCES TO BE DISPLAYED ' ) ;
5035 END IF;
5036 x_return_status := 'E';
5037 x_error_mesg := 'MRP_ATP_NO_SOURCES';
5038 FND_MESSAGE.SET_NAME('MSC','MRP_ATP_NO_SOURCES');
5039 OE_MSG_PUB.Add;
5040 x_return_status := 'E';
5041
5042 END IF; -- IF x_sources.organization_id.COUNT > 0
5043
5044 END IF; -- if get_supply_sources is not successful
5045
5046 --deleting from the temp table
5047 DELETE mrp_atp_schedule_temp
5048 WHERE session_id = l_session_id;
5049
5050 END IF; -- if the fetching of plan was successful
5051
5052 END IF; -- if get_assignment fails
5053
5054
5055 -- if it was a failure then we retrieve the message
5056 IF nvl(x_return_status,'E') <> 'S' then
5057 IF l_debug_level > 0 THEN
5058 oe_debug_pub.add( 'DOING COUNT_AND_GET' ) ;
5059 END IF;
5060 oe_msg_pub.count_and_get(p_encoded=>fnd_api.G_TRUE,
5061 p_count => x_msg_count,
5062 p_data=>x_msg_data
5063 );
5064 IF l_debug_level > 0 THEN
5065 oe_debug_pub.add( 'COUNT = '||X_MSG_COUNT||' MSG='||X_MSG_DATA ) ;
5066 END IF;
5067 END IF;
5068
5069 IF l_debug_level > 0 THEN
5070 oe_debug_pub.add( 'EXITING GA' ) ;
5071 END IF;
5072
5073 EXCEPTION
5074 WHEN OTHERS THEN
5075
5076 IF l_debug_level > 0 THEN
5077 oe_debug_pub.add( 'WHEN OTHERS OF get_global_availability' ) ;
5078 oe_debug_pub.add( 'CODE='||SQLCODE||' MSG='||SQLERRM ) ;
5079 END IF;
5080
5081 x_return_status := 'E';
5082 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
5083
5084 -- Get message count and data
5085 OE_MSG_PUB.Count_And_Get
5086 ( p_count => x_msg_count
5087 , p_data => x_msg_data
5088 );
5089
5090 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
5091 OE_MSG_PUB.Add_Exc_Msg
5092 ( G_PKG_NAME,
5093 'Get_Global_Availability');
5094 END IF;
5095
5096 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5097
5098 END get_global_availability;
5099
5100
5101
5102 PROCEDURE different_uom(
5103 in_org_id in number
5104 ,in_ordered_uom in varchar2
5105 ,in_pricing_uom in varchar2
5106 ,out_conversion_rate out nocopy number
5107
5108 )IS
5109
5110 CURSOR c_items IS
5111 SELECT primary_uom_code
5112 FROM mtl_system_items_b
5113 WHERE organization_id = in_org_id
5114 AND inventory_item_id = g_panda_rec_table(1).p_Inventory_item_id;
5115
5116 CURSOR c_class(in_ordered_uom in varchar2) is
5117 SELECT uom_Class
5118 FROM mtl_units_of_measure_tl
5119 WHERE uom_code = in_ordered_uom;
5120
5121 CURSOR c_base_uom(in_class in varchar2) IS
5122 SELECT uom_code
5123 FROM mtl_units_of_measure_tl
5124 WHERE uom_class = in_class
5125 AND base_uom_flag = 'Y';
5126
5127 l_primary_Uom varchar2(100);
5128 l_uom_class varchar2(50);
5129 l_base_uom varchar2(50);
5130 l_conversion_rate number;
5131 l_ordered_conversion number;
5132 l_pricing_conversion number;
5133
5134 --
5135 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5136 --
5137 BEGIN
5138
5139 IF l_debug_level > 0 THEN
5140 oe_debug_pub.add( 'ENTERING OE_AVAILABILITY.DIFFERENT_UOM'||
5141 ' ORDERED_UOM ='||IN_ORDERED_UOM|| ' PRICING_UOM='||
5142 IN_PRICING_UOM|| ' IN_INV_ITEM_ID='||
5143 G_panda_rec_table(1).p_INVENTORY_ITEM_ID|| ' IN_ORG_ID='||IN_ORG_ID ) ;
5144 END IF;
5145
5146 OPEN c_items;
5147 FETCH c_items
5148 INTO l_primary_uom;
5149
5150 IF c_items%FOUND then
5151
5152 OPEN c_class(l_primary_uom);
5153 FETCH c_class
5154 INTO l_uom_class;
5155
5156 IF c_class%FOUND then
5157
5158 OPEN c_base_uom(l_uom_class);
5159 FETCH c_base_Uom
5160 INTO l_base_uom;
5161
5162 IF c_base_uom%FOUND then
5163
5164 -- Both Ordered and Pricing are not Base UOM
5165 IF in_ordered_uom <> l_base_uom AND
5166 in_pricing_uom <> l_base_uom THEN
5167
5168 IF l_debug_level > 0 THEN
5169 oe_debug_pub.add( 'NEITHER THE ORDERED OR PRICING UOM IS BASE UOM' ) ;
5170 END IF;
5171
5172 l_ordered_conversion := get_conversion_rate(
5173 in_uom_code => in_ordered_uom,
5174 in_base_uom => l_base_uom
5175 );
5176 IF l_debug_level > 0 THEN
5177 oe_debug_pub.add( 'THE ORD RATE ='||L_ORDERED_CONVERSION ) ;
5178 END IF;
5179 l_pricing_conversion := get_conversion_rate(
5180 in_uom_code => in_pricing_uom,
5181 in_base_uom => l_base_uom
5182 );
5183 IF l_debug_level > 0 THEN
5184 oe_debug_pub.add( 'THE PRICING RATE ='||L_PRICING_CONVERSION ) ;
5185 END IF;
5186
5187 out_conversion_rate := l_ordered_conversion/l_pricing_conversion;
5188 IF l_debug_level > 0 THEN
5189 oe_debug_pub.add( 'THE RATE ='||OUT_CONVERSION_RATE ) ;
5190 END IF;
5191
5192 -- Ordered Uom is the Base Uom,sending the pricing uom for conversion
5193 ELSIF in_ordered_uom = l_base_uom then
5194
5195 IF l_debug_level > 0 THEN
5196 oe_debug_pub.add( 'THE ORDERED UOM IS BASE UOM' ) ;
5197 END IF;
5198
5199 l_ordered_conversion := get_conversion_rate(
5200 in_uom_code => in_pricing_uom,
5201 in_base_uom => l_base_uom
5202 );
5203 out_conversion_rate := l_ordered_conversion;
5204 IF l_debug_level > 0 THEN
5205 oe_debug_pub.add( 'THE RATE ='||OUT_CONVERSION_RATE ) ;
5206 END IF;
5207
5208 -- Pricing Uom is the Base Uom
5209 ELSIF in_pricing_uom = l_base_uom then
5210
5211 IF l_debug_level > 0 THEN
5212 oe_debug_pub.add( 'THE PRICING UOM IS BASE UOM' ) ;
5213 END IF;
5214 l_pricing_conversion := get_conversion_rate(
5215 in_uom_code => in_ordered_uom,
5216 in_base_uom => l_base_uom
5217 );
5218 out_conversion_rate := l_pricing_conversion;
5219 IF l_debug_level > 0 THEN
5220 oe_debug_pub.add( 'THE RATE ='||OUT_CONVERSION_RATE ) ;
5221 END IF;
5222
5223 END IF;
5224
5225 END IF;
5226
5227 CLOSE c_base_uom;
5228
5229 END IF;
5230
5231 CLOSE c_class;
5232
5233 END IF;
5234 CLOSE c_items;
5235
5236 EXCEPTION
5237
5238 WHEN NO_DATA_FOUND THEN
5239 IF l_debug_level > 0 THEN
5240 oe_debug_pub.add( 'NO DATA FONUNG DIFFERENT_UOM ' ) ;
5241 END IF;
5242
5243 WHEN OTHERS THEN
5244 IF c_items%ISOPEN then
5245 CLOSE c_items;
5246 END IF;
5247 IF c_class%ISOPEN then
5248 CLOSE c_class;
5249 END IF;
5250 IF c_base_uom%ISOPEN then
5251 CLOSE c_base_uom;
5252 END IF;
5253 IF l_debug_level > 0 THEN
5254 oe_debug_pub.add( 'ERROR IN DIFFERENT_UOM '|| SQLCODE||SQLERRM ) ;
5255 END IF;
5256
5257 END different_uom;
5258
5259
5260
5261 FUNCTION get_conversion_rate (in_uom_code in varchar2,
5262 in_base_uom in varchar2
5263 ) RETURN number is
5264
5265
5266 CURSOR c_item_conversion IS
5267 SELECT round(1/conversion_rate,6)
5268 FROM mtl_uom_conversions
5269 WHERE uom_code = in_uom_code
5270 AND inventory_item_id = g_panda_rec_table(1).p_inventory_item_id;
5271
5272 CURSOR c_conversion IS
5273 SELECT round(1/conversion_rate,6)
5274 FROM mtl_uom_conversions
5275 WHERE uom_Code = in_uom_code
5276 AND inventory_item_id = 0;
5277
5278 CURSOR c_inter_class IS
5279 SELECT round(1/conversion_rate,6)
5280 FROM mtl_uom_class_conversions
5281 WHERE to_uom_code = in_uom_code
5282 AND from_uom_code = in_base_uom
5283 AND inventory_item_id = g_panda_rec_table(1).p_inventory_item_id;
5284
5285 l_conversion_rate number;
5286 l_uom_code varchar2(50);
5287
5288 --
5289 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5290 --
5291 BEGIN
5292
5293 IF l_debug_level > 0 THEN
5294 oe_debug_pub.add( 'INSIDE GET_CONVERSION_RATE '|| ' IN_UOM_CODE='||IN_UOM_CODE|| ' IN_BASE_UOM='||IN_BASE_UOM ) ;
5295 END IF;
5296
5297 OPEN c_item_conversion;
5298 FETCH c_item_conversion
5299 INTO l_conversion_rate;
5300
5301 IF c_item_conversion%NOTFOUND THEN
5302
5303 IF l_debug_level > 0 THEN
5304 oe_debug_pub.add( 'ITEM SPECIFIC CONVERSION RATE NOT FOUND' ) ;
5305 END IF;
5306
5307 OPEN c_conversion;
5308 FETCH c_conversion
5309 INTO l_conversion_rate;
5310
5311 IF c_conversion%NOTFOUND THEN
5312
5313 IF l_debug_level > 0 THEN
5314 oe_debug_pub.add( 'GENERIC CONVERSION NOT FOUND' ) ;
5315 END IF;
5316 OPEN c_inter_class;
5317 FETCH c_inter_class
5318 INTO l_conversion_rate;
5319
5320 IF c_inter_class%NOTFOUND THEN
5321 IF l_debug_level > 0 THEN
5322 oe_debug_pub.add( 'INTER CLASS RETURN RATE NOT FOUND= 1' ) ;
5323 END IF;
5324 l_conversion_rate := 1;
5325
5326 ELSE
5327 IF l_debug_level > 0 THEN
5328 oe_debug_pub.add( 'INTER CLASS RETURN RATE = '||L_CONVERSION_RATE ) ;
5329 END IF;
5330
5331 END IF;
5332 CLOSE c_inter_class;
5333
5334 ELSIF c_conversion%FOUND then
5335
5336 IF l_debug_level > 0 THEN
5337 oe_debug_pub.add( 'RETURN RATE GENERIC= '||L_CONVERSION_RATE ) ;
5338 END IF;
5339
5340 END IF;
5341 CLOSE c_conversion;
5342
5343 ELSIF c_item_conversion%FOUND THEN
5344
5345 IF l_debug_level > 0 THEN
5346 oe_debug_pub.add( 'ITEM SPECIFIC CONVERSION RATE='||L_CONVERSION_RATE ) ;
5347 END IF;
5348
5349 END IF;
5350 CLOSE c_item_conversion;
5351
5352 return l_conversion_rate;
5353
5354 EXCEPTION
5355
5356 WHEN ZERO_DIVIDE THEN
5357 IF l_debug_level > 0 THEN
5358 oe_debug_pub.add( 'DIVIDE BY ZERO ERROR IN_UOM_CODE='||IN_UOM_CODE|| ' BASE UOM='||IN_BASE_UOM ) ;
5359 END IF;
5360
5361 IF c_item_conversion%ISOPEN then
5362 CLOSE c_item_conversion;
5363 END IF;
5364 IF c_conversion%ISOPEN then
5365 CLOSE c_conversion;
5366 END IF;
5367 IF c_inter_class%ISOPEN then
5368 CLOSE c_inter_class;
5369 END IF;
5370
5371 WHEN OTHERS THEN
5372
5373 IF c_item_conversion%ISOPEN then
5374 CLOSE c_item_conversion;
5375 END IF;
5376 IF c_conversion%ISOPEN then
5377 CLOSE c_conversion;
5378 END IF;
5379 IF c_inter_class%ISOPEN then
5380 CLOSE c_inter_class;
5381 END IF;
5382 IF l_debug_level > 0 THEN
5383 oe_debug_pub.add( 'ERROR IN GET_CONVERSION_RATE '|| SQLCODE||SQLERRM ) ;
5384 END IF;
5385 return 1;
5386 END get_conversion_rate;
5387
5388
5389 PROCEDURE Call_mrp_and_inventory(
5390 in_org_id in number
5391 ,out_on_hand_qty out nocopy number
5392
5393 ,out_reservable_qty out nocopy number
5394
5395 ,out_available_qty out nocopy varchar2
5396
5397 ,out_available_date out nocopy date
5398
5399 ,out_error_message out nocopy varchar2
5400
5401 ,out_qty_uom out nocopy varchar2
5402
5403 ) IS
5404
5405 l_ship_from_org_id number;
5406 l_out_message varchar2(4000);
5407 l_return_status varchar2(1);
5408 l_msg_count number;
5409 l_msg_data varchar2(4000);
5410
5411 --
5412 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5413 --
5414 BEGIN
5415
5416
5417 Query_Qty_Tree( p_org_id=>in_org_id
5418 ,p_item_id=>g_panda_rec_table(1).p_inventory_item_id
5419 ,p_sch_date=>g_panda_rec_table(1).p_request_date
5420 ,x_on_hand_qty =>out_on_hand_qty
5421 ,x_avail_to_reserve =>out_reservable_qty
5422 );
5423
5424
5425 Call_MRP_ATP(
5426 in_global_orgs => 'Y'
5427 ,in_ship_from_org_id =>in_org_id
5428 ,out_available_qty => out_available_qty
5429 ,out_ship_from_org_id =>l_ship_from_org_id
5430 ,out_available_date =>out_available_date
5431 ,out_qty_uom =>out_qty_uom
5432 ,x_out_message =>l_out_message
5433 ,x_return_status =>l_return_status
5434 ,x_msg_count =>l_msg_count
5435 ,x_msg_data =>l_msg_data
5436 ,x_error_message =>out_error_message
5437 );
5438
5439 IF l_debug_level > 0 THEN
5440 oe_debug_pub.add( 'L_RETURN_STATUS='||L_RETURN_STATUS|| ' OUT_AVAILABLE_QTY='||OUT_AVAILABLE_QTY|| ' L_OUT_MESSAGE='||L_OUT_MESSAGE|| ' OUT_ERROR_MESSAGE='||OUT_ERROR_MESSAGE ) ;
5441 END IF;
5442
5443
5444 IF l_debug_level > 0 THEN
5445 oe_debug_pub.add( 'CALL_MRP_AND_INVENTORY'|| ' OUT_AVAILABLE_DATE ='||OUT_AVAILABLE_DATE|| ' OUT_AVAILABLE_QTY ='||OUT_AVAILABLE_QTY);
5446 oe_debug_pub.add( ' OUT_ON_HAND_QTY ='||OUT_ON_HAND_QTY|| ' OUT_RESERVABLE_QTY ='||OUT_RESERVABLE_QTY|| ' OUT_ERROR_MESSAGE ='||OUT_ERROR_MESSAGE ) ;
5447 END IF;
5448
5449 EXCEPTION
5450 WHEN OTHERS THEN
5451 IF l_debug_level > 0 THEN
5452 oe_debug_pub.add( 'INSIDE CALL_MRP_AND_INVENTORY '|| SQLERRM||SQLERRM ) ;
5453 END IF;
5454
5455 END call_mrp_and_inventory;
5456
5457
5458
5459 PROCEDURE set_mrp_debug(out_mrp_file out nocopy varchar2) IS
5460
5461
5462 l_session_id number;
5463 l_mrp_dir varchar2(200);
5464
5465 --
5466 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5467 --
5468 BEGIN
5469
5470 SELECT mrp_atp_schedule_temp_s.nextval
5471 INTO l_session_id
5472 FROM dual;
5473
5474 SELECT ltrim(rtrim(substr(value, instr(value,',',-1,1)+1)))
5475 INTO l_mrp_dir
5476 FROM v$parameter
5477 WHERE name='utl_file_dir';
5478
5479 order_sch_wb.mr_debug := 'Y';
5480 order_sch_wb.debug_session_id := l_session_id;
5481
5482 IF l_debug_level > 0 THEN
5483 oe_debug_pub.add( 'MSC_ATP_DEBUG DIR='||L_MRP_DIR|| ' SESSION ID ='||L_SESSION_ID ) ;
5484 END IF;
5485 l_mrp_dir := substr(l_mrp_dir,1,18);
5486 IF l_debug_level > 0 THEN
5487 oe_debug_pub.add( 'MSC_ATP_DEBUG DIR2='||L_MRP_DIR ) ;
5488 END IF;
5489 out_mrp_file := l_mrp_dir||'/session-'||l_session_id;
5490
5491 EXCEPTION
5492 WHEN NO_DATA_FOUND THEN
5493 IF l_debug_level > 0 THEN
5494 oe_debug_pub.add( 'OE_OE_AVAILABILITY.SET_MRP_DEBUG NO_DATA_FOUND' ) ;
5495 END IF;
5496 WHEN OTHERS THEN
5497 IF l_debug_level > 0 THEN
5498 oe_debug_pub.add( 'WHEN OTHERS OE_OE_AVAILABILITY.SET_MRP_DEBUG '|| SQLCODE||SQLERRM ) ;
5499 END IF;
5500
5501 END set_mrp_debug;
5502
5503
5504 PROCEDURE copy_fields_to_globals(
5505 in_inventory_item_id in number,
5506 in_qty in number,
5507 in_uom in varchar2,
5508 in_request_date in date,
5509 in_customer_id in number,
5510 in_item_identifier_type in varchar2,
5511 in_agreement_id in number,
5512 in_price_list_id in number,
5513 in_ship_to_org_id in number,
5514 in_invoice_to_org_id in number,
5515 in_ship_from_org_id in number,
5516 in_pricing_date in date,
5517 in_order_type_id in number,
5518 in_currency in varchar2,
5519 in_pricing_context in varchar2,
5520 in_pricing_attribute1 in varchar2,
5521 in_pricing_attribute2 in varchar2,
5522 in_pricing_attribute3 in varchar2,
5523 in_pricing_attribute4 in varchar2,
5524 in_pricing_attribute5 in varchar2,
5525 in_pricing_attribute6 in varchar2,
5526 in_pricing_attribute7 in varchar2,
5527 in_pricing_attribute8 in varchar2,
5528 in_pricing_attribute9 in varchar2,
5529 in_pricing_attribute10 in varchar2,
5530 in_pricing_attribute11 in varchar2,
5531 in_pricing_attribute12 in varchar2,
5532 in_pricing_attribute13 in varchar2,
5533 in_pricing_attribute14 in varchar2,
5534 in_pricing_attribute15 in varchar2,
5535 in_pricing_attribute16 in varchar2,
5536 in_pricing_attribute17 in varchar2,
5537 in_pricing_attribute18 in varchar2,
5538 in_pricing_attribute19 in varchar2,
5539 in_pricing_attribute20 in varchar2,
5540 in_pricing_attribute21 in varchar2,
5541 in_pricing_attribute22 in varchar2,
5542 in_pricing_attribute23 in varchar2,
5543 in_pricing_attribute24 in varchar2,
5544 in_pricing_attribute25 in varchar2,
5545 in_pricing_attribute26 in varchar2,
5546 in_pricing_attribute27 in varchar2,
5547 in_pricing_attribute28 in varchar2,
5548 in_pricing_attribute29 in varchar2,
5549 in_pricing_attribute30 in varchar2,
5550 in_pricing_attribute31 in varchar2,
5551 in_pricing_attribute32 in varchar2,
5552 in_pricing_attribute33 in varchar2,
5553 in_pricing_attribute34 in varchar2,
5554 in_pricing_attribute35 in varchar2,
5555 in_pricing_attribute36 in varchar2,
5556 in_pricing_attribute37 in varchar2,
5557 in_pricing_attribute38 in varchar2,
5558 in_pricing_attribute39 in varchar2,
5559 in_pricing_attribute40 in varchar2,
5560 in_pricing_attribute41 in varchar2,
5561 in_pricing_attribute42 in varchar2,
5562 in_pricing_attribute43 in varchar2,
5563 in_pricing_attribute44 in varchar2,
5564 in_pricing_attribute45 in varchar2,
5565 in_pricing_attribute46 in varchar2,
5566 in_pricing_attribute47 in varchar2,
5567 in_pricing_attribute48 in varchar2,
5568 in_pricing_attribute49 in varchar2,
5569 in_pricing_attribute50 in varchar2,
5570 in_pricing_attribute51 in varchar2,
5571 in_pricing_attribute52 in varchar2,
5572 in_pricing_attribute53 in varchar2,
5573 in_pricing_attribute54 in varchar2,
5574 in_pricing_attribute55 in varchar2,
5575 in_pricing_attribute56 in varchar2,
5576 in_pricing_attribute57 in varchar2,
5577 in_pricing_attribute58 in varchar2,
5578 in_pricing_attribute59 in varchar2,
5579 in_pricing_attribute60 in varchar2,
5580 in_pricing_attribute61 in varchar2,
5581 in_pricing_attribute62 in varchar2,
5582 in_pricing_attribute63 in varchar2,
5583 in_pricing_attribute64 in varchar2,
5584 in_pricing_attribute65 in varchar2,
5585 in_pricing_attribute66 in varchar2,
5586 in_pricing_attribute67 in varchar2,
5587 in_pricing_attribute68 in varchar2,
5588 in_pricing_attribute69 in varchar2,
5589 in_pricing_attribute70 in varchar2,
5590 in_pricing_attribute71 in varchar2,
5591 in_pricing_attribute72 in varchar2,
5592 in_pricing_attribute73 in varchar2,
5593 in_pricing_attribute74 in varchar2,
5594 in_pricing_attribute75 in varchar2,
5595 in_pricing_attribute76 in varchar2,
5596 in_pricing_attribute77 in varchar2,
5597 in_pricing_attribute78 in varchar2,
5598 in_pricing_attribute79 in varchar2,
5599 in_pricing_attribute80 in varchar2,
5600 in_pricing_attribute81 in varchar2,
5601 in_pricing_attribute82 in varchar2,
5602 in_pricing_attribute83 in varchar2,
5603 in_pricing_attribute84 in varchar2,
5604 in_pricing_attribute85 in varchar2,
5605 in_pricing_attribute86 in varchar2,
5606 in_pricing_attribute87 in varchar2,
5607 in_pricing_attribute88 in varchar2,
5608 in_pricing_attribute89 in varchar2,
5609 in_pricing_attribute90 in varchar2,
5610 in_pricing_attribute91 in varchar2,
5611 in_pricing_attribute92 in varchar2,
5612 in_pricing_attribute93 in varchar2,
5613 in_pricing_attribute94 in varchar2,
5614 in_pricing_attribute95 in varchar2,
5615 in_pricing_attribute96 in varchar2,
5616 in_pricing_attribute97 in varchar2,
5617 in_pricing_attribute98 in varchar2,
5618 in_pricing_attribute99 in varchar2,
5619 in_pricing_attribute100 in varchar2
5620 ) IS
5621
5622 --
5623 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5624 --
5625 l_index number :=1;
5626 BEGIN
5627
5628 g_panda_rec_table.delete;
5629
5630
5631 l_index:=1;
5632 g_panda_rec_table(l_index).p_inventory_item_id := in_inventory_item_id;
5633 g_panda_rec_table(l_index).p_qty := in_qty;
5634 g_panda_rec_table(l_index).p_uom := in_uom;
5635 g_panda_rec_table(l_index).p_request_date := in_request_date;
5636 g_panda_rec_table(l_index).p_customer_id := in_customer_id;
5637 g_panda_rec_table(l_index).p_item_identIFier_type:= in_item_identifier_type;
5638 g_panda_rec_table(l_index).p_agreement_id := in_agreement_id;
5639 g_panda_rec_table(l_index).p_price_list_id := in_price_list_id;
5640 g_panda_rec_table(l_index).p_ship_to_org_id := in_ship_to_org_id;
5641 g_panda_rec_table(l_index).p_invoice_to_org_id := in_invoice_to_org_id;
5642 g_panda_rec_table(l_index).p_ship_from_org_id := in_ship_from_org_id;
5643 g_panda_rec_table(l_index).p_pricing_date := in_pricing_date;
5644 g_panda_rec_table(l_index).p_order_type_id := in_order_type_id;
5645 g_panda_rec_table(l_index).p_currency := in_currency;
5646 g_panda_rec_table(l_index).p_pricing_context := in_pricing_context;
5647 g_panda_rec_table(l_index).p_pricing_attribute1:= in_pricing_attribute1;
5648 g_panda_rec_table(l_index).p_pricing_attribute2:= in_pricing_attribute2;
5649 g_panda_rec_table(l_index).p_pricing_attribute3:= in_pricing_attribute3;
5650 g_panda_rec_table(l_index).p_pricing_attribute4:= in_pricing_attribute4;
5651 g_panda_rec_table(l_index).p_pricing_attribute5:= in_pricing_attribute5;
5652 g_panda_rec_table(l_index).p_pricing_attribute6:= in_pricing_attribute6;
5653 g_panda_rec_table(l_index).p_pricing_attribute7:= in_pricing_attribute7;
5654 g_panda_rec_table(l_index).p_pricing_attribute8:= in_pricing_attribute8;
5655 g_panda_rec_table(l_index).p_pricing_attribute9:= in_pricing_attribute9;
5656 g_panda_rec_table(l_index).p_pricing_attribute10 := in_pricing_attribute10;
5657 g_panda_rec_table(l_index).p_pricing_attribute11 := in_pricing_attribute11;
5658 g_panda_rec_table(l_index).p_pricing_attribute12 := in_pricing_attribute12;
5659 g_panda_rec_table(l_index).p_pricing_attribute13 := in_pricing_attribute13;
5660 g_panda_rec_table(l_index).p_pricing_attribute14 := in_pricing_attribute14;
5661 g_panda_rec_table(l_index).p_pricing_attribute15 := in_pricing_attribute15;
5662 g_panda_rec_table(l_index).p_pricing_attribute16 := in_pricing_attribute16;
5663 g_panda_rec_table(l_index).p_pricing_attribute17 := in_pricing_attribute17;
5664 g_panda_rec_table(l_index).p_pricing_attribute18 := in_pricing_attribute18;
5665 g_panda_rec_table(l_index).p_pricing_attribute19 := in_pricing_attribute19;
5666 g_panda_rec_table(l_index).p_pricing_attribute20 := in_pricing_attribute20;
5667 g_panda_rec_table(l_index).p_pricing_attribute21 := in_pricing_attribute21;
5668 g_panda_rec_table(l_index).p_pricing_attribute22 :=in_pricing_attribute22;
5669 g_panda_rec_table(l_index).p_pricing_attribute23 :=in_pricing_attribute23;
5670 g_panda_rec_table(l_index).p_pricing_attribute24 :=in_pricing_attribute24;
5671 g_panda_rec_table(l_index).p_pricing_attribute25 :=in_pricing_attribute25;
5672 g_panda_rec_table(l_index).p_pricing_attribute26 :=in_pricing_attribute26;
5673 g_panda_rec_table(l_index).p_pricing_attribute27 :=in_pricing_attribute27;
5674 g_panda_rec_table(l_index).p_pricing_attribute28 :=in_pricing_attribute28;
5675 g_panda_rec_table(l_index).p_pricing_attribute29 := in_pricing_attribute29;
5676 g_panda_rec_table(l_index).p_pricing_attribute30 := in_pricing_attribute30;
5677 g_panda_rec_table(l_index).p_pricing_attribute31 := in_pricing_attribute31;
5678 g_panda_rec_table(l_index).p_pricing_attribute32 := in_pricing_attribute32;
5679 g_panda_rec_table(l_index).p_pricing_attribute33 := in_pricing_attribute33;
5680 g_panda_rec_table(l_index).p_pricing_attribute34 := in_pricing_attribute34;
5681 g_panda_rec_table(l_index).p_pricing_attribute35 := in_pricing_attribute35;
5682 g_panda_rec_table(l_index).p_pricing_attribute36 := in_pricing_attribute36;
5683 g_panda_rec_table(l_index).p_pricing_attribute37 := in_pricing_attribute37;
5684 g_panda_rec_table(l_index).p_pricing_attribute38 := in_pricing_attribute38;
5685 g_panda_rec_table(l_index).p_pricing_attribute39 := in_pricing_attribute39;
5686 g_panda_rec_table(l_index).p_pricing_attribute40 := in_pricing_attribute40;
5687 g_panda_rec_table(l_index).p_pricing_attribute41 := in_pricing_attribute41;
5688 g_panda_rec_table(l_index).p_pricing_attribute42 := in_pricing_attribute42;
5689 g_panda_rec_table(l_index).p_pricing_attribute43 := in_pricing_attribute43;
5690 g_panda_rec_table(l_index).p_pricing_attribute44 := in_pricing_attribute44;
5691 g_panda_rec_table(l_index).p_pricing_attribute45 := in_pricing_attribute45;
5692 g_panda_rec_table(l_index).p_pricing_attribute46 := in_pricing_attribute46;
5693 g_panda_rec_table(l_index).p_pricing_attribute47 := in_pricing_attribute47;
5694 g_panda_rec_table(l_index).p_pricing_attribute48 := in_pricing_attribute48;
5695 g_panda_rec_table(l_index).p_pricing_attribute49 := in_pricing_attribute49;
5696 g_panda_rec_table(l_index).p_pricing_attribute50 := in_pricing_attribute50;
5697 g_panda_rec_table(l_index).p_pricing_attribute51 := in_pricing_attribute51;
5698 g_panda_rec_table(l_index).p_pricing_attribute52 := in_pricing_attribute52;
5699 g_panda_rec_table(l_index).p_pricing_attribute53 := in_pricing_attribute53;
5700 g_panda_rec_table(l_index).p_pricing_attribute54 := in_pricing_attribute54;
5701 g_panda_rec_table(l_index).p_pricing_attribute55 := in_pricing_attribute55;
5702 g_panda_rec_table(l_index).p_pricing_attribute56 := in_pricing_attribute56;
5703 g_panda_rec_table(l_index).p_pricing_attribute57 := in_pricing_attribute57;
5704 g_panda_rec_table(l_index).p_pricing_attribute58 := in_pricing_attribute58;
5705 g_panda_rec_table(l_index).p_pricing_attribute59 := in_pricing_attribute59;
5706 g_panda_rec_table(l_index).p_pricing_attribute60 := in_pricing_attribute60;
5707 g_panda_rec_table(l_index).p_pricing_attribute61 := in_pricing_attribute61;
5708 g_panda_rec_table(l_index).p_pricing_attribute62 := in_pricing_attribute62;
5709 g_panda_rec_table(l_index).p_pricing_attribute63 := in_pricing_attribute63;
5710 g_panda_rec_table(l_index).p_pricing_attribute64 := in_pricing_attribute64;
5711 g_panda_rec_table(l_index).p_pricing_attribute65 := in_pricing_attribute65;
5712 g_panda_rec_table(l_index).p_pricing_attribute66 := in_pricing_attribute66;
5713 g_panda_rec_table(l_index).p_pricing_attribute67 := in_pricing_attribute67;
5714 g_panda_rec_table(l_index).p_pricing_attribute68 := in_pricing_attribute68;
5715 g_panda_rec_table(l_index).p_pricing_attribute69 := in_pricing_attribute69;
5716 g_panda_rec_table(l_index).p_pricing_attribute70 := in_pricing_attribute70;
5717 g_panda_rec_table(l_index).p_pricing_attribute71 := in_pricing_attribute71;
5718 g_panda_rec_table(l_index).p_pricing_attribute72 := in_pricing_attribute72;
5719 g_panda_rec_table(l_index).p_pricing_attribute73 := in_pricing_attribute73;
5720 g_panda_rec_table(l_index).p_pricing_attribute74 := in_pricing_attribute74;
5721 g_panda_rec_table(l_index).p_pricing_attribute75 := in_pricing_attribute75;
5722 g_panda_rec_table(l_index).p_pricing_attribute76 := in_pricing_attribute76;
5723 g_panda_rec_table(l_index).p_pricing_attribute77 := in_pricing_attribute77;
5724 g_panda_rec_table(l_index).p_pricing_attribute78 := in_pricing_attribute78;
5725 g_panda_rec_table(l_index).p_pricing_attribute79 := in_pricing_attribute79;
5726 g_panda_rec_table(l_index).p_pricing_attribute80 := in_pricing_attribute80;
5727 g_panda_rec_table(l_index).p_pricing_attribute81 := in_pricing_attribute81;
5728 g_panda_rec_table(l_index).p_pricing_attribute82 := in_pricing_attribute82;
5729 g_panda_rec_table(l_index).p_pricing_attribute83 := in_pricing_attribute83;
5730 g_panda_rec_table(l_index).p_pricing_attribute84 := in_pricing_attribute84;
5731 g_panda_rec_table(l_index).p_pricing_attribute85 := in_pricing_attribute85;
5732 g_panda_rec_table(l_index).p_pricing_attribute86 := in_pricing_attribute86;
5733 g_panda_rec_table(l_index).p_pricing_attribute87 := in_pricing_attribute87;
5734 g_panda_rec_table(l_index).p_pricing_attribute88 := in_pricing_attribute88;
5735 g_panda_rec_table(l_index).p_pricing_attribute89 := in_pricing_attribute89;
5736 g_panda_rec_table(l_index).p_pricing_attribute90 := in_pricing_attribute90;
5737 g_panda_rec_table(l_index).p_pricing_attribute91 := in_pricing_attribute91;
5738 g_panda_rec_table(l_index).p_pricing_attribute92 := in_pricing_attribute92;
5739 g_panda_rec_table(l_index).p_pricing_attribute93 := in_pricing_attribute93;
5740 g_panda_rec_table(l_index).p_pricing_attribute94 := in_pricing_attribute94;
5741 g_panda_rec_table(l_index).p_pricing_attribute95 := in_pricing_attribute95;
5742 g_panda_rec_table(l_index).p_pricing_attribute96 := in_pricing_attribute96;
5743 g_panda_rec_table(l_index).p_pricing_attribute97 := in_pricing_attribute97;
5744 g_panda_rec_table(l_index).p_pricing_attribute98 := in_pricing_attribute98;
5745 g_panda_rec_table(l_index).p_pricing_attribute99 := in_pricing_attribute99;
5746 g_panda_rec_table(l_index).p_pricing_attribute100 := in_pricing_attribute100;
5747
5748 END copy_fields_to_globals;
5749
5750
5751 END oe_oe_availability;