[Home] [Help]
PACKAGE BODY: APPS.OE_OE_PRICING_AVAILABILITY
Source
1 PACKAGE BODY oe_oe_pricing_availability AS
2 /* $Header: OEXFPRAB.pls 120.20.12020000.4 2013/02/20 13:07:20 nilegupt ship $ */
3
4 --Global variables
5
6 G_PKG_NAME CONSTANT VARCHAR2(30) := 'oe_oe_pricing_availability';
7 G_ATP_TBL OE_ATP.atp_tbl_type;
8 g_order_source_id CONSTANT NUMBER :=26;
9 G_line_id CONSTANT NUMBER := -1244; --bug#16061437
10 G_atp_line_id CONSTANT NUMBER := -9987;
11 g_header_id CONSTANT NUMBER :=-2345; -- bug 8916379
12 g_hsecs number;
13 g_place varchar2(100);
14 g_total number :=0;
15 g_total2 number ;
16 global_line_index number;
17 g_upgrade_item_exists varchar2(1):='N';
18 g_upgrade_item_id number;
19 g_upgrade_order_qty_uom varchar2(30);
20 g_upgrade_ship_from_org_id number;
21
22 --Global Tables required for temp_table population.
23
24 G_LINE_INDEX_tbl QP_PREQ_GRP.pls_integer_type;
25 G_LINE_TYPE_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
26 G_PRICING_EFFECTIVE_DATE_TBL QP_PREQ_GRP.DATE_TYPE ;
27 G_ACTIVE_DATE_FIRST_TBL QP_PREQ_GRP.DATE_TYPE ;
28 G_ACTIVE_DATE_FIRST_TYPE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
29 G_ACTIVE_DATE_SECOND_TBL QP_PREQ_GRP.DATE_TYPE ;
30 G_ACTIVE_DATE_SECOND_TYPE_TBL QP_PREQ_GRP.VARCHAR_TYPE ;
31 G_LINE_QUANTITY_TBL QP_PREQ_GRP.NUMBER_TYPE ;
32 G_LINE_UOM_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
33 G_REQUEST_TYPE_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
34 G_PRICED_QUANTITY_TBL QP_PREQ_GRP.NUMBER_TYPE;
35 G_UOM_QUANTITY_TBL QP_PREQ_GRP.NUMBER_TYPE;
36 G_PRICED_UOM_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
37 G_CURRENCY_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
38 G_UNIT_PRICE_TBL QP_PREQ_GRP.NUMBER_TYPE;
39 G_PERCENT_PRICE_TBL QP_PREQ_GRP.NUMBER_TYPE;
40 G_ADJUSTED_UNIT_PRICE_TBL QP_PREQ_GRP.NUMBER_TYPE;
41 G_UPD_ADJUSTED_UNIT_PRICE_TBL QP_PREQ_GRP.NUMBER_TYPE;
42 G_PROCESSED_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
43 G_PRICE_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
44 G_LINE_ID_TBL QP_PREQ_GRP.NUMBER_TYPE;
45 G_PROCESSING_ORDER_TBL QP_PREQ_GRP.PLS_INTEGER_TYPE;
46 G_ROUNDING_FACTOR_TBL QP_PREQ_GRP.PLS_INTEGER_TYPE;
47 G_ROUNDING_FLAG_TBL QP_PREQ_GRP.FLAG_TYPE;
48 G_QUALIFIERS_EXIST_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
49 G_PRICING_ATTRS_EXIST_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
50 G_PRICE_LIST_ID_TBL QP_PREQ_GRP.NUMBER_TYPE;
51 G_PL_VALIDATED_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
52 G_PRICE_REQUEST_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
53 G_USAGE_PRICING_TYPE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
54 G_LINE_CATEGORY_TBL QP_PREQ_GRP.VARCHAR_TYPE;
55 G_PRICING_STATUS_CODE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
56 G_PRICING_STATUS_TEXT_tbl QP_PREQ_GRP.VARCHAR_TYPE;
57 G_ATTR_LINE_INDEX_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
58 G_ATTR_LINE_DETAIL_INDEX_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
59 G_ATTR_VALIDATED_FLAG_tbl QP_PREQ_GRP.VARCHAR_TYPE;
60 G_ATTR_PRICING_CONTEXT_tbl QP_PREQ_GRP.VARCHAR_TYPE;
61 G_ATTR_PRICING_ATTRIBUTE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
62 G_ATTR_ATTRIBUTE_LEVEL_tbl QP_PREQ_GRP.VARCHAR_TYPE;
63 G_ATTR_ATTRIBUTE_TYPE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
64 G_ATTR_APPLIED_FLAG_tbl QP_PREQ_GRP.VARCHAR_TYPE;
65 G_ATTR_PRICING_STATUS_CODE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
66 G_ATTR_PRICING_ATTR_FLAG_tbl QP_PREQ_GRP.VARCHAR_TYPE;
67 G_ATTR_LIST_HEADER_ID_tbl QP_PREQ_GRP.NUMBER_TYPE;
68 G_ATTR_LIST_LINE_ID_tbl QP_PREQ_GRP.NUMBER_TYPE;
69 G_ATTR_VALUE_FROM_tbl QP_PREQ_GRP.VARCHAR_TYPE;
70 G_ATTR_SETUP_VALUE_FROM_tbl QP_PREQ_GRP.VARCHAR_TYPE;
71 G_ATTR_VALUE_TO_tbl QP_PREQ_GRP.VARCHAR_TYPE;
72 G_ATTR_SETUP_VALUE_TO_tbl QP_PREQ_GRP.VARCHAR_TYPE;
73 G_ATTR_GROUPING_NUMBER_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
74 G_ATTR_NO_QUAL_IN_GRP_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
75 G_ATTR_COMP_OPERATOR_TYPE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
76 G_ATTR_PRICING_STATUS_TEXT_tbl QP_PREQ_GRP.VARCHAR_TYPE;
77 G_ATTR_QUAL_PRECEDENCE_tbl QP_PREQ_GRP.PLS_INTEGER_TYPE;
78 G_ATTR_DATATYPE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
79 G_ATTR_QUALIFIER_TYPE_tbl QP_PREQ_GRP.VARCHAR_TYPE;
80 G_ATTR_PRODUCT_UOM_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
81 G_ATTR_EXCLUDER_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
82 G_ATTR_PRICING_PHASE_ID_TBL QP_PREQ_GRP.PLS_INTEGER_TYPE;
83 G_ATTR_INCOM_GRP_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
84 G_ATTR_LDET_TYPE_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
85 G_ATTR_MODIFIER_LEVEL_CODE_TBL QP_PREQ_GRP.VARCHAR_TYPE;
86 G_ATTR_PRIMARY_UOM_FLAG_TBL QP_PREQ_GRP.VARCHAR_TYPE;
87 G_CATCHWEIGHT_QTY_TBL QP_PREQ_GRP.NUMBER_TYPE;
88 G_ACTUAL_ORDER_QTY_TBL QP_PREQ_GRP.NUMBER_TYPE;
89 G_IS_THERE_FREEZE_OVERRIDE Boolean:=TRUE;
90
91
92 --g_panda_rec_table panda_rec_table;
93 g_promotions_tbl Promotions_Tbl;
94 g_manual_modifier_tbl Manual_modifier_tbl;
95 g_modf_attributes_tbl Modifier_attributes_Tbl;
96 g_modf_rel_Tbl Modifier_assoc_Tbl;
97 g_enforce_price_flag varchar2(2) :='N';
98 g_applied_manual_tbl oe_oe_pricing_availability.number_type;
99
100 --Start of bug#7380336
101 G_PR_AV VARCHAR(20):= 'N';
102
103 FUNCTION IS_PRICING_AVAILIBILITY RETURN VARCHAR2
104 IS
105
106 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
107
108 BEGIN
109 IF l_debug_level > 0 THEN
110 oe_debug_pub.add('In function IS_PRICING_AVAILIBILITY',1);
111 oe_debug_pub.add('G_PR_AV ' || G_PR_AV);
112
113 END IF;
114 IF G_PR_AV = 'Y' THEN
115 RETURN('Y') ;
116 ELSE
117 G_PR_AV := 'N';
118 RETURN('N');
119 END IF;
120 G_PR_AV := 'N';
121 RETURN('N') ;
122
123 END IS_PRICING_AVAILIBILITY; --End of bug#7380336
124
125
126 Procedure Initialize_mrp_record
127 ( p_x_atp_rec IN OUT NOCOPY MRP_ATP_PUB.ATP_Rec_Typ
128 ,l_count IN NUMBER) IS
129
130 l_return_status varchar2(10);
131
132 --
133 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
134 --
135 BEGIN
136
137 IF l_debug_level > 0 THEN
138 oe_debug_pub.add( 'EXTENDING THE TABLE BY ' || L_COUNT , 5 ) ;
139 END IF;
140
141 MSC_SATP_FUNC.Extend_ATP
142 (p_atp_tab => p_x_atp_rec,
143 p_index => l_count,
144 x_return_status => l_return_status);
145
146 EXCEPTION
147
148 WHEN OTHERS THEN
149
150 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
151 OE_MSG_PUB.Add_Exc_Msg
152 ( G_PKG_NAME,
153 'Initialize_mrp_record');
154 END IF;
155
156 END Initialize_mrp_record;
157
158
159 Procedure Check_Results_from_rec (
160 in_global_orgs in varchar2
161 ,p_atp_rec IN MRP_ATP_PUB.ATP_Rec_Typ
162 ,x_return_status OUT NOCOPY VARCHAR2
163
164 ,x_msg_count OUT NOCOPY NUMBER
165
166 ,x_msg_data OUT NOCOPY VARCHAR2
167
168 ,x_error_message OUT NOCOPY varchar2
169
170 )IS
171
172 atp_count NUMBER := 1;
173 J NUMBER := 1;
174 l_explanation VARCHAR2(80);
175 l_type_code VARCHAR2(30);
176 l_ship_set_name VARCHAR2(30);
177 l_arrival_set_name VARCHAR2(30);
178 l_arrival_date DATE := NULL;
179 l_sch_action varchar2(100) := 'OESCH_ACT_ATP_CHECK';
180 --
181 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
182 --
183 l_lookup_type VARCHAR2(50); -- added for bug 3776769
184 l_lookup_code NUMBER;
185
186 BEGIN
187
188 x_return_status := 'S';
189 l_lookup_type := 'MTL_DEMAND_INTERFACE_ERRORS'; -- added for bug 3776769
190
191 IF l_debug_level > 0 AND
192 p_atp_rec.error_code.COUNT > 0 THEN
193 oe_debug_pub.add( '2. ENTERING CHECK_RESULTS ERROR_CODE='|| P_ATP_REC.ERROR_CODE ( J ) ||
194 ' IN_GLOBAL_ORGS='||IN_GLOBAL_ORGS ) ;
195 END IF;
196
197 IF p_atp_rec.error_code.COUNT > 0 AND
198 p_atp_rec.error_code(J) <> 0 AND
199 p_atp_rec.error_code(J) <> -99 AND -- Multi org changes.
200 p_atp_rec.error_code(J) <> 150 -- to fix bug 1880166
201
202 THEN
203
204 IF l_debug_level > 0 THEN
205 oe_debug_pub.add( 'ERROR FROM MRP: ' || P_ATP_REC.ERROR_CODE ( J ) , 1 ) ;
206 END IF;
207
208 IF p_atp_rec.error_code(J) = 80 THEN
209
210 l_explanation := null;
211 l_lookup_code := 80;
212 select meaning
213 into l_explanation
214 from mfg_lookups
215 where lookup_type = l_lookup_type
216 and lookup_code = l_lookup_code; -- added for bug 3776769
217
218
219 IF l_debug_level > 0 THEN
220 oe_debug_pub.add( 'SETTING THE MESSAGE FOR OE_SCH_NO_SOURCE' ) ;
221 END IF;
222
223 IF in_global_orgs = 'N' then
224
225 FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_NO_SOURCES');
226 OE_MSG_PUB.Add;
227 ELSE
228 x_error_message := l_explanation;
229 END IF;
230
231 ELSE
232
233 IF l_debug_level > 0 THEN
234 oe_debug_pub.add( 'SCH FAILED ERROR CODE='||P_ATP_REC.ERROR_CODE ( J ) ) ;
235 END IF;
236
237 l_explanation := null;
238 l_lookup_code := p_atp_rec.error_code(J) ; -- added for bug 3776769
239 select meaning
240 into l_explanation
241 from mfg_lookups
242 where lookup_type = l_lookup_type
243 and lookup_code =l_lookup_code; -- added for bug 3776769
244
245 IF p_atp_rec.error_code(J) = 19 THEN
246 -- This error code is given for those lines which are
247 -- in a group and whose scheduling failed due to some other lines.
248 -- We do not want to give this out as a message.
249 null;
250
251 ELSIF p_atp_rec.error_code(J) = 61 THEN
252
253 -- setting the status flag to partial for ATP not applicable
254 IF l_debug_level > 0 THEN
255 oe_debug_pub.add( 'ERROR CODE = 61' ) ;
256 END IF;
257
258 x_return_status := 'P';
259 x_error_message := l_explanation;
260
261 /* Added the following code to fix the bug 3245976 - issue 8 */
262
263 ELSIF p_atp_rec.error_code(J) = 53 THEN
264
265 x_return_status := 'E';
266 IF l_debug_level > 0 THEN
267 oe_debug_pub.add( 'ERROR CODE = 53' ) ;
268 END IF;
269
270 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_AVA_NO_REQUESTED_QTY');
271 FND_MESSAGE.SET_TOKEN('PARTIAL_QUANTITY', p_atp_rec.requested_date_quantity(J));
272 FND_MESSAGE.SET_TOKEN('REQUEST_DATE', p_atp_rec.requested_ship_date(J));
273 FND_MESSAGE.SET_TOKEN('EARLIEST_DATE', p_atp_rec.ship_date(J));
274
275 g_mrp_error_msg :=FND_MESSAGE.GET;
276 g_mrp_error_msg_flag := 'T';
277
278 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_AVA_NO_REQUESTED_QTY');
279 FND_MESSAGE.SET_TOKEN('PARTIAL_QUANTITY', p_atp_rec.requested_date_quantity(J));
280 FND_MESSAGE.SET_TOKEN('REQUEST_DATE', p_atp_rec.requested_ship_date(J));
281 FND_MESSAGE.SET_TOKEN('EARLIEST_DATE', p_atp_rec.ship_date(J));
282
283 IF in_global_orgs = 'N' then
284 OE_MSG_PUB.Add;
285 ELSE
286 x_error_message := fnd_message.get;
287 END IF;
288
289 /* End of code added to fix the bug 3245976 - issue 8 */
290
291 ELSIF p_atp_rec.Ship_Set_Name(J) is not null OR
292 p_atp_rec.Arrival_Set_Name(J) is not null THEN
293
294 -- This line belongs to a scheduling group. We do not want
295 -- to give out individual messages for each line.
296 null;
297
298 ELSE
299 IF l_debug_level > 0 THEN
300 oe_debug_pub.add( 'ADDING MESSAGE TO THE STACK' , 1 ) ;
301 END IF;
302 --FND_MESSAGE.SET_NAME('ONT','OE_SCH_OE_ORDER_FAILED');
303 --FND_MESSAGE.SET_TOKEN('EXPLANATION',l_explanation);
304
305 IF in_global_orgs = 'N' then
306 FND_MESSAGE.SET_NAME('ONT','ONT_INLNE_CUSTOMER');
307 FND_MESSAGE.SET_TOKEN('TEXT',l_explanation);
308 OE_MSG_PUB.Add;
309 ELSE
310 x_error_message := l_explanation;
311 END IF;
312
313 END IF;
314
315 END IF; -- 80
316
317 IF l_debug_level > 0 THEN
318 oe_debug_pub.add( 'SETTING ERROR' , 1 ) ;
319 END IF;
320 IF x_return_status <> 'P' then
321 x_return_status := 'E';
322 END IF;
323
324 ELSE
325
326 IF l_debug_level > 0 THEN
327 oe_debug_pub.add( ' ELSE '||P_ATP_REC.SOURCE_ORGANIZATION_ID ( 1 ) ||
328 ' ERROR CODE : ' || P_ATP_REC.ERROR_CODE ( J ) ) ;
329 END IF;
330
331 -- Muti org changes.
332 IF (p_atp_rec.error_code(J) <> -99 ) THEN
333
334 IF l_debug_level > 0 THEN
335 oe_debug_pub.add( 'ERROR CODE : ' || P_ATP_REC.ERROR_CODE ( J ) || 'IDENTIFIER : ' ||
336 P_ATP_REC.IDENTIFIER ( J ) || 'ITEM : ' ||
337 P_ATP_REC.INVENTORY_ITEM_ID ( J ));
338 oe_debug_pub.add( 'REQUEST SHIP DATE :' ||
339 TO_CHAR ( P_ATP_REC.REQUESTED_SHIP_DATE ( J ) , 'DD-MON-RR:HH:MM:SS' )
340 || 'REQUEST ARRIVAL DATE :' || P_ATP_REC.REQUESTED_ARRIVAL_DATE ( J ));
341 oe_debug_pub.add( 'ARRIVAL DATE :' ||
342 TO_CHAR ( P_ATP_REC.ARRIVAL_DATE ( J ) , 'DD-MON-RR:HH:MM:SS' ) ||
343 'SHIP DATE :' ||
344 TO_CHAR ( P_ATP_REC.SHIP_DATE ( J ) , 'DD-MON-RR:HH:MM:SS' ));
345 oe_debug_pub.add( 'LEAD TIME :' ||P_ATP_REC.DELIVERY_LEAD_TIME ( J ) ||
346 'GROUP SHIP DATE :'||P_ATP_REC.GROUP_SHIP_DATE ( J ) ||
347 'GROUP ARR DATE :'||P_ATP_REC.GROUP_ARRIVAL_DATE ( J ) ) ;
348 END IF;
349
350 l_explanation := null;
351
352 IF (p_atp_rec.error_code(J) <> 0) THEN
353
354 BEGIN
355 l_lookup_code := p_atp_rec.error_code(J) ; -- added for bug 3776769
356 select meaning
357 into l_explanation
358 from mfg_lookups
359 where lookup_type =l_lookup_type
360 and lookup_code =l_lookup_code; -- added for bug 3776769
361
362 g_atp_tbl(atp_count).error_message := l_explanation;
363 IF l_debug_level > 0 THEN
364 oe_debug_pub.add( 'EXPLANATION IS : ' || L_EXPLANATION , 1 ) ;
365 END IF;
366 x_error_message := l_explanation;
367
368 IF p_atp_rec.error_code(J) = 150 THEN
369 OE_MSG_PUB.add_text(l_explanation);
370 END IF;
371
372 EXCEPTION
373 WHEN OTHERS THEN
374 Null;
375 END;
376
377 END IF;
378
379 END IF; --Check for -99.
380
381 END IF; -- Main If;
382
383 -- umcomment for testing the error handling
384 --x_return_status := 'E';
385 --FND_MESSAGE.SET_NAME('ONT','OE_SCH_NO_SOURCE');
386 --OE_MSG_PUB.Add;
387
388 IF x_return_status ='E' and in_global_orgs = 'N' then
389 IF l_debug_level > 0 THEN
390 oe_debug_pub.add( 'DOING COUNT_AND_GET' ) ;
391 END IF;
392 oe_msg_pub.count_and_get(p_encoded=>fnd_api.G_TRUE,
393 p_count => x_msg_count,
394 p_data=>x_msg_data
395 );
396 IF l_debug_level > 0 THEN
397 oe_debug_pub.add( 'COUNT = '||X_MSG_COUNT||' MSG='||X_MSG_DATA ) ;
398 END IF;
399 END IF;
400
401 IF l_debug_level > 0 THEN
402 oe_debug_pub.add( 'EXITING CHECK_RESULTS: ' || X_RETURN_STATUS , 1 ) ;
403 END IF;
404
405 EXCEPTION
406 WHEN OTHERS THEN
407 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
408 THEN
409 OE_MSG_PUB.Add_Exc_Msg
410 ( G_PKG_NAME
411 , 'Check_Results'
412 );
413 END IF;
414 IF l_debug_level > 0 THEN
415 oe_debug_pub.add( 'UNEXPECTED ERROR IN CHECK_RESULTS' ) ;
416 END IF;
417 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
418
419 END Check_Results_from_rec;
420
421
422
423 Procedure Call_MRP_ATP(
424 in_global_orgs in varchar2,
425 in_ship_from_org_id in number,
426 out_available_qty out nocopy varchar2,
427 out_ship_from_org_id out nocopy number,
428 out_available_date out nocopy date,
429 out_qty_uom out nocopy varchar2,
430 x_out_message out nocopy varchar2,
431 x_return_status OUT NOCOPY VARCHAR2,
432 x_msg_count OUT NOCOPY NUMBER,
433 x_msg_data OUT NOCOPY VARCHAR2,
434 x_error_message out nocopy varchar2
435 ) IS
436
437 l_session_id NUMBER := 0;
438 l_mrp_atp_rec MRP_ATP_PUB.ATP_Rec_Typ;
439 l_atp_supply_demand MRP_ATP_PUB.ATP_Supply_Demand_Typ;
440 l_atp_period MRP_ATP_PUB.ATP_Period_Typ;
441 l_atp_details MRP_ATP_PUB.ATP_Details_Typ;
442 x_atp_rec MRP_ATP_PUB.ATP_Rec_Typ;
443 in_atp_rec MRP_ATP_PUB.ATP_Rec_Typ;
444 I NUMBER := 1;
445 l_mrp_calc_sd VARCHAR2(240);--bug14222176
446
447
448 --
449 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
450 --
451 BEGIN
452
453 IF l_debug_level > 0 THEN
454 oe_debug_pub.add( 'ENTERING CALL ATP' ) ;
455 END IF;
456
457 Initialize_mrp_record
458 ( p_x_atp_rec => in_atp_rec
459 ,l_count =>1 );
460
461
462 IF l_debug_level > 0 THEN
463 oe_debug_pub.add( 'INVENTORY_ITEM_ID='||g_panda_rec_table(1).P_INVENTORY_ITEM_ID
464 || ' SHIP_FORM_ORG_ID='||G_panda_rec_table(1).p_SHIP_FROM_ORG_ID
465 || ' IN_GLOBAL_ORGS='||IN_GLOBAL_ORGS);
466 oe_debug_pub.add(' CUST_ID='||G_panda_rec_table(1).p_CUSTOMER_ID|| ' SHIP_TO_ORG_ID='
467 ||G_panda_rec_table(1).p_SHIP_TO_ORG_ID||' QTY='||G_panda_rec_table(1).p_QTY
468 || ' UOM='||G_panda_rec_table(1).p_UOM||' REQ DATE='||
469 G_panda_rec_table(1).p_REQUEST_DATE ) ;
470 END IF;
471
472 --if the call is made for GA then the org_id is passed
473 IF in_global_orgs = 'Y' and
474 in_ship_from_org_id is not null then
475
476 in_atp_rec.Source_Organization_Id(1) := in_ship_from_org_id;
477 ELSE
478
479 in_atp_rec.Source_Organization_Id(1) := g_panda_rec_table(1).p_ship_from_org_id;
480 END IF;
481
482 /*SELECT OE_ORDER_LINES_S.NEXTVAL
483 INTO l_line_id
484 FROM DUAL;
485 */
486
487 IF l_debug_level > 0 THEN
488 oe_debug_pub.add( 'LINE_ID='||G_ATP_LINE_ID ) ;
489 END IF;
490
491 in_atp_rec.Identifier(I) := g_atp_line_id;
492 in_atp_rec.Action(I) := 100;
493 in_atp_rec.calling_module(I) := 660;
494 in_atp_rec.customer_id(I) := g_panda_rec_table(1).p_customer_id;
495 in_atp_rec.customer_site_id(I) := g_panda_rec_table(1).p_ship_to_org_id;
496 in_atp_rec.inventory_item_id(I) := g_panda_rec_table(1).p_inventory_item_id;
497 in_atp_rec.quantity_ordered(I) := g_panda_rec_table(1).p_qty;
498 in_atp_rec.quantity_uom(I) := g_panda_rec_table(1).p_uom;
499 in_atp_rec.Earliest_Acceptable_Date(I):= null;
500 in_atp_rec.Requested_Ship_Date(I) := g_panda_rec_table(1).p_request_date;
501 in_atp_rec.Requested_Arrival_Date(I) := null;
502 in_atp_rec.Delivery_Lead_Time(I) := Null;
503 in_atp_rec.Freight_Carrier(I) := null;
504 in_atp_rec.Ship_Method(I) := null;
505 in_atp_rec.Demand_Class(I) := g_panda_rec_table(1).p_demand_class_code; --null; --9218117
506 in_atp_rec.Ship_Set_Name(I) := null;
507 in_atp_rec.Arrival_Set_Name(I) := null;
508 in_atp_rec.Override_Flag(I) := 'N';
509 in_atp_rec.Ship_Date(I) := null;
510 in_atp_rec.Available_Quantity(I) := null;
511 in_atp_rec.Requested_Date_Quantity(I) := null;
512 in_atp_rec.Group_Ship_Date(I) := null;
513 in_atp_rec.Group_Arrival_Date(I) := null;
514 in_atp_rec.Vendor_Id(I) := null;
515 in_atp_rec.Vendor_Site_Id(I) := null;
516 --in_atp_rec.Insert_Flag(I) := 1; -- it can be 0 or 1
517 -- commented by bug14222176
518 in_atp_rec.Error_Code(I) := null;
519 in_atp_rec.Message(I) := null;
520 in_atp_rec.atp_lead_time(I) := 0;
521
522 --bug14222176
523 l_mrp_calc_sd := fnd_profile.value('MRP_ATP_CALC_SD');
524 IF nvl(l_mrp_calc_sd,'N') = 'Y' THEN
525 oe_debug_pub.add('in OEXFPRAB, MRP_ATP_CALC_SD profile set to yes ' );
526 in_atp_rec.Insert_Flag(I) := 1;
527 ELSE
528 oe_debug_pub.add('in OEXFPRAB, MRP_ATP_CALC_SD profile set to No ' );
529 in_atp_rec.Insert_Flag(I) := 0;
530 END IF;
531 --end bug14222176
532
533 SELECT mrp_atp_schedule_temp_s.nextval
534 INTO l_session_id
535 FROM dual;
536
537 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510'
538 AND MSC_ATP_GLOBAL.GET_APS_VERSION = 10 THEN
539 in_atp_rec.Included_item_flag(I) := 1; -- This has to be 1 since OM explodes included items before calling ATP.
540 -- in_atp_rec.top_model_line_id(I) := p_line_rec.top_model_line_id;
541 in_atp_rec.validation_org(I) := OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
542 END IF;
543
544 -- Call ATP
545 -- Added to display upgraded item information
546 IF g_upgrade_item_exists ='Y' then
547
548 IF l_debug_level > 0 THEN
549 oe_debug_pub.add('The Upgrade ITem Infomation before calling MRP');
550 oe_debug_pub.add('Upgraded Item id'||g_upgrade_item_id);
551 oe_debug_pub.add('Upgrade Order Uom'||g_upgrade_order_qty_uom);
552 oe_debug_pub.add('Upgrade Ship from org'||g_upgrade_ship_from_org_id);
553 END IF;
554
555 IF g_upgrade_ship_from_org_id is not null then
556 in_atp_rec.Source_Organization_Id(1):= g_upgrade_ship_from_org_id;
557 END IF;
558 IF g_upgrade_item_id is not null then
559 in_atp_rec.inventory_item_id(I):=g_upgrade_item_id;
560 END IF;
561 IF g_upgrade_order_qty_uom is not null then
562 in_atp_rec.quantity_uom(I):=g_upgrade_order_qty_uom;
563 END IF;
564
565 END IF;
566
567 IF l_debug_level > 0 THEN
568 oe_debug_pub.add('1.CALLING MRP API WITH SESSION ID '||L_SESSION_ID);
569 END IF;
570
571 IF l_debug_level > 0 THEN
572 print_time('Calling MRP');
573 END IF;
574
575 MRP_ATP_PUB.Call_ATP (
576 p_session_id => l_session_id
577 , p_atp_rec => in_atp_rec
578 , x_atp_rec => x_atp_rec
579 , x_atp_supply_demand => l_atp_supply_demand
580 , x_atp_period => l_atp_period
581 , x_atp_details => l_atp_details
582 , x_return_status => x_return_status
583 , x_msg_data => x_msg_data
584 , x_msg_count => x_msg_count
585 );
586
587 IF l_debug_level > 0 THEN
588 print_time('After Calling MRP');
589 END IF;
590
591 IF l_debug_level > 0 THEN
592 oe_debug_pub.add( 'AFTER CALL MRP_ATP_PUB.CALL_ATP STS='||X_RETURN_STATUS|| ' MSG COUNT='||X_MSG_COUNT);
593
594 IF x_atp_rec.available_quantity.COUNT > 0 AND
595 x_atp_rec.source_organization_id.COUNT > 0 then
596 oe_debug_pub.add( ' MSG DATA='||X_MSG_DATA|| 'AVL QTY='|| X_ATP_REC.AVAILABLE_QUANTITY ( 1 ) ||
597 'SHIP_FROM_ORG_ID =' ||X_ATP_REC.SOURCE_ORGANIZATION_ID ( 1 ) ) ;
598 END IF;
599 END IF;
600
601 IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
602 IF l_debug_level > 0 THEN
603 oe_debug_pub.add( 'ERROR IS' || X_MSG_DATA , 1 ) ;
604 END IF;
605 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
606 END IF;
607
608
609 Check_Results_from_rec(
610 in_global_orgs =>in_global_orgs
611 ,p_atp_rec => x_atp_rec
612 ,x_return_status => x_return_status
613 ,x_msg_count =>x_msg_count
614 ,x_msg_data =>x_msg_data
615 ,x_error_message =>x_error_message
616 );
617
618 IF l_debug_level > 0 THEN
619 oe_debug_pub.add( 'STATUS='||X_RETURN_STATUS|| ' X_ERROR_MESSAGE ='
620 ||X_ERROR_MESSAGE|| ' MSG DATA='||X_MSG_DATA ) ;
621 END IF;
622
623 /* Commented the following code to fix the bug 3245976 -- issue 8*/
624 /*
625 IF nvl(x_return_status,'E') <> 'P' then
626
627 IF l_debug_level > 0 THEN
628 oe_debug_pub.add( 'RETURN_STATUS<>P' ) ;
629 END IF;
630
631 IF nvl(x_return_status,'E') <> 'E' THEN
632 IF nvl(x_atp_rec.available_quantity(1),0) = 0 then
633
634 IF l_debug_level > 0 THEN
635 oe_debug_pub.add( 'AVAILABLE QUANTITY IS 0' ) ;
636 END IF;
637 out_available_date := null;
638 out_available_qty := 0;
639
640 ELSE
641 IF x_atp_rec.available_quantity.COUNT > 0 THEN
642 out_available_qty := x_atp_rec.available_quantity(1);
643 END IF;
644 IF x_atp_rec.ship_date.COUNT > 0 THEN
645 out_available_date := x_atp_rec.ship_date(1);
646 END IF;
647 IF x_atp_rec.group_ship_date.COUNT > 0 THEN
648 IF x_atp_rec.group_ship_date(1) is not null THEN
649 out_available_date := x_atp_rec.group_ship_date(1);
650 END IF;
651 END IF;
652
653 END IF;
654 ELSE
655 out_available_date := null;
656 out_available_qty := 0;
657
658 END IF; -- if status is not E
659
660 ELSE -- if status is P
661
662 IF l_debug_level > 0 THEN
663 oe_debug_pub.add( 'RETURN_STATUS=P MESG='||X_ERROR_MESSAGE ) ;
664 END IF;
665 out_available_qty := x_error_message;
666 out_available_date := null;
667 IF nvl(x_atp_rec.available_quantity(1),0) = 0 then
668 IF l_debug_level > 0 THEN
669 oe_debug_pub.add( 'AVAILABLE QUANTITY IS 0' ) ;
670 END IF;
671 ELSE
672 IF x_atp_rec.ship_date.COUNT > 0 THEN
673 out_available_date := x_atp_rec.ship_date(1);
674 END IF;
675 IF x_atp_rec.group_ship_date.COUNT > 0 THEN
676 IF x_atp_rec.group_ship_date(1) is not null THEN
677 out_available_date := x_atp_rec.group_ship_date(1);
678 END IF;
679 END IF;
680
681 END IF;
682 x_error_message := null;
683
684 END IF; -- if return status is not P
685
686 */
687 /* End of code commented to fix the bug 3245976 - issue 8*/
688
689 /* Added the following code to fix the bug 3245976 - issue 8 */
690
691 IF x_atp_rec.available_quantity.COUNT > 0 THEN
692 out_available_qty := x_atp_rec.available_quantity(1);
693 END IF;
694 IF x_atp_rec.ship_date.COUNT > 0 THEN
695 out_available_date := x_atp_rec.ship_date(1);
696 END IF;
697 IF x_atp_rec.group_ship_date.COUNT > 0 THEN
698 IF x_atp_rec.group_ship_date(1) is not null THEN
699 out_available_date := x_atp_rec.group_ship_date(1);
700 END IF;
701 END IF;
702 IF x_atp_rec.error_code(1) = 53 then
703 out_available_qty := x_atp_rec.requested_date_quantity(1);
704 END IF;
705
706 /* End of new code added to fix the bug 3245976 - issue 8 */
707
708 IF x_atp_rec.source_organization_id.COUNT > 0 THEN
709 out_ship_from_org_id := x_atp_rec.source_organization_id(1);
710 END IF;
711 IF x_atp_rec.quantity_uom.COUNT > 0 THEN
712 out_qty_uom := x_atp_rec.quantity_uom(1);
713 END IF;
714
715
716 IF l_debug_level > 0 THEN
717 oe_debug_pub.add( 'OUT_AVAL_QTY='||OUT_AVAILABLE_QTY|| ' SHIP_FORM_ORG_ID='||
718 OUT_SHIP_FROM_ORG_ID|| ' UOM='||OUT_QTY_UOM);
719
720
721 IF x_atp_rec.ship_date.COUNT > 0 THEN
722 oe_debug_pub.add(' OUT SHIP DATE='||X_ATP_REC.SHIP_DATE(1));
723 END IF;
724
725 IF x_atp_rec.group_ship_date.COUNT > 0 THEN
726 oe_debug_pub.add(' OUT GRP SHIP DATE='||X_ATP_REC.GROUP_SHIP_DATE(1));
727 END IF;
728
729 IF x_atp_rec.arrival_date.COUNT > 0 THEN
730 oe_debug_pub.add(' OUT ARRIVAL DATE='||X_ATP_REC.ARRIVAL_DATE(1));
731 END IF;
732
733 IF x_atp_rec.requested_date_quantity.COUNT > 0 THEN
734 oe_debug_pub.add('REQ DATE QTY='||X_ATP_REC.REQUESTED_DATE_QUANTITY(1));
735 END IF;
736 IF x_atp_rec.available_quantity.COUNT > 0 THEN
737 oe_debug_pub.add(' AVAILABLE QTY='||X_ATP_REC.AVAILABLE_QUANTITY(1));
738 END IF;
739
740 END IF; -- if debug is on
741
742
743 IF l_debug_level > 0 THEN
744 oe_debug_pub.add( 'EXITING CALL ATP' , 1 ) ;
745 END IF;
746
747
748 EXCEPTION
749
750 WHEN OTHERS THEN
751
752 IF l_debug_level > 0 THEN
753 oe_debug_pub.add( 'WHEN OTHERS OF CALL_MRP_ATP' ) ;
754 END IF;
755 IF l_debug_level > 0 THEN
756 oe_debug_pub.add( 'CODE='||SQLCODE||' MSG='||SQLERRM ) ;
757 END IF;
758 x_return_status := 'E';
759 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
760 -- Get message count and data
761 OE_MSG_PUB.Count_And_Get
762 ( p_count => x_msg_count
763 , p_data => x_msg_data
764 );
765
766 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
767 OE_MSG_PUB.Add_Exc_Msg
768 ( G_PKG_NAME,
769 'Call_MRP_ATP');
770 END IF;
771
772 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
773
774 END Call_MRP_ATP;
775
776 Procedure Enforce_price_list(in_order_type_id in number,
777 out_enforce_price_flag out nocopy varchar2)
778 IS
779 Begin
780 select nvl(enforce_line_prices_flag,'N') into out_enforce_price_flag
781 from oe_Order_types_v where Order_type_id=in_order_type_id;
782 g_enforce_price_flag:= out_enforce_price_flag;
783 exception when no_data_found then
784 out_enforce_price_flag := 'N';
785 g_enforce_price_flag:= out_enforce_price_flag;
786 End Enforce_price_list;
787
788 Procedure Pass_Upgrade_information(in_upgrade_item_exists varchar2,
789 in_upgrade_item_id in number,
790 in_upgrade_order_qty_uom in varchar2,
791 in_upgrade_ship_from_org_id in number) IS
792 BEGIN
793 g_upgrade_item_exists:=in_upgrade_item_exists;
794 g_upgrade_item_id:=in_upgrade_item_id;
795 g_upgrade_order_qty_uom:=in_upgrade_order_qty_uom;
796 g_upgrade_ship_from_org_id:= in_upgrade_ship_from_org_id;
797 END Pass_Upgrade_information;
798
799
800 PROCEDURE defaulting(
801 in_source in varchar2
802 ,in_org_id in varchar2
803 ,in_item_id in number
804 ,in_customer_id in number
805 ,in_ship_to_org_id in number
806 ,in_bill_to_org_id in number
807 ,in_agreement_id in number
808 ,in_order_type_id in number
809 ,out_wsh_id out nocopy number
810 ,out_uom out nocopy varchar2
811 ,out_item_type_code out nocopy varchar2
812 ,out_price_list_id out nocopy number
813 ,out_conversion_type out nocopy varchar2
814
815 ) IS
816
817 x_msg_count number;
818 tmp_var varchar2(2000);
819 tmp_var1 varchar2(2000);
820 x_msg_data varchar2(2000);
821 x_return_status varchar2(2000);
822
823 l_old_rec oe_ak_order_lines_v%ROWTYPE;
824 l_rec oe_ak_order_lines_v%ROWTYPE;
825 l_out_rec oe_ak_order_lines_v%ROWTYPE;
826 l_old_header_rec OE_AK_ORDER_HEADERS_V%ROWTYPE;
827 l_record OE_AK_ORDER_HEADERS_V%ROWTYPE;
828 l_out_record OE_AK_ORDER_HEADERS_V%ROWTYPE;
829
830 --
831 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
832 --
833 l_bom_item_type Varchar2(1);
834 l_pick_components_flag Varchar2(1);
835 BEGIN
836
837
838 IF l_debug_level > 0 THEN
839 oe_debug_pub.add( 'ENTERING OE_AVAILABILITY.DEFAULTING '|| ' ITEM_ID='||
840 IN_ITEM_ID|| ' SOURCE TYPE ='||IN_SOURCE|| ' ORG ID TYPE ='||IN_ORG_ID);
841 oe_debug_pub.add( ' CUSTOMER_ID ='||IN_CUSTOMER_ID|| ' SHIP_TO_ORG_ID ='||
842 IN_SHIP_TO_ORG_ID|| ' IN_BILL_TO_ORG_ID ='||IN_BILL_TO_ORG_ID
843 || ' IN_AGREEMENT_ID ='||IN_AGREEMENT_ID|| ' IN_ORDER_TYPE_ID ='
844 ||IN_ORDER_TYPE_ID ) ;
845 END IF;
846
847
848
849 IF in_source = 'ITEM' then
850
851 l_rec.inventory_item_id := in_item_id;
852 l_rec.org_id := in_org_id;
853 l_rec.sold_to_org_id := in_customer_id;
854 l_rec.ship_to_org_id := in_ship_to_org_id;
855 l_rec.ship_from_org_id := FND_API.G_MISS_NUM;
856 l_rec.order_quantity_uom := FND_API.G_MISS_CHAR;
857 --l_rec.price_list_id := FND_API.G_MISS_NUM;
858
859 l_out_rec := l_rec;
860
861 ONT_LINE_DEF_HDLR.Default_record(
862 p_x_rec => l_out_rec,
863 p_initial_rec =>l_rec,
864 p_in_old_rec => l_old_rec
865 );
866 out_wsh_id := l_out_rec.ship_from_org_id;
867 out_uom := l_out_rec.order_quantity_uom;
868 out_price_list_id := null;
869 BEGIN
870 SELECT BOM_ITEM_TYPE,PICK_COMPONENTS_FLAG
871 INTO l_bom_item_type,l_pick_components_flag
872 FROM MTL_SYSTEM_ITEMS
873 WHERE INVENTORY_ITEM_ID= in_item_id
874 AND ORGANIZATION_ID=in_org_id;
875 IF l_bom_item_type=4 AND l_pick_components_flag='N' THEN
876 out_item_type_code := 'STANDARD';
877 END IF;
878 EXCEPTION
879 WHEN NO_DATA_FOUND THEN
880 Null;
881 WHEN TOO_MANY_ROWS THEN
882 Null;
883 WHEN OTHERS THEN
884 Null;
885 END;
886
887 IF l_debug_level > 0 THEN
888 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM|| ' PRICE_LIST_ID='||
889 OUT_PRICE_LIST_ID ) ;
890 END IF;
891
892 ELSIF in_source = 'CUSTOMER' then
893
894 IF l_debug_level > 0 THEN
895 oe_debug_pub.add( 'SOURCE = CUSTOMER' ) ;
896 END IF;
897 l_record.sold_to_org_id := in_customer_id;
898 l_record.org_id := in_org_id;
899 l_record.ship_to_org_id := in_ship_to_org_id;
900 l_record.agreement_id := in_agreement_id;
901 l_record.invoice_to_org_id := in_bill_to_org_id;
902 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
903 l_record.price_list_id := FND_API.G_MISS_NUM;
904
905 l_out_record := l_record;
906
907 ONT_HEADER_Def_Hdlr.Default_Record
908 ( p_x_rec => l_out_record
909 , p_initial_rec => l_record
910 , p_in_old_rec => l_old_header_rec
911 , p_iteration => 1
912 );
913
914 out_wsh_id := l_out_record.ship_from_org_id;
915 out_price_list_id := l_out_record.price_list_id;
916
917 IF l_debug_level > 0 THEN
918 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM|| ' PRICE_LIST_ID='
919 ||OUT_PRICE_LIST_ID ) ;
920 END IF;
921
922 ELSIF in_source = 'SHIP_TO' then
923
924 l_record.sold_to_org_id := in_customer_id;
925 l_record.org_id := in_org_id;
926 l_record.ship_to_org_id := in_ship_to_org_id;
927 l_record.agreement_id := in_agreement_id;
928 l_record.invoice_to_org_id := in_bill_to_org_id;
929 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
930 l_record.price_list_id := FND_API.G_MISS_NUM;
931
932 l_out_record := l_record;
933
934 ONT_HEADER_Def_Hdlr.Default_Record
935 ( p_x_rec => l_out_record
936 , p_initial_rec => l_record
937 , p_in_old_rec => l_old_header_rec
938 , p_iteration => 1
939 );
940
941 out_wsh_id := l_out_record.ship_from_org_id;
942 out_price_list_id := l_out_record.price_list_id;
943
944 IF l_debug_level > 0 THEN
945 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM||
946 ' PRICE_LIST_ID='||OUT_PRICE_LIST_ID ) ;
947 END IF;
948
949 ELSIF in_source = 'BILL_TO' then
950
951 l_record.sold_to_org_id := in_customer_id;
952 l_record.org_id := in_org_id;
953 l_record.ship_to_org_id := in_ship_to_org_id;
954 l_record.agreement_id := in_agreement_id;
955 l_record.invoice_to_org_id := in_bill_to_org_id;
956 l_record.price_list_id := FND_API.G_MISS_NUM;
957
958 l_out_record := l_record;
959
960 ONT_HEADER_Def_Hdlr.Default_Record
961 ( p_x_rec => l_out_record
962 , p_initial_rec => l_record
963 , p_in_old_rec => l_old_header_rec
964 , p_iteration => 1
965 );
966
967 out_wsh_id := null;
968 out_uom := null;
969 out_price_list_id := l_out_record.price_list_id;
970
971 IF l_debug_level > 0 THEN
972 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM
973 || ' PRICE_LIST_ID='||OUT_PRICE_LIST_ID ) ;
974 END IF;
975
976 ELSIF in_source = 'AGREEMENT' then
977
978 l_rec.agreement_id := in_agreement_id;
979 l_rec.ship_to_org_id := in_ship_to_org_id;
980 l_rec.invoice_to_org_id := in_bill_to_org_id;
981 l_rec.sold_to_org_id := in_customer_id;
982 l_rec.org_id := in_org_id;
983 l_rec.price_list_id := FND_API.G_MISS_NUM;
984
985 l_out_rec := l_rec;
986
987 ONT_LINE_DEF_HDLR.Default_record(
988 p_x_rec => l_out_rec,
989 p_initial_rec =>l_rec,
990 p_in_old_rec => l_old_rec
991 );
992 out_wsh_id := null;
993 out_uom := null;
994 out_price_list_id := l_out_rec.price_list_id;
995
996 IF l_debug_level > 0 THEN
997 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||
998 OUT_UOM|| ' PRICE_LIST_ID='||OUT_PRICE_LIST_ID ) ;
999 END IF;
1000
1001 ELSIF in_source = 'ORDER_TYPE' then
1002
1003 l_record.org_id := in_org_id;
1004 l_record.order_type_id := in_order_type_id;
1005 l_record.conversion_type_code := FND_API.G_MISS_CHAR;
1006
1007 l_out_record := l_record;
1008
1009
1010 ONT_HEADER_Def_Hdlr.Default_Record
1011 ( p_x_rec => l_out_record
1012 , p_initial_rec => l_record
1013 , p_in_old_rec => l_old_header_rec
1014 , p_iteration => 1
1015 );
1016
1017 out_conversion_type := l_out_record.conversion_type_code;
1018 out_uom := null;
1019 out_price_list_id := null;
1020 out_wsh_id := null;
1021
1022 IF l_debug_level > 0 THEN
1023 oe_debug_pub.add( 'WSH_ID='||OUT_WSH_ID|| ' UOM='||OUT_UOM
1024 || ' CONVERSION_TYPE_CODE='||OUT_CONVERSION_TYPE ) ;
1025 END IF;
1026
1027 ELSIF in_source = 'STARTUP' then
1028
1029 l_record.org_id := in_org_id;
1030
1031 l_record.conversion_type_code := FND_API.G_MISS_CHAR;
1032 l_record.price_list_id := FND_API.G_MISS_NUM;
1033 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
1034
1035 l_out_record := l_record;
1036
1037 ONT_HEADER_Def_Hdlr.Default_Record
1038 ( p_x_rec => l_out_record
1039 , p_initial_rec => l_record
1040 , p_in_old_rec => l_old_header_rec
1041 , p_iteration => 1
1042 );
1043
1044 out_wsh_id := l_out_rec.ship_from_org_id;
1045 out_uom := l_out_rec.order_quantity_uom;
1046 out_price_list_id := l_out_record.price_list_id;
1047 out_conversion_type := l_out_record.conversion_type_code;
1048
1049
1050
1051
1052
1053 END IF; -- in source_type
1054
1055 IF l_debug_level > 0 THEN
1056 oe_debug_pub.add( 'EXITING OE_AVAILABILITY.DEFAULTING' ) ;
1057 END IF;
1058
1059 EXCEPTION
1060
1061 WHEN FND_API.G_EXC_ERROR THEN
1062
1063 x_return_status := FND_API.G_RET_STS_ERROR;
1064
1065 -- Get message count and data
1066
1067 OE_MSG_PUB.Count_And_Get
1068 ( p_count => x_msg_count
1069 , p_data => x_msg_data
1070 );
1071
1072 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1073
1074 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1075
1076 -- Get message count and data
1077
1078 OE_MSG_PUB.Count_And_Get
1079 ( p_count => x_msg_count
1080 , p_data => x_msg_data
1081 );
1082
1083 WHEN OTHERS THEN
1084
1085 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1086
1087 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1088 THEN
1089 OE_MSG_PUB.Add_Exc_Msg
1090 ( G_PKG_NAME
1091 , 'defaulting'
1092 );
1093 END IF;
1094
1095 -- Get message count and data
1096
1097 OE_MSG_PUB.Count_And_Get
1098 ( p_count => x_msg_count
1099 , p_data => x_msg_data
1100 );
1101
1102 END defaulting;
1103
1104 PROCEDURE defaulting(
1105 in_source in varchar2,
1106 in_out_default_rec in out NOCOPY /* file.sql.39 change */ default_rec
1107 ) IS
1108
1109 x_msg_count number;
1110 tmp_var varchar2(2000);
1111 tmp_var1 varchar2(2000);
1112 x_msg_data varchar2(2000);
1113 x_return_status varchar2(2000);
1114
1115 l_old_rec oe_ak_order_lines_v%ROWTYPE;
1116 l_rec oe_ak_order_lines_v%ROWTYPE;
1117 l_out_rec oe_ak_order_lines_v%ROWTYPE;
1118 l_old_header_rec OE_AK_ORDER_HEADERS_V%ROWTYPE;
1119 l_record OE_AK_ORDER_HEADERS_V%ROWTYPE;
1120 l_out_record OE_AK_ORDER_HEADERS_V%ROWTYPE;
1121
1122 --
1123 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1124 --
1125 l_bom_item_type Varchar2(1);
1126 l_pick_components_flag Varchar2(1);
1127 BEGIN
1128
1129 in_out_default_rec.created_by := FND_GLOBAL.user_id;
1130 IF l_debug_level > 0 THEN
1131 oe_debug_pub.add('ENTERING DEFAULTING PROCEDURE');
1132 oe_debug_pub.add('SOURCE ='|| in_source);
1133 oe_debug_pub.add('VALUES PASSED');
1134 oe_debug_pub.add('************************************************');
1135 oe_debug_pub.add('ORG_ID ='|| in_out_default_rec.org_id);
1136 oe_debug_pub.add('SOLD_TO_ORG_ID =' || in_out_default_rec.sold_to_org_id);
1137 oe_debug_pub.add('INVENTORY_ITEM_ID ='|| in_out_default_rec.inventory_item_id);
1138 oe_debug_pub.add('ITEM_TYPE_CODE =' || in_out_default_rec.item_type_code);
1139 oe_debug_pub.add('USER_ID ='|| in_out_default_rec.user_id);
1140 oe_debug_pub.add('CREATED_BY ='|| in_out_default_rec.created_by);
1141 oe_debug_pub.add('SHIP_TO_ORG_ID =' || in_out_default_rec.ship_to_org_id);
1142 oe_debug_pub.add('ORDER_QUANTITY_UOM =' ||in_out_default_rec.order_quantity_uom);
1143 oe_debug_pub.add('LINE_TYPE_ID ='|| in_out_default_rec.line_type_id);
1144 oe_debug_pub.add('INVOICE_TO_ORG_ID = '|| in_out_default_rec.invoice_to_org_id);
1145 oe_debug_pub.add('DEMAND_CLASS_CODE = ' || in_out_default_rec.demand_class_code);
1146 oe_debug_pub.add('AGREEMENT_ID = ' || in_out_default_rec.agreement_id );
1147 oe_debug_pub.add('ORDER_TYPE_ID ='|| in_out_default_rec.order_type_id);
1148 oe_debug_pub.add('PRICE_LIST_ID = '|| in_out_default_rec.price_list_id);
1149 oe_debug_pub.add('SHIP_FROM_ORG_ID =' || in_out_default_rec.ship_from_org_id);
1150 oe_debug_pub.add('TRANSACTIONAL_CURR_CODE ='|| in_out_default_rec.transactional_curr_code);
1151 oe_debug_pub.add('REQUEST_DATE ='|| in_out_default_rec.request_date);
1152 oe_debug_pub.add('****************************************************************');
1153 END IF;
1154
1155 IF in_source = 'ITEM' then
1156
1157 l_rec.inventory_item_id := in_out_default_rec.inventory_item_id;
1158 l_rec.org_id := in_out_default_rec.org_id;
1159 l_rec.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1160 l_rec.ship_to_org_id := in_out_default_rec.ship_to_org_id;
1161 l_rec.created_by := in_out_default_rec.created_by;
1162 l_rec.agreement_id := in_out_default_rec.agreement_id;
1163 l_rec.invoice_to_org_id := in_out_default_rec.invoice_to_org_id;
1164 l_rec.request_date := in_out_default_rec.request_date;
1165 l_rec.price_list_id := in_out_default_rec.price_list_id;
1166 l_rec.line_type_id := in_out_default_rec.line_type_id;
1167 l_rec.demand_class_code := in_out_default_rec.demand_class_code;
1168 l_rec.ship_from_org_id := FND_API.G_MISS_NUM;
1169 l_rec.order_quantity_uom := FND_API.G_MISS_CHAR;
1170 l_out_rec := l_rec;
1171
1172
1173 ONT_LINE_DEF_HDLR.Default_record(
1174 p_x_rec => l_out_rec,
1175 p_initial_rec =>l_rec,
1176 p_in_old_rec => l_old_rec
1177 );
1178
1179 in_out_default_rec.ship_from_org_id := l_out_rec.ship_from_org_id;
1180 in_out_default_rec.order_quantity_uom := l_out_rec.order_quantity_uom;
1181
1182
1183 BEGIN
1184 SELECT BOM_ITEM_TYPE,PICK_COMPONENTS_FLAG
1185 INTO l_bom_item_type,l_pick_components_flag
1186 FROM MTL_SYSTEM_ITEMS
1187 WHERE INVENTORY_ITEM_ID= in_out_default_rec.inventory_item_id
1188 AND ORGANIZATION_ID=in_out_default_rec.org_id;
1189 IF l_bom_item_type=4 AND l_pick_components_flag='N' THEN
1190 in_out_default_rec.item_type_code := 'STANDARD';
1191 END IF;
1192 EXCEPTION
1193 WHEN NO_DATA_FOUND THEN
1194 Null;
1195
1196 WHEN TOO_MANY_ROWS THEN
1197
1198 Null;
1199
1200 WHEN OTHERS THEN
1201 Null;
1202 END;
1203
1204
1205 ELSIF in_source = 'CUSTOMER' then
1206
1207 l_record.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1208 l_record.org_id := in_out_default_rec.org_id;
1209 --l_record.transactional_curr_code := in_out_default_rec.transactional_curr_code;commented for bug 15923529
1210 l_record.created_by := in_out_default_rec.created_by;
1211 l_record.request_date := in_out_default_rec.request_date;
1212 l_record.demand_class_code := in_out_default_rec.demand_class_code;
1213 l_record.ship_To_org_id := FND_API.G_MISS_NUM;
1214 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
1215 l_record.price_list_id := FND_API.G_MISS_NUM;
1216 l_record.order_type_id := FND_API.G_MISS_NUM;
1217 l_record.invoice_to_org_id := FND_API.G_MISS_NUM;
1218 l_record.agreement_id := FND_API.G_MISS_NUM;
1219 l_record.transactional_curr_code := FND_API.G_MISS_CHAR; --for testing bug 15923529
1220 l_out_record := l_record;
1221
1222 ONT_HEADER_Def_Hdlr.Default_Record
1223 ( p_x_rec => l_out_record
1224 , p_initial_rec => l_record
1225 , p_in_old_rec => l_old_header_rec
1226 , p_iteration => 1
1227 );
1228
1229 in_out_default_rec.ship_from_org_id :=l_out_record.ship_from_org_id;
1230 in_out_default_rec.price_list_id := l_out_record.price_list_id;
1231 in_out_default_rec.order_type_id := l_out_record.order_type_id;
1232 in_out_default_rec.invoice_to_org_id := l_out_record.invoice_to_org_id;
1233 in_out_default_rec.agreement_id := l_out_record.agreement_id;
1234 in_out_default_rec.ship_to_org_id := l_out_record.ship_to_org_id;
1235 in_out_default_rec.transactional_curr_code := l_out_record.transactional_curr_code; --for testing bug 15923529
1236
1237
1238 ELSIF in_source = 'SHIP_TO' then
1239
1240 l_record.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1241 l_record.org_id := in_out_default_rec.org_id;
1242 l_record.ship_to_org_id := in_out_default_rec.ship_to_org_id;
1243 l_record.agreement_id := in_out_default_rec.agreement_id;
1244 l_record.created_by := in_out_default_rec.created_by;
1245 l_record.invoice_to_org_id := in_out_default_rec.invoice_to_org_id;
1246 --l_record.transactional_curr_code := in_out_default_rec.transactional_curr_code; commented for bug 15923529
1247 l_record.request_date := in_out_default_rec.request_date;
1248 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
1249 l_record.price_list_id := FND_API.G_MISS_NUM;
1250 l_record.order_type_id := FND_API.G_MISS_NUM;
1251 l_record.demand_class_code := FND_API.G_MISS_CHAR;
1252 l_record.invoice_to_org_id := FND_API.G_MISS_NUM;
1253 l_record.transactional_curr_code := FND_API.G_MISS_CHAR; --for testing bug 15923529
1254
1255 l_out_record := l_record;
1256
1257 ONT_HEADER_Def_Hdlr.Default_Record
1258 ( p_x_rec => l_out_record
1259 , p_initial_rec => l_record
1260 , p_in_old_rec => l_old_header_rec
1261 , p_iteration => 1
1262 );
1263 in_out_default_rec.ship_from_org_id := l_out_record.ship_from_org_id;
1264 in_out_default_rec.price_list_id := l_out_record.price_list_id;
1265 in_out_default_rec.order_type_id := l_out_record.order_type_id;
1266 in_out_default_rec.demand_class_code := l_out_record.demand_class_code;
1267 in_out_default_rec.invoice_to_org_id:= l_out_record.invoice_to_org_id;
1268 in_out_default_rec.transactional_curr_code := l_out_record.transactional_curr_code; --for testing bug 15923529
1269
1270 ELSIF in_source = 'BILL_TO' then
1271
1272 l_record.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1273 l_record.org_id := in_out_default_rec.org_id;
1274 l_record.ship_to_org_id := in_out_default_rec.ship_to_org_id;
1275 l_record.agreement_id := in_out_default_rec.agreement_id;
1276 l_record.invoice_to_org_id := in_out_default_rec.invoice_to_org_id;
1277 --l_record.transactional_curr_code := in_out_default_rec.transactional_curr_code; commented for bug 15923529
1278 l_record.ship_from_org_id := in_out_default_rec.ship_from_org_id;
1279 l_record.demand_class_code := in_out_default_rec.demand_class_code;
1280 l_record.created_by := in_out_default_rec.created_by;
1281 l_record.request_date := in_out_default_rec.request_date;
1282 l_record.price_list_id := FND_API.G_MISS_NUM;
1283 l_record.order_type_id := FND_API.G_MISS_NUM;
1284 l_record.transactional_curr_code := FND_API.G_MISS_CHAR; --for testing bug 15923529
1285 l_out_record := l_record;
1286
1287 ONT_HEADER_Def_Hdlr.Default_Record
1288 ( p_x_rec => l_out_record
1289 , p_initial_rec => l_record
1290 , p_in_old_rec => l_old_header_rec
1291 , p_iteration => 1
1292 );
1293
1294 in_out_default_rec.price_list_id := l_out_record.price_list_id;
1295 in_out_default_rec.order_type_id := l_out_record.order_type_id;
1296 in_out_default_rec.transactional_curr_code := l_out_record.transactional_curr_code; --for testing bug 15923529
1297
1298 ELSIF in_source = 'AGREEMENT' then
1299
1300
1301 l_rec.agreement_id := in_out_default_rec.agreement_id;
1302 l_rec.ship_to_org_id := in_out_default_rec.ship_to_org_id;
1303 l_rec.inventory_item_id := in_out_default_rec.inventory_item_id;
1304 l_rec.request_date := in_out_default_rec.request_date;
1305 l_rec.line_type_id := in_out_default_rec.line_type_id;
1306 l_rec.ship_from_org_id := in_out_default_rec.ship_from_org_id;
1307 l_rec.order_quantity_uom := in_out_default_rec.order_quantity_uom;
1308 l_rec.demand_class_code := in_out_default_rec.demand_class_code;
1309 l_rec.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1310 l_rec.org_id := in_out_default_rec.org_id;
1311 l_rec.created_by := in_out_default_rec.created_by;
1312 l_rec.price_list_id := FND_API.G_MISS_NUM;
1313 l_rec.invoice_to_org_id := FND_API.G_MISS_NUM;
1314 l_out_rec := l_rec;
1315
1316
1317
1318 ONT_LINE_DEF_HDLR.Default_record(
1319 p_x_rec => l_out_rec,
1320 p_initial_rec =>l_rec,
1321 p_in_old_rec => l_old_rec
1322 );
1323 in_out_default_rec.price_list_id := l_out_rec.price_list_id;
1324 in_out_default_rec.invoice_to_org_id := l_out_rec.invoice_to_org_id;
1325
1326 --bug 4517640
1327 l_record.agreement_id := in_out_default_rec.agreement_id;
1328 l_record.ship_to_org_id := in_out_default_rec.ship_to_org_id;
1329 l_record.request_date := in_out_default_rec.request_date;
1330 l_record.ship_from_org_id := in_out_default_rec.ship_from_org_id;
1331 l_record.demand_class_code := in_out_default_rec.demand_class_code;
1332 l_record.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1333 l_record.org_id := in_out_default_rec.org_id;
1334 l_record.created_by := in_out_default_rec.created_by;
1335 l_record.price_list_id := in_out_default_rec.price_list_id;
1336 l_record.invoice_to_org_id := in_out_default_rec.invoice_to_org_id;
1337 l_record.transactional_curr_code :=FND_API.G_MISS_CHAR;
1338 l_out_record := l_record;
1339
1340 ONT_HEADER_Def_Hdlr.Default_Record
1341 ( p_x_rec => l_out_record
1342 , p_initial_rec => l_record
1343 , p_in_old_rec => l_old_header_rec
1344 , p_iteration => 1
1345 );
1346 in_out_default_rec.transactional_curr_code :=l_out_record.transactional_curr_code;
1347
1348 --end 4517640
1349
1350 ELSIF in_source = 'ORDER_TYPE' then
1351
1352 l_record.org_id := in_out_default_rec.org_id;
1353 l_record.order_type_id := in_out_default_rec.order_type_id;
1354 l_record.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1355 l_record.ship_to_org_id := in_out_default_rec.ship_to_org_id;
1356 l_record.agreement_id := in_out_default_rec.agreement_id;
1357 l_record.invoice_to_org_id := in_out_default_rec.invoice_to_org_id;
1358 l_record.created_by := in_out_default_rec.created_by;
1359 l_record.request_date := in_out_default_rec.request_date;
1360 --Bug 7347299
1361 l_record.conversion_type_code := FND_API.G_MISS_CHAR;
1362
1363 l_record.demand_class_code := FND_API.G_MISS_CHAR;
1364 l_record.price_list_id := FND_API.G_MISS_NUM;
1365 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
1366 l_record.transactional_curr_code := FND_API.G_MISS_CHAR;
1367 l_out_record := l_record;
1368
1369
1370 ONT_HEADER_Def_Hdlr.Default_Record
1371 ( p_x_rec => l_out_record
1372 , p_initial_rec => l_record
1373 , p_in_old_rec => l_old_header_rec
1374 , p_iteration => 1
1375 );
1376
1377
1378 in_out_default_rec.demand_class_code := l_out_record.demand_class_code;
1379 in_out_default_rec.price_list_id := l_out_record.price_list_id;
1380 in_out_default_rec.ship_from_org_id := l_out_record.ship_from_org_id;
1381 in_out_default_rec.transactional_curr_code := l_out_record.transactional_curr_code;
1382 --Bug 7347299
1383 in_out_default_rec.conversion_type_code := l_out_record.conversion_type_code;
1384
1385
1386 ELSIF in_source ='LINE_TYPE' then
1387
1388 l_rec.agreement_id := in_out_default_rec.agreement_id;
1389 l_rec.ship_to_org_id := in_out_default_rec.ship_to_org_id;
1390 l_rec.inventory_item_id := in_out_default_rec.inventory_item_id;
1391 l_rec.request_date := in_out_default_rec.request_date;
1392 l_rec.line_type_id := in_out_default_rec.line_type_id;
1393 l_rec.invoice_to_org_id := in_out_default_rec.invoice_to_org_id;
1394 l_rec.order_quantity_uom := in_out_default_rec.order_quantity_uom;
1395 l_rec.created_by := in_out_default_rec.created_by;
1396 l_rec.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1397 l_rec.org_id := in_out_default_rec.org_id;
1398
1399 l_rec.price_list_id := FND_API.G_MISS_NUM;
1400 l_rec.ship_from_org_id := FND_API.G_MISS_NUM;
1401 l_rec.demand_class_code := FND_API.G_MISS_CHAR;
1402 l_out_rec := l_rec;
1403
1404 ONT_LINE_DEF_HDLR.Default_record(
1405 p_x_rec => l_out_rec,
1406 p_initial_rec =>l_rec,
1407 p_in_old_rec => l_old_rec
1408 );
1409
1410 in_out_default_rec.price_list_id := l_out_rec.price_list_id;
1411 in_out_default_rec.ship_from_org_id := l_out_rec.ship_from_org_id;
1412 in_out_default_rec.demand_class_code := l_out_rec.demand_class_code;
1413
1414 ELSIF in_source = 'PRICE_LIST' then
1415
1416 IF UPPER(fnd_profile.value('QP_MULTI_CURRENCY_INSTALLED')) NOT IN ('Y', 'YES') THEN
1417
1418 l_record.org_id := in_out_default_rec.org_id;
1419 l_record.order_type_id := in_out_default_rec.order_type_id;
1420 l_record.sold_to_org_id := in_out_default_rec.sold_to_org_id;
1421 l_record.ship_to_org_id := in_out_default_rec.ship_to_org_id;
1422 l_record.agreement_id := in_out_default_rec.agreement_id;
1423 l_record.invoice_to_org_id := in_out_default_rec.invoice_to_org_id;
1424 l_record.created_by := in_out_default_rec.created_by;
1425 l_record.request_date := in_out_default_rec.request_date;
1426
1427 l_record.demand_class_code := in_out_default_rec.demand_class_code;
1428 l_record.price_list_id := in_out_default_rec.price_list_id;
1429 l_record.ship_from_org_id := in_out_default_rec.ship_from_org_id;
1430
1431 l_record.transactional_curr_code := FND_API.G_MISS_CHAR;
1432 l_out_record := l_record;
1433 ONT_HEADER_Def_Hdlr.Default_Record
1434 ( p_x_rec => l_out_record
1435 , p_initial_rec => l_record
1436 , p_in_old_rec => l_old_header_rec
1437 , p_iteration => 1
1438 );
1439
1440
1441 in_out_default_rec.transactional_curr_code := l_out_record.transactional_curr_code;
1442
1443 END IF;
1444
1445 ELSIF in_source = 'STARTUP' then
1446
1447 l_record.org_id := in_out_default_rec.org_id;
1448 l_record.created_by := in_out_default_rec.created_by;
1449 l_record.request_date := in_out_default_rec.request_date;
1450 -- for line level defaulting
1451 l_rec.org_id := in_out_default_rec.org_id;
1452 l_rec.created_by := in_out_default_rec.created_by;
1453 l_rec.request_date := in_out_default_rec.request_date;
1454
1455
1456
1457 l_record.price_list_id := FND_API.G_MISS_NUM;
1458 l_record.ship_from_org_id := FND_API.G_MISS_NUM;
1459 l_record.order_type_id := FND_API.G_MISS_NUM;
1460 l_record.agreement_id := FND_API.G_MISS_NUM;
1461 l_record.demand_class_code := FND_API.G_MISS_CHAR;
1462 l_record.transactional_curr_code := FND_API.G_MISS_CHAR;
1463 l_record.invoice_to_org_id := FND_API.G_MISS_NUM;
1464 l_record.ship_to_org_id := FND_API.G_MISS_NUM;
1465 l_record.sold_to_org_id := FND_API.G_MISS_NUM;
1466 --Bug 7347299
1467 l_record.conversion_type_code := FND_API.G_MISS_CHAR;
1468
1469 l_out_record := l_record;
1470
1471 ONT_HEADER_Def_Hdlr.Default_Record
1472 ( p_x_rec => l_out_record
1473 , p_initial_rec => l_record
1474 , p_in_old_rec => l_old_header_rec
1475 , p_iteration => 1
1476 );
1477
1478 in_out_default_rec.ship_from_org_id := l_out_record.ship_from_org_id;
1479 in_out_default_rec.price_list_id := l_out_record.price_list_id;
1480 in_out_default_rec.order_type_id := l_out_record.order_type_id;
1481 in_out_default_rec.agreement_id := l_out_record.agreement_id;
1482 in_out_default_rec.demand_class_code := l_out_record.demand_class_code;
1483 in_out_default_rec.transactional_curr_code := l_out_record.transactional_curr_code;
1484 in_out_default_rec.invoice_to_org_id := l_out_record.invoice_to_org_id;
1485 in_out_default_rec.ship_to_org_id := l_out_record.ship_to_org_id;
1486 in_out_default_rec.sold_to_org_id := l_out_record.sold_to_org_id;
1487 --Bug 7347299
1488 in_out_default_rec.conversion_type_code := l_out_record.conversion_type_code;
1489 -- code added to get the item identifier type
1490
1491 l_rec.agreement_id := FND_API.G_MISS_NUM;
1492 l_rec.ship_to_org_id := FND_API.G_MISS_NUM;
1493 l_rec.inventory_item_id := FND_API.G_MISS_NUM;
1494 l_rec.line_type_id := FND_API.G_MISS_NUM;
1495 l_rec.invoice_to_org_id := FND_API.G_MISS_NUM;
1496 l_rec.order_quantity_uom := FND_API.G_MISS_CHAR;
1497 l_rec.sold_to_org_id :=FND_API.G_MISS_NUM;
1498 l_rec.price_list_id := FND_API.G_MISS_NUM;
1499 l_rec.ship_from_org_id := FND_API.G_MISS_NUM;
1500 l_rec.demand_class_code := FND_API.G_MISS_CHAR;
1501 l_rec.item_identifier_type := FND_API.G_MISS_CHAR;
1502 l_out_rec := l_rec;
1503
1504 ONT_LINE_DEF_HDLR.Default_record(
1505 p_x_rec => l_out_rec,
1506 p_initial_rec =>l_rec,
1507 p_in_old_rec => l_old_rec
1508 );
1509
1510
1511 in_out_default_rec.item_type_code := l_out_rec.item_identifier_type;
1512
1513
1514 END IF; -- in source_type
1515
1516 IF l_debug_level > 0 THEN
1517
1518 oe_debug_pub.add('VALUES RETURNED FROM DEFAULTING');
1519 oe_debug_pub.add('************************************************');
1520 oe_debug_pub.add('SOLD_TO_ORG_ID =' || in_out_default_rec.sold_to_org_id);
1521 oe_debug_pub.add('ITEM_TYPE_CODE =' || in_out_default_rec.item_type_code);
1522 oe_debug_pub.add('SHIP_TO_ORG_ID =' || in_out_default_rec.ship_to_org_id);
1523 oe_debug_pub.add('ORDER_QUANTITY_UOM =' ||in_out_default_rec.order_quantity_uom);
1524 oe_debug_pub.add('LINE_TYPE_ID ='|| in_out_default_rec.line_type_id);
1525 oe_debug_pub.add('INVOICE_TO_ORG_ID = '|| in_out_default_rec.invoice_to_org_id);
1526 oe_debug_pub.add('DEMAND_CLASS_CODE = ' || in_out_default_rec.demand_class_code);
1527 oe_debug_pub.add('AGREEMENT_ID = ' || in_out_default_rec.agreement_id );
1528 oe_debug_pub.add('ORDER_TYPE_ID ='|| in_out_default_rec.order_type_id);
1529 oe_debug_pub.add('PRICE_LIST_ID = '|| in_out_default_rec.price_list_id);
1530 oe_debug_pub.add('SHIP_FROM_ORG_ID =' || in_out_default_rec.ship_from_org_id);
1531 oe_debug_pub.add('TRANSACTIONAL_CURR_CODE ='|| in_out_default_rec.transactional_curr_code);
1532 oe_debug_pub.add('****************************************************************');
1533 oe_debug_pub.add( 'EXITING OE_AVAILABILITY.DEFAULTING' ) ;
1534 END IF;
1535
1536 EXCEPTION
1537
1538 WHEN FND_API.G_EXC_ERROR THEN
1539
1540 x_return_status := FND_API.G_RET_STS_ERROR;
1541
1542 -- Get message count and data
1543
1544 OE_MSG_PUB.Count_And_Get
1545 ( p_count => x_msg_count
1546 , p_data => x_msg_data
1547 );
1548
1549 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1550
1551 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1552
1553 -- Get message count and data
1554
1555 OE_MSG_PUB.Count_And_Get
1556 ( p_count => x_msg_count
1557 , p_data => x_msg_data
1558 );
1559
1560 WHEN OTHERS THEN
1561
1562 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1563
1564 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1565 THEN
1566 OE_MSG_PUB.Add_Exc_Msg
1567 ( G_PKG_NAME
1568 , 'defaulting'
1569 );
1570 END IF;
1571
1572 -- Get message count and data
1573
1574 OE_MSG_PUB.Count_And_Get
1575 ( p_count => x_msg_count
1576 , p_data => x_msg_data
1577 );
1578
1579 END defaulting;
1580
1581
1582
1583
1584 Procedure Query_Qty_Tree(p_org_id IN NUMBER,
1585 p_item_id IN NUMBER,
1586 p_sch_date IN DATE DEFAULT NULL,
1587 x_on_hand_qty OUT NOCOPY NUMBER,
1588
1589 x_avail_to_reserve OUT NOCOPY NUMBER
1590
1591 ) IS
1592
1593 l_return_status VARCHAR2(1);
1594 l_msg_count NUMBER;
1595 l_msg_data VARCHAR2(2000);
1596 l_qoh NUMBER;
1597 l_rqoh NUMBER;
1598 l_qr NUMBER;
1599 l_qs NUMBER;
1600 l_att NUMBER;
1601 l_atr NUMBER;
1602 l_msg_index NUMBER;
1603 l_lot_control_flag BOOLEAN;
1604 l_lot_control_code NUMBER;
1605 l_org_id NUMBER;
1606
1607 --
1608 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1609 --
1610 BEGIN
1611
1612 IF l_debug_level > 0 THEN
1613 oe_debug_pub.add( 'ENTERING QUERY_QTY_TREE'|| 'ORG IS : ' || P_ORG_ID
1614 || 'ITEM IS : ' || P_ITEM_ID ) ;
1615 END IF;
1616
1617 BEGIN
1618 IF p_org_id is null THEN
1619 l_org_id := OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
1620 END IF;
1621
1622 SELECT msi.lot_control_code
1623 INTO l_lot_control_code
1624 FROM mtl_system_items msi
1625 WHERE msi.inventory_item_id = p_item_id
1626 AND msi.organization_id = nvl(p_org_id,l_org_id);
1627
1628 IF l_lot_control_code = 2 THEN
1629 l_lot_control_flag := TRUE;
1630 ELSE
1631 l_lot_control_flag := FALSE;
1632 END IF;
1633
1634 EXCEPTION
1635 WHEN OTHERS THEN
1636 l_lot_control_flag := FALSE;
1637 END;
1638
1639 inv_quantity_tree_pub.query_quantities
1640 ( p_api_version_number => 1.0
1641 , x_return_status => l_return_status
1642 , x_msg_count => l_msg_count
1643 , x_msg_data => l_msg_data
1644 , p_organization_id => p_org_id
1645 , p_inventory_item_id => p_item_id
1646 , p_tree_mode => 2
1647 , p_is_revision_control => false
1648 , p_is_lot_control => l_lot_control_flag
1649 , p_lot_expiration_date => nvl(p_sch_date,sysdate)
1650 , p_is_serial_control => false
1651 , p_revision => null
1652 , p_lot_number => null
1653 , p_subinventory_code => null
1654 , p_locator_id => null
1655 , x_qoh => l_qoh
1656 , x_rqoh => l_rqoh
1657 , x_qr => l_qr
1658 , x_qs => l_qs
1659 , x_att => l_att
1660 , x_atr => l_atr
1661 );
1662
1663 IF l_debug_level > 0 THEN
1664 oe_debug_pub.add( 'RR: L_QOH ' || L_QOH|| 'RR: L_QOH ' || L_ATR ) ;
1665 END IF;
1666
1667 x_on_hand_qty := l_qoh;
1668 x_avail_to_reserve := l_atr;
1669
1670 IF l_debug_level > 0 THEN
1671 oe_debug_pub.add( 'EXITING QUERY_QTY_TREE ' , 1 ) ;
1672 END IF;
1673
1674 END Query_Qty_Tree;
1675
1676
1677
1678 PROCEDURE get_ship_from_org(in_org_id in number,
1679 out_code out nocopy varchar2,
1680
1681 out_name out nocopy varchar2
1682
1683 )IS
1684
1685 --
1686 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1687 --
1688 BEGIN
1689 SELECT organization_code,
1690 name
1691 INTO out_code,
1692 out_name
1693 FROM oe_ship_from_orgs_v
1694 WHERE organization_id = in_org_id;
1695
1696 EXCEPTION
1697
1698 WHEN OTHERS THEN
1699 IF l_debug_level > 0 THEN
1700 oe_debug_pub.add( 'GET_SHIP_FROM_ORG WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1701 END IF;
1702
1703 END get_ship_From_org;
1704
1705 PROCEDURE get_sold_to_org(in_org_id in number,
1706 out_name out nocopy varchar2,
1707 out_cust_id out nocopy number
1708 )IS
1709
1710 --
1711 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1712 --
1713 BEGIN
1714 SELECT p.party_name,p.party_id
1715 INTO out_name,out_cust_id
1716 FROM hz_parties p ,hz_cust_accounts c
1717 WHERE p.party_id=c.party_id and c.cust_account_id = in_org_id;
1718
1719 EXCEPTION
1720 WHEN OTHERS THEN
1721 IF l_debug_level > 0 THEN
1722 oe_debug_pub.add( 'GET_SHIP_FROM_ORG WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1723 END IF;
1724
1725 END get_sold_to_org;
1726
1727 --bug5621717
1728 PROCEDURE get_sold_to_org(in_org_id in number,
1729 out_name out nocopy varchar2,
1730 out_cust_id out nocopy varchar2
1731 )IS
1732
1733 --
1734 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1735 --
1736 BEGIN
1737 SELECT p.party_name,c.ACCOUNT_NUMBER
1738 INTO out_name,out_cust_id
1739 FROM hz_parties p ,hz_cust_accounts c
1740 WHERE p.party_id=c.party_id and c.cust_account_id = in_org_id;
1741
1742 EXCEPTION
1743 WHEN OTHERS THEN
1744 IF l_debug_level > 0 THEN
1745 oe_debug_pub.add( 'GET_SHIP_FROM_ORG WHEN OTHERS varchar-'|| SQLCODE||SQLERRM ) ;
1746 END IF;
1747
1748 END get_sold_to_org;
1749
1750 PROCEDURE get_ship_to_org(in_org_id in number,
1751 out_name out nocopy varchar2
1752
1753 )IS
1754
1755 --
1756 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1757 --
1758 BEGIN
1759 SELECT name
1760 INTO out_name
1761 FROM oe_ship_to_orgs_v
1762 WHERE organization_id = in_org_id;
1763
1764 EXCEPTION
1765
1766 WHEN OTHERS THEN
1767 IF l_debug_level > 0 THEN
1768 oe_debug_pub.add( 'GET_SHIP_TO_ORG WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1769 END IF;
1770
1771 END get_ship_to_org;
1772
1773
1774 PROCEDURE get_order_type(in_order_type_id in number,
1775 out_name out nocopy varchar2
1776
1777 )IS
1778
1779 --
1780 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1781 --
1782 BEGIN
1783 SELECT name
1784 INTO out_name
1785 FROM oe_order_types_v
1786 WHERE order_type_id = in_order_type_id;
1787
1788 EXCEPTION
1789
1790 WHEN OTHERS THEN
1791 IF l_debug_level > 0 THEN
1792 oe_debug_pub.add( 'GET_ORDER_TYPE WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1793 END IF;
1794
1795
1796 END get_order_type;
1797
1798
1799
1800
1801 PROCEDURE get_currency_name(in_transactional_curr_code in varchar2,
1802 out_name out nocopy varchar2
1803
1804 )IS
1805
1806 --
1807 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1808 l_temp varchar2(30);
1809 --
1810 BEGIN
1811 if l_debug_level > 0 then
1812 oe_debug_pub.add('entering transactional curency with currency code'||in_transactional_curr_code);
1813 end if;
1814 l_temp := UPPER(in_transactional_curr_code)||'%';
1815 SELECT name
1816 INTO out_name
1817 FROM fnd_currencies_vl
1818 WHERE currency_code like l_temp;
1819
1820 EXCEPTION
1821
1822 WHEN OTHERS THEN
1823 IF l_debug_level > 0 THEN
1824 oe_debug_pub.add( 'GET_CURRENCY WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1825 END IF;
1826
1827 END get_currency_name;
1828
1829
1830 PROCEDURE get_demand_class(in_demand_class_code in varchar2,
1831 out_name out nocopy varchar2
1832
1833 )IS
1834
1835 --
1836 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1837 l_temp varchar2(30);
1838 --
1839 BEGIN
1840 if l_debug_level > 0 then
1841 oe_Debug_pub.add('entering demand class doe with'||in_demand_class_code);
1842 end if;
1843 l_temp:= UPPER(in_demand_class_code)||'%';
1844
1845 SELECT demand_class
1846 INTO out_name
1847 FROM oe_demand_classes_v
1848 WHERE demand_class_code like l_temp;
1849 EXCEPTION
1850
1851 WHEN OTHERS THEN
1852 IF l_debug_level > 0 THEN
1853 oe_debug_pub.add( 'GET_DEMAND_CLASS WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1854 END IF;
1855
1856
1857 END get_demand_class;
1858
1859 PROCEDURE get_invoice_to_org(in_bill_to_org_id in number,
1860 out_name out nocopy varchar2
1861
1862 )IS
1863
1864 --
1865 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1866 --
1867 BEGIN
1868 SELECT name
1869 INTO out_name
1870 FROM oe_invoice_to_orgs_v
1871 WHERE organization_id = in_bill_to_org_id;
1872
1873 EXCEPTION
1874
1875 WHEN OTHERS THEN
1876 IF l_debug_level > 0 THEN
1877 oe_debug_pub.add( 'GET_INVOICE_TO_ORG WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1878 END IF;
1879
1880
1881 END get_invoice_to_org;
1882
1883 PROCEDURE get_agreement_name(in_agreement_id in number,
1884 out_name out nocopy varchar2
1885
1886 )IS
1887
1888 --
1889 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1890 --
1891 BEGIN
1892 SELECT agreement_name
1893 INTO out_name
1894 FROM oe_agreements_lov_v
1895 WHERE agreement_id = in_agreement_id;
1896
1897 EXCEPTION
1898
1899 WHEN OTHERS THEN
1900 IF l_debug_level > 0 THEN
1901 oe_debug_pub.add( 'GET_AGREEMENT_NAME WHEN OTHERS '|| SQLCODE||SQLERRM ) ;
1902 END IF;
1903
1904
1905 END get_agreement_name;
1906
1907
1908
1909
1910
1911
1912 procedure copy_Header_to_request(
1913 p_request_type_code in varchar2
1914 ,p_calculate_price_flag in varchar2
1915 -- ,px_req_line_tbl in out nocopy QP_PREQ_GRP.LINE_TBL_TYPE
1916 ,px_req_line_tbl in out nocopy oe_oe_pricing_availability.QP_LINE_TBL_TYPE
1917 ) is
1918
1919 l_line_index pls_integer := 0;
1920
1921 --
1922 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1923 --
1924 BEGIN
1925
1926 IF l_debug_level > 0 THEN
1927 oe_debug_pub.add( 'ENTERING OE_AVAILABILITY.COPY_HEADER_TO_REQUEST' , 1 ) ;
1928 END IF;
1929
1930 l_line_index := l_line_index+1;
1931 px_req_line_tbl(l_line_index).REQUEST_TYPE_CODE :=p_Request_Type_Code;
1932 px_req_line_tbl(l_line_index).LINE_INDEX := l_line_index;
1933 px_req_line_tbl(l_line_index).LINE_TYPE_CODE := 'ORDER';
1934 -- Hold the header_id in line_id for 'HEADER' Records
1935
1936 px_req_line_tbl(l_line_index).line_id := g_line_id;
1937
1938 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
1939 px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE := trunc(sysdate);
1940 Else
1941 px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE := g_panda_rec_table(1).p_pricing_date;
1942 End If;
1943
1944 px_req_line_tbl(l_line_index).CURRENCY_CODE := g_panda_rec_table(1).p_currency;
1945 px_req_line_tbl(l_line_index).PRICE_FLAG := p_calculate_price_flag;
1946 px_req_line_tbl(l_line_index).Active_date_first_type := 'ORD';
1947 px_req_line_tbl(l_line_index).Active_date_first := g_panda_rec_table(1).p_request_date;
1948
1949 --If G_ROUNDING_FLAG = 'Y' Then
1950 IF g_panda_rec_table(1).p_price_list_id is not null then
1951 px_req_line_tbl(l_line_index).Rounding_factor := Get_Rounding_factor(g_panda_rec_table(1).p_price_list_id);
1952 END IF;
1953 --End If;
1954
1955 IF l_debug_level > 0 THEN
1956 oe_debug_pub.add( 'CURR='||G_panda_rec_table(1).p_CURRENCY||' REQ DATE='||
1957 G_panda_rec_table(1).p_REQUEST_DATE||' ROUNDING_FACTOR='||
1958 PX_REQ_LINE_TBL ( L_LINE_INDEX ) .ROUNDING_FACTOR ) ;
1959 END IF;
1960
1961 --px_req_line_tbl(l_line_index).price_request_code := p_header_rec.price_request_code; -- PROMOTIONS SEP/01
1962 --populating temp tables
1963 G_LINE_INDEX_TBL.delete;
1964 if l_debug_level > 0 then
1965 oe_debug_pub.add('********** POPULATING HEADER RECORD INTO TEMP TABLE *********************');
1966 --oe_debug_pub.add('line index is='||G_LINE_INDEX_TBL(l_line_index));
1967 end if;
1968 G_LINE_INDEX_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_INDEX;
1969 G_LINE_TYPE_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_TYPE_CODE;
1970 G_PRICING_EFFECTIVE_DATE_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE);
1971 G_ACTIVE_DATE_FIRST_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).ACTIVE_DATE_FIRST);
1972 G_ACTIVE_DATE_FIRST_TYPE_TBL(l_line_index) := px_req_line_tbl(l_line_index).ACTIVE_DATE_FIRST_TYPE;
1973 G_ACTIVE_DATE_SECOND_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).ACTIVE_DATE_SECOND);
1974 G_ACTIVE_DATE_SECOND_TYPE_TBL(l_line_index):= px_req_line_tbl(l_line_index).ACTIVE_DATE_SECOND_TYPE;
1975 G_LINE_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_QUANTITY;
1976 G_LINE_UOM_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_UOM_CODE;
1977 G_REQUEST_TYPE_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).REQUEST_TYPE_CODE;
1978 G_PRICED_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICED_QUANTITY;
1979 G_UOM_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).UOM_QUANTITY;
1980 G_PRICED_UOM_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICED_UOM_CODE;
1981 G_CURRENCY_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).CURRENCY_CODE;
1982 G_UNIT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).unit_price; -- AG
1983 G_PERCENT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).PERCENT_PRICE;
1984 G_ADJUSTED_UNIT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).ADJUSTED_UNIT_PRICE;
1985 G_PROCESSED_FLAG_TBL(l_line_index) := QP_PREQ_GRP.G_NOT_PROCESSED;
1986 G_PRICE_FLAG_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICE_FLAG;
1987 G_LINE_ID_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_ID;
1988 if l_debug_level >0 then
1989 oe_debug_pub.add('the order line id'||G_LINE_ID_TBL(l_line_index));
1990 end if;
1991 G_ROUNDING_FLAG_TBL(l_line_index) := NULL;
1992 G_ROUNDING_FACTOR_TBL(l_line_index) := px_req_line_tbl(l_line_index).ROUNDING_FACTOR;
1993 G_PROCESSING_ORDER_TBL(l_line_index) := NULL;
1994 G_PRICING_STATUS_CODE_tbl(l_line_index) := QP_PREQ_GRP.G_STATUS_UNCHANGED;
1995 G_PRICING_STATUS_TEXT_tbl(l_line_index) := NULL;
1996
1997 G_QUALIFIERS_EXIST_FLAG_TBL(l_line_index) :='N';
1998 G_PRICING_ATTRS_EXIST_FLAG_TBL(l_line_index) :='N';
1999 G_PRICE_LIST_ID_TBL(l_line_index) :=g_panda_rec_table(1).p_price_list_id;
2000 G_PL_VALIDATED_FLAG_TBL(l_line_index) := 'N';
2001 G_PRICE_REQUEST_CODE_TBL(l_line_index) := NULL;
2002 G_USAGE_PRICING_TYPE_TBL(l_line_index) :='REGULAR';
2003 G_UPD_ADJUSTED_UNIT_PRICE_TBL(l_line_index) :=NULL;
2004 G_LINE_CATEGORY_TBL(l_line_index) :=NULL;
2005 G_CATCHWEIGHT_QTY_TBL(l_line_index) := NULL;
2006 G_ACTUAL_ORDER_QTY_TBL(l_line_index) :=NULL;
2007
2008 --Temp Table population done
2009
2010 IF l_debug_level > 0 THEN
2011 oe_debug_pub.add( 'EXITING oe_oe_pricing_availability.COPY_HEADER_TO_REQUEST' ) ;
2012 END IF;
2013
2014 END copy_Header_to_request;
2015
2016
2017 PROCEDURE copy_Line_to_request(
2018 -- px_req_line_tbl in out nocopy QP_PREQ_GRP.LINE_TBL_TYPE
2019 px_req_line_tbl in out nocopy oe_oe_pricing_availability.QP_LINE_TBL_TYPE
2020 ,p_pricing_event in varchar2
2021 ,p_Request_Type_Code in varchar2
2022 ,p_honor_price_flag in VARCHAR2 Default 'Y'
2023 ,p_line_index in number
2024 ) IS
2025
2026 l_line_index pls_integer := nvl(px_req_line_tbl.count,0);
2027 l_uom_rate NUMBER;
2028 v_discounting_privilege VARCHAR2(30);
2029 l_item_type_code VARCHAR2(30);
2030
2031 --
2032 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2033 --
2034 begin
2035
2036 IF l_debug_level > 0 THEN
2037 oe_debug_pub.add( 'ENTERING OE_ORDER_ADJ_PVT.COPY_LINE_TO_REQUEST' , 1 ) ;
2038 END IF;
2039
2040 l_line_index := l_line_index+1;
2041 global_line_index:=l_line_index;
2042 -- px_req_line_tbl(l_line_index).Line_id := g_line_id;
2043 px_req_line_tbl(l_line_index).Line_id := g_panda_rec_table(p_line_index).p_line_id;
2044 px_req_line_tbl(l_line_index).REQUEST_TYPE_CODE := p_Request_Type_Code;
2045 px_req_line_tbl(l_line_index).LINE_INDEX := l_line_index;
2046 px_req_line_tbl(l_line_index).LINE_TYPE_CODE := 'LINE';
2047
2048 IF g_panda_rec_table(p_line_index).p_pricing_date is null or
2049 g_panda_rec_table(p_line_index).p_pricing_date = fnd_api.g_miss_date then
2050 px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE := trunc(sysdate);
2051 ELSE
2052 px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE := g_panda_rec_table(p_line_index).p_pricing_date;
2053 END IF;
2054
2055 px_req_line_tbl(l_line_index).LINE_QUANTITY := g_panda_rec_table(p_line_index).p_qty ;
2056 px_req_line_tbl(l_line_index).LINE_UOM_CODE := g_panda_rec_table(p_line_index).p_uom;
2057 px_req_line_tbl(l_line_index).PRICED_QUANTITY := g_panda_rec_table(p_line_index).p_qty;
2058 px_req_line_tbl(l_line_index).PRICED_UOM_CODE := g_panda_rec_table(p_line_index).p_uom;
2059 px_req_line_tbl(l_line_index).CURRENCY_CODE :=g_panda_rec_table(p_line_index).p_currency;
2060 px_req_line_tbl(l_line_index).UNIT_PRICE := Null;
2061 --px_req_line_tbl(l_line_index).PERCENT_PRICE := p_Line_rec.unit_list_percent;
2062 IF l_debug_level > 0 THEN
2063 oe_debug_pub.add( 'QTY='||G_panda_rec_table(p_line_index).p_QTY||' UOM ='||
2064 G_panda_rec_table(p_line_index).p_UOM||' CURR='||G_panda_rec_table(p_line_index).p_CURRENCY ) ;
2065 END IF;
2066
2067 /*If (p_Line_rec.service_period = p_Line_rec.Order_quantity_uom) Then
2068 px_req_line_tbl(l_line_index).UOM_QUANTITY := p_Line_rec.service_duration;
2069 Else
2070 INV_CONVERT.INV_UM_CONVERSION(From_Unit => p_Line_rec.service_period
2071 ,To_Unit => p_Line_rec.Order_quantity_uom
2072 ,Item_ID => p_Line_rec.Inventory_item_id
2073 ,Uom_Rate => l_Uom_rate);
2074 px_req_line_tbl(l_line_index).UOM_QUANTITY := p_Line_rec.service_duration * l_uom_rate;
2075 End If; */
2076
2077 /* Rounding factor is not needed now as it willbe calculated in QP since the rounding
2078 flag passed in control req is 'Q'. Bug fix for issue 5893353 --FP bug 7363233 smbalara
2079 --If G_ROUNDING_FLAG = 'Y' Then
2080 px_req_line_tbl(l_line_index).Rounding_factor :=
2081 Get_Rounding_factor(g_panda_rec_table(p_line_index).p_price_list_id);
2082 --End If;
2083 */
2084
2085 px_req_line_tbl(l_line_index).PRICE_FLAG := 'Y';
2086
2087
2088 -- Get Discounting Privilege Profile Option value
2089 fnd_profile.get('ONT_DISCOUNTING_PRIVILEGE', v_discounting_privilege);
2090
2091 -- Execute the pricing phase if the list price is null
2092
2093 IF p_pricing_event = 'PRICE' and
2094
2095
2096 px_req_line_tbl(l_line_index).UNIT_PRICE is null then
2097
2098 px_req_line_tbl(l_line_index).PRICE_FLAG := 'Y' ;
2099
2100 END IF;
2101
2102 --l_item_type_code := oe_line_util.Get_Return_Item_Type_Code(p_Line_rec);
2103 l_item_type_code := 'STANDARD';
2104
2105 px_req_line_tbl(l_line_index).Active_date_first_type := 'ORD';
2106 px_req_line_tbl(l_line_index).Active_date_first := g_panda_rec_table(p_line_index).p_request_date;
2107
2108 IF g_panda_rec_table(p_line_index).p_request_date is not null then
2109 px_req_line_tbl(l_line_index).Active_date_Second_type := 'SHIP';
2110 px_req_line_tbl(l_line_index).Active_date_Second := g_panda_rec_table(p_line_index).p_request_date;
2111 End If;
2112
2113 --px_req_line_tbl(l_line_index).price_request_code := p_line_rec.price_request_code; -- PROMOTIONS SEP/01
2114 --px_req_line_tbl(l_line_index).line_category :=p_line_rec.line_category_code;
2115 If l_debug_level >0 then
2116 oe_debug_pub.add('********Temp tables population for lines **************');
2117 oe_debug_pub.add('LINE INDEX'||l_line_index);
2118 END IF;
2119
2120 G_LINE_INDEX_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_INDEX;
2121 G_LINE_TYPE_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_TYPE_CODE;
2122 G_PRICING_EFFECTIVE_DATE_TBL(l_line_index):= TRUNC(px_req_line_tbl(l_line_index).PRICING_EFFECTIVE_DATE);
2123 G_ACTIVE_DATE_FIRST_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).ACTIVE_DATE_FIRST);
2124 G_ACTIVE_DATE_FIRST_TYPE_TBL(l_line_index):= px_req_line_tbl(l_line_index).ACTIVE_DATE_FIRST_TYPE;
2125 G_ACTIVE_DATE_SECOND_TBL(l_line_index) := TRUNC(px_req_line_tbl(l_line_index).ACTIVE_DATE_SECOND);
2126 G_ACTIVE_DATE_SECOND_TYPE_TBL(l_line_index):= px_req_line_tbl(l_line_index).ACTIVE_DATE_SECOND_TYPE;
2127 --px_req_line_tbl(l_line_index).priced_quantity := NULL;
2128 IF l_debug_level > 0 THEN
2129 oe_debug_pub.add( 'QUANTITY'||PX_REQ_LINE_TBL(L_LINE_INDEX).LINE_QUANTITY||' '||
2130 PX_REQ_LINE_TBL(L_LINE_INDEX).PRICED_QUANTITY , 3 ) ;
2131 END IF;
2132 IF l_debug_level > 0 THEN
2133 oe_debug_pub.add( 'PRICE FLAG'||PX_REQ_LINE_TBL(L_LINE_INDEX).PRICE_FLAG ) ;
2134 END IF;
2135 G_LINE_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_QUANTITY;
2136
2137 G_LINE_UOM_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_UOM_CODE;
2138 G_REQUEST_TYPE_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).REQUEST_TYPE_CODE;
2139 G_PRICED_QUANTITY_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICED_QUANTITY;
2140 G_UOM_QUANTITY_TBL(l_line_index) := NULL;
2141 G_PRICED_UOM_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICED_UOM_CODE;
2142 G_CURRENCY_CODE_TBL(l_line_index) := px_req_line_tbl(l_line_index).CURRENCY_CODE;
2143 IF l_debug_level > 0 THEN
2144 oe_debug_pub.add( 'UNIT PRICE'||PX_REQ_LINE_TBL(L_LINE_INDEX).UNIT_PRICE||' '||
2145 PX_REQ_LINE_TBL(L_LINE_INDEX).ADJUSTED_UNIT_PRICE ) ;
2146 END IF;
2147 G_UNIT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).unit_price; -- AG
2148 G_PERCENT_PRICE_TBL(l_line_index) := NULL;
2149 G_ADJUSTED_UNIT_PRICE_TBL(l_line_index) := px_req_line_tbl(l_line_index).ADJUSTED_UNIT_PRICE;
2150 G_PROCESSED_FLAG_TBL(l_line_index) := QP_PREQ_GRP.G_NOT_PROCESSED;
2151 G_PRICE_FLAG_TBL(l_line_index) := px_req_line_tbl(l_line_index).PRICE_FLAG;
2152 G_LINE_ID_TBL(l_line_index) := px_req_line_tbl(l_line_index).LINE_ID;
2153 IF l_debug_level > 0 THEN
2154 oe_debug_pub.add( 'LINE ID IN G_LINE_ID_TBL:'|| G_LINE_ID_TBL ( L_LINE_INDEX ) ) ;
2155 END IF;
2156 G_ROUNDING_FLAG_TBL(l_line_index) := NULL; -- AG
2157 G_ROUNDING_FACTOR_TBL(l_line_index) := px_req_line_tbl(l_line_index).ROUNDING_FACTOR;
2158 G_PROCESSING_ORDER_TBL(l_line_index) := NULL;
2159 G_PRICING_STATUS_CODE_tbl(l_line_index) := QP_PREQ_GRP.G_STATUS_UNCHANGED; -- AG
2160 G_PRICING_STATUS_TEXT_tbl(l_line_index) := NULL;
2161 G_QUALIFIERS_EXIST_FLAG_TBL(l_line_index) :='N';
2162 G_PRICING_ATTRS_EXIST_FLAG_TBL(l_line_index) :='N';
2163
2164 --start 3471501
2165 --G_PRICE_LIST_ID_TBL(l_line_index) :=g_panda_rec_table(1).p_price_list_id;
2166
2167 G_PRICE_LIST_ID_TBL(l_line_index) :=g_panda_rec_table(p_line_index).p_price_list_id;
2168
2169 --end 3471501
2170
2171 G_PL_VALIDATED_FLAG_TBL(l_line_index) := 'N';
2172 G_PRICE_REQUEST_CODE_TBL(l_line_index) := NULL;
2173 G_USAGE_PRICING_TYPE_TBL(l_line_index) :='REGULAR';
2174 G_UPD_ADJUSTED_UNIT_PRICE_TBL(l_line_index) :=NULL;
2175 G_LINE_CATEGORY_TBL(l_line_index) := NULL;
2176
2177
2178 IF l_debug_level > 0 THEN
2179 oe_debug_pub.add( 'EXITING oe_oe_pricing_availability.COPY_LINE_TO_REQUEST' , 1 ) ;
2180 END IF;
2181
2182 END copy_Line_to_request;
2183
2184
2185
2186 PROCEDURE set_pricing_control_record (
2187 l_Control_Rec in out NOCOPY /* file.sql.39 change */ oe_oe_pricing_availability.QP_CONTROL_RECORD_TYPE
2188 ,in_pricing_event in varchar2)IS
2189
2190 --
2191 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2192 --
2193 BEGIN
2194 if g_enforce_price_flag ='Y' then
2195 l_control_rec.pricing_event := 'PRICE';
2196 else
2197 l_control_rec.pricing_event := in_pricing_event;
2198 end if;
2199 l_Control_Rec.calculate_flag := QP_PREQ_GRP.G_SEARCH_N_CALCULATE;
2200 l_control_rec.simulation_flag := 'Y';
2201
2202 l_control_rec.gsa_check_flag := 'Y';
2203 l_control_rec.gsa_dup_check_flag := 'Y';
2204 --newly added
2205 l_control_rec.temp_table_insert_flag := 'N';
2206 l_control_rec.request_type_code := 'ONT';
2207 --l_control_rec.request_type_code := 'ASO';
2208 l_control_rec.rounding_flag := 'Q';
2209 l_control_rec.use_multi_currency:='Y';
2210 l_control_rec.SOURCE_ORDER_AMOUNT_FLAG := 'Y'; -- bug 5965668--FP bug 7491750 smbalara
2211
2212 END set_pricing_control_record;
2213
2214 Procedure copy_control_rec(in_Control_Rec in oe_oe_pricing_availability.QP_CONTROL_RECORD_TYPE,
2215 x_Control_Rec out NOCOPY /* file.sql.39 change */ QP_PREQ_GRP.CONTROL_RECORD_TYPE) IS
2216
2217 Begin
2218 x_control_rec.pricing_event := in_control_rec.pricing_event;
2219 x_Control_Rec.calculate_flag := in_control_Rec.calculate_flag;
2220 x_control_rec.simulation_flag:= in_control_rec.simulation_flag;
2221 x_control_rec.gsa_check_flag := in_control_rec.gsa_check_flag;
2222 x_control_rec.gsa_dup_check_flag := in_Control_rec.gsa_dup_check_flag;
2223 x_control_rec.temp_table_insert_flag := in_control_rec.temp_table_insert_flag;
2224 x_control_rec.request_type_code := in_control_rec.request_type_code;
2225 x_control_rec.rounding_flag := in_control_rec.rounding_flag;
2226 x_control_rec.use_multi_currency:= in_Control_rec.use_multi_currency;
2227 x_control_rec.SOURCE_ORDER_AMOUNT_FLAG :=in_Control_rec.SOURCE_ORDER_AMOUNT_FLAG; -- bug 5965668--FP bug 7491750 smbalara
2228
2229
2230 End copy_control_rec;
2231
2232
2233 PROCEDURE build_context_for_line(
2234 p_req_line_tbl_count in number,
2235 p_price_request_code in varchar2,
2236 p_item_type_code in varchar2,
2237 p_Req_line_attr_tbl in out nocopy oe_oe_pricing_availability.QP_LINE_ATTR_TBL_TYPE,
2238 p_Req_qual_tbl in out nocopy oe_oe_pricing_availability.QP_QUAL_TBL_TYPE,
2239 p_line_index in number
2240 )IS
2241
2242 qp_attr_mapping_error exception;
2243 l_master_org_id Number:= OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
2244 l_org_id Number;
2245 p_pricing_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type;
2246 p_qualifier_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type;
2247
2248 --
2249 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2250 l_pass_line VARCHAR2(1) :='N';
2251 --
2252 BEGIN
2253
2254 IF l_debug_level > 0 THEN
2255 oe_debug_pub.add( 'BEFORE QP_ATTR_MAPPING_PUB.BUILD_CONTEXTS FOR LINE' , 1 ) ;
2256 END IF;
2257
2258 -- added for bug 5645866/5847803
2259 l_org_id := OE_GLOBALS.G_ORG_ID;
2260 IF l_org_id IS NULL THEN
2261 OE_GLOBALS.Set_Context;
2262 l_org_id := OE_GLOBALS.G_ORG_ID;
2263 END IF;
2264
2265 IF l_debug_level > 0 THEN
2266 oe_debug_pub.add( 'ORG_ID='||L_ORG_ID|| ' PRICING_DATE='||
2267 G_panda_rec_table(p_line_index).p_PRICING_DATE|| ' INV ITEM_IE='
2268 ||G_panda_rec_table(p_line_index).p_INVENTORY_ITEM_ID);
2269 oe_debug_pub.add( ' AGREEMENT_ID='||G_panda_rec_table(p_line_index).p_AGREEMENT_ID||
2270 ' REQ DATE='||G_panda_rec_table(p_line_index).p_REQUEST_DATE||
2271 ' SHIP_TO_ORG_ID='||G_panda_rec_table(p_line_index).p_SHIP_TO_ORG_ID||
2272 ' INVOICE_TO_ORG_ID='||G_panda_rec_table(p_line_index).p_INVOICE_TO_ORG_ID ) ;
2273 END IF;
2274
2275 IF l_debug_level > 0 THEN
2276 oe_debug_pub.add( 'QTY='||G_panda_rec_table(p_line_index).p_QTY||
2277 ' ITEM_TYPE_CODE='||P_ITEM_TYPE_CODE||
2278 ' PRICE_LIST_ID='||G_panda_rec_table(p_line_index).p_PRICE_LIST_ID||
2279 ' CUST_ID='||G_panda_rec_table(p_line_index).p_CUSTOMER_ID||
2280 ' PRICE REQ CODE='||P_PRICE_REQUEST_CODE||
2281 ' UOM='||G_panda_rec_table(p_line_index).p_UOM ) ;
2282 END IF;
2283
2284 oe_order_pub.g_line.org_id := l_org_id;
2285 oe_order_pub.g_line.pricing_date := g_panda_rec_table(p_line_index).p_pricing_date;
2286 oe_order_pub.g_line.inventory_item_id := g_panda_rec_table(p_line_index).p_inventory_item_id;
2287 oe_order_pub.g_line.agreement_id := g_panda_rec_table(p_line_index).p_agreement_id;
2288 --oe_order_pub.g_line.ordered_date := g_request_date;
2289 oe_order_pub.g_line.ship_to_org_id := g_panda_rec_table(p_line_index).p_ship_to_org_id;
2290 oe_order_pub.g_line.invoice_to_org_id := g_panda_rec_table(p_line_index).p_invoice_to_org_id;
2291 oe_order_pub.g_line.ordered_quantity := g_panda_rec_table(p_line_index).p_qty;
2292 oe_order_pub.g_line.line_type_id := g_panda_rec_table(p_line_index).p_line_type_id;
2293 oe_order_pub.g_line.item_identifier_type := g_panda_rec_table(p_line_index).p_item_identifier_type;
2294 oe_order_pub.g_line.ordered_item_id := g_panda_rec_table(p_line_index).p_ordered_item_id;
2295 --oe_order_pub.g_line.line_id := g_line_id;
2296 oe_order_pub.g_line.line_id := g_panda_rec_table(p_line_index).p_line_id;
2297 oe_order_pub.g_line.header_id := g_header_id;
2298 oe_order_pub.g_line.item_type_code := p_item_type_code;
2299 oe_order_pub.g_line.price_list_id := g_panda_rec_table(p_line_index).p_price_list_id;
2300 oe_order_pub.g_line.sold_to_org_id := g_panda_rec_table(p_line_index).p_customer_id;
2301 oe_order_pub.g_line.price_request_code := p_price_request_code;
2302 oe_order_pub.g_line.order_quantity_uom := g_panda_rec_table(p_line_index).p_uom;
2303 -- Added for the bug 4150554
2304 oe_order_pub.g_line.ship_from_org_id := g_panda_rec_table(p_line_index).p_ship_from_org_id;
2305
2306 --BUG#7671483
2307 /*The change is done to fetch the Order_category_code based on Order_Type
2308 As Order_Category is directly related to Order_Type so if Order_Type is
2309 mentioned the corresponding Order_Category should be determined and
2310 interfaced to Pricing*/
2311 oe_order_pub.g_hdr.order_type_id := g_panda_rec_table(p_line_index).p_order_type_id;
2312
2313 oe_debug_pub.add('order_type_id' || oe_order_pub.g_hdr.order_type_id);
2314
2315 oe_order_pub.g_hdr.order_category_code := OE_Header_Util.Get_Order_Type(g_panda_rec_table(1).p_order_type_id);
2316
2317 oe_debug_pub.add('order_category_code' || oe_order_pub.g_hdr.order_category_code);
2318 oe_debug_pub.add('in line' ||g_panda_rec_table(p_line_index).p_order_type_id );
2319 --BUG#7671483
2320 oe_order_pub.g_hdr.transactional_curr_code:= g_panda_rec_table(p_line_index).p_currency ; --14002299
2321
2322 IF g_panda_rec_table(p_line_index).p_item_identifier_type ='INT' then
2323
2324 SELECT concatenated_segments
2325 INTO oe_order_pub.g_line.ordered_item
2326 FROM mtl_system_items_kfv
2327 WHERE inventory_item_id = g_panda_rec_table(p_line_index).p_inventory_item_id
2328 AND organization_id = l_master_org_id; -- bug 5645866/5847803
2329
2330 End IF;
2331
2332 QP_Attr_Mapping_PUB.Build_Contexts(
2333 p_request_type_code => 'ONT',
2334 p_line_index =>global_line_index,
2335 p_pricing_type_code =>'L',
2336 p_check_line_flag => 'N',
2337 p_pricing_event =>'BATCH',
2338 x_pass_line =>l_pass_line);
2339
2340
2341 IF l_debug_level > 0 THEN
2342 oe_debug_pub.add('l_PASS_LINE'||l_pass_line);
2343 END IF;
2344
2345 IF l_debug_level > 0 THEN
2346 oe_debug_pub.add( 'EXIT QP_ATTR_MAPPING_PUB.BUILD_CONTEXTS FOR LINE' , 1 ) ;
2347 END IF;
2348
2349 EXCEPTION
2350 when no_data_found then
2351 Null;
2352 when others then
2353 Raise QP_ATTR_MAPPING_ERROR;
2354
2355 END build_context_for_line;
2356
2357
2358
2359 PROCEDURE build_context_for_header(
2360 p_req_line_tbl_count in number,
2361 p_price_request_code in varchar2,
2362 p_item_type_code in varchar2,
2363 p_Req_line_attr_tbl in out nocopy oe_oe_pricing_availability.QP_LINE_ATTR_TBL_TYPE,
2364 p_Req_qual_tbl in out nocopy oe_oe_pricing_availability.QP_QUAL_TBL_TYPE
2365 )IS
2366
2367 qp_attr_mapping_error exception;
2368 -- l_org_id Number:= OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
2369 l_org_id Number;
2370 p_pricing_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type;
2371 p_qualifier_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type;
2372
2373 --
2374 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2375 --
2376 BEGIN
2377
2378 IF l_debug_level > 0 THEN
2379 oe_debug_pub.add( 'BEFORE QP_ATTR_MAPPING_PUB.BUILD_CONTEXTS FOR HEADER' , 1 ) ;
2380 END IF;
2381
2382 -- bug 5645866/5847803
2383 l_org_id := OE_GLOBALS.G_ORG_ID;
2384 IF l_org_id IS NULL THEN
2385 OE_GLOBALS.Set_Context;
2386 l_org_id := OE_GLOBALS.G_ORG_ID;
2387 END IF;
2388
2389 IF l_debug_level > 0 THEN
2390 oe_debug_pub.add( 'ORG_ID='||L_ORG_ID|| ' PRICING_DATE='||
2391 G_panda_rec_table(1).p_PRICING_DATE|| ' AGREEMENT_ID='||
2392 G_panda_rec_table(1).p_AGREEMENT_ID|| ' REQ DATE='||
2393 G_panda_rec_table(1).p_REQUEST_DATE|| ' SHIP_TO_ORG_ID='||
2394 G_panda_rec_table(1).p_SHIP_TO_ORG_ID|| ' INVOICE_TO_ORG_ID='||
2395 G_panda_rec_table(1).p_INVOICE_TO_ORG_ID ) ;
2396 END IF;
2397
2398 IF l_debug_level > 0 THEN
2399 oe_debug_pub.add( 'QTY='||G_panda_rec_table(1).p_QTY||
2400 ' PRICE_LIST_ID='||G_panda_rec_table(1).p_PRICE_LIST_ID||
2401 ' CUST_ID='||G_panda_rec_table(1).p_CUSTOMER_ID|| ' PRICE REQ CODE='||
2402 P_PRICE_REQUEST_CODE ) ;
2403 END IF;
2404
2405 oe_order_pub.g_hdr.agreement_id := g_panda_rec_table(1).p_agreement_id;
2406 oe_order_pub.g_hdr.invoice_to_org_id := g_panda_rec_table(1).p_invoice_to_org_id;
2407 oe_order_pub.g_hdr.ordered_date := g_panda_rec_table(1).p_request_date;
2408 oe_order_pub.g_hdr.header_id := g_header_id;
2409 oe_order_pub.g_hdr.org_id := l_org_id;
2410 oe_order_pub.g_hdr.price_list_id := g_panda_rec_table(1).p_price_list_id;
2411 oe_order_pub.g_hdr.price_request_code := p_price_request_code;
2412 oe_order_pub.g_hdr.pricing_date := g_panda_rec_table(1).p_pricing_date;
2413 oe_order_pub.g_hdr.request_date := g_panda_rec_table(1).p_request_date;
2414 oe_order_pub.g_hdr.ship_to_org_id := g_panda_rec_table(1).p_ship_to_org_id;
2415 oe_order_pub.g_hdr.sold_to_org_id := g_panda_rec_table(1).p_customer_id;
2416 oe_order_pub.g_hdr.order_type_id := g_panda_rec_table(1).p_order_type_id;
2417 oe_order_pub.g_hdr.ship_from_org_id := g_panda_rec_table(1).p_ship_from_org_id;
2418 --oe_order_pub.g_line.inventory_item_id := p_inventory_item_id;
2419 --oe_order_pub.g_line.ordered_quantity := p_ordered_quantity;
2420 --oe_order_pub.g_line.line_id := g_line_id;
2421 --oe_order_pub.g_line.item_type_code := p_item_type_code;
2422 --oe_order_pub.g_line.order_quantity_uom := p_uom;
2423
2424
2425
2426 QP_ATTR_Mapping_PUB.Build_Contexts(
2427 p_request_type_code =>'ONT',
2428 p_line_index =>1,
2429 p_pricing_type_code =>'H');
2430
2431
2432
2433 IF l_debug_level > 0 THEN
2434 oe_debug_pub.add( 'EXIT QP_ATTR_MAPPING_PUB.BUILD_CONTEXTS FOR HEADER' , 1 ) ;
2435 END IF;
2436
2437 EXCEPTION
2438 when no_data_found then
2439 Null;
2440 when others then
2441 Raise QP_ATTR_MAPPING_ERROR;
2442
2443 END build_context_for_header;
2444
2445
2446
2447 procedure Append_attributes(
2448 p_header_id number default null
2449 ,p_Line_id number default null
2450 ,p_line_index number
2451 ,px_Req_line_attr_tbl in out nocopy oe_oe_pricing_availability.QP_LINE_ATTR_TBL_TYPE
2452 ,px_Req_qual_tbl in out nocopy oe_oe_pricing_availability.QP_QUAL_TBL_TYPE
2453 ,p_g_line_index in number
2454
2455 ) is
2456
2457 i pls_integer;
2458
2459 --
2460 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2461
2462 --
2463 BEGIN
2464
2465 IF l_debug_level > 0 THEN
2466 oe_debug_pub.add('ENTERING oe_oe_pricing_availability.APPEND_ATTRIBUTES'||
2467 ' p_line_id='||p_line_id);
2468 END IF;
2469
2470 -- if line_id is not null, this does not apply to header level
2471 IF p_line_id is not null then
2472
2473 IF l_debug_level > 0 THEN
2474 oe_debug_pub.add( 'appending main attributes');
2475 END IF;
2476
2477 IF g_panda_rec_table(p_g_line_index).p_pricing_attribute1 is not null then
2478 i := px_Req_line_attr_tbl.count+1;
2479 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2480 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2481 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2482 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE1';
2483 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE1;
2484 END IF;
2485
2486 IF g_panda_rec_table(p_g_line_index).p_pricing_attribute2 is not null then
2487 i := px_Req_line_attr_tbl.count+1;
2488 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2489 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2490 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2491 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE2';
2492 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE2;
2493 END IF;
2494
2495 IF g_panda_rec_table(p_g_line_index).p_pricing_attribute3 is not null then
2496 i := px_Req_line_attr_tbl.count+1;
2497 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2498 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2499 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2500 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE3';
2501 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE3;
2502 END IF;
2503
2504 IF g_panda_rec_table(p_g_line_index).p_pricing_attribute4 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_ATTRIBUTE4';
2510 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE4;
2511 END IF;
2512
2513 if g_panda_rec_table(p_g_line_index).p_pricing_attribute5 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_ATTRIBUTE5';
2519 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE5;
2520 end if;
2521
2522 if g_panda_rec_table(p_g_line_index).p_pricing_attribute6 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_ATTRIBUTE6';
2528 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE6;
2529 end if;
2530
2531 if g_panda_rec_table(p_g_line_index).p_pricing_attribute7 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_ATTRIBUTE7';
2537 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE7;
2538 end if;
2539
2540 if g_panda_rec_table(p_g_line_index).p_pricing_attribute8 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_ATTRIBUTE8';
2546 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE8;
2547 end if;
2548
2549 if g_panda_rec_table(p_g_line_index).p_pricing_attribute9 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_ATTRIBUTE9';
2555 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE9;
2556 end if;
2557
2558 if g_panda_rec_table(p_g_line_index).p_pricing_attribute10 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_ATTRIBUTE10';
2564 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE10;
2565 end if;
2566
2567 if g_panda_rec_table(p_g_line_index).p_pricing_attribute11 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_ATTRIBUTE11';
2573 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE11;
2574 end if;
2575
2576 if g_panda_rec_table(p_g_line_index).p_pricing_attribute12 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_ATTRIBUTE12';
2582 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE12;
2583 end if;
2584
2585 if g_panda_rec_table(p_g_line_index).p_pricing_attribute13 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_ATTRIBUTE13';
2591 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE13;
2592 end if;
2593
2594 if g_panda_rec_table(p_g_line_index).p_pricing_attribute14 is not null then
2595 i := px_Req_line_attr_tbl.count+1;
2596 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2597 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2598 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2599 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE14';
2600 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE14;
2601 end if;
2602
2603 if g_panda_rec_table(p_g_line_index).p_pricing_attribute15 is not null then
2604 i := px_Req_line_attr_tbl.count+1;
2605 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2606 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2607 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2608 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE15';
2609 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE15;
2610 end if;
2611
2612 if g_panda_rec_table(p_g_line_index).p_pricing_attribute16 is not null then
2613 i := px_Req_line_attr_tbl.count+1;
2614 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2615 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2616 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2617 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE16';
2618 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE16;
2619 end if;
2620
2621 if g_panda_rec_table(p_g_line_index).p_pricing_attribute17 is not null then
2622 i := px_Req_line_attr_tbl.count+1;
2623 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2624 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2625 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2626 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE17';
2627 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE17;
2628 end if;
2629
2630 if g_panda_rec_table(p_g_line_index).p_pricing_attribute18 is not null then
2631 i := px_Req_line_attr_tbl.count+1;
2632 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2633 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2634 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2635 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE18';
2636 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE18;
2637 end if;
2638
2639 if g_panda_rec_table(p_g_line_index).p_pricing_attribute19 is not null then
2640 i := px_Req_line_attr_tbl.count+1;
2641 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2642 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2643 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2644 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE19';
2645 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE19;
2646 end if;
2647
2648 if g_panda_rec_table(p_g_line_index).p_pricing_attribute20 is not null then
2649 i := px_Req_line_attr_tbl.count+1;
2650 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2651 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2652 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2653 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE20';
2654 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE20;
2655 end if;
2656
2657 if g_panda_rec_table(p_g_line_index).p_pricing_attribute21 is not null then
2658 i := px_Req_line_attr_tbl.count+1;
2659 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2660 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2661 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2662 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE21';
2663 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE21;
2664 end if;
2665
2666 if g_panda_rec_table(p_g_line_index).p_pricing_attribute22 is not null then
2667 i := px_Req_line_attr_tbl.count+1;
2668 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2669 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2670 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2671 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE22';
2672 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE22;
2673 end if;
2674
2675 if g_panda_rec_table(p_g_line_index).p_pricing_attribute23 is not null then
2676 i := px_Req_line_attr_tbl.count+1;
2677 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2678 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2679 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2680 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE23';
2681 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE23;
2682 end if;
2683
2684 if g_panda_rec_table(p_g_line_index).p_pricing_attribute24 is not null then
2685 i := px_Req_line_attr_tbl.count+1;
2686 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2687 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2688 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2689 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE24';
2690 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE24;
2691 end if;
2692
2693 if g_panda_rec_table(p_g_line_index).p_pricing_attribute25 is not null then
2694 i := px_Req_line_attr_tbl.count+1;
2695 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2696 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2697 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2698 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE25';
2699 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE25;
2700 end if;
2701
2702 if g_panda_rec_table(p_g_line_index).p_pricing_attribute26 is not null then
2703 i := px_Req_line_attr_tbl.count+1;
2704 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2705 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2706 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2707 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE26';
2708 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE26;
2709 end if;
2710
2711 if g_panda_rec_table(p_g_line_index).p_pricing_attribute27 is not null then
2712 i := px_Req_line_attr_tbl.count+1;
2713 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2714 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2715 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2716 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE27';
2717 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE27;
2718 end if;
2719
2720 if g_panda_rec_table(p_g_line_index).p_pricing_attribute28 is not null then
2721 i := px_Req_line_attr_tbl.count+1;
2722 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2723 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2724 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2725 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE28';
2726 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE28;
2727 end if;
2728
2729 if g_panda_rec_table(p_g_line_index).p_pricing_attribute29 is not null then
2730 i := px_Req_line_attr_tbl.count+1;
2731 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2732 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2733 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2734 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE29';
2735 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_PRICING_ATTRIBUTE29;
2736 end if;
2737
2738 if g_panda_rec_table(p_g_line_index).p_pricing_attribute30 is not null then
2739 i := px_Req_line_attr_tbl.count+1;
2740 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2741 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2742 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2743 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE30';
2744 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute30;
2745 end if;
2746
2747 if g_panda_rec_table(p_g_line_index).p_pricing_attribute31 is not null then
2748 i := px_Req_line_attr_tbl.count+1;
2749 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2750 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2751 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2752 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE31';
2753 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute31;
2754 end if;
2755
2756 if g_panda_rec_table(p_g_line_index).p_pricing_attribute32 is not null then
2757 i := px_Req_line_attr_tbl.count+1;
2758 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2759 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2760 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2761 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE32';
2762 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute32;
2763 end if;
2764
2765 if g_panda_rec_table(p_g_line_index).p_pricing_attribute33 is not null then
2766 i := px_Req_line_attr_tbl.count+1;
2767 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2768 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2769 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2770 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE33';
2771 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute33;
2772 end if;
2773
2774 if g_panda_rec_table(p_g_line_index).p_pricing_attribute34 is not null then
2775 i := px_Req_line_attr_tbl.count+1;
2776 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2777 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2778 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2779 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE34';
2780 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute34;
2781 end if;
2782
2783 if g_panda_rec_table(p_g_line_index).p_pricing_attribute35 is not null then
2784 i := px_Req_line_attr_tbl.count+1;
2785 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2786 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2787 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2788 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE35';
2789 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute35;
2790 end if;
2791
2792 if g_panda_rec_table(p_g_line_index).p_pricing_attribute36 is not null then
2793 i := px_Req_line_attr_tbl.count+1;
2794 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2795 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2796 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2797 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE36';
2798 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute36;
2799 end if;
2800
2801 if g_panda_rec_table(p_g_line_index).p_pricing_attribute37 is not null then
2802 i := px_Req_line_attr_tbl.count+1;
2803 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2804 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2805 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2806 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE37';
2807 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute37;
2808 end if;
2809
2810 if g_panda_rec_table(p_g_line_index).p_pricing_attribute38 is not null then
2811 i := px_Req_line_attr_tbl.count+1;
2812 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2813 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2814 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2815 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE38';
2816 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute38;
2817 end if;
2818
2819 if g_panda_rec_table(p_g_line_index).p_pricing_attribute39 is not null then
2820 i := px_Req_line_attr_tbl.count+1;
2821 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2822 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2823 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2824 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE39';
2825 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute39;
2826 end if;
2827
2828 if g_panda_rec_table(p_g_line_index).p_pricing_attribute40 is not null then
2829 i := px_Req_line_attr_tbl.count+1;
2830 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2831 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2832 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2833 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE40';
2834 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute40;
2835 end if;
2836
2837 if g_panda_rec_table(p_g_line_index).p_pricing_attribute41 is not null then
2838 i := px_Req_line_attr_tbl.count+1;
2839 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2840 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2841 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2842 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE41';
2843 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute41;
2844 end if;
2845
2846 if g_panda_rec_table(p_g_line_index).p_pricing_attribute42 is not null then
2847 i := px_Req_line_attr_tbl.count+1;
2848 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2849 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2850 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2851 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE42';
2852 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute42;
2853 end if;
2854
2855 if g_panda_rec_table(p_g_line_index).p_pricing_attribute43 is not null then
2856 i := px_Req_line_attr_tbl.count+1;
2857 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2858 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2859 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2860 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE43';
2861 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute43;
2862 end if;
2863
2864 if g_panda_rec_table(p_g_line_index).p_pricing_attribute44 is not null then
2865 i := px_Req_line_attr_tbl.count+1;
2866 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2867 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2868 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2869 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE44';
2870 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute44;
2871 end if;
2872
2873 if g_panda_rec_table(p_g_line_index).p_pricing_attribute45 is not null then
2874 i := px_Req_line_attr_tbl.count+1;
2875 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2876 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2877 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2878 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE45';
2879 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute45;
2880 end if;
2881
2882 if g_panda_rec_table(p_g_line_index).p_pricing_attribute46 is not null then
2883 i := px_Req_line_attr_tbl.count+1;
2884 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2885 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2886 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2887 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE46';
2888 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute46;
2889 end if;
2890
2891 if g_panda_rec_table(p_g_line_index).p_pricing_attribute47 is not null then
2892 i := px_Req_line_attr_tbl.count+1;
2893 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2894 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2895 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2896 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE47';
2897 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute47;
2898 end if;
2899
2900 if g_panda_rec_table(p_g_line_index).p_pricing_attribute48 is not null then
2901 i := px_Req_line_attr_tbl.count+1;
2902 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2903 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2904 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2905 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE48';
2906 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute48;
2907 end if;
2908
2909 if g_panda_rec_table(p_g_line_index).p_pricing_attribute49 is not null then
2910 i := px_Req_line_attr_tbl.count+1;
2911 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2912 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2913 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2914 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE49';
2915 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute49;
2916 end if;
2917
2918
2919 if g_panda_rec_table(p_g_line_index).p_pricing_attribute50 is not null then
2920 i := px_Req_line_attr_tbl.count+1;
2921 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2922 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2923 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2924 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE20';
2925 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute20;
2926 end if;
2927
2928 if g_panda_rec_table(p_g_line_index).p_pricing_attribute51 is not null then
2929 i := px_Req_line_attr_tbl.count+1;
2930 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2931 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2932 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2933 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE51';
2934 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute51;
2935 end if;
2936
2937 if g_panda_rec_table(p_g_line_index).p_pricing_attribute52 is not null then
2938 i := px_Req_line_attr_tbl.count+1;
2939 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2940 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2941 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2942 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE52';
2943 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute52;
2944 end if;
2945
2946 if g_panda_rec_table(p_g_line_index).p_pricing_attribute53 is not null then
2947 i := px_Req_line_attr_tbl.count+1;
2948 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2949 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2950 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2951 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE53';
2952 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute53;
2953 end if;
2954
2955 if g_panda_rec_table(p_g_line_index).p_pricing_attribute54 is not null then
2956 i := px_Req_line_attr_tbl.count+1;
2957 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2958 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2959 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2960 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE54';
2961 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute54;
2962 end if;
2963
2964 if g_panda_rec_table(p_g_line_index).p_pricing_attribute55 is not null then
2965 i := px_Req_line_attr_tbl.count+1;
2966 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2967 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2968 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2969 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE55';
2970 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute55;
2971 end if;
2972
2973 if g_panda_rec_table(p_g_line_index).p_pricing_attribute56 is not null then
2974 i := px_Req_line_attr_tbl.count+1;
2975 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2976 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2977 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2978 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE56';
2979 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute56;
2980 end if;
2981
2982 if g_panda_rec_table(p_g_line_index).p_pricing_attribute57 is not null then
2983 i := px_Req_line_attr_tbl.count+1;
2984 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2985 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2986 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2987 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE57';
2988 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute57;
2989 end if;
2990
2991 if g_panda_rec_table(p_g_line_index).p_pricing_attribute58 is not null then
2992 i := px_Req_line_attr_tbl.count+1;
2993 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
2994 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
2995 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
2996 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE58';
2997 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute58;
2998 end if;
2999
3000 if g_panda_rec_table(p_g_line_index).p_pricing_attribute59 is not null then
3001 i := px_Req_line_attr_tbl.count+1;
3002 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3003 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3004 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3005 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE59';
3006 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute59;
3007 end if;
3008
3009
3010 if g_panda_rec_table(p_g_line_index).p_pricing_attribute60 is not null then
3011 i := px_Req_line_attr_tbl.count+1;
3012 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3013 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3014 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3015 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE60';
3016 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute60;
3017 end if;
3018
3019 if g_panda_rec_table(p_g_line_index).p_pricing_attribute61 is not null then
3020 i := px_Req_line_attr_tbl.count+1;
3021 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3022 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3023 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3024 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE61';
3025 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute61;
3026 end if;
3027
3028 if g_panda_rec_table(p_g_line_index).p_pricing_attribute62 is not null then
3029 i := px_Req_line_attr_tbl.count+1;
3030 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3031 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3032 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3033 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE62';
3034 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute62;
3035 end if;
3036
3037 if g_panda_rec_table(p_g_line_index).p_pricing_attribute63 is not null then
3038 i := px_Req_line_attr_tbl.count+1;
3039 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3040 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3041 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3042 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE63';
3043 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute63;
3044 end if;
3045
3046 if g_panda_rec_table(p_g_line_index).p_pricing_attribute64 is not null then
3047 i := px_Req_line_attr_tbl.count+1;
3048 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3049 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3050 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3051 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE64';
3052 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute64;
3053 end if;
3054
3055 if g_panda_rec_table(p_g_line_index).p_pricing_attribute65 is not null then
3056 i := px_Req_line_attr_tbl.count+1;
3057 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3058 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3059 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3060 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE65';
3061 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute65;
3062 end if;
3063
3064 if g_panda_rec_table(p_g_line_index).p_pricing_attribute66 is not null then
3065 i := px_Req_line_attr_tbl.count+1;
3066 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3067 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3068 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3069 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE66';
3070 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute66;
3071 end if;
3072
3073 if g_panda_rec_table(p_g_line_index).p_pricing_attribute67 is not null then
3074 i := px_Req_line_attr_tbl.count+1;
3075 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3076 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3077 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3078 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE67';
3079 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute67;
3080 end if;
3081
3082 if g_panda_rec_table(p_g_line_index).p_pricing_attribute68 is not null then
3083 i := px_Req_line_attr_tbl.count+1;
3084 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3085 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3086 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3087 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE68';
3088 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute68;
3089 end if;
3090
3091 if g_panda_rec_table(p_g_line_index).p_pricing_attribute69 is not null then
3092 i := px_Req_line_attr_tbl.count+1;
3093 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3094 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3095 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3096 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE69';
3097 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute69;
3098 end if;
3099
3100
3101 if g_panda_rec_table(p_g_line_index).p_pricing_attribute70 is not null then
3102 i := px_Req_line_attr_tbl.count+1;
3103 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3104 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3105 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3106 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE70';
3107 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute70;
3108 end if;
3109
3110 if g_panda_rec_table(p_g_line_index).p_pricing_attribute71 is not null then
3111 i := px_Req_line_attr_tbl.count+1;
3112 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3113 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3114 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3115 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE71';
3116 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute71;
3117 end if;
3118
3119 if g_panda_rec_table(p_g_line_index).p_pricing_attribute72 is not null then
3120 i := px_Req_line_attr_tbl.count+1;
3121 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3122 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3123 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3124 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE72';
3125 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute72;
3126 end if;
3127
3128 if g_panda_rec_table(p_g_line_index).p_pricing_attribute73 is not null then
3129 i := px_Req_line_attr_tbl.count+1;
3130 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3131 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3132 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3133 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE73';
3134 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute73;
3135 end if;
3136
3137 if g_panda_rec_table(p_g_line_index).p_pricing_attribute74 is not null then
3138 i := px_Req_line_attr_tbl.count+1;
3139 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3140 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3141 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3142 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE74';
3143 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute74;
3144 end if;
3145
3146 if g_panda_rec_table(p_g_line_index).p_pricing_attribute75 is not null then
3147 i := px_Req_line_attr_tbl.count+1;
3148 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3149 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3150 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3151 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE75';
3152 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute75;
3153 end if;
3154
3155 if g_panda_rec_table(p_g_line_index).p_pricing_attribute76 is not null then
3156 i := px_Req_line_attr_tbl.count+1;
3157 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3158 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3159 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3160 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE76';
3161 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute76;
3162 end if;
3163
3164 if g_panda_rec_table(p_g_line_index).p_pricing_attribute77 is not null then
3165 i := px_Req_line_attr_tbl.count+1;
3166 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3167 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3168 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3169 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE77';
3170 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute77;
3171 end if;
3172
3173 if g_panda_rec_table(p_g_line_index).p_pricing_attribute78 is not null then
3174 i := px_Req_line_attr_tbl.count+1;
3175 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3176 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3177 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3178 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE78';
3179 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute27;
3180 end if;
3181
3182 if g_panda_rec_table(p_g_line_index).p_pricing_attribute79 is not null then
3183 i := px_Req_line_attr_tbl.count+1;
3184 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3185 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3186 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3187 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE79';
3188 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute27;
3189 end if;
3190
3191
3192 if g_panda_rec_table(p_g_line_index).p_pricing_attribute80 is not null then
3193 i := px_Req_line_attr_tbl.count+1;
3194 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3195 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3196 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3197 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE80';
3198 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute80;
3199 end if;
3200
3201 if g_panda_rec_table(p_g_line_index).p_pricing_attribute81 is not null then
3202 i := px_Req_line_attr_tbl.count+1;
3203 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3204 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3205 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3206 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE81';
3207 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute81;
3208 end if;
3209
3210 if g_panda_rec_table(p_g_line_index).p_pricing_attribute82 is not null then
3211 i := px_Req_line_attr_tbl.count+1;
3212 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3213 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3214 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3215 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE82';
3216 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute82;
3217 end if;
3218
3219 if g_panda_rec_table(p_g_line_index).p_pricing_attribute83 is not null then
3220 i := px_Req_line_attr_tbl.count+1;
3221 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3222 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3223 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3224 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE83';
3225 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute83;
3226 end if;
3227
3228 if g_panda_rec_table(p_g_line_index).p_pricing_attribute84 is not null then
3229 i := px_Req_line_attr_tbl.count+1;
3230 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3231 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3232 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3233 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE84';
3234 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute84;
3235 end if;
3236
3237 if g_panda_rec_table(p_g_line_index).p_pricing_attribute85 is not null then
3238 i := px_Req_line_attr_tbl.count+1;
3239 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3240 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3241 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3242 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE85';
3243 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute85;
3244 end if;
3245
3246 if g_panda_rec_table(p_g_line_index).p_pricing_attribute86 is not null then
3247 i := px_Req_line_attr_tbl.count+1;
3248 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3249 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3250 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3251 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE86';
3252 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute86;
3253 end if;
3254
3255 if g_panda_rec_table(p_g_line_index).p_pricing_attribute87 is not null then
3256 i := px_Req_line_attr_tbl.count+1;
3257 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3258 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3259 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3260 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE87';
3261 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute87;
3262 end if;
3263
3264 if g_panda_rec_table(p_g_line_index).p_pricing_attribute88 is not null then
3265 i := px_Req_line_attr_tbl.count+1;
3266 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3267 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3268 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3269 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE88';
3270 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute88;
3271 end if;
3272
3273 if g_panda_rec_table(p_g_line_index).p_pricing_attribute89 is not null then
3274 i := px_Req_line_attr_tbl.count+1;
3275 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3276 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3277 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3278 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE89';
3279 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute89;
3280 end if;
3281
3282
3283 if g_panda_rec_table(p_g_line_index).p_pricing_attribute90 is not null then
3284 i := px_Req_line_attr_tbl.count+1;
3285 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3286 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3287 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3288 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE90';
3289 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute90;
3290 end if;
3291
3292 if g_panda_rec_table(p_g_line_index).p_pricing_attribute91 is not null then
3293 i := px_Req_line_attr_tbl.count+1;
3294 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3295 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3296 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3297 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE91';
3298 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute91;
3299 end if;
3300
3301 if g_panda_rec_table(p_g_line_index).p_pricing_attribute92 is not null then
3302 i := px_Req_line_attr_tbl.count+1;
3303 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3304 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3305 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3306 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE92';
3307 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute92;
3308 end if;
3309
3310 if g_panda_rec_table(p_g_line_index).p_pricing_attribute93 is not null then
3311 i := px_Req_line_attr_tbl.count+1;
3312 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3313 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3314 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3315 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE93';
3316 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From :=g_panda_rec_table(p_g_line_index).p_pricing_attribute93;
3317 end if;
3318
3319 if g_panda_rec_table(p_g_line_index).p_pricing_attribute94 is not null then
3320 i := px_Req_line_attr_tbl.count+1;
3321 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3322 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3323 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3324 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE94';
3325 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute94;
3326 end if;
3327
3328 if g_panda_rec_table(p_g_line_index).p_pricing_attribute95 is not null then
3329 i := px_Req_line_attr_tbl.count+1;
3330 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3331 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3332 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3333 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE95';
3334 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute95;
3335 end if;
3336
3337 if g_panda_rec_table(p_g_line_index).p_pricing_attribute96 is not null then
3338 i := px_Req_line_attr_tbl.count+1;
3339 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3340 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3341 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3342 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE96';
3343 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute96;
3344 end if;
3345
3346 if g_panda_rec_table(p_g_line_index).p_pricing_attribute97 is not null then
3347 i := px_Req_line_attr_tbl.count+1;
3348 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3349 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3350 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3351 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE97';
3352 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute97;
3353 end if;
3354
3355 if g_panda_rec_table(p_g_line_index).p_pricing_attribute98 is not null then
3356 i := px_Req_line_attr_tbl.count+1;
3357 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3358 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3359 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3360 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE98';
3361 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute98;
3362 end if;
3363
3364 if g_panda_rec_table(p_g_line_index).p_pricing_attribute99 is not null then
3365 i := px_Req_line_attr_tbl.count+1;
3366 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3367 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3368 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3369 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE99';
3370 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_panda_rec_table(p_g_line_index).p_pricing_attribute99;
3371 end if;
3372
3373 if g_panda_rec_table(p_g_line_index).p_pricing_attribute100 is not null then
3374 i := px_Req_line_attr_tbl.count+1;
3375 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3376 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3377 px_Req_line_attr_tbl(i).pricing_context := g_panda_rec_table(p_g_line_index).p_pricing_context;
3378 px_Req_line_attr_tbl(i).Pricing_Attribute := 'PRICING_ATTRIBUTE100';
3379 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From:=g_panda_rec_table(p_g_line_index).p_pricing_attribute100;
3380 end if;
3381
3382 end if; -- if line_id is not null
3383
3384 oe_debug_pub.add(' p_line_id='||p_line_id||
3385 ' promo count='||g_promotions_tbl.COUNT
3386 );
3387
3388 IF p_line_id is not null and g_promotions_tbl.COUNT > 0 then
3389
3390 FOR k in g_promotions_tbl.first..g_promotions_tbl.last
3391 LOOP
3392
3393 oe_debug_pub.add('promo line_id='||g_promotions_tbl(k).p_line_id||
3394 ' p_level='||g_promotions_tbl(k).p_level||
3395 ' p_line_id='||p_line_id);
3396
3397
3398 IF g_promotions_tbl(k).p_level <> 'ORDER' then
3399
3400 IF g_promotions_tbl(k).p_line_id = p_line_id and
3401 g_promotions_tbl(k).p_type = 'COUPON' then
3402
3403 oe_debug_pub.add(' Append line coupon attr='||g_promotions_tbl(k).p_pricing_attribute3);
3404 i := px_Req_line_attr_tbl.count+1;
3405 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3406 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3407 --If asked_for_rec.flex_title = 'QP_ATTR_DEFNS_QUALIFIER' then
3408 px_Req_line_attr_tbl(i).Pricing_Context := 'MODLIST';
3409 px_Req_line_attr_tbl(i).Pricing_Attribute := 'QUALIFIER_ATTRIBUTE3';
3410 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_promotions_tbl(k).p_PRICING_ATTRIBUTE3;
3411
3412 ELSIF g_promotions_tbl(k).p_line_id = p_line_id and
3413 g_promotions_tbl(k).p_type = 'PROMOTION' then
3414
3415 oe_debug_pub.add(' Append Line Promotion attr1='||g_promotions_tbl(k).p_pricing_attribute1);
3416 i := px_Req_line_attr_tbl.count+1;
3417 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3418 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3419 px_Req_line_attr_tbl(i).Pricing_Context := 'MODLIST';
3420 px_Req_line_attr_tbl(i).Pricing_Attribute := 'QUALIFIER_ATTRIBUTE1';
3421 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_promotions_tbl(k).p_PRICING_ATTRIBUTE1;
3422
3423
3424 IF g_promotions_tbl(k).p_pricing_attribute2 is not null then
3425 oe_debug_pub.add(' Append Line Promotion attr2='||g_promotions_tbl(k).p_pricing_attribute2);
3426 i := px_Req_line_attr_tbl.count+1;
3427 px_Req_line_attr_tbl(i).Line_Index := p_Line_Index;
3428 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3429 px_Req_line_attr_tbl(i).Pricing_Context := 'MODLIST';
3430 px_Req_line_attr_tbl(i).Pricing_Attribute := 'QUALIFIER_ATTRIBUTE2';
3431 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_promotions_tbl(k).p_PRICING_ATTRIBUTE2;
3432 END IF; -- attr2 is not null
3433
3434 END IF; -- if type coupon
3435 END IF; -- if level is not ORDER
3436 END LOOP;
3437 END IF; -- if promotions temp table is not null
3438
3439
3440 oe_debug_pub.add(' Applying Header Promotions p_line_id='||p_line_id||
3441 ' promo count='||g_promotions_tbl.COUNT||
3442 ' p_line_id='||p_line_id
3443 );
3444
3445 IF p_line_id is null and g_promotions_tbl.COUNT > 0 then
3446 FOR k in g_promotions_tbl.first..g_promotions_tbl.last
3447 LOOP
3448
3449 IF g_promotions_tbl(k).p_level = 'ORDER' then
3450
3451 IF g_promotions_tbl(k).p_type = 'COUPON' then
3452
3453 oe_debug_pub.add(' Append Hdr coupon attr='||g_promotions_tbl(k).p_pricing_attribute3);
3454 i := px_Req_line_attr_tbl.count+1;
3455 px_Req_line_attr_tbl(i).Line_Index := 1; --p_Line_Index;
3456 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3457 --If asked_for_rec.flex_title = 'QP_ATTR_DEFNS_QUALIFIER' then
3458 px_Req_line_attr_tbl(i).Pricing_Context := 'MODLIST';
3459 px_Req_line_attr_tbl(i).Pricing_Attribute := 'QUALIFIER_ATTRIBUTE3';
3460 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_promotions_tbl(k).p_PRICING_ATTRIBUTE3;
3461
3462 ELSIF g_promotions_tbl(k).p_type = 'PROMOTION' then
3463
3464 oe_debug_pub.add(' Append Hdr Promotion attr1='||g_promotions_tbl(k).p_pricing_attribute1);
3465 i := px_Req_line_attr_tbl.count+1;
3466 px_Req_line_attr_tbl(i).Line_Index := 1; --p_Line_Index;
3467 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3468 px_Req_line_attr_tbl(i).Pricing_Context := 'MODLIST';
3469 px_Req_line_attr_tbl(i).Pricing_Attribute := 'QUALIFIER_ATTRIBUTE1';
3470 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_promotions_tbl(k).p_PRICING_ATTRIBUTE1;
3471
3472
3473 IF g_promotions_tbl(k).p_pricing_attribute2 is not null then
3474 oe_debug_pub.add(' Append Hdr Promotion Line attr2='||g_promotions_tbl(k).p_pricing_attribute2);
3475 i := px_Req_line_attr_tbl.count+1;
3476 px_Req_line_attr_tbl(i).Line_Index := 1; --p_Line_Index;
3477 px_Req_line_attr_tbl(i).Validated_Flag := 'N';
3478 px_Req_line_attr_tbl(i).Pricing_Context := 'MODLIST';
3479 px_Req_line_attr_tbl(i).Pricing_Attribute := 'QUALIFIER_ATTRIBUTE2';
3480 px_Req_line_attr_tbl(i).Pricing_Attr_Value_From := g_promotions_tbl(k).p_PRICING_ATTRIBUTE2;
3481 END IF; -- attr2 is not null
3482
3483 END IF; -- if type coupon
3484 END IF; -- if level is not ORDER
3485
3486 END LOOP;
3487 END IF; -- if promotions temp table is not null and for header
3488
3489 IF l_debug_level > 0 THEN
3490 oe_debug_pub.add( 'EXITING oe_oe_pricing_availability.APPEND_ATTRIBUTES' , 1 ) ;
3491 END IF;
3492
3493 END Append_attributes;
3494
3495
3496
3497 PROCEDURE Append_attr_to_ttables(px_req_line_attr_tbl in out nocopy oe_oe_pricing_availability.QP_LINE_ATTR_TBL_TYPE
3498 )
3499 IS
3500 i number;
3501 k number;
3502 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3503 l_attribute_type VARCHAR2(30);
3504 BEGIN
3505 --Temp Tables
3506 k:=G_ATTR_PRICING_ATTRIBUTE_TBL.count;
3507 i := px_req_line_attr_tbl.first;
3508 if l_debug_level >0 then
3509 oe_debug_pub.add('****populating attributes in to temp table **********');
3510 end if;
3511
3512 if l_debug_level > 0 then
3513
3514 oe_debug_pub.add('k='||k||'i='||i);
3515 end if;
3516
3517 while i is not null loop
3518 k:=k+1;
3519 IF l_debug_level > 0 THEN
3520 oe_debug_pub.add( 'POPULATE LINE ATTRS'||K||' '||PX_REQ_LINE_ATTR_TBL ( I ) .PRICING_CONTEXT , 3 ) ;
3521 END IF;
3522
3523 IF (px_req_line_attr_tbl(I).PRICING_CONTEXT = QP_PREQ_GRP.G_ITEM_CONTEXT) THEN
3524 l_attribute_type := QP_PREQ_GRP.G_PRODUCT_TYPE;
3525 ELSIF (px_req_line_attr_tbl(I).PRICING_CONTEXT = 'MODLIST') THEN
3526 l_attribute_type := QP_PREQ_GRP.G_QUALIFIER_TYPE;
3527 ELSE
3528 l_attribute_type := QP_PREQ_GRP.G_PRICING_TYPE;
3529 END IF;
3530 G_ATTR_LINE_INDEX_tbl(k) := px_req_line_attr_tbl(i).line_index;
3531 IF l_debug_level > 0 THEN
3532 oe_debug_pub.add( 'LINE_INDEX:'||G_ATTR_LINE_INDEX_TBL ( K ) ) ;
3533 END IF;
3534 G_ATTR_LINE_DETAIL_INDEX_tbl(k) := NULL;
3535 G_ATTR_ATTRIBUTE_LEVEL_tbl(k) := QP_PREQ_GRP.G_LINE_LEVEL;
3536 G_ATTR_VALIDATED_FLAG_tbl(k) := 'N';
3537 G_ATTR_ATTRIBUTE_TYPE_tbl(k) := l_attribute_type;
3538 G_ATTR_PRICING_CONTEXT_tbl(k)
3539 := px_req_line_attr_tbl(i).pricing_context;
3540 G_ATTR_PRICING_ATTRIBUTE_tbl(k)
3541 := px_req_line_attr_tbl(i).pricing_attribute;
3542 G_ATTR_APPLIED_FLAG_tbl(k) := QP_PREQ_GRP.G_LIST_NOT_APPLIED;--NULL;
3543 G_ATTR_PRICING_STATUS_CODE_tbl(k) := QP_PREQ_GRP.G_STATUS_UNCHANGED;
3544 G_ATTR_PRICING_ATTR_FLAG_tbl (k) := QP_PREQ_GRP.G_YES;--NULL;
3545 G_ATTR_LIST_HEADER_ID_tbl(k) := NULL;
3546 G_ATTR_LIST_LINE_ID_tbl(k) := NULL;
3547 G_ATTR_VALUE_FROM_tbl(k) :=px_req_line_attr_tbl(i).pricing_attr_value_from;
3548 G_ATTR_SETUP_VALUE_FROM_tbl(k):=NULL;
3549 G_ATTR_VALUE_TO_tbl(k) :=NULL;
3550 G_ATTR_SETUP_VALUE_TO_tbl(k) := NULL;
3551 G_ATTR_GROUPING_NUMBER_tbl(k) := NULL;
3552 G_ATTR_NO_QUAL_IN_GRP_tbl(k) :=NULL;
3553 G_ATTR_COMP_OPERATOR_TYPE_tbl(k):= NULL;
3554 G_ATTR_PRICING_STATUS_TEXT_tbl(k) :=NULL;
3555 G_ATTR_QUAL_PRECEDENCE_tbl(k):=NULL;
3556 G_ATTR_DATATYPE_tbl(k) := NULL;
3557 G_ATTR_QUALIFIER_TYPE_tbl(k) := NULL;
3558 G_ATTR_PRODUCT_UOM_CODE_TBL(k) := NULL;
3559 G_ATTR_EXCLUDER_FLAG_TBL(k) := NULL;
3560 G_ATTR_PRICING_PHASE_ID_TBL(k) := NULL;
3561 G_ATTR_INCOM_GRP_CODE_TBL(k):=NULL;
3562 G_ATTR_LDET_TYPE_CODE_TBL(k):=NULL;
3563 G_ATTR_MODIFIER_LEVEL_CODE_TBL(k):=NULL;
3564 G_ATTR_PRIMARY_UOM_FLAG_TBL(k):=NULL;
3565 i:= px_req_line_attr_tbl.next(i);
3566 END LOOP;
3567
3568
3569 --G_ATTR_LINE_INDEX_tbl(G_ATTR_LINE_INDEX_tbl.count+1):=2;
3570 --G_ATTR_ATTRIBUTE_LEVEL_tbl(G_ATTR_LINE_INDEX_tbl.count):=QP_PREQ_GRP.G_LINE_LEVEL;
3571
3572 --Temp_tables population ends
3573
3574 end append_attr_to_TTables;
3575
3576 PROCEDURE Reset_All_Tbls
3577 AS
3578 l_routine VARCHAR2(240):='QP_PREQ_GRP.Reset_All_Tbls';
3579 --
3580 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3581 --
3582 BEGIN
3583 G_LINE_INDEX_tbl.delete;
3584 G_LINE_TYPE_CODE_TBL.delete ;
3585 G_PRICING_EFFECTIVE_DATE_TBL.delete ;
3586 G_ACTIVE_DATE_FIRST_TBL.delete ;
3587 G_ACTIVE_DATE_FIRST_TYPE_TBL.delete ;
3588 G_ACTIVE_DATE_SECOND_TBL.delete ;
3589 G_ACTIVE_DATE_SECOND_TYPE_TBL.delete ;
3590 G_LINE_QUANTITY_TBL.delete ;
3591 G_LINE_UOM_CODE_TBL.delete ;
3592 G_REQUEST_TYPE_CODE_TBL.delete ;
3593 G_PRICED_QUANTITY_TBL.delete ;
3594 G_UOM_QUANTITY_TBL.delete ;
3595 G_PRICED_UOM_CODE_TBL.delete ;
3596 G_CURRENCY_CODE_TBL.delete ;
3597 G_UNIT_PRICE_TBL.delete ;
3598 G_PERCENT_PRICE_TBL.delete ;
3599 G_ADJUSTED_UNIT_PRICE_TBL.delete ;
3600 G_PROCESSED_FLAG_TBL.delete ;
3601 G_PRICE_FLAG_TBL.delete ;
3602 G_LINE_ID_TBL.delete ;
3603 G_PROCESSING_ORDER_TBL.delete ;
3604 G_ROUNDING_FLAG_TBL.delete;
3605 G_ROUNDING_FACTOR_TBL.delete ;
3606 G_PRICING_STATUS_CODE_TBL.delete ;
3607 G_PRICING_STATUS_TEXT_TBL.delete ;
3608 G_ATTR_LINE_INDEX_tbl.delete;
3609 G_ATTR_ATTRIBUTE_LEVEL_tbl.delete;
3610 G_ATTR_VALIDATED_FLAG_tbl.delete;
3611 G_ATTR_ATTRIBUTE_TYPE_tbl.delete;
3612 G_ATTR_PRICING_CONTEXT_tbl.delete;
3613 G_ATTR_PRICING_ATTRIBUTE_tbl.delete;
3614 G_ATTR_APPLIED_FLAG_tbl.delete;
3615 G_ATTR_PRICING_STATUS_CODE_tbl.delete;
3616 G_ATTR_PRICING_ATTR_FLAG_tbl.delete;
3617 G_ATTR_LIST_HEADER_ID_tbl.delete;
3618 G_ATTR_LIST_LINE_ID_tbl.delete;
3619 G_ATTR_VALUE_FROM_tbl.delete;
3620 G_ATTR_SETUP_VALUE_FROM_tbl.delete;
3621 G_ATTR_VALUE_TO_tbl.delete;
3622 G_ATTR_SETUP_VALUE_TO_tbl.delete;
3623 G_ATTR_GROUPING_NUMBER_tbl.delete;
3624 G_ATTR_NO_QUAL_IN_GRP_tbl.delete;
3625 G_ATTR_COMP_OPERATOR_TYPE_tbl.delete;
3626 G_ATTR_VALIDATED_FLAG_tbl.delete;
3627 G_ATTR_APPLIED_FLAG_tbl.delete;
3628 G_ATTR_PRICING_STATUS_CODE_tbl.delete;
3629 G_ATTR_PRICING_STATUS_TEXT_tbl.delete;
3630 G_ATTR_QUAL_PRECEDENCE_tbl.delete;
3631 G_ATTR_DATATYPE_tbl.delete;
3632 G_ATTR_PRICING_ATTR_FLAG_tbl.delete ;
3633 G_ATTR_QUALIFIER_TYPE_tbl.delete;
3634 G_ATTR_PRODUCT_UOM_CODE_TBL.delete;
3635 G_ATTR_EXCLUDER_FLAG_TBL.delete;
3636 G_ATTR_PRICING_PHASE_ID_TBL.delete;
3637 G_ATTR_INCOM_GRP_CODE_TBL.delete;
3638 G_ATTR_LDET_TYPE_CODE_TBL.delete;
3639 G_ATTR_MODIFIER_LEVEL_CODE_TBL.delete;
3640 G_ATTR_PRIMARY_UOM_FLAG_TBL.delete;
3641 EXCEPTION
3642 WHEN OTHERS THEN
3643 IF l_debug_level > 0 THEN
3644 oe_debug_pub.add( L_ROUTINE||': '||SQLERRM , 1 ) ;
3645 END IF;
3646 END reset_all_tbls;
3647
3648
3649 procedure Populate_Temp_Table
3650 IS
3651 l_return_status varchar2(1) := FND_API.G_RET_STS_SUCCESS;
3652 l_return_status_Text varchar2(240) ;
3653 --
3654 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3655 --
3656 BEGIN
3657 IF l_debug_level > 0 THEN
3658 oe_debug_pub.add( 'BEFORE DIRECT INSERT INTO TEMP TABLE: BULK INSERT'||G_LINE_INDEX_TBL.COUNT , 1 ) ;
3659 END IF;
3660 QP_PREQ_GRP.INSERT_LINES2
3661 (p_LINE_INDEX => G_LINE_INDEX_TBL,
3662 p_LINE_TYPE_CODE => G_LINE_TYPE_CODE_TBL,
3663 p_PRICING_EFFECTIVE_DATE =>G_PRICING_EFFECTIVE_DATE_TBL,
3664 p_ACTIVE_DATE_FIRST =>G_ACTIVE_DATE_FIRST_TBL,
3665 p_ACTIVE_DATE_FIRST_TYPE =>G_ACTIVE_DATE_FIRST_TYPE_TBL,
3666 p_ACTIVE_DATE_SECOND =>G_ACTIVE_DATE_SECOND_TBL,
3667 p_ACTIVE_DATE_SECOND_TYPE =>G_ACTIVE_DATE_SECOND_TYPE_TBL,
3668 p_LINE_QUANTITY => G_LINE_QUANTITY_TBL,
3669 p_LINE_UOM_CODE => G_LINE_UOM_CODE_TBL,
3670 p_REQUEST_TYPE_CODE => G_REQUEST_TYPE_CODE_TBL,
3671 p_PRICED_QUANTITY => G_PRICED_QUANTITY_TBL,
3672 p_PRICED_UOM_CODE => G_PRICED_UOM_CODE_TBL,
3673 p_CURRENCY_CODE => G_CURRENCY_CODE_TBL,
3674 p_UNIT_PRICE => G_UNIT_PRICE_TBL,
3675 p_PERCENT_PRICE => G_PERCENT_PRICE_TBL,
3676 p_UOM_QUANTITY => G_UOM_QUANTITY_TBL,
3677 p_ADJUSTED_UNIT_PRICE =>G_ADJUSTED_UNIT_PRICE_TBL,
3678 p_UPD_ADJUSTED_UNIT_PRICE =>G_UPD_ADJUSTED_UNIT_PRICE_TBL,
3679 p_PROCESSED_FLAG =>G_PROCESSED_FLAG_TBL,
3680 p_PRICE_FLAG =>G_PRICE_FLAG_TBL,
3681 p_LINE_ID =>G_LINE_ID_TBL,
3682 p_PROCESSING_ORDER =>G_PROCESSING_ORDER_TBL,
3683 p_PRICING_STATUS_CODE =>G_PRICING_STATUS_CODE_tbl,
3684 p_PRICING_STATUS_TEXT =>G_PRICING_STATUS_TEXT_tbl,
3685 p_ROUNDING_FLAG =>G_ROUNDING_FLAG_TBL,
3686 p_ROUNDING_FACTOR =>G_ROUNDING_FACTOR_TBL,
3687 p_QUALIFIERS_EXIST_FLAG => G_QUALIFIERS_EXIST_FLAG_TBL,
3688 p_PRICING_ATTRS_EXIST_FLAG =>G_PRICING_ATTRS_EXIST_FLAG_TBL,
3689 p_PRICE_LIST_ID => G_PRICE_LIST_ID_TBL,
3690 p_VALIDATED_FLAG => G_PL_VALIDATED_FLAG_TBL,
3691 p_PRICE_REQUEST_CODE => G_PRICE_REQUEST_CODE_TBL,
3692 p_USAGE_PRICING_TYPE => G_USAGE_PRICING_TYPE_tbl,
3693 p_line_category => G_LINE_CATEGORY_tbl,
3694 --p_catchweight_qty => G_CATCHWEIGHT_QTY_tbl,
3695 --p_actual_order_qty => G_ACTUAL_ORDER_QTY_TBL,
3696 x_status_code =>l_return_status,
3697 x_status_text =>l_return_status_text);
3698
3699 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
3700 IF l_debug_level > 0 THEN
3701 oe_debug_pub.add( 'WRONG IN INSERT_LINES2'||L_RETURN_STATUS_TEXT , 1 ) ;
3702 END IF;
3703 FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
3704 FND_MESSAGE.SET_TOKEN('ERR_TEXT',l_return_status_text);
3705 OE_MSG_PUB.Add;
3706 RAISE FND_API.G_EXC_ERROR;
3707 END IF;
3708
3709 IF G_ATTR_LINE_INDEX_tbl.count > 0 THEN
3710 QP_PREQ_GRP.INSERT_LINE_ATTRS2
3711 ( G_ATTR_LINE_INDEX_tbl,
3712 G_ATTR_LINE_DETAIL_INDEX_tbl ,
3713 G_ATTR_ATTRIBUTE_LEVEL_tbl ,
3714 G_ATTR_ATTRIBUTE_TYPE_tbl ,
3715 G_ATTR_LIST_HEADER_ID_tbl ,
3716 G_ATTR_LIST_LINE_ID_tbl ,
3717 G_ATTR_PRICING_CONTEXT_tbl ,
3718 G_ATTR_PRICING_ATTRIBUTE_tbl ,
3719 G_ATTR_VALUE_FROM_tbl ,
3720 G_ATTR_SETUP_VALUE_FROM_tbl ,
3721 G_ATTR_VALUE_TO_tbl ,
3722 G_ATTR_SETUP_VALUE_TO_tbl ,
3723 G_ATTR_GROUPING_NUMBER_tbl ,
3724 G_ATTR_NO_QUAL_IN_GRP_tbl ,
3725 G_ATTR_COMP_OPERATOR_TYPE_tbl ,
3726 G_ATTR_VALIDATED_FLAG_tbl ,
3727 G_ATTR_APPLIED_FLAG_tbl ,
3728 G_ATTR_PRICING_STATUS_CODE_tbl ,
3729 G_ATTR_PRICING_STATUS_TEXT_tbl ,
3730 G_ATTR_QUAL_PRECEDENCE_tbl ,
3731 G_ATTR_DATATYPE_tbl ,
3732 G_ATTR_PRICING_ATTR_FLAG_tbl ,
3733 G_ATTR_QUALIFIER_TYPE_tbl ,
3734 G_ATTR_PRODUCT_UOM_CODE_TBL ,
3735 G_ATTR_EXCLUDER_FLAG_TBL ,
3736 G_ATTR_PRICING_PHASE_ID_TBL ,
3737 G_ATTR_INCOM_GRP_CODE_TBL,
3738 G_ATTR_LDET_TYPE_CODE_TBL,
3739 G_ATTR_MODIFIER_LEVEL_CODE_TBL,
3740 G_ATTR_PRIMARY_UOM_FLAG_TBL,
3741 l_return_status ,
3742 l_return_status_text );
3743
3744 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
3745 IF l_debug_level > 0 THEN
3746 oe_debug_pub.add( 'ERROR INSERTING INTO LINE ATTRS'||SQLERRM ) ;
3747 END IF;
3748 FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
3749 FND_MESSAGE.SET_TOKEN('ERR_TEXT',l_return_status_text);
3750 OE_MSG_PUB.Add;
3751 raise fnd_api.g_exc_unexpected_error;
3752 END IF;
3753
3754 END IF;
3755 IF l_debug_level > 0 THEN
3756 oe_debug_pub.add( 'AFTER DIRECT INSERT INTO TEMP TABLE: BULK INSERT' , 1 ) ;
3757 END IF;
3758
3759 EXCEPTION
3760 WHEN OTHERS THEN
3761 RAISE FND_API.G_EXC_ERROR;
3762 END POPULATE_TEMP_TABLE;
3763
3764
3765 PROCEDURE Populate_results
3766 (x_line_tbl OUT NOCOPY /* file.sql.39 change */ OE_OE_PRICING_AVAILABILITY.QP_LINE_TBL_TYPE,
3767 x_line_qual_tbl OUT NOCOPY /* file.sql.39 change */ OE_OE_PRICING_AVAILABILITY.QP_QUAL_TBL_TYPE,
3768 x_line_attr_tbl OUT NOCOPY /* file.sql.39 change */ OE_OE_PRICING_AVAILABILITY.QP_LINE_ATTR_TBL_TYPE,
3769 x_line_detail_tbl OUT NOCOPY /* file.sql.39 change */ OE_OE_PRICING_AVAILABILITY.QP_LINE_DETAIL_TBL_TYPE,
3770 x_line_detail_qual_tbl OUT NOCOPY /* file.sql.39 change */ OE_OE_PRICING_AVAILABILITY.QP_LINE_DQUAL_TBL_TYPE,
3771 x_line_detail_attr_tbl OUT NOCOPY /* file.sql.39 change */ OE_OE_PRICING_AVAILABILITY.QP_LINE_DATTR_TBL_TYPE,
3772 x_related_lines_tbl OUT NOCOPY /* file.sql.39 change */ OE_OE_PRICING_AVAILABILITY.QP_RLTD_LINES_TBL_TYPE)
3773 AS
3774
3775 -- Cursor l_lines_cur changed for removing NMV SQL Id : 14877269
3776
3777 CURSOR l_lines_cur IS
3778 SELECT qpt.line_index, qpt.line_id, qpt.price_list_header_id,
3779 qpt.line_type_code, qpt.line_quantity, qpt.line_uom_code,
3780 qpt.line_unit_price, qpt.rounding_factor, qpt.priced_quantity,
3781 qpt.uom_quantity, qpt.priced_uom_code, qpt.currency_code,
3782 qpt.unit_price, qpt.percent_price, qpt.parent_price,
3783 qpt.parent_quantity, qpt.parent_uom_code, qpt.price_flag,
3784 qpt.adjusted_unit_price, qpt.updated_adjusted_unit_price,
3785 qpt.processing_order, qpt.processed_code, qpt.pricing_status_code,
3786 qpt.pricing_status_text, qpt.hold_code, qpt.hold_text,
3787 qpt.price_request_code, qpt.pricing_effective_date, qpt.extended_price,
3788 qpt.order_uom_selling_price
3789 FROM qp_preq_lines_tmp_t qpt
3790 WHERE qp_java_engine_util_pub.java_engine_running = 'N'
3791 AND request_id = NVL (SYS_CONTEXT ('qp_context', 'request_id'), 1)
3792 UNION ALL
3793 SELECT qpt.line_index, qpt.line_id, qpt.price_list_header_id,
3794 qpt.line_type_code, qpt.line_quantity, qpt.line_uom_code,
3795 qpt.line_unit_price, qpt.rounding_factor, qpt.priced_quantity,
3796 qpt.uom_quantity, qpt.priced_uom_code, qpt.currency_code,
3797 qpt.unit_price, qpt.percent_price, qpt.parent_price,
3798 qpt.parent_quantity, qpt.parent_uom_code, qpt.price_flag,
3799 qpt.adjusted_unit_price, qpt.updated_adjusted_unit_price,
3800 qpt.processing_order, qpt.processed_code, qpt.pricing_status_code,
3801 qpt.pricing_status_text, qpt.hold_code, qpt.hold_text,
3802 qpt.price_request_code, qpt.pricing_effective_date, qpt.extended_price,
3803 qpt.order_uom_selling_price
3804 FROM qp_int_lines_t qpt
3805 WHERE qp_java_engine_util_pub.java_engine_running = 'Y'
3806 AND request_id = NVL (SYS_CONTEXT ('qp_context', 'request_id'), -9999);
3807
3808
3809
3810 CURSOR l_qual_cur (L_ATTRIBUTE_LEVEL VARCHAR2)IS
3811 SELECT QPLAT.LINE_INDEX,
3812 QPLAT.LINE_DETAIL_INDEX,
3813 QPLAT.CONTEXT,
3814 QPLAT.ATTRIBUTE,
3815 QPLAT.SETUP_VALUE_FROM,
3816 QPLAT.SETUP_VALUE_TO,
3817 QPLAT.COMPARISON_OPERATOR_TYPE_CODE,
3818 QPLAT.VALIDATED_FLAG,
3819 QPLAT.PRICING_STATUS_CODE,
3820 QPLAT.PRICING_STATUS_TEXT
3821 FROM QP_PREQ_LDETS_TMP QPLD ,
3822 QP_PREQ_LINE_ATTRS_TMP QPLAT
3823 WHERE QPLD.LINE_DETAIL_INDEX = QPLAT.LINE_DETAIL_INDEX
3824 AND QPLD.PRICING_STATUS_CODE = QP_PREQ_GRP.G_STATUS_NEW
3825 AND QPLAT.ATTRIBUTE_TYPE = 'QUALIFIER';
3826 --AND QPLAT.PRICING_STATUS_CODE = G_STATUS_NEW;
3827
3828
3829 CURSOR l_pricing_attr_cur IS
3830 SELECT QPLAT_PRICING.CONTEXT PRICING_CONTEXT,
3831 QPLAT_PRICING.ATTRIBUTE PRICING_ATTRIBUTE,
3832 nvl(QPLAT_PRICING.SETUP_VALUE_FROM,QPLAT_PRICING.VALUE_FROM) PRICING_ATTR_VALUE_FROM,
3833 QPLAT_PRICING.SETUP_VALUE_TO PRICING_ATTR_VALUE_TO,
3834 QPLAT_PRICING.COMPARISON_OPERATOR_TYPE_CODE,
3835 QPLAT_PRICING.LINE_DETAIL_INDEX,
3836 QPLAT_PRICING.LINE_INDEX,
3837 QPLAT_PRICING.VALIDATED_FLAG
3838 FROM QP_PREQ_LDETS_TMP QPLD ,
3839 QP_PREQ_LINE_ATTRS_TMP QPLAT_PRICING
3840 WHERE QPLD.LINE_DETAIL_INDEX = QPLAT_PRICING.LINE_DETAIL_INDEX
3841 AND QPLD.PRICING_STATUS_CODE = QP_PREQ_GRP.G_STATUS_NEW
3842 AND QPLAT_PRICING.ATTRIBUTE_TYPE IN ('PRICING','PRODUCT');
3843 --AND QPLAT_PRICING.PRICING_STATUS_CODE = G_STATUS_NEW;
3844
3845
3846 -- Cursor l_ldets_cur is changed to remove NMV and reduce Sharable Memory SQL Id 14877295
3847
3848 CURSOR l_ldets_cur IS
3849 SELECT qpt.line_detail_index, qpt.line_detail_type_code, qpt.line_index,
3850 qpt.created_from_list_header_id list_header_id,
3851 qpt.created_from_list_line_id list_line_id,
3852 qpt.created_from_list_line_type list_line_type_code,
3853 qpt.price_break_type_code, qpt.line_quantity, qpt.adjustment_amount,qpt.automatic_flag,
3854 qpt.pricing_phase_id, qpt.operand_calculation_code, qpt.operand_value,
3855 qpt.pricing_group_sequence, qpt.created_from_list_type_code,
3856 qpt.applied_flag, qpt.pricing_status_code, qpt.pricing_status_text,
3857 qpt.limit_code, qpt.limit_text, qpt.list_line_no, qpt.group_quantity,
3858 qpt.group_amount, qpt.updated_flag, qpt.process_code,
3859 qpt.calculation_code, qpt.change_reason_code, qpt.change_reason_text,
3860 qpt.order_qty_adj_amt, b.substitution_value substitution_value_to,
3861 b.substitution_attribute, b.accrual_flag, b.modifier_level_code,
3862 b.estim_gl_value, b.accrual_conversion_rate, b.override_flag,
3863 b.print_on_invoice_flag, b.inventory_item_id, b.organization_id,
3864 b.related_item_id, b.relationship_type_id, b.estim_accrual_rate,
3865 b.expiration_date, b.benefit_price_list_line_id, b.recurring_flag,
3866 b.recurring_value, b.benefit_limit, b.charge_type_code,
3867 b.charge_subtype_code, b.benefit_qty, b.benefit_uom_code,
3868 b.proration_type_code, b.include_on_returns_flag,
3869 b.rebate_transaction_type_code, b.number_expiration_periods,
3870 b.expiration_period_uom, b.comments
3871 FROM qp_preq_ldets_tmp_t qpt, qp_list_lines b
3872 WHERE qp_java_engine_util_pub.java_engine_running = 'N'
3873 AND qpt.request_id = NVL (SYS_CONTEXT ('QP_CONTEXT', 'REQUEST_ID'), 1)
3874 AND qpt.created_from_list_line_id = b.list_line_id
3875 AND qpt.pricing_status_code = QP_PREQ_GRP.G_STATUS_NEW
3876 UNION ALL
3877 SELECT qpt.line_detail_index, qpt.line_detail_type_code, qpt.line_index,
3878 qpt.created_from_list_header_id list_header_id, qpt.created_from_list_line_id list_line_id,
3879 qpt.created_from_list_line_type list_line_type_code, qpt.price_break_type_code,
3880 qpt.line_quantity, qpt.adjustment_amount, qpt.automatic_flag, qpt.pricing_phase_id,
3881 qpt.operand_calculation_code, qpt.operand_value,
3882 qpt.pricing_group_sequence, qpt.created_from_list_type_code,
3883 qpt.applied_flag, qpt.pricing_status_code, qpt.pricing_status_text,
3884 qpt.limit_code, qpt.limit_text, qpt.list_line_no, qpt.group_quantity,
3885 qpt.group_amount, qpt.updated_flag, qpt.process_code,
3886 qpt.calculation_code, qpt.change_reason_code, qpt.change_reason_text,
3887 qpt.order_qty_adj_amt, b.substitution_value substitution_value_to,
3888 b.substitution_attribute, b.accrual_flag, b.modifier_level_code,
3889 b.estim_gl_value, b.accrual_conversion_rate, b.override_flag,
3890 b.print_on_invoice_flag, b.inventory_item_id, b.organization_id,
3891 b.related_item_id, b.relationship_type_id, b.estim_accrual_rate,
3892 b.expiration_date, b.benefit_price_list_line_id, b.recurring_flag,
3893 b.recurring_value, b.benefit_limit, b.charge_type_code,
3894 b.charge_subtype_code, b.benefit_qty, b.benefit_uom_code,
3895 b.proration_type_code, b.include_on_returns_flag,
3896 b.rebate_transaction_type_code, b.number_expiration_periods,
3897 b.expiration_period_uom, b.comments
3898 FROM qp_int_ldets_t qpt, qp_list_lines b
3899 WHERE qp_java_engine_util_pub.java_engine_running = 'Y'
3900 AND qpt.request_id = NVL (SYS_CONTEXT ('QP_CONTEXT', 'REQUEST_ID'), -9999)
3901 AND qpt.created_from_list_line_id = b.list_line_id
3902 AND qpt.pricing_status_code = QP_PREQ_GRP.G_STATUS_NEW;
3903
3904
3905 CURSOR l_rltd_lines_cur IS
3906 SELECT LINE_INDEX,
3907 LINE_DETAIL_INDEX,
3908 RELATIONSHIP_TYPE_CODE,
3909 RELATED_LINE_INDEX,
3910 RELATED_LINE_DETAIL_INDEX,
3911 PRICING_STATUS_CODE,
3912 PRICING_STATUS_TEXT
3913 FROM QP_PREQ_RLTD_LINES_TMP
3914 WHERE PRICING_STATUS_CODE = QP_PREQ_GRP.G_STATUS_NEW
3915 ORDER BY SETUP_VALUE_FROM;
3916
3917
3918 I PLS_INTEGER :=1;
3919 J PLS_INTEGER :=1;
3920 l_expiration_period_end_date Date;
3921 l_status_code VARCHAR2(30);
3922 l_status_text VARCHAR2(30);
3923 E_ROUTINE_ERROR EXCEPTION;
3924 l_routine VARCHAR2(240):='QP_PREQ_GRP.POPULATE_OUTPUT';
3925 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3926
3927 BEGIN
3928
3929 IF l_debug_level >0 then
3930 oe_debug_pub.add('----Before populate l_line_tbl-----');
3931 oe_debug_pub.add('----Line information return back to caller----');
3932 END IF;
3933
3934 FOR l_line IN l_lines_cur LOOP
3935 --requirement from Jay, will cause holes in pl/sql table.
3936 I := l_line.LINE_INDEX;
3937 x_line_tbl(I).LINE_INDEX := l_line.LINE_INDEX;
3938 x_line_tbl(I).LINE_ID := l_line.LINE_ID;
3939 x_line_tbl(I).HEADER_ID := l_line.PRICE_LIST_HEADER_ID;
3940 x_line_tbl(I).LINE_TYPE_CODE := l_line.LINE_TYPE_CODE;
3941 x_line_tbl(I).PRICED_QUANTITY := l_line.PRICED_QUANTITY;
3942 x_line_tbl(I).CURRENCY_CODE := l_line.CURRENCY_CODE;
3943 x_line_tbl(I).ROUNDING_FACTOR := l_line.ROUNDING_FACTOR;
3944 x_line_tbl(I).PRICED_UOM_CODE := l_line.PRICED_UOM_CODE;
3945 x_line_tbl(I).UNIT_PRICE := l_line.UNIT_PRICE; --shu_latest
3946 x_line_tbl(I).LINE_QUANTITY:=l_line.LINE_QUANTITY;
3947 x_line_tbl(I).LINE_UOM_CODE:=l_line.LINE_UOM_CODE;
3948 x_line_tbl(I).LINE_UNIT_PRICE := l_line.LINE_UNIT_PRICE; --shu_latest
3949 x_line_tbl(I).UOM_QUANTITY := l_line.UOM_QUANTITY; --shu_latest
3950 x_line_tbl(I).PERCENT_PRICE := l_line.PERCENT_PRICE;
3951 -- x_line_tbl(I).ADJUSTED_UNIT_PRICE := l_line.ADJUSTED_UNIT_PRICE;
3952 x_line_tbl(I).ADJUSTED_UNIT_PRICE:= l_line.ORDER_UOM_SELLING_PRICE;
3953 x_line_tbl(I).UPDATED_ADJUSTED_UNIT_PRICE := l_line.UPDATED_ADJUSTED_UNIT_PRICE;
3954 x_line_tbl(I).PARENT_PRICE := l_line.PARENT_PRICE;
3955 x_line_tbl(I).PARENT_QUANTITY := l_line.PARENT_QUANTITY;
3956 x_line_tbl(I).PARENT_UOM_CODE := l_line.PARENT_UOM_CODE;
3957 x_line_tbl(I).PROCESSED_CODE := l_line.PROCESSED_CODE;
3958 x_line_tbl(I).PRICE_FLAG := l_line.PRICE_FLAG;
3959 x_line_tbl(I).STATUS_CODE := l_line.PRICING_STATUS_CODE;
3960 x_line_tbl(I).STATUS_TEXT := substr(l_line.PRICING_STATUS_TEXT,1,2000); -- shulin, fix bug 1745788
3961 x_line_tbl(I).HOLD_CODE := l_line.HOLD_CODE;
3962 x_line_tbl(I).HOLD_TEXT := substr(l_line.HOLD_TEXT,1,240);
3963 x_line_tbl(I).PRICE_REQUEST_CODE := l_line.PRICE_REQUEST_CODE;
3964 x_line_tbl(I).PRICING_EFFECTIVE_DATE := l_line.PRICING_EFFECTIVE_DATE;
3965 x_line_tbl(I).EXTENDED_PRICE := l_line.EXTENDED_PRICE; -- block pricing
3966
3967
3968 END LOOP;
3969 I:=1;
3970
3971
3972 --Populate Line detail
3973 IF l_debug_level > 0 then
3974 oe_debug_pub.add('----Line detail information return back to caller----');
3975 END IF;
3976
3977 FOR l_dets IN l_ldets_cur LOOP
3978 IF l_debug_level > 0 then
3979 oe_debug_pub.add('----populating line detail output------');
3980 END IF;
3981 --requirement by Jay, will cause holes in pl/sql tbl
3982 I := l_dets.line_detail_index;
3983 x_line_detail_tbl(I).LINE_DETAIL_INDEX := l_dets.LINE_DETAIL_INDEX;
3984 x_line_detail_tbl(I).LINE_DETAIL_TYPE_CODE:=l_dets.LINE_DETAIL_TYPE_CODE;
3985 x_line_detail_tbl(I).LINE_INDEX:=l_dets.LINE_INDEX;
3986 x_line_detail_tbl(I).LIST_HEADER_ID:=l_dets.LIST_HEADER_ID;
3987 x_line_detail_tbl(I).LIST_LINE_ID:=l_dets.LIST_LINE_ID;
3988 x_line_detail_tbl(I).LIST_LINE_TYPE_CODE:=l_dets.LIST_LINE_TYPE_CODE;
3989 x_line_detail_tbl(I).SUBSTITUTION_TO:=l_dets.SUBSTITUTION_VALUE_TO;
3990 x_line_detail_tbl(I).LINE_QUANTITY :=l_dets.LINE_QUANTITY;
3991 --x_line_detail_tbl(I).ADJUSTMENT_AMOUNT := l_dets.ADJUSTMENT_AMOUNT;
3992 x_line_detail_tbl(I).ADJUSTMENT_AMOUNT:= nvl(l_dets.ORDER_QTY_ADJ_AMT,l_dets.ADJUSTMENT_AMOUNT);
3993 -- nvl(ldets.order_qty_adj_amt, ldets.adjustment_amount*nvl(lines.priced_quantity,1)/nvl(lines.line_quantity,1))
3994 x_line_detail_tbl(I).AUTOMATIC_FLAG := l_dets.AUTOMATIC_FLAG;
3995 x_line_detail_tbl(I).APPLIED_FLAG := l_dets.APPLIED_FLAG;
3996 x_line_detail_tbl(I).PRICING_GROUP_SEQUENCE := l_dets.PRICING_GROUP_SEQUENCE;
3997 x_line_detail_tbl(I).CREATED_FROM_LIST_TYPE_CODE:=l_dets.CREATED_FROM_LIST_TYPE_CODE;
3998 x_line_detail_tbl(I).PRICE_BREAK_TYPE_CODE := l_dets.PRICE_BREAK_TYPE_CODE;
3999 x_line_detail_tbl(I).OVERRIDE_FLAG := L_Dets.override_flag;
4000 x_line_detail_tbl(I).PRINT_ON_INVOICE_FLAG :=l_dets.print_on_invoice_flag;
4001 x_line_detail_tbl(I).PRICING_PHASE_ID := l_dets.PRICING_PHASE_ID;
4002 x_line_detail_tbl(I).APPLIED_FLAG := l_dets.APPLIED_FLAG;
4003 x_line_detail_tbl(I).OPERAND_CALCULATION_CODE := l_dets.OPERAND_CALCULATION_CODE;
4004 x_line_detail_tbl(I).OPERAND_VALUE := l_dets.OPERAND_VALUE;
4005 x_line_detail_tbl(I).STATUS_CODE:=l_dets.PRICING_STATUS_CODE;
4006 x_line_detail_tbl(I).STATUS_TEXT:=substr(l_dets.PRICING_STATUS_TEXT,1,240);
4007 x_line_detail_tbl(I).SUBSTITUTION_ATTRIBUTE:=l_dets.SUBSTITUTION_ATTRIBUTE;
4008 x_line_detail_tbl(I).ACCRUAL_FLAG:=l_dets.ACCRUAL_FLAG;
4009 x_line_detail_tbl(I).LIST_LINE_NO:=l_dets.LIST_LINE_NO;
4010 x_line_detail_tbl(I).ESTIM_GL_VALUE:=l_dets.ESTIM_GL_VALUE;
4011 x_line_detail_tbl(I).ACCRUAL_CONVERSION_RATE:=l_dets.ACCRUAL_CONVERSION_RATE;
4012 --Pass throuh components
4013 x_line_detail_tbl(I).OVERRIDE_FLAG:= l_dets.OVERRIDE_FLAG;
4014 x_line_detail_tbl(I).PRINT_ON_INVOICE_FLAG:=l_dets.PRINT_ON_INVOICE_FLAG;
4015 x_line_detail_tbl(I).INVENTORY_ITEM_ID:=l_dets.INVENTORY_ITEM_ID;
4016 x_line_detail_tbl(I).ORGANIZATION_ID:=l_dets.ORGANIZATION_ID;
4017 x_line_detail_tbl(I).RELATED_ITEM_ID:= l_dets.RELATED_ITEM_ID;
4018 x_line_detail_tbl(I).RELATIONSHIP_TYPE_ID:=l_dets.RELATIONSHIP_TYPE_ID;
4019 x_line_detail_tbl(I).ESTIM_ACCRUAL_RATE:=l_dets.ESTIM_ACCRUAL_RATE;
4020
4021 x_line_detail_tbl(I).BENEFIT_PRICE_LIST_LINE_ID:=l_dets.BENEFIT_PRICE_LIST_LINE_ID;
4022 x_line_detail_tbl(I).RECURRING_FLAG:= l_dets.RECURRING_FLAG;
4023 x_line_detail_tbl(I).RECURRING_VALUE:= l_dets.RECURRING_VALUE;
4024 x_line_detail_tbl(I).BENEFIT_LIMIT:= l_dets.BENEFIT_LIMIT;
4025 x_line_detail_tbl(I).CHARGE_TYPE_CODE:= l_dets.CHARGE_TYPE_CODE;
4026 x_line_detail_tbl(I).CHARGE_SUBTYPE_CODE:=l_dets.CHARGE_SUBTYPE_CODE;
4027 x_line_detail_tbl(I).BENEFIT_QTY:=l_dets.BENEFIT_QTY;
4028 x_line_detail_tbl(I).BENEFIT_UOM_CODE:=l_dets.BENEFIT_UOM_CODE;
4029 x_line_detail_tbl(I).PRORATION_TYPE_CODE:=l_dets.PRORATION_TYPE_CODE;
4030 x_line_detail_tbl(I).INCLUDE_ON_RETURNS_FLAG := l_dets.INCLUDE_ON_RETURNS_FLAG;
4031 x_line_detail_tbl(I).LIST_LINE_NO := l_dets.LIST_LINE_NO;
4032 x_line_detail_tbl(I).MODIFIER_LEVEL_CODE := l_dets.MODIFIER_LEVEL_CODE;
4033 x_line_detail_tbl(I).GROUP_VALUE := nvl(l_dets.GROUP_QUANTITY,l_dets.GROUP_AMOUNT); -- 2388011_new
4034 x_line_detail_tbl(I).COMMENTS := l_dets.COMMENTS;
4035 x_line_detail_tbl(I).UPDATED_FLAG := l_dets.UPDATED_FLAG;
4036 x_line_detail_tbl(I).PROCESS_CODE := l_dets.PROCESS_CODE;
4037 x_line_detail_tbl(I).LIMIT_CODE := l_dets.LIMIT_CODE;
4038 x_line_detail_tbl(I).LIMIT_TEXT := substr(l_dets.LIMIT_TEXT,1,240);
4039 x_line_detail_tbl(I).CALCULATION_CODE := l_dets.CALCULATION_CODE;
4040 x_line_detail_tbl(I).CHANGE_REASON_CODE := l_dets.CHANGE_REASON_CODE;
4041 x_line_detail_tbl(I).CHANGE_REASON_CODE := substr(l_dets.CHANGE_REASON_CODE,1,240);
4042
4043 IF l_status_code = FND_API.G_RET_STS_ERROR THEN
4044 -- IF G_DEBUG_ENGINE = FND_API.G_TRUE THEN
4045 IF l_debug_level > 0 then
4046 oe_debug_pub.add(l_routine||':'||substr(l_status_text,1,240));
4047 END IF;
4048 --END IF;
4049 END IF;
4050
4051 x_line_detail_tbl(I).EXPIRATION_DATE :=l_expiration_period_end_date;
4052 END LOOP;
4053 I:=1;
4054
4055 --Populate Qualifier detail
4056 --IF G_DEBUG_ENGINE = FND_API.G_TRUE THEN
4057 IF l_debug_level > 0 then
4058 oe_debug_pub.add('----Before populate x_qual_tbl-----');
4059 END IF;
4060 --END IF;
4061 FOR l_qual IN l_qual_cur(QP_PREQ_GRP.G_DETAIL_LEVEL) LOOP
4062 x_line_detail_qual_tbl(I).LINE_DETAIL_INDEX := l_qual.LINE_DETAIL_INDEX;
4063 x_line_detail_qual_tbl(I).QUALIFIER_CONTEXT := l_qual.CONTEXT;
4064 x_line_detail_qual_tbl(I).QUALIFIER_ATTRIBUTE := l_qual.ATTRIBUTE;
4065 x_line_detail_qual_tbl(I).QUALIFIER_ATTR_VALUE_FROM := l_qual.SETUP_VALUE_FROM;
4066 x_line_detail_qual_tbl(I).QUALIFIER_ATTR_VALUE_TO := l_qual.SETUP_VALUE_TO;
4067 x_line_detail_qual_tbl(I).COMPARISON_OPERATOR_CODE := l_qual.COMPARISON_OPERATOR_TYPE_CODE;
4068 x_line_detail_qual_tbl(I).status_code := l_qual.PRICING_STATUS_CODE;
4069 x_line_detail_qual_tbl(I).VALIDATED_FLAG :=l_qual.VALIDATED_FLAG;
4070
4071 I:=I+1;
4072 END LOOP;
4073 I:=1;
4074
4075 --LINE ATTRIBUTE DETAIL NEEDED
4076
4077 IF l_debug_level > 0 then
4078 oe_debug_pub.add('----Before populate attr_tbl-----');
4079 END IF;
4080
4081 FOR l_prc IN l_pricing_attr_cur LOOP
4082 IF l_debug_level >0 then
4083 oe_debug_pub.add('--------populating x_line_detail_attr----------');
4084 oe_debug_pub.add('Line Detail Index: '||l_prc.LINE_DETAIL_INDEX);
4085 END IF;
4086 x_line_detail_attr_tbl(I).LINE_DETAIL_INDEX := l_prc.LINE_DETAIL_INDEX;
4087 x_line_detail_attr_tbl(I).PRICING_CONTEXT := l_prc.PRICING_CONTEXT;
4088 x_line_detail_attr_tbl(I).PRICING_ATTRIBUTE := l_prc.PRICING_ATTRIBUTE;
4089 x_line_detail_attr_tbl(I).PRICING_ATTR_VALUE_FROM :=l_prc.PRICING_ATTR_VALUE_FROM;
4090 x_line_detail_attr_tbl(I).PRICING_ATTR_VALUE_TO :=l_prc.PRICING_ATTR_VALUE_TO;
4091 x_line_detail_attr_tbl(I).VALIDATED_FLAG :=l_prc.VALIDATED_FLAG;
4092 --x_line_attr_tbl(I).PRICING_STATUS_CODE := l_prc.PRICING_STATUS_CODE;
4093 --x_line_attr_tbl(I).PRICING_STATUS_TEXT := l_prc.PRICING_STATUS_TEXT;
4094 I:=I+1;
4095 END LOOP;
4096
4097 I:=1;
4098
4099 IF l_debug_level > 0 then
4100 oe_debug_pub.add('----Before populate l_rltd_lines_tbl-----');
4101 END IF;
4102 FOR l_rltd IN l_rltd_lines_cur LOOP
4103 x_related_lines_tbl(I).LINE_INDEX := l_rltd.Line_index;
4104 x_related_lines_tbl(I).LINE_DETAIL_INDEX := l_rltd.LINE_DETAIL_INDEX;
4105 x_related_lines_tbl(I).RELATIONSHIP_TYPE_CODE :=l_rltd.RELATIONSHIP_TYPE_CODE;
4106 x_related_lines_tbl(I).RELATED_LINE_INDEX :=l_rltd.RELATED_LINE_INDEX;
4107 x_related_lines_tbl(I).RELATED_LINE_DETAIL_INDEX :=l_rltd.RELATED_LINE_DETAIL_INDEX;
4108 x_related_lines_tbl(I).STATUS_CODE :=l_rltd.PRICING_STATUS_CODE;
4109 x_related_lines_tbl(I).STATUS_TEXT :=l_rltd.PRICING_STATUS_TEXT;
4110 I:=I+1;
4111 END LOOP;
4112
4113 EXCEPTION
4114 WHEN E_ROUTINE_ERROR THEN
4115 IF l_debug_level >0 then
4116 oe_debug_pub.add(l_routine||':'||substr(l_status_text,1,240));
4117 END IF;
4118
4119 END Populate_results;
4120
4121
4122
4123
4124 PROCEDURE price_item(out_req_line_tbl in out NOCOPY /* file.sql.39 change */ OE_OE_PRICING_AVAILABILITY.QP_LINE_TBL_TYPE,
4125 out_Req_line_attr_tbl in out nocopy OE_OE_PRICING_AVAILABILITY.QP_LINE_ATTR_TBL_TYPE,
4126 out_Req_LINE_DETAIL_attr_tbl in out nocopy OE_OE_PRICING_AVAILABILITY.QP_LINE_DATTR_TBL_TYPE,
4127 out_Req_LINE_DETAIL_tbl in out nocopy OE_OE_PRICING_AVAILABILITY.QP_LINE_DETAIL_TBL_TYPE,
4128 out_Req_related_lines_tbl in out nocopy OE_OE_PRICING_AVAILABILITY.QP_RLTD_LINES_TBL_TYPE,
4129 out_Req_qual_tbl in out nocopy OE_OE_PRICING_AVAILABILITY.QP_QUAL_TBL_TYPE,
4130 out_Req_LINE_DETAIL_qual_tbl in out nocopy OE_OE_PRICING_AVAILABILITY.QP_LINE_DQUAL_TBL_TYPE,
4131 out_child_detail_type out nocopy varchar2
4132 ) IS
4133
4134 l_return_status varchar2(10);
4135 l_return_status_Text varchar2(240) ;
4136 lx_Control_Rec QP_PREQ_GRP.CONTROL_RECORD_TYPE;
4137 l_Control_Rec OE_OE_PRICING_AVAILABILITY.QP_CONTROL_RECORD_TYPE;
4138 l_req_line_tbl OE_OE_PRICING_AVAILABILITY.QP_LINE_TBL_TYPE;
4139 l_Req_qual_tbl OE_OE_PRICING_AVAILABILITY.QP_QUAL_TBL_TYPE;
4140 l_Req_line_attr_tbl OE_OE_PRICING_AVAILABILITY.QP_LINE_ATTR_TBL_TYPE;
4141 l_Req_LINE_DETAIL_tbl OE_OE_PRICING_AVAILABILITY.QP_LINE_DETAIL_TBL_TYPE;
4142 l_Req_LINE_DETAIL_qual_tbl OE_OE_PRICING_AVAILABILITY.QP_LINE_DQUAL_TBL_TYPE;
4143 l_Req_LINE_DETAIL_attr_tbl OE_OE_PRICING_AVAILABILITY.QP_LINE_DATTR_TBL_TYPE;
4144 l_Req_related_lines_tbl OE_OE_PRICING_AVAILABILITY.QP_RLTD_LINES_TBL_TYPE;
4145
4146 --
4147 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4148 --
4149 BEGIN
4150
4151 out_child_detail_type := qp_preq_grp.G_CHILD_DETAIL_TYPE;
4152 reset_all_tbls;
4153
4154 IF l_debug_level > 0 THEN
4155 oe_debug_pub.add( 'SETTING REQUEST ID' , 1 ) ;
4156 END IF;
4157
4158 qp_price_request_context.set_request_id;
4159
4160 IF l_debug_level > 0 THEN
4161 oe_debug_pub.add('REQUEST ID IS : ' || QP_PREQ_GRP.G_REQUEST_ID , 1 ) ;
4162 END IF;
4163
4164
4165 OE_ORDER_PUB.G_HDR:=NULL;
4166 OE_ORDER_PUB.G_LINE:=NULL;
4167
4168 IF l_debug_level > 0 THEN
4169 print_time('Before Calling Copy Header to Request');
4170 END IF;
4171 g_applied_manual_tbl.delete;
4172 copy_Header_to_request(
4173 p_request_type_code => 'ONT'
4174 -- p_request_type_code => 'ASO'
4175 ,p_calculate_price_flag => 'Y'
4176 ,px_req_line_tbl => l_req_line_tbl
4177 );
4178
4179 IF l_debug_level > 0 THEN
4180 print_time('After Calling Copy Header to Request');
4181 END IF;
4182 set_pricing_control_record (
4183 l_Control_Rec => l_control_rec
4184 ,in_pricing_event => 'BATCH'
4185 );
4186
4187 copy_control_rec(in_Control_Rec => l_control_rec,
4188 x_Control_Rec=>lx_control_rec);
4189
4190 build_context_for_header(
4191 p_req_line_tbl_count =>l_req_line_tbl.count,
4192 p_price_request_code => null,
4193 p_item_type_code => null,
4194 p_Req_line_attr_tbl =>l_req_line_attr_tbl,
4195 p_Req_qual_tbl =>l_req_qual_tbl
4196 );
4197
4198
4199 IF l_debug_level > 0 THEN
4200 print_time('Before Looping through Copy Line to request');
4201 END IF;
4202 for l_line_index in g_panda_rec_table.first..g_panda_rec_table.last
4203 LOOP
4204
4205 IF l_debug_level > 0 THEN
4206 oe_debug_pub.add('the line index'||l_line_index);
4207 END IF;
4208 copy_Line_to_request(
4209 px_req_line_tbl => l_req_line_tbl
4210 ,p_pricing_event => 'BATCH'
4211 ,p_Request_Type_Code => 'ONT'
4212 -- ,p_Request_Type_Code => 'ASO'
4213 ,p_honor_price_flag => 'Y'
4214 ,p_line_index=>l_line_index
4215 );
4216
4217 build_context_for_line(
4218 p_req_line_tbl_count =>l_req_line_tbl.count,
4219 p_price_request_code => null,
4220 p_item_type_code => null,
4221 p_Req_line_attr_tbl =>l_req_line_attr_tbl,
4222 p_Req_qual_tbl =>l_req_qual_tbl,
4223 p_line_index=>l_line_index
4224 );
4225
4226
4227
4228 oe_Debug_pub.add('Calling Append Attributes for Line');
4229 Append_attributes(
4230 p_header_id => g_header_id
4231 ,p_Line_id => g_panda_rec_table(l_line_index).p_line_id
4232 ,p_line_index =>global_line_index
4233 ,px_Req_line_attr_tbl => l_req_line_attr_tbl
4234 ,px_Req_qual_tbl => l_req_qual_tbl
4235 ,p_g_line_index =>l_line_index
4236 );
4237
4238 -- inserting manual adjsutments
4239 oe_Debug_pub.add('modfier count'||g_manual_modifier_tbl.count);
4240 if g_manual_modifier_tbl.count > 0 then
4241
4242 IF l_debug_level > 0 THEN
4243 oe_debug_pub.add('before inserting manual adjustment'||g_manual_modifier_tbl.count);
4244 END IF;
4245
4246 insert_manual_adjustment(in_line_id=>g_panda_rec_table(l_line_index).p_line_id,
4247 in_line_index=>global_line_index) ;
4248
4249 IF l_debug_level > 0 THEN
4250 oe_debug_pub.add('after inserting manual adjustment');
4251 END IF;
4252 end if;
4253
4254
4255 end loop; -- Looping for each line
4256
4257 IF l_debug_level > 0 THEN
4258 print_time('After Looping through Copy Line to Request');
4259 END IF;
4260
4261 /* build_context_for_header(
4262 p_req_line_tbl_count =>l_req_line_tbl.count,
4263 p_price_request_code => null,
4264 p_item_type_code => null,
4265 p_Req_line_attr_tbl =>l_req_line_attr_tbl,
4266 p_Req_qual_tbl =>l_req_qual_tbl
4267 ); */
4268
4269 oe_Debug_pub.add('Calling Append Attributes for Header');
4270
4271 Append_attributes(
4272 p_header_id => g_header_id
4273 ,p_Line_id => null
4274 ,p_line_index => l_req_line_tbl.count
4275 ,px_Req_line_attr_tbl => l_req_line_attr_tbl
4276 ,px_Req_qual_tbl => l_req_qual_tbl
4277 ,p_g_line_index =>1
4278 );
4279
4280
4281 IF l_debug_level > 0 THEN
4282 print_time('After appending the Header Attributes and Before Appending attributes to Temp Tables');
4283 oe_Debug_pub.add(' Populating the attr tables');
4284 END IF;
4285
4286 append_attr_to_TTables(px_req_line_attr_tbl=>l_req_line_attr_tbl);
4287 IF l_debug_level > 0 THEN
4288 print_time('After Appending attributes to Temp Tables');
4289 END IF;
4290 out_req_line_tbl(1).status_Code := null;
4291 out_req_line_tbl(1).status_text := null;
4292
4293
4294 IF l_debug_level > 0 then
4295 oe_Debug_pub.add(' Populating the temp tables');
4296 print_time('Before Populate Temp Tables');
4297 END IF;
4298 populate_temp_table;
4299
4300 IF l_debug_level > 0 THEN
4301 print_time(' After populating temp tables and Before calling PE');
4302 END IF;
4303 QP_PREQ_PUB.PRICE_REQUEST
4304 (p_control_rec =>lx_control_rec,
4305 x_return_status =>l_return_status,
4306 x_return_status_Text =>l_return_status_Text
4307 );
4308
4309 IF l_debug_level > 0 THEN
4310 print_time('After calling PE');
4311 oe_debug_pub.add('After calling the pricing engine');
4312 END IF;
4313 IF l_debug_level > 0 THEN
4314 print_time('Before populate results ');
4315 END IF;
4316 populate_results(
4317 x_line_tbl =>out_req_line_tbl
4318 ,x_line_qual_tbl =>out_Req_qual_tbl
4319 ,x_line_attr_tbl =>out_Req_line_attr_tbl
4320 ,x_line_detail_tbl =>out_req_line_detail_tbl
4321 ,x_line_detail_qual_tbl=>out_req_line_detail_qual_tbl
4322 ,x_line_detail_attr_tbl =>out_req_line_detail_attr_tbl
4323 ,x_related_lines_tbl=>out_req_related_lines_tbl);
4324
4325 IF l_debug_level > 0 THEN
4326 print_time('After populating results');
4327 END IF;
4328 IF l_debug_level > 0 THEN
4329 print_time('After populating the pl/sql records');
4330 END IF;
4331
4332 IF l_debug_level > 0 THEN
4333 oe_debug_pub.add('******AFTER CALLING PRICING ENGINE' ) ;
4334 oe_debug_pub.add('MAIN STATUS ='||L_RETURN_STATUS ) ;
4335 oe_debug_pub.add('MAIN TEXT ='||L_RETURN_STATUS_TEXT ) ;
4336 oe_debug_pub.add('COUNT LINE TABLE='||OUT_REQ_LINE_TBL.COUNT ) ;
4337 END IF;
4338
4339 if out_req_line_tbl.count > 0 then
4340 for i in out_req_line_tbl.first..out_req_line_tbl.last
4341 loop
4342
4343 IF l_debug_level > 0 THEN
4344 oe_debug_pub.add('*******************************' ) ;
4345 oe_debug_pub.add(' LINE_INDEX ='||OUT_REQ_LINE_TBL (I).LINE_INDEX );
4346 oe_debug_pub.add('LINE_ID='||OUT_REQ_LINE_TBL (I).LINE_ID);
4347 oe_debug_pub.add('REQUEST_TYPE_CODE ='|| OUT_REQ_LINE_TBL (I) .REQUEST_TYPE_CODE ) ;
4348 oe_debug_pub.add('PRICING_EVENT ='||OUT_REQ_LINE_TBL (I) .PRICING_EVENT ) ;
4349 oe_debug_pub.add('HEADER_ID ='||OUT_REQ_LINE_TBL (I) .HEADER_ID ) ;
4350 oe_debug_pub.add('LINE_TYPE_CODE='||OUT_REQ_LINE_TBL (I) .LINE_TYPE_CODE ) ;
4351 oe_debug_pub.add('LINE_QUANTITY ='||OUT_REQ_LINE_TBL (I) .LINE_QUANTITY ) ;
4352 oe_debug_pub.add('LINE_UOM_CODE ='||OUT_REQ_LINE_TBL (I) .LINE_UOM_CODE ) ;
4353 oe_debug_pub.add('UOM_QUANTITY ='||OUT_REQ_LINE_TBL (I) .UOM_QUANTITY ) ;
4354 oe_debug_pub.add('PRI_QUANTITY='||OUT_REQ_LINE_TBL (I) .PRICED_QUANTITY ) ;
4355 oe_debug_pub.add('PR_UOM_CODE ='||OUT_REQ_LINE_TBL (I) .PRICED_UOM_CODE ) ;
4356 oe_debug_pub.add('CURRENCY_CODE ='||OUT_REQ_LINE_TBL (I) .CURRENCY_CODE ) ;
4357 oe_debug_pub.add('UNIT_PRICE ='||OUT_REQ_LINE_TBL (I) .UNIT_PRICE ) ;
4358 oe_debug_pub.add('PERCENT_PRICE ='||OUT_REQ_LINE_TBL (I) .PERCENT_PRICE ) ;
4359 oe_debug_pub.add('ADJ_UNIT_PRICE='|| OUT_REQ_LINE_TBL (I) .ADJUSTED_UNIT_PRICE ) ;
4360 oe_debug_pub.add('UPDATED_ADJUSTED_UNIT_PRICE ='|| OUT_REQ_LINE_TBL (I) .UPDATED_ADJUSTED_UNIT_PRICE ) ;
4361 oe_debug_pub.add('ROUNDING_FAC='||OUT_REQ_LINE_TBL (I) .ROUNDING_FACTOR ) ;
4362 oe_debug_pub.add('PRICE_FLAG ='||OUT_REQ_LINE_TBL (I) .PRICE_FLAG ) ;
4363 oe_debug_pub.add('PRICE_REQUEST_CODE ='|| OUT_REQ_LINE_TBL (I) .PRICE_REQUEST_CODE ) ;
4364 oe_debug_pub.add('HOLD_CODE ='||OUT_REQ_LINE_TBL (I) .HOLD_CODE ) ;
4365 oe_debug_pub.add('HOLD_TEXT ='||OUT_REQ_LINE_TBL (I) .HOLD_TEXT ) ;
4366 oe_debug_pub.add('STATUS_CODE ='||OUT_REQ_LINE_TBL (I) .STATUS_CODE ) ;
4367 oe_debug_pub.add('STATUS_TEXT ='||OUT_REQ_LINE_TBL (I) .STATUS_TEXT ) ;
4368 oe_debug_pub.add('USAGE_PRICING_TYPE ='|| OUT_REQ_LINE_TBL (I) .USAGE_PRICING_TYPE ) ;
4369 oe_debug_pub.add('LINE_CATEGORY ='||OUT_REQ_LINE_TBL (I) .LINE_CATEGORY ) ;
4370 oe_debug_pub.add('PRICING EFFECTIVE DATE='|| OUT_REQ_LINE_TBL (I) .PRICING_EFFECTIVE_DATE ) ;
4371 oe_debug_pub.add('ACTIVE_DATE_FIRST ='|| OUT_REQ_LINE_TBL (I) .ACTIVE_DATE_FIRST ) ;
4372 oe_debug_pub.add('ACTIVE_DATE_FIRST_TYPE ='|| OUT_REQ_LINE_TBL (I) .ACTIVE_DATE_FIRST_TYPE ) ;
4373 oe_debug_pub.add('ACTIVE_DATE_SECOND ='|| OUT_REQ_LINE_TBL (I) .ACTIVE_DATE_SECOND ) ;
4374 oe_debug_pub.add('ACTIVE_DATE_SECOND_TYPE ='|| OUT_REQ_LINE_TBL (I) .ACTIVE_DATE_SECOND_TYPE ) ;
4375 END IF;
4376 end loop;
4377 end if;
4378
4379 IF l_debug_level > 0 THEN
4380 oe_debug_pub.add('COUNT LINE DETAIL TABLE='||OUT_REQ_LINE_DETAIL_TBL.COUNT ) ;
4381 END IF;
4382
4383 if out_req_line_detail_tbl.count > 0 then
4384
4385 for i in out_req_line_detail_tbl.first..out_req_line_detail_tbl.last
4386 loop
4387
4388 IF l_debug_level > 0 THEN
4389 oe_debug_pub.add('LINE DETAIL TABLE RECORD='||I ) ;
4390 END IF;
4391
4392 IF out_req_line_detail_tbl.exists(i) then
4393
4394 IF l_debug_level > 0 THEN
4395 oe_debug_pub.add('*******************************' ) ;
4396 oe_debug_pub.add('LINE_DETAIL_INDEX ='||OUT_REQ_LINE_DETAIL_TBL (I).LINE_DETAIL_INDEX);
4397 oe_debug_pub.add('LINE_DETAIL_TYPE_CODE='||OUT_REQ_LINE_DETAIL_TBL (I).LINE_DETAIL_TYPE_CODE);
4398 oe_debug_pub.add('LIN_INDEX='||OUT_REQ_LINE_DETAIL_TBL (I) .LINE_INDEX ) ;
4399 oe_debug_pub.add('LIST_HEADER_ID='|| OUT_REQ_LINE_DETAIL_TBL (I) .LIST_HEADER_ID ) ;
4400 oe_debug_pub.add('LIST_LINE_ID='|| OUT_REQ_LINE_DETAIL_TBL (I) .LIST_LINE_ID ) ;
4401 oe_debug_pub.add('LIST_LINE_TYPE_CODE='|| OUT_REQ_LINE_DETAIL_TBL (I) .LIST_LINE_TYPE_CODE ) ;
4402 oe_debug_pub.add('LINE_DETAIL_TYPE_CODE='|| OUT_REQ_LINE_DETAIL_TBL (I) .LINE_DETAIL_TYPE_CODE ) ;
4403 oe_debug_pub.add('SUBSTITUTION_TO='||OUT_REQ_LINE_DETAIL_TBL (I).SUBSTITUTION_TO);
4404 oe_debug_pub.add('LINE_QUANTITY='||OUT_REQ_LINE_DETAIL_TBL (I).LINE_QUANTITY);
4405 oe_debug_pub.add('ADJUSTMENT_AMOUNT='|| OUT_REQ_LINE_DETAIL_TBL (I) .ADJUSTMENT_AMOUNT ) ;
4406 oe_debug_pub.add('AUTOMATIC_FLAG='|| OUT_REQ_LINE_DETAIL_TBL (I) .AUTOMATIC_FLAG ) ;
4407 oe_debug_pub.add('APPLIED_FLAG ='||OUT_REQ_LINE_DETAIL_TBL (I).APPLIED_FLAG );
4408 oe_debug_pub.add('PRICING_GROUP_SEQUENCE='||OUT_REQ_LINE_DETAIL_TBL (I).PRICING_GROUP_SEQUENCE);
4409 oe_debug_pub.add('CREATED_FROM_LIST_TYPE_CODE='|| OUT_REQ_LINE_DETAIL_TBL (I) .CREATED_FROM_LIST_TYPE_CODE ) ;
4410 oe_debug_pub.add('PRICE_BREAK_TYPE_CODE='|| OUT_REQ_LINE_DETAIL_TBL (I) .PRICE_BREAK_TYPE_CODE ) ;
4411 oe_debug_pub.add('OVERRIDE_FLAG='||OUT_REQ_LINE_DETAIL_TBL (I).OVERRIDE_FLAG);
4412 oe_debug_pub.add('PRINT_ON_INVOICE_FLAG='||OUT_REQ_LINE_DETAIL_TBL (I).PRINT_ON_INVOICE_FLAG);
4413 oe_debug_pub.add('PRICING_PHASE_ID='||OUT_REQ_LINE_DETAIL_TBL (I).PRICING_PHASE_ID);
4414 oe_debug_pub.add('OPERAND_CALCULATION_CODE='||OUT_REQ_LINE_DETAIL_TBL(I).OPERAND_CALCULATION_CODE);
4415 oe_debug_pub.add('OPERAND_VALUE='||OUT_REQ_LINE_DETAIL_TBL (I).OPERAND_VALUE);
4416 oe_debug_pub.add('STATUS_CODE='||OUT_REQ_LINE_DETAIL_TBL (I).STATUS_CODE);
4417 oe_debug_pub.add('STATUS_TEXT='||OUT_REQ_LINE_DETAIL_TBL (I).STATUS_TEXT);
4418 oe_debug_pub.add('SUBSTITUTION_ATTRIBUTE='||OUT_REQ_LINE_DETAIL_TBL (I).SUBSTITUTION_ATTRIBUTE);
4419 oe_debug_pub.add('ACCRUAL='||OUT_REQ_LINE_DETAIL_TBL (I) .ACCRUAL_FLAG ) ;
4420 oe_debug_pub.add('LIST_LINE_NO='||OUT_REQ_LINE_DETAIL_TBL (I).LIST_LINE_NO);
4421 oe_debug_pub.add('ESTIM_GL_VALUE='||OUT_REQ_LINE_DETAIL_TBL (I).ESTIM_GL_VALUE);
4422 oe_debug_pub.add('ACCRUAL_CONVERSION_RATE='||OUT_REQ_LINE_DETAIL_TBL (I).ACCRUAL_CONVERSION_RATE);
4423 oe_debug_pub.add('PRINT_ON_INVOICE_FLAG='||OUT_REQ_LINE_DETAIL_TBL (I).PRINT_ON_INVOICE_FLAG);
4424 oe_debug_pub.add('INVENTORY_ITEM_ID='|| OUT_REQ_LINE_DETAIL_TBL (I) .INVENTORY_ITEM_ID ) ;
4425 oe_debug_pub.add('ORGANIZATION_ID='||OUT_REQ_LINE_DETAIL_TBL (I).ORGANIZATION_ID);
4426 oe_debug_pub.add('RELATED_ITEM_ID='||OUT_REQ_LINE_DETAIL_TBL (I).RELATED_ITEM_ID);
4427 oe_debug_pub.add('RELATIONSHIP_TYPE_ID='||OUT_REQ_LINE_DETAIL_TBL (I).RELATIONSHIP_TYPE_ID);
4428 oe_debug_pub.add('ESTIM_ACCRUAL_RATE='||OUT_REQ_LINE_DETAIL_TBL (I).ESTIM_ACCRUAL_RATE);
4429 oe_debug_pub.add('BENEFIT_PRICE_LIST_LINE_ID='||OUT_REQ_LINE_DETAIL_TBL (I).BENEFIT_PRICE_LIST_LINE_ID);
4430 oe_debug_pub.add('RECURRING_FLAG='||OUT_REQ_LINE_DETAIL_TBL (I).RECURRING_FLAG );
4431 oe_debug_pub.add('RECURRING_VALUE='||OUT_REQ_LINE_DETAIL_TBL(I).RECURRING_VALUE);
4432 oe_debug_pub.add('BENEFIT_LIMIT='||OUT_REQ_LINE_DETAIL_TBL (I).BENEFIT_LIMIT);
4433 oe_debug_pub.add('CHARGE_TYPE_CODE='||OUT_REQ_LINE_DETAIL_TBL (I).CHARGE_TYPE_CODE);
4434 oe_debug_pub.add('CHARGE_SUBTYPE_CODE='||OUT_REQ_LINE_DETAIL_TBL (I).CHARGE_SUBTYPE_CODE);
4435 oe_debug_pub.add('BENEFIT_QTY='||OUT_REQ_LINE_DETAIL_TBL (I).BENEFIT_QTY);
4436 oe_debug_pub.add('BENEFIT_UOM_CODE='||OUT_REQ_LINE_DETAIL_TBL (I).BENEFIT_UOM_CODE);
4437 oe_debug_pub.add('PRORATION_TYPE_CODE='||OUT_REQ_LINE_DETAIL_TBL (I).PRORATION_TYPE_CODE);
4438 oe_debug_pub.add('NCLUDE_ON_RETURNS_FLAG ='||OUT_REQ_LINE_DETAIL_TBL (I).INCLUDE_ON_RETURNS_FLAG );
4439 oe_debug_pub.add('CALCULATION_CODE='||OUT_REQ_LINE_DETAIL_TBL (I).CALCULATION_CODE);
4440 oe_debug_pub.add('LST_PRICE='||OUT_REQ_LINE_DETAIL_TBL (I) .LIST_PRICE ) ;
4441 oe_debug_pub.add('MODIFIER_LEVEL_CODE='|| OUT_REQ_LINE_DETAIL_TBL (I) .MODIFIER_LEVEL_CODE ) ;
4442
4443
4444 end if;
4445 end if;
4446 end loop;
4447
4448 end if;
4449
4450
4451 IF l_debug_level > 0 THEN
4452 oe_debug_pub.add('COUNT LINE DETAIL ATTR TBL='|| OUT_REQ_LINE_DETAIL_ATTR_TBL.COUNT ) ;
4453 END IF;
4454
4455 if out_req_line_detail_attr_tbl.count > 0 then
4456 for i in out_req_line_detail_attr_tbl.first..out_req_line_detail_attr_tbl.last
4457 loop
4458 IF l_debug_level > 0 THEN
4459 oe_debug_pub.add('*******************************' ) ;
4460 oe_debug_pub.add('LINE DETAIL ATTR_TABLE RECORD='||I ) ;
4461 oe_debug_pub.add('LINE_DETAIL_INDEX='|| OUT_REQ_LINE_DETAIL_ATTR_TBL (I) .LINE_DETAIL_INDEX ) ;
4462 oe_debug_pub.add('PRICING_CONTEXT='|| OUT_REQ_LINE_DETAIL_ATTR_TBL (I) .PRICING_CONTEXT ) ;
4463 oe_debug_pub.add('PRICING_ATTRIBUTE='|| OUT_REQ_LINE_DETAIL_ATTR_TBL (I) .PRICING_ATTRIBUTE ) ;
4464 oe_debug_pub.add('PRICING_ATTR_VALUE_FROM='|| OUT_REQ_LINE_DETAIL_ATTR_TBL (I) .PRICING_ATTR_VALUE_FROM ) ;
4465 oe_debug_pub.add('PRICING_ATTR_VALUE_TO='|| OUT_REQ_LINE_DETAIL_ATTR_TBL (I) .PRICING_ATTR_VALUE_TO ) ;
4466 END IF;
4467
4468 end loop;
4469 end if;
4470
4471
4472 IF l_debug_level > 0 THEN
4473 oe_debug_pub.add('COUNT LINE ATTR TBL='||OUT_REQ_LINE_ATTR_TBL.COUNT ) ;
4474 END IF;
4475
4476 if out_req_line_attr_tbl.count > 0 then
4477 for i in out_req_line_attr_tbl.first..out_req_line_attr_tbl.last
4478 loop
4479 IF l_debug_level > 0 THEN
4480 oe_debug_pub.add('*******************************' ) ;
4481 oe_debug_pub.add('LINE ATTR_TABLE RECORD='||I ) ;
4482 oe_debug_pub.add('LINE_INDEX='||OUT_REQ_LINE_ATTR_TBL (I) .LINE_INDEX ) ;
4483 oe_debug_pub.add('PRICING_CONTEXT='|| OUT_REQ_LINE_ATTR_TBL (I) .PRICING_CONTEXT ) ;
4484 oe_debug_pub.add('PRICING_ATTRIBUTE='|| OUT_REQ_LINE_ATTR_TBL (I) .PRICING_ATTRIBUTE ) ;
4485 oe_debug_pub.add('PRICING_ATTR_VALUE_FROM='|| OUT_REQ_LINE_ATTR_TBL (I) .PRICING_ATTR_VALUE_FROM ) ;
4486 oe_debug_pub.add('PRICING_ATTR_VALUE_TO='|| OUT_REQ_LINE_ATTR_TBL (I) .PRICING_ATTR_VALUE_TO ) ;
4487 END IF;
4488
4489 end loop;
4490 end if;
4491
4492
4493 IF l_debug_level > 0 THEN
4494 oe_debug_pub.add('COUNT RELATED LINES TBL='|| OUT_REQ_RELATED_LINES_TBL.COUNT ) ;
4495 END IF;
4496
4497 if out_req_related_lines_tbl.count > 0 then
4498 for i in out_req_related_lines_tbl.first..out_req_related_lines_tbl.last
4499 loop
4500 IF l_debug_level > 0 THEN
4501 oe_debug_pub.add('*******************************' ) ;
4502 oe_debug_pub.add('RELATD LINES RECORD='||I ) ;
4503 oe_debug_pub.add('LIN_INDEX='||OUT_REQ_RELATED_LINES_TBL (I) .LINE_INDEX ) ;
4504 oe_debug_pub.add('LINE_DETAIL_INDEX='|| OUT_REQ_RELATED_LINES_TBL (I) .LINE_DETAIL_INDEX ) ;
4505 oe_debug_pub.add('RELATIONSHIP_TYPE_CODE='|| OUT_REQ_RELATED_LINES_TBL (I) .RELATIONSHIP_TYPE_CODE ) ;
4506 oe_debug_pub.add('RELATED_LINE_INDEX='|| OUT_REQ_RELATED_LINES_TBL (I) .RELATED_LINE_INDEX ) ;
4507 oe_debug_pub.add('RELATED_LINE_DETAIL_INDEX='|| OUT_REQ_RELATED_LINES_TBL (I) .RELATED_LINE_DETAIL_INDEX ) ;
4508 END IF;
4509
4510 end loop;
4511 end if;
4512
4513
4514 IF l_debug_level > 0 THEN
4515 oe_debug_pub.add('COUNT LINE QUAL TBL='||OUT_REQ_QUAL_TBL.COUNT ) ;
4516 END IF;
4517
4518 if out_req_qual_tbl.count > 0 then
4519 for i in out_req_qual_tbl.first..out_req_qual_tbl.last
4520 loop
4521 IF l_debug_level > 0 THEN
4522 oe_debug_pub.add('*******************************' ) ;
4523 oe_debug_pub.add('QUAL TABLE RECORD='||I ) ;
4524 oe_debug_pub.add('LINE_INDEX='||OUT_REQ_QUAL_TBL (I) .LINE_INDEX ) ;
4525 oe_debug_pub.add('QUALIFIER_CONTEXT='|| OUT_REQ_QUAL_TBL (I) .QUALIFIER_CONTEXT ) ;
4526 oe_debug_pub.add('QUALIFIER_ATTRIBUTE='|| OUT_REQ_QUAL_TBL (I) .QUALIFIER_ATTRIBUTE ) ;
4527 oe_debug_pub.add('QUALIFIER_ATTR_VALUE_FROM='|| OUT_REQ_QUAL_TBL (I) .QUALIFIER_ATTR_VALUE_FROM ) ;
4528 oe_debug_pub.add('QUALIFIER_ATTR_VALUE_TO='|| OUT_REQ_QUAL_TBL (I) .QUALIFIER_ATTR_VALUE_TO ) ;
4529 oe_debug_pub.add('COMPARISON_OPERATOR_CODE='|| OUT_REQ_QUAL_TBL (I) .COMPARISON_OPERATOR_CODE ) ;
4530 oe_debug_pub.add('VALIDATED_FLAG='||OUT_REQ_QUAL_TBL (I) .VALIDATED_FLAG ) ;
4531 END IF;
4532
4533 end loop;
4534 end if;
4535
4536
4537 IF l_debug_level > 0 THEN
4538 oe_debug_pub.add('COUNT LINE DETAIL QUAL TBL='|| OUT_REQ_LINE_DETAIL_QUAL_TBL.COUNT ) ;
4539 END IF;
4540
4541 if out_req_line_detail_qual_tbl.count > 0 then
4542 for i in out_req_line_detail_qual_tbl.first..out_req_line_detail_qual_tbl.last
4543 loop
4544 IF l_debug_level > 0 THEN
4545 oe_debug_pub.add('*******************************' ) ;
4546 oe_debug_pub.add('LINE DETAIL QUAL TABLE RECORD='||I ) ;
4547 oe_debug_pub.add('LINE_DETAIL_INDEX='|| OUT_REQ_LINE_DETAIL_QUAL_TBL (I) .LINE_DETAIL_INDEX ) ;
4548 oe_debug_pub.add('QUALIFIER_CONTEXT='|| OUT_REQ_LINE_DETAIL_QUAL_TBL (I) .QUALIFIER_CONTEXT ) ;
4549 oe_debug_pub.add('QUALIFIER_ATTRIBUTE='|| OUT_REQ_LINE_DETAIL_QUAL_TBL (I) .QUALIFIER_ATTRIBUTE ) ;
4550 oe_debug_pub.add('QUALIFIER_ATTR_VALUE_FROM='|| OUT_REQ_LINE_DETAIL_QUAL_TBL (I) .QUALIFIER_ATTR_VALUE_FROM ) ;
4551 oe_debug_pub.add('QUALIFIER_ATTR_VALUE_TO='|| OUT_REQ_LINE_DETAIL_QUAL_TBL (I) .QUALIFIER_ATTR_VALUE_TO ) ;
4552 oe_debug_pub.add('COMPARISON_OPERATOR_CODE='|| OUT_REQ_LINE_DETAIL_QUAL_TBL (I) .COMPARISON_OPERATOR_CODE ) ;
4553 oe_debug_pub.add('VALIDATED_FLAG='|| OUT_REQ_LINE_DETAIL_QUAL_TBL (I) .VALIDATED_FLAG ) ;
4554 END IF;
4555
4556 end loop;
4557 end if;
4558
4559
4560 IF l_debug_level > 0 THEN
4561 oe_debug_pub.add( 'EXITING PRICE_ITEM*******************************' ) ;
4562 END IF;
4563
4564 EXCEPTION
4565 when others then
4566
4567 IF l_debug_level > 0 THEN
4568 oe_debug_pub.add( 'PRICE ITEM EXCEPTION WHEN OTHERS CODE='|| SQLCODE||' MESSAGE='||SQLERRM ) ;
4569 END IF;
4570
4571 END price_item;
4572
4573 PROCEDURE pass_values_to_backend (
4574 in_panda_rec_table in panda_rec_table)
4575 IS
4576 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4577 BEGIN
4578
4579 g_panda_rec_table.delete;
4580 for i in in_panda_rec_table.first..in_panda_rec_table.last
4581 loop
4582 if l_debug_level > 0 then
4583 oe_debug_pub.add(' Line Record Nbr='||i);
4584 end if;
4585 g_panda_rec_table(i):=in_panda_rec_table(i);
4586 if l_debug_level > 0 then
4587 oe_debug_pub.add('*******IT STARTS HERE*****');
4588 oe_debug_pub.add('index is'||i||' item is='||g_panda_rec_table(i).p_inventory_item_id);
4589 end if;
4590
4591 end loop;
4592
4593 END pass_values_to_backend;
4594
4595 Procedure Delete_manual_modifiers Is
4596 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4597 Begin
4598
4599 if l_debug_level > 0 then
4600 oe_debug_pub.add('entered delete manual modifiers');
4601 end if;
4602 g_manual_modifier_tbl.delete;
4603 g_modf_rel_tbl.delete;
4604 g_modf_attributes_tbl.delete;
4605 if l_debug_level > 0 then
4606 oe_debug_pub.add('exiting delete manual modifiers');
4607 end if;
4608
4609 End Delete_manual_modifiers;
4610
4611 Procedure Pass_Modifiers_to_backend(in_manual_adj_tbl in Manual_modifier_tbl,
4612 in_modf_rel_tbl in Modifier_assoc_Tbl,
4613 in_modf_attr_tbl in Modifier_attributes_Tbl) IS
4614
4615 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4616 l_ctr number;
4617
4618 BEGIN
4619 if l_debug_level > 0 then
4620 oe_debug_pub.add('Entering PLS pass modifiers to backend');
4621 end if;
4622
4623 l_ctr := g_manual_modifier_tbl.COUNT ;
4624
4625 /* add the passed modifier and the line id accordingly */
4626 if in_manual_Adj_tbl.count >0 then
4627 for i in in_manual_adj_tbl.first..in_manual_adj_tbl.last
4628 loop
4629 IF in_manual_adj_tbl.exists(i) then
4630 l_ctr:=l_ctr+1;
4631 g_manual_modifier_tbl(l_ctr):=in_manual_adj_tbl(i);
4632 oe_Debug_pub.add('after assigning modifiers');
4633 oe_Debug_pub.add('after increasing counter');
4634
4635 IF l_debug_level > 0 then
4636 oe_debug_pub.add('line_id='||g_manual_modifier_tbl(l_ctr).p_line_id);
4637
4638 END IF;
4639
4640 END IF;
4641 end loop;
4642 end if;
4643 -- g_modf_Rel_tbl.delete;
4644 l_ctr:=g_modf_rel_Tbl.count;
4645 if in_modf_rel_tbl.count >0 then
4646
4647 for i in in_modf_rel_tbl.first..in_modf_rel_tbl.last
4648 loop
4649 IF in_modf_rel_tbl.exists(i) then
4650 l_ctr:=l_ctr+1;
4651 g_modf_rel_tbl(l_ctr):=in_modf_rel_tbl(i);
4652 oe_Debug_pub.add('after assigning modifiers relationship');
4653 oe_Debug_pub.add('after increasing counter');
4654
4655 IF l_debug_level > 0 then
4656 oe_debug_pub.add('line_id='||g_manual_modifier_tbl(l_ctr).p_line_id);
4657
4658 END IF;
4659
4660 END IF;
4661 end loop;
4662 end if;
4663
4664 l_ctr:=g_modf_attributes_Tbl.count;
4665 if in_modf_attr_tbl.count >0 then
4666 for i in in_modf_attr_tbl.first..in_modf_attr_tbl.last
4667 loop
4668 IF in_modf_attr_tbl.exists(i) then
4669 l_ctr:=l_ctr+1;
4670 g_modf_attributes_tbl(l_ctr):=in_modf_attr_tbl(i);
4671 oe_Debug_pub.add('after assigning modifiers attributes');
4672
4673
4674 IF l_debug_level > 0 then
4675 oe_debug_pub.add('line_id='||g_manual_modifier_tbl(l_ctr).p_line_id);
4676
4677 END IF;
4678
4679 END IF;
4680 end loop;
4681 end if;
4682
4683 oe_debug_pub.add('Exiting PLS pass modifiers to backend count='||
4684 g_manual_modifier_tbl.COUNT);
4685
4686
4687 END Pass_Modifiers_to_backend;
4688
4689 PROCEDURE Delete_Applied_Manual_Adj(in_line_id in number,
4690 in_list_line_id in number,
4691 in_list_header_id in number)
4692 IS
4693 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4694 BEGIN
4695
4696 IF l_debug_level > 0 then
4697 oe_debug_pub.add('Entered Delete Applied Manual Adj');
4698 oe_debug_pub.add('line_id='||in_line_id||' List line id'||in_list_line_id ||'List header id'
4699 ||in_list_header_id);
4700 END IF;
4701
4702
4703 for i in g_manual_modifier_tbl.first..g_manual_modifier_tbl.last
4704 loop
4705 if ( g_manual_modifier_tbl.exists(i) and
4706 g_manual_modifier_tbl(i).p_line_id = in_line_id and
4707 g_manual_modifier_tbl(i).list_line_id =in_list_line_id and
4708 g_manual_modifier_tbl(i).list_header_id=in_list_header_id) then
4709
4710
4711
4712 IF g_manual_modifier_tbl(i).list_line_type_code ='PBH' then
4713
4714 for k in g_modf_rel_tbl.first..g_modf_rel_tbl.last
4715 loop
4716 if ( g_modf_rel_tbl.exists(k) and
4717 g_modf_rel_tbl(k).line_detail_index = in_list_line_id)
4718 then
4719
4720 for ix in g_manual_modifier_tbl.first..g_manual_modifier_tbl.last
4721 loop
4722 if ( g_manual_modifier_tbl.exists(ix) and
4723 g_manual_modifier_tbl(ix).p_line_id = in_line_id and
4724 g_manual_modifier_tbl(ix).list_line_id =g_modf_rel_Tbl(k).rltd_line_detail_index)
4725 then
4726 -- delete the corresponding attributes
4727 if g_modf_attributes_tbl.count >0 then
4728 for ms in g_modf_attributes_tbl.first..g_modf_attributes_tbl.last
4729 loop
4730 if (g_modf_attributes_tbl.exists(ms) and
4731 g_modf_attributes_tbl(ms).p_line_id = in_line_id and
4732 g_modf_attributes_tbl(ms).p_list_line_id = g_manual_modifier_tbl(ix).list_line_id)
4733 then
4734 g_modf_attributes_tbl.DELETE(ms);
4735 end if;
4736 end loop;
4737 end if;
4738
4739 g_manual_modifier_tbl.DELETE(ix);
4740 end if;
4741 end loop;
4742 g_modf_rel_tbl.delete(k);
4743 end if;
4744 end loop;
4745
4746 end if; -- if pbh;
4747
4748 -- delete the corresponding attributes
4749 /* if g_modf_attributes_tbl.count >0 then
4750 for ms in g_modf_attributes_tbl.first..g_modf_attributes_tbl.last
4751 loop
4752 if (g_modf_attributes_tbl.exists(ms) and
4753 g_modf_attributes_tbl(ms).p_line_id = in_line_id and
4754 g_modf_attributes_tbl(ms).p_list_line_id = g_manual_modifier_tbl(i).list_line_id)
4755 then
4756 g_modf_attributes_tbl.DELETE(ms);
4757 end if;
4758 end loop;
4759 end if; */
4760
4761 g_manual_modifier_tbl.DELETE(i);
4762
4763 IF l_debug_level > 0 then
4764 oe_debug_pub.add('Deleted the modifier');
4765 END IF;
4766
4767 end if;
4768 end loop;
4769 END Delete_Applied_Manual_Adj;
4770
4771
4772 PROCEDURE Insert_Manual_Adjustment(in_line_id in number,
4773 in_line_index in number)
4774 IS
4775 x_status_code varchar2(100);
4776 x_status_text varchar2(2000);
4777 in_line_detail_index number;
4778 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4779 l_line_index number;
4780 l_line_detail_index number;
4781 rltd_line_index number;
4782 rltd_line_detail_index number;
4783 l_applied_flag varchar2(1):='Y';
4784 l_price_break_type_code varchar2(30);
4785 l_insert_flag varchar2(2);
4786 rs number;
4787 BEGIN
4788 oe_debug_pub.add('entered insert adjustment'||g_manual_modifier_tbl.count);
4789 select count(*) into in_line_detail_index from qp_preq_ldets_tmp;
4790
4791 for i in g_manual_modifier_tbl.first..g_manual_modifier_tbl.last
4792 Loop
4793 l_insert_flag:='Y';
4794
4795 IF g_manual_modifier_tbl(i).modifier_level_code ='ORDER' then
4796 if g_applied_manual_tbl.count > 0 then
4797 for xs in g_applied_manual_tbl.first..g_applied_manual_tbl.last
4798 loop
4799 if (g_applied_manual_tbl.exists(xs) and
4800 g_applied_manual_tbl(xs)= g_manual_modifier_tbl(i).list_line_id)
4801 then
4802 l_insert_flag:='N';
4803 exit;
4804 end if;
4805 end loop;
4806 end if;-- for count;
4807 end if;-- for order level;
4808
4809 if l_insert_flag = 'Y' then
4810
4811 rs:= g_applied_manual_tbl.count;
4812 g_applied_manual_tbl(rs+1):= g_manual_modifier_tbl(i).list_line_id;
4813
4814 if g_manual_modifier_tbl(i).p_line_id=in_line_id or g_manual_modifier_tbl(i).modifier_level_code = 'ORDER' then
4815 in_line_detail_index:= in_line_detail_index+1;
4816
4817
4818 IF (nvl(g_manual_modifier_tbl(i).list_line_type_code,NULL) <>'PBH'
4819 and g_manual_modifier_tbl(i).line_detail_type_code ='CHILD_DETAIL_LINE')
4820 then
4821 l_applied_flag :='N';
4822 l_price_break_type_code:=NULL;
4823 else
4824 l_applied_flag := 'Y';
4825 l_price_break_type_code:=g_manual_modifier_tbl(i).price_break_type_code;
4826 end if;
4827
4828 IF l_debug_level >0 then
4829 oe_debug_pub.add('line index'||in_line_index);
4830 oe_debug_pub.add('line detail index'||in_line_detail_index);
4831 oe_debug_pub.add('Line id'||g_manual_modifier_tbl(i).p_line_id);
4832 oe_debug_pub.add('Modifier_number'||g_manual_modifier_tbl(i).modifier_number);
4833 oe_debug_pub.add('List type code'||g_manual_modifier_tbl(i).list_line_type_code);
4834 oe_debug_pub.add('Operator'||g_manual_modifier_tbl(i).operator);
4835 oe_debug_pub.add('Operand'||g_manual_modifier_tbl(i).operand);
4836 oe_debug_pub.add('List line id'||g_manual_modifier_tbl(i).list_line_id);
4837 oe_debug_pub.add('List header id'||g_manual_modifier_tbl(i).list_header_id);
4838 oe_debug_pub.add('Pricing phase id'||g_manual_modifier_tbl(i).pricing_phase_id);
4839 oe_debug_pub.add('automatic flag'||g_manual_modifier_tbl(i).automatic_flag);
4840 oe_debug_pub.add('modifier_level_code'||g_manual_modifier_tbl(i).modifier_level_code);
4841 oe_debug_pub.add('Override flag'||g_manual_modifier_tbl(i).override_flag);
4842 oe_Debug_pub.add('line_detail_type_code'||g_manual_modifier_tbl(i).line_detail_type_code);
4843 oe_debug_pub.add('price break type code'||g_manual_modifier_tbl(i).price_break_type_code);
4844 oe_debug_pub.add('Applied flag'||l_applied_flag||
4845 ' price_break_type='||l_price_break_type_code);
4846 END IF;
4847
4848
4849 IF g_manual_modifier_tbl(i).modifier_level_code = 'ORDER' then
4850 l_line_index := 1;
4851 ELSE
4852 l_line_index := in_line_index;
4853 END IF;
4854
4855
4856 INSERT INTO QP_NPREQ_LDETS_TMP
4857 (LINE_DETAIL_INDEX,
4858 LINE_DETAIL_TYPE_CODE,
4859 LINE_INDEX,
4860 PROCESS_CODE,
4861 PRICING_PHASE_ID,
4862 OPERAND_CALCULATION_CODE,
4863 OPERAND_VALUE,
4864 OVERRIDE_FLAG,
4865 CREATED_FROM_LIST_TYPE_CODE,
4866 CREATED_FROM_LIST_HEADER_ID,
4867 CREATED_FROM_LIST_LINE_ID,
4868 CREATED_FROM_LIST_LINE_TYPE,
4869 PRICING_STATUS_CODE,
4870 APPLIED_FLAG,
4871 MODIFIER_LEVEL_CODE,
4872 UPDATED_FLAG,
4873 PRICE_BREAK_TYPE_CODE)
4874 --ORDER_QTY_OPERAND)
4875
4876 VALUES ( in_LINE_DETAIL_INDEX,
4877 ' ',
4878 --in_LINE_INDEX,
4879 l_LINE_INDEX,
4880 'N',
4881 g_manual_modifier_tbl(i).pricing_phase_id,
4882 g_manual_modifier_tbl(i).operator,
4883 g_manual_modifier_tbl(i).operand,
4884 g_manual_modifier_tbl(i).override_flag,
4885 ' ',
4886 g_manual_modifier_tbl(i).list_header_id,
4887 g_manual_modifier_tbl(i).list_line_id,
4888 g_manual_modifier_tbl(i).list_line_type_code,
4889 'X',
4890 --'N',
4891 l_applied_flag,
4892 g_manual_modifier_tbl(i).modifier_level_code,
4893 'Y',
4894 l_price_break_type_code);
4895 -- 1);
4896 --END IF;
4897
4898
4899 if g_manual_modifier_tbl(i).list_line_type_code='PBH' then
4900 Insert into qp_npreq_line_attrs_tmp
4901 (Line_index,
4902 Line_detail_index,
4903 attribute_level,
4904 attribute_type,
4905 list_header_id,
4906 list_line_id,
4907 context,
4908 attribute,
4909 value_from,
4910 value_to,
4911 pricing_status_code,
4912 pricing_phase_id,
4913 modifier_level_code,
4914 validated_flag)
4915 values
4916 (in_line_index,
4917 in_line_detail_index,
4918 'LINE',
4919 'PRICING',
4920 g_manual_modifier_tbl(i).list_header_id,
4921 g_manual_modifier_tbl(i).list_line_id,
4922 'VOLUME',
4923 'PRICING_ATTRIBUTE10',
4924 0,
4925 0 ,
4926 'X',
4927 g_manual_modifier_tbl(i).pricing_phase_id,
4928 g_manual_modifier_tbl(i).modifier_level_code,
4929 'N');
4930 oe_debug_pub.add('inserted pbh line into qp_preq_line_attrs_tmp');
4931 end if;
4932
4933 if g_modf_attributes_tbl.count >0 then
4934 for k in g_modf_attributes_tbl.first..g_modf_attributes_tbl.last
4935 loop
4936 if g_modf_attributes_tbl(k).p_list_line_id = g_manual_modifier_Tbl(i).list_line_id then
4937
4938 IF l_debug_level >0 then
4939 oe_debug_pub.add('line index'||in_line_index);
4940 oe_debug_pub.add('line detail index'||in_line_detail_index);
4941 oe_debug_pub.add('list_header_id'|| g_manual_modifier_tbl(i).list_header_id);
4942 oe_debug_pub.add('list line id'|| g_manual_modifier_tbl(i).list_line_id);
4943 oe_debug_pub.add('context'|| g_modf_attributes_tbl(k).p_context);
4944 oe_debug_pub.add('attribute'|| g_modf_attributes_tbl(k).p_attribute);
4945 oe_debug_pub.add('Value from'|| g_modf_attributes_tbl(k).p_attr_value_from);
4946 oe_debug_pub.add('Value to'|| g_modf_attributes_tbl(k).p_attr_value_to);
4947
4948 end if;
4949
4950 Insert into qp_npreq_line_attrs_tmp
4951 (Line_index,
4952 Line_detail_index,
4953 attribute_level,
4954 attribute_type,
4955 list_header_id,
4956 list_line_id,
4957 context,
4958 attribute,
4959 value_from,
4960 value_to,
4961 pricing_status_code,
4962 pricing_phase_id,
4963 modifier_level_code,
4964 validated_flag)
4965 values
4966 (in_line_index,
4967 in_line_detail_index,
4968 'LINE',
4969 'PRICING',
4970 g_manual_modifier_tbl(i).list_header_id,
4971 g_manual_modifier_tbl(i).list_line_id,
4972 g_modf_attributes_tbl(k).p_context,
4973 g_modf_attributes_tbl(k).p_attribute,
4974 g_modf_attributes_tbl(k).p_attr_value_from,
4975 g_modf_attributes_tbl(k).p_attr_value_to,
4976 'X',
4977 g_manual_modifier_tbl(i).pricing_phase_id,
4978 g_manual_modifier_tbl(i).modifier_level_code,
4979 'N');
4980 end if;
4981 end loop;
4982 end if;
4983
4984 oe_debug_pub.add('after inserting attributes');
4985
4986 END IF;-- if line id
4987 END IF; -- if order level modifiers not applied
4988 End Loop;
4989
4990 if g_modf_rel_Tbl.count>0 then
4991 for s in g_modf_rel_tbl.first..g_modf_rel_tbl.last
4992 loop
4993 if g_modf_rel_tbl.exists(s) and g_modf_rel_Tbl(s).p_line_id=in_line_id
4994 then
4995
4996 select line_index,line_detail_index into l_line_index,l_line_detail_index
4997 from qp_preq_ldets_Tmp where created_From_list_line_id=g_modf_rel_tbl(s).line_detail_index;
4998
4999 select line_index,line_detail_index into rltd_line_index,rltd_line_detail_index from
5000 qp_preq_ldets_tmp where created_from_list_line_id=g_modf_rel_tbl(s).rltd_line_detail_index;
5001
5002 IF l_debug_level >0 then
5003 oe_debug_pub.add('line index'||l_line_index);
5004 oe_debug_pub.add('line detail index'||l_line_detail_index);
5005 oe_debug_pub.add('related line index'|| rltd_line_index);
5006 oe_debug_pub.add('related line detail index'||rltd_line_detail_index );
5007 end if;
5008
5009
5010 Insert into qp_npreq_rltd_lines_tmp
5011 (line_index,
5012 line_detail_index,
5013 related_line_index,
5014 related_line_detail_index,
5015 pricing_status_code,
5016 relationship_type_code)
5017 Values
5018 (l_line_index,
5019 l_line_detail_index,
5020 rltd_line_index,
5021 rltd_line_detail_index,
5022 'N',
5023 'PBH_LINE');
5024
5025 end if;
5026 end loop;
5027 oe_Debug_pub.add('after inserting relationship types');
5028 end if;
5029
5030 oe_debug_pub.add('end of inserting');
5031
5032 EXCEPTION
5033 WHEN OTHERS THEN
5034 x_status_code := FND_API.G_RET_STS_ERROR;
5035 x_status_text :=SQLERRM;
5036 oe_debug_pub.add('insert into ldets'||x_status_code||'error'||x_status_text);
5037 END Insert_Manual_Adjustment;
5038
5039 PROCEDURE pass_promotions_to_backend (in_promotions_tbl promotions_tbl,
5040 in_line_id in number) IS
5041
5042 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5043 l_ctr number;
5044
5045 BEGIN
5046
5047 if l_debug_level > 0 then
5048 oe_debug_pub.add('Entering PLS pass promotions to backend');
5049 oe_debug_pub.add('line_id='||in_line_id||
5050 ' Count ='||in_promotions_tbl.COUNT);
5051 end if;
5052
5053 l_ctr := g_promotions_tbl.COUNT + 1;
5054
5055 -- Remove the promotion records if they already exist for that line_id
5056 IF g_promotions_tbl.COUNT > 0 then
5057 for m in g_promotions_tbl.FIRST..g_promotions_tbl.LAST
5058 LOOP
5059 oe_Debug_pub.add('deleting current promotions');
5060 IF g_promotions_tbl(m).p_line_id = in_line_id then
5061 oe_Debug_pub.add('actually deleting current promotions');
5062 g_promotions_tbl.DELETE(m);
5063 END IF;
5064
5065 END LOOP;
5066 END IF;
5067
5068 IF in_promotions_tbl.COUNT > 0 then
5069
5070 for i in in_promotions_tbl.first..in_promotions_tbl.last
5071 LOOP
5072
5073 g_promotions_tbl(l_ctr):=in_promotions_tbl(i);
5074
5075 IF l_debug_level > 0 then
5076 oe_debug_pub.add('line_id='||g_promotions_tbl(l_ctr).p_line_id||
5077 ' type= '||g_promotions_tbl(l_ctr).p_type||
5078 ' Level='||g_promotions_tbl(l_ctr).p_level||
5079 ' Attr1='||g_promotions_tbl(l_ctr).p_pricing_attribute1||
5080 ' Attr2='||g_promotions_tbl(l_ctr).p_pricing_attribute2||
5081 ' Attr3='||g_promotions_tbl(l_ctr).p_pricing_attribute3);
5082 END IF;
5083 l_ctr := l_ctr + 1;
5084
5085 END LOOP;
5086 END IF;
5087
5088 oe_debug_pub.add('Exiting PLS pass promotions to backend count='||
5089 g_promotions_tbl.COUNT);
5090
5091 END pass_promotions_to_backend;
5092
5093
5094 PROCEDURE copy_attribs_to_Req(
5095 p_line_index number
5096 ,px_Req_line_attr_tbl in out nocopy oe_oe_pricing_availability.QP_LINE_ATTR_TBL_TYPE
5097 ,px_Req_qual_tbl in out nocopy oe_oe_pricing_availability.QP_QUAL_TBL_TYPE
5098 ,p_pricing_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type
5099 ,p_qualifier_contexts_Tbl QP_Attr_Mapping_PUB.Contexts_Result_Tbl_Type
5100 ) IS
5101
5102 i pls_integer := 0;
5103 l_attr_index pls_integer := nvl(px_Req_line_attr_tbl.last,0);
5104 l_qual_index pls_integer := nvl(px_Req_qual_tbl.last,0);
5105
5106 --
5107 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5108 --
5109 BEGIN
5110
5111 IF l_debug_level > 0 THEN
5112 oe_debug_pub.add( 'ENTERING oe_oe_pricing_availability.COPY_ATTRIBS_TO_REQ' , 1 ) ;
5113 END IF;
5114 i := p_pricing_contexts_Tbl.First;
5115 While i is not null loop
5116 l_attr_index := l_attr_index +1;
5117 px_Req_line_attr_tbl(l_attr_index).VALIDATED_FLAG := 'N';
5118 px_Req_line_attr_tbl(l_attr_index).line_index := p_line_index;
5119
5120 -- Product and Pricing Contexts go into pricing contexts...
5121 px_Req_line_attr_tbl(l_attr_index).PRICING_CONTEXT :=
5122 p_pricing_contexts_Tbl(i).context_name;
5123 px_Req_line_attr_tbl(l_attr_index).PRICING_ATTRIBUTE :=
5124 p_pricing_contexts_Tbl(i).Attribute_Name;
5125 px_Req_line_attr_tbl(l_attr_index).PRICING_ATTR_VALUE_FROM :=
5126 p_pricing_contexts_Tbl(i).attribute_value;
5127
5128 i := p_pricing_contexts_Tbl.Next(i);
5129 end loop;
5130
5131 -- Copy the qualifiers
5132 i := p_qualifier_contexts_Tbl.First;
5133 While i is not null loop
5134 l_qual_index := l_qual_index +1;
5135
5136 If p_qualifier_contexts_Tbl(i).context_name ='MODLIST' and
5137 p_qualifier_contexts_Tbl(i).Attribute_Name ='QUALIFIER_ATTRIBUTE4' then
5138
5139 If OE_Order_PUB.G_Line.agreement_id is not null and
5140 OE_Order_PUB.G_Line.agreement_id <> fnd_api.g_miss_num then
5141 px_Req_Qual_Tbl(l_qual_index).Validated_Flag := 'Y';
5142 Else
5143 px_Req_Qual_Tbl(l_qual_index).Validated_Flag := 'N';
5144 End If;
5145
5146 Else
5147 px_Req_Qual_Tbl(l_qual_index).Validated_Flag := 'N';
5148 End If;
5149
5150 px_Req_qual_tbl(l_qual_index).line_index := p_line_index;
5151
5152 px_Req_qual_tbl(l_qual_index).QUALIFIER_CONTEXT :=
5153 p_qualifier_contexts_Tbl(i).context_name;
5154 px_Req_qual_tbl(l_qual_index).QUALIFIER_ATTRIBUTE :=
5155 p_qualifier_contexts_Tbl(i).Attribute_Name;
5156 px_Req_qual_tbl(l_qual_index).QUALIFIER_ATTR_VALUE_FROM :=
5157 p_qualifier_contexts_Tbl(i).attribute_value;
5158
5159 i := p_qualifier_contexts_Tbl.Next(i);
5160 end loop;
5161
5162 IF l_debug_level > 0 THEN
5163 oe_debug_pub.add( 'EXITING oe_oe_pricing_availability.COPY_ATTRIBS_TO_REQ' , 1 ) ;
5164 END IF;
5165
5166 END copy_attribs_to_Req;
5167
5168
5169
5170
5171 PROCEDURE process_pricing_errors(in_line_type_code in varchar2,
5172 in_status_code in varchar2,
5173 in_status_text in varchar2,
5174 in_ordered_item in varchar2,
5175 in_uom in varchar2,
5176 in_unit_price in number,
5177 in_adjusted_unit_price in number,
5178 in_process_code in varchar2 ,
5179 in_price_flag in varchar2,
5180 in_price_list_id in number,
5181 l_return_status out nocopy varchar2,
5182
5183 l_msg_count out nocopy number,
5184
5185 l_msg_data out nocopy varchar2
5186
5187 ) IS
5188
5189 l_price_list varchar2(200);
5190 l_allow_negative_price varchar2(10):= nvl(OE_Sys_Parameters.VALUE('ONT_NEGATIVE_PRICING'),'N');
5191 --Bug 7409782
5192 --l_gsa_violation_action Varchar2(30) :=fnd_profile.value('ONT_GSA_VIOLATION_ACTION');
5193 l_org_id Number:= OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
5194
5195 --Bug 7409782
5196 l_GSA_Enabled_Flag Varchar2(30) := FND_PROFILE.VALUE('QP_VERIFY_GSA');
5197 l_gsa_violation_action Varchar2(30) := nvl(oe_sys_parameters.value('ONT_GSA_VIOLATION_ACTION'),'WARNING');
5198 Cursor get_gsa_list_lines is
5199 Select/*+ ordered use_nl(qpq qppa qpll qplh) */ min(qpll.operand)
5200 From
5201 qp_qualifiers qpq
5202 , qp_pricing_attributes qppa
5203 , qp_list_lines qpll
5204 , qp_list_headers_b qplh
5205 , qp_price_req_sources qpprs
5206 where
5207 qpq.qualifier_context='CUSTOMER'
5208 and qpq.qualifier_attribute='QUALIFIER_ATTRIBUTE15'
5209 and qpq.qualifier_attr_value='Y'
5210 and qppa.list_header_id=qplh.list_header_id
5211 and qplh.Active_flag='Y'
5212 and qpprs.request_type_code = 'ONT'
5213 and qpprs.source_system_code=qplh.source_system_code
5214 and qppa.pricing_phase_id = 2
5215 and qppa.qualification_ind = 6
5216 and qppa.product_attribute_context ='ITEM'
5217 and qppa.product_attribute='PRICING_ATTRIBUTE1'
5218 and qppa.product_attr_value= g_panda_rec_table(1).p_inventory_item_id
5219 and qppa.excluder_flag = 'N'
5220 and qppa.list_header_id=qpq.list_header_id
5221 and qppa.list_line_id=qpll.list_line_id
5222 and g_panda_rec_table(1).p_pricing_date between nvl(trunc(qplh.start_date_active),g_panda_rec_table(1).p_pricing_date)
5223 and nvl(trunc(qplh.End_date_active),g_panda_rec_table(1).p_pricing_date);
5224
5225 l_operand number;
5226 l_msg_text Varchar2(2000);
5227
5228 --
5229 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5230 --
5231 BEGIN
5232
5233 IF l_debug_level > 0 THEN
5234 oe_debug_pub.add( 'ENTERING PROCESS_PRICING_ERRORS' ) ;
5235 END IF;
5236 IF l_debug_level > 0 THEN
5237 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 ) ;
5238 END IF;
5239
5240
5241 IF in_line_Type_code ='LINE' and
5242 in_status_code in ( QP_PREQ_GRP.G_STATUS_INVALID_PRICE_LIST,
5243 QP_PREQ_GRP.G_STS_LHS_NOT_FOUND,
5244 QP_PREQ_GRP.G_STATUS_FORMULA_ERROR,
5245 QP_PREQ_GRP.G_STATUS_OTHER_ERRORS,
5246 FND_API.G_RET_STS_UNEXP_ERROR,
5247 FND_API.G_RET_STS_ERROR,
5248 QP_PREQ_GRP.G_STATUS_CALC_ERROR,
5249 QP_PREQ_GRP.G_STATUS_UOM_FAILURE,
5250 QP_PREQ_GRP.G_STATUS_INVALID_UOM,
5251 QP_PREQ_GRP.G_STATUS_DUP_PRICE_LIST,
5252 QP_PREQ_GRP.G_STATUS_INVALID_UOM_CONV,
5253 QP_PREQ_GRP.G_STATUS_INVALID_INCOMP,
5254 QP_PREQ_GRP.G_STATUS_BEST_PRICE_EVAL_ERROR)
5255 then
5256
5257 l_return_status := 'E';
5258
5259 IF in_price_list_id is not null then
5260 Begin
5261 Select name into l_price_list
5262 from qp_list_headers_vl
5263 where list_header_id = in_price_list_id;
5264 Exception When No_data_found then
5265 l_price_list := in_price_list_id;
5266 End;
5267 END IF;
5268
5269 IF in_status_code = QP_PREQ_GRP.G_STATUS_INVALID_PRICE_LIST then
5270
5271 IF l_debug_level > 0 THEN
5272 oe_debug_pub.add( 'INVALID PRICE LIST'|| ' PRICE_LIST_ID='||G_panda_rec_table(1).p_PRICE_LIST_ID ) ;
5273 END IF;
5274 IF g_panda_rec_table(1).p_price_list_id is null then
5275
5276 FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_GENERIC');
5277 FND_MESSAGE.SET_TOKEN('TEXT',in_status_text);
5278 IF l_debug_level > 0 THEN
5279 oe_debug_pub.add( 'INVALID PL ERR TXT='||IN_STATUS_TEXT ) ;
5280 END IF;
5281 OE_MSG_PUB.Add;
5282
5283 ELSE
5284 IF l_debug_level > 0 THEN
5285 oe_debug_pub.add( 'INVALID PRICE LIST' ) ;
5286 END IF;
5287 FND_MESSAGE.SET_NAME('ONT','OE_PRC_NO_LIST_PRICE');
5288 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
5289 FND_MESSAGE.SET_TOKEN('UNIT',in_uom);
5290 FND_MESSAGE.SET_TOKEN('PRICE_LIST',l_Price_List);
5291 OE_MSG_PUB.Add;
5292
5293 END IF;
5294
5295 ELSIF in_status_code = QP_PREQ_GRP.G_STS_LHS_NOT_FOUND Then
5296
5297 FND_MESSAGE.SET_NAME('ONT','ONT_NO_PRICE_LIST_FOUND');
5298 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
5299 FND_MESSAGE.SET_TOKEN('UOM',in_uom);
5300 OE_MSG_PUB.Add;
5301
5302 ELSIF in_status_code = QP_PREQ_GRP.G_STATUS_FORMULA_ERROR then
5303 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_ERROR_IN_FORMULA');
5304 FND_MESSAGE.SET_TOKEN('ERR_TEXT',in_status_text); --3730467
5305 OE_MSG_PUB.Add;
5306
5307
5308 ELSIF in_status_code in
5309 ( QP_PREQ_GRP.G_STATUS_OTHER_ERRORS , FND_API.G_RET_STS_UNEXP_ERROR,
5310 FND_API.G_RET_STS_ERROR) then
5311 FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
5312 FND_MESSAGE.SET_TOKEN('ERR_TEXT',in_status_text);
5313 OE_MSG_PUB.Add;
5314
5315 ELSIF in_status_code = QP_PREQ_GRP.G_STATUS_INVALID_UOM then
5316 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_UOM');
5317 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
5318 FND_MESSAGE.SET_TOKEN('UOM',in_uom);
5319 OE_MSG_PUB.Add;
5320
5321 ElSIF in_status_code = QP_PREQ_GRP.G_STATUS_DUP_PRICE_LIST then
5322 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_DUPLICATE_PRICE_LIST');
5323
5324 IF l_debug_level > 0 THEN
5325 oe_debug_pub.add( 'DUPLICATE PRICE LIST ERROR' ) ;
5326 END IF;
5327 Begin
5328 Select name into l_price_list
5329 from qp_list_headers_vl a,qp_list_lines b where
5330 b.list_line_id = to_number(substr(in_status_text,1,
5331 instr(in_status_text,',')-1))
5332 and a.list_header_id=b.list_header_id ;
5333 Exception When No_data_found then
5334 l_price_list := to_number(substr(in_status_text,1,
5335 instr(in_status_text,',')-1));
5336 When invalid_number then
5337 l_price_list := substr(in_status_text,1,
5338 instr(in_status_text,',')-1);
5339 End;
5340
5341 IF l_debug_level > 0 THEN
5342 oe_debug_pub.add( 'PRICE LIST 1='||L_PRICE_LIST ) ;
5343 END IF;
5344 FND_MESSAGE.SET_TOKEN('PRICE_LIST1','( '||in_Ordered_Item||' ) '|| l_price_list);
5345 Begin
5346 Select name into l_price_list
5347 from qp_list_headers_vl a,qp_list_lines b where
5348 b.list_line_id = to_number(substr(in_status_text,
5349 instr(in_status_text,',')+1))
5350 and a.list_header_id=b.list_header_id ;
5351 Exception When No_data_found then
5352 l_price_list := to_number(substr(in_status_text,
5353 instr(in_status_text,',')+1));
5354 When invalid_number then
5355 l_price_list := substr(in_status_text,
5356 instr(in_status_text,',')+1);
5357 End;
5358 IF l_debug_level > 0 THEN
5359 oe_debug_pub.add( 'PRICE LIST 2='||L_PRICE_LIST ) ;
5360 END IF;
5361
5362 FND_MESSAGE.SET_TOKEN('PRICE_LIST2',l_price_list);
5363 OE_MSG_PUB.Add;
5364
5365 ELSIF in_status_code = QP_PREQ_GRP.G_STATUS_INVALID_UOM_CONV then
5366 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_UOM_CONVERSION');
5367 FND_MESSAGE.SET_TOKEN('UOM_TEXT','( '||in_Ordered_Item||' ) '||
5368 in_status_text);
5369 OE_MSG_PUB.Add;
5370
5371 ElSIF in_status_code = QP_PREQ_GRP.G_STATUS_INVALID_INCOMP then
5372 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_INCOMP');
5373 FND_MESSAGE.SET_TOKEN('ERR_TEXT','( '||in_Ordered_Item||' ) '||
5374 in_status_text);
5375 OE_MSG_PUB.Add;
5376
5377 ELSIF in_status_code = QP_PREQ_GRP.G_STATUS_BEST_PRICE_EVAL_ERROR then
5378 FND_MESSAGE.SET_NAME('ONT','ONT_PRC_BEST_PRICE_ERROR');
5379 FND_MESSAGE.SET_TOKEN('ITEM',in_Ordered_Item);
5380 FND_MESSAGE.SET_TOKEN('ERR_TEXT',in_status_text);
5381 OE_MSG_PUB.Add;
5382 END IF;
5383
5384
5385
5386 ELSIF in_line_Type_code ='LINE' and
5387 in_status_code = QP_PREQ_GRP.G_STATUS_OTHER_ERRORS Then
5388
5389 IF l_debug_level > 0 THEN
5390 oe_debug_pub.add( 'OE_PRICING_ERROR' ) ;
5391 END IF;
5392 FND_MESSAGE.SET_NAME('ONT','OE_PRICING_ERROR');
5393 FND_MESSAGE.SET_TOKEN('ERR_TEXT','( '||in_Ordered_Item||' ) '||in_STATUS_TEXT);
5394 OE_MSG_PUB.Add;
5395
5396 ELSIF in_line_Type_code ='LINE' and in_status_code in
5397 --( QP_PREQ_GRP.G_STATUS_UPDATED,
5398 (QP_PREQ_GRP.G_STATUS_GSA_VIOLATION) and
5399 -- QP_PREQ_GRP.G_STATUS_UNCHANGED) and
5400 nvl(in_process_code,'0') <> QP_PREQ_GRP.G_BY_ENGINE
5401 and in_price_flag IN ('Y','P')
5402 --we do not want to go in this loop if price_flag is set up 'N' because
5403 --engine doesn't look at the line and will not return adjustments. In this
5404 --case we DON't want to remove the adjustments that engine doesn't return.
5405 then
5406 IF l_debug_level > 0 THEN
5407 oe_debug_pub.add( 'OE_PRICING_ERROR 2' ) ;
5408 END IF;
5409
5410 IF in_status_text is not null then
5411 --Bug 7409782 starts
5412 IF l_gsa_violation_action = 'WARNING'
5413 THEN
5414 l_return_status := 'W';
5415 ELSE
5416 l_return_status := 'E';
5417 END IF;
5418 --Bug 7409782 ends
5419
5420 FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
5421 FND_MESSAGE.SET_TOKEN('ERR_TEXT',in_status_text);
5422 OE_MSG_PUB.Add;
5423 END IF;
5424
5425 -- we need to do this check in UPDATED code or do the gsa check through
5426 -- the control record of Pricing
5427 /*OPEN get_gsa_list_lines;
5428 FETCH get_gsa_list_lines
5429 INTO l_operand;
5430 CLOSE get_gsa_list_lines;
5431 oe_debug_pub.add('After select OE_PRICING_ERROR 2');
5432 oe_debug_pub.add('Adj price='||in_adjusted_unit_price||
5433 ' Operand='||l_operand);
5434
5435 IF in_adjusted_unit_price <= l_operand then
5436 oe_debug_pub.add('If unit price less than operand violation='||
5437 l_gsa_violation_action);
5438 --Check if the GSA check needs to be done.
5439 If l_gsa_violation_action in ('WARNING','ERROR') then
5440
5441 oe_debug_pub.add('GSA warning or error');
5442 Begin
5443 SELECT concatenated_segments
5444 INTO l_msg_text
5445 FROM mtl_system_items_kfv
5446 WHERE inventory_item_id = g_inventory_item_id
5447 AND organization_id = l_org_id;
5448 Exception
5449 when no_data_found then
5450 Null;
5451 End;
5452
5453 l_return_status := 'E';
5454 oe_debug_pub.add('GSA warning or error 2 msg_Text='||l_msg_text);
5455 FND_MESSAGE.SET_NAME('ONT','OE_GSA_VIOLATION');
5456 l_msg_text := l_operand||' ( '||l_msg_text||' )';
5457 FND_MESSAGE.SET_TOKEN('GSA_PRICE',l_msg_text);
5458 OE_MSG_PUB.Add;
5459 END IF;
5460 END IF; */
5461
5462
5463 ELSIF -- Process header level adjustments
5464 in_line_type_code ='ORDER' and
5465 (in_status_code in ( QP_PREQ_GRP.G_STATUS_UPDATED ,
5466 QP_PREQ_GRP.G_STATUS_GSA_VIOLATION)
5467 --In this case even engine doesn't update the order (status = UNCHANGED)
5468 --because of one of the lined is frozen,
5469 --there can be some order level adjustments in database which
5470 --need to be pulled out by append_adjustment_lines routine
5471 or (in_status_code = QP_PREQ_GRP.G_STATUS_UNCHANGED))
5472 Then
5473 IF l_debug_level > 0 THEN
5474 oe_debug_pub.add( 'OE_PRICING_ERROR 3' ) ;
5475 END IF;
5476 null;
5477
5478 ELSIF in_line_Type_code ='LINE' and in_status_code = 'UPDATED' then
5479
5480 IF l_debug_level > 0 THEN
5481 oe_debug_pub.add( 'STATUS = UPDATED' ) ;
5482 END IF;
5483
5484 END IF;-- Status_Code
5485
5486
5487 IF l_debug_level > 0 THEN
5488 oe_debug_pub.add( 'PROCESS PRICING ERROR AFTER ERR CHK ST='||L_RETURN_STATUS ) ;
5489 END IF;
5490
5491 --Bug 7409782
5492 IF l_return_status IN('E','W') then
5493 IF l_debug_level > 0 THEN
5494 oe_debug_pub.add( 'DOING COUNT_AND_GET' ) ;
5495 END IF;
5496 oe_msg_pub.count_and_get(p_encoded=>fnd_api.G_TRUE,
5497 p_count => l_msg_count,
5498 p_data=>l_msg_data
5499 );
5500 END IF;
5501
5502 IF l_debug_level > 0 THEN
5503 oe_debug_pub.add( 'EXITING PROCESS_PRICING_ERRORS' ) ;
5504 END IF;
5505
5506 EXCEPTION
5507
5508 when others then
5509 IF l_debug_level > 0 THEN
5510 oe_debug_pub.add( 'PROCESS PRICING ERRORS WHEN OTHERS EXCEPTION CODE='|| SQLCODE||' MESSAGE='||SQLERRM ) ;
5511 END IF;
5512
5513 END process_pricing_errors;
5514
5515
5516
5517 FUNCTION Get_Rounding_factor(p_list_header_id number) return number is
5518
5519 l_rounding_factor number;
5520
5521 --
5522 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5523 --
5524 BEGIN
5525
5526 select rounding_factor
5527 into l_rounding_factor
5528 from qp_list_headers_b
5529 where list_header_id = p_list_header_id;
5530
5531 If l_rounding_factor = fnd_api.g_miss_num then
5532 l_rounding_factor:= Null;
5533 End If;
5534
5535 Return l_rounding_factor;
5536
5537
5538 EXCEPTION
5539 when no_data_found then
5540 Return Null;
5541 END Get_Rounding_factor;
5542
5543 PROCEDURE get_item_name(l_inv_item_id in number,
5544 out_inv_item_name out nocopy varchar2
5545 )
5546 IS
5547 l_org_id number := OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
5548 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5549 BEGIN
5550 SELECT concatenated_segments
5551 INTO out_inv_item_name
5552 FROM mtl_system_items_kfv
5553 WHERE inventory_item_id = l_inv_item_id
5554 AND organization_id = l_org_id;
5555
5556
5557 EXCEPTION
5558 when no_data_found then
5559 IF l_debug_level > 0 THEN
5560 oe_debug_pub.add( 'OE_AVAILABILITY.GET_item_name NO DATA FOUND' ) ;
5561 END IF;
5562 when others then
5563 IF l_debug_level > 0 THEN
5564 oe_debug_pub.add( 'OE_AVAILABILITY.GET_item_NAME WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
5565 END IF;
5566
5567 END get_item_name;
5568
5569 PROCEDURE get_item_type(in_item_type_code in varchar2,
5570 out_meaning out nocopy varchar2
5571 )
5572 IS
5573
5574 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5575 l_lookup_type varchar2(50) ; -- added for bug 3776769
5576 BEGIN
5577 l_lookup_type := 'ITEM_IDENTIFIER_TYPE';
5578 Select meaning into out_meaning from oe_lookups
5579 where lookup_type = l_lookup_type and -- added for bug 3776769
5580 lookup_code=in_item_type_code;
5581
5582
5583 EXCEPTION
5584 when no_data_found then
5585 IF l_debug_level > 0 THEN
5586 oe_debug_pub.add( 'OE_AVAILABILITY.GET_item_type NO DATA FOUND' ) ;
5587 END IF;
5588 when others then
5589 IF l_debug_level > 0 THEN
5590 oe_debug_pub.add( 'OE_AVAILABILITY.GET_item_type WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
5591 END IF;
5592
5593 END get_item_type;
5594
5595
5596 PROCEDURE get_upgrade_item_details(l_inv_item_id in number,
5597 out_inv_item_name out nocopy varchar2,
5598 out_inv_desc out nocopy varchar2,
5599 out_inv_item_type out nocopy varchar2
5600 )
5601 IS
5602 l_org_id number := OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
5603 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5604 BEGIN
5605 SELECT concatenated_segments,description,item_type
5606 INTO out_inv_item_name,out_inv_desc,out_inv_item_type
5607 FROM mtl_system_items_kfv
5608 WHERE inventory_item_id = l_inv_item_id
5609 AND organization_id = l_org_id;
5610
5611
5612 EXCEPTION
5613 when no_data_found then
5614 IF l_debug_level > 0 THEN
5615 oe_debug_pub.add( 'OE_AVAILABILITY.GET_item_upgrade_details NO DATA FOUND' ) ;
5616 END IF;
5617 when others then
5618 IF l_debug_level > 0 THEN
5619 oe_debug_pub.add( 'OE_AVAILABILITY.GET_item_NAME WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
5620 END IF;
5621
5622 END get_upgrade_item_details;
5623
5624 PROCEDURE get_oid_information(l_list_line_no in number,
5625 out_inv_item_name out nocopy varchar2)
5626 IS
5627 l_item_id number;
5628 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5629 l_desc varchar2(200);
5630 BEGIN
5631 select product_attr_value into l_item_id from qp_pricing_attributes
5632 where list_line_id=l_list_line_no;
5633
5634 oe_debug_pub.add('after fetching the attribute value');
5635
5636 get_item_name(l_inv_item_id=>l_item_id,
5637 out_inv_item_name=>out_inv_item_name);
5638
5639
5640
5641
5642 EXCEPTION
5643 when no_data_found then
5644 IF l_debug_level > 0 THEN
5645 oe_debug_pub.add( 'OE_AVAILABILITY.GET_oid_information NO DATA FOUND' ) ;
5646 END IF;
5647 when others then
5648 IF l_debug_level > 0 THEN
5649 oe_debug_pub.add( 'OE_AVAILABILITY.GET_oid_information WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
5650 END IF;
5651
5652 END get_oid_information;
5653
5654 PROCEDURE get_coupon_details(in_list_line_id in number,
5655 in_list_header_id in number,
5656 out_benefit out nocopy varchar2,
5657 out_benefit_method out nocopy varchar2,
5658 out_benefit_value out nocopy varchar2,
5659 out_benefit_item out nocopy varchar2)
5660
5661 IS
5662 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5663 l_list_line_no NUMBER;
5664 l_code varchar2(200);
5665 l_operator varchar2(100);
5666 l_operand number;
5667 l_item_id varchar2(100);
5668 l_desc varchar2(100);
5669 BEGIN
5670 oe_debug_pub.add('before fetching the related lines');
5671
5672 select to_rltd_modifier_id into l_list_line_no
5673 from qp_rltd_modifiers where
5674 from_rltd_modifier_id=in_list_line_id;
5675
5676 oe_debug_pub.add('after fetching the related line');
5677
5678 select list_line_type_code,
5679 arithmetic_operator,
5680 operand into
5681 l_code,l_operator,l_operand
5682 from qp_list_lines where list_line_id=l_list_line_no;
5683
5684 oe_debug_pub.add('after fetching the line details ');
5685
5686 out_benefit:= get_qp_lookup_meaning(in_lookup_type=>'LIST_LINE_TYPE_CODE',
5687 in_lookup_code=>l_code);
5688 out_benefit_method := get_qp_lookup_meaning(in_lookup_type=>'ARITHMETIC_OPERATOR',
5689 in_lookup_code=>l_operator);
5690 out_benefit_value := l_operand;
5691
5692 oe_debug_pub.add('out_benefit'||out_benefit||'out_benefit_method'
5693 ||out_benefit_method||'out_benefit_value'||out_benefit_value);
5694
5695 select product_attr_value into l_item_id from qp_pricing_attributes
5696 where list_line_id=l_list_line_no;
5697
5698 oe_debug_pub.add('after fetching the attribute value');
5699
5700 get_item_name(l_inv_item_id=>l_item_id,
5701 out_inv_item_name=>out_benefit_item);
5702
5703
5704 oe_debug_pub.add('inventory item returned'||out_benefit_item);
5705 EXCEPTION
5706 when no_data_found then
5707 IF l_debug_level > 0 THEN
5708 oe_debug_pub.add( 'OE_AVAILABILITY.GET_coupon_details NO DATA FOUND' ) ;
5709 END IF;
5710 when others then
5711 IF l_debug_level > 0 THEN
5712 oe_debug_pub.add( 'OE_AVAILABILITY.GET_coupon_details WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
5713 END IF;
5714
5715 END get_coupon_details;
5716
5717 PROCEDURE get_terms_details(in_substitution_attribute in varchar2,
5718 in_substitution_to in varchar2,
5719 out_benefit_method out nocopy varchar2,
5720 out_benefit_value out nocopy varchar2)
5721
5722 IS
5723
5724 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5725 l_benefit_method Varchar2(500);
5726 l_segment_code Varchar2(500);
5727 l_lang_code Varchar2(10);
5728 l_lookup_type Varchar2(50);
5729 BEGIN
5730
5731 if l_Debug_level >0 then
5732 oe_debug_pub.add('entering terms with parameter Substitution attribute'||in_substitution_attribute||'substituion'||
5733 in_substitution_to);
5734 end if;
5735 Begin
5736 select segment_code into l_benefit_method from qp_segments_b qsb,qp_prc_contexts_b qpcb
5737 where qsb.prc_context_id=qpcb.prc_context_id and
5738 qsb.segment_mapping_column=in_substitution_attribute and qpcb.prc_context_code='TERMS';
5739 Exception
5740 When others then
5741 oe_Debug_pub.add('Exception while quering for the terms'||SQLCODE||SQLERRM);
5742 End ;
5743 -- added recently
5744
5745
5746 /* qp_util.Get_Attribute_Code(p_FlexField_Name => 'QP_ATTR_DEFNS_QUALIFIER',
5747 p_Context_Name => 'TERMS',
5748 p_attribute => l_benefit_method, -- <attribute_code>, -- pass the code like "FREIGHT_TERMS"
5749 x_attribute_code =>out_benefit_method, -- <attribute_text>, -- get the text like "Freight Terms"
5750 x_segment_name => l_segment_code
5751 );*/
5752 Begin
5753 select language_code into l_lang_code from fnd_languages where installed_flag='B';
5754
5755 select user_segment_name into out_benefit_method from qp_segments_tl qst,qp_segments_b qsb
5756 where qst.segment_id= qsb.segment_id and qsb.segment_code=l_benefit_method and qst.language=l_lang_code;
5757 Exception
5758 When Others then
5759 oe_Debug_pub.add(' Exception while queries for terms and language code'||SQLCODE||SQLERRM);
5760 End;
5761 if l_Debug_level >0 then
5762 oe_debug_pub.add('final benefit method'||out_benefit_method);
5763 end if;
5764
5765
5766
5767 IF l_benefit_method ='PAYMENT_TERMS' then
5768 select name into out_benefit_value from ra_terms where term_id=in_substitution_to;
5769 ELSIF l_benefit_method='FREIGHT_TERMS' then
5770 select freight_terms into out_benefit_value from oe_frght_terms_Active_v
5771 where freight_terms_code=in_substitution_to;
5772 ELSIF l_benefit_method ='SHIPPING_TERMS' then
5773 l_lookup_type := 'SHIP_METHOD';
5774 select meaning into out_benefit_value from oe_ship_methods_v where
5775 lookup_type = l_lookup_type and lookup_code=in_substitution_to;
5776 END IF;
5777
5778 oe_debug_pub.add('final benefit value'||out_benefit_value);
5779
5780 EXCEPTION
5781 when no_data_found then
5782 IF l_debug_level > 0 THEN
5783 oe_debug_pub.add( 'OE_AVAILABILITY.GET_terms_details NO DATA FOUND' ) ;
5784 END IF;
5785 when others then
5786 IF l_debug_level > 0 THEN
5787 oe_debug_pub.add( 'OE_AVAILABILITY.GET_terms_details WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
5788 END IF;
5789
5790 END get_terms_details;
5791
5792
5793
5794 PROCEDURE Get_modifier_name( in_list_header_id in number
5795 ,out_name out nocopy varchar2
5796
5797 ,out_description out nocopy varchar2
5798
5799 ,out_end_date out nocopy date
5800
5801 ,out_start_date out nocopy date
5802
5803 ,out_currency out nocopy varchar2
5804
5805 ,out_ask_for_flag out nocopy varchar2
5806
5807 ) IS
5808
5809
5810 l_list_type_code varchar2(300);
5811
5812 --
5813 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5814 --
5815 BEGIN
5816
5817 SELECT name,
5818 description,
5819 list_type_code,
5820 end_date_active,
5821 start_date_active,
5822 currency_code,
5823 ask_for_flag
5824 INTO out_name,
5825 out_description,
5826 l_list_type_code,
5827 out_end_date,
5828 out_start_date,
5829 out_currency,
5830 out_ask_for_flag
5831
5832 FROM qp_list_headers_vl
5833 WHERE list_header_id = in_list_header_id;
5834
5835
5836 IF l_debug_level > 0 THEN
5837 oe_debug_pub.add( 'END_DATE='||OUT_END_DATE|| ' START_DATE='||OUT_START_DATE ) ;
5838 END IF;
5839 IF l_debug_level > 0 THEN
5840 oe_debug_pub.add( 'EXITING OE_AVA.GET_MODIFIER_NAME TYP='||L_LIST_TYPE_CODE ) ;
5841 END IF;
5842
5843 EXCEPTION
5844 when no_data_found then
5845 IF l_debug_level > 0 THEN
5846 oe_debug_pub.add( 'OE_AVAILABILITY.GET_MODIFIER_NAME NO DATA FOUND' ) ;
5847 END IF;
5848 when others then
5849 IF l_debug_level > 0 THEN
5850 oe_debug_pub.add( 'OE_AVAILABILITY.GET_MODIFIER_NAME WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
5851 END IF;
5852
5853 END get_modifier_name;
5854
5855
5856
5857 PROCEDURE Get_list_line_details( in_list_line_id in number
5858 ,out_end_date out nocopy date
5859
5860 ,out_start_date out nocopy date
5861
5862 ,out_list_line_type_Code out nocopy varchar2
5863
5864 ,out_modifier_level_code out nocopy varchar2
5865
5866 ) IS
5867
5868 --
5869 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5870 --
5871 BEGIN
5872
5873 SELECT
5874 l.list_line_type_code,
5875 nvl(l.end_date_active,h.end_date_active),
5876 l.start_date_active,
5877 l.modifier_level_code
5878 INTO
5879 out_list_line_type_code,
5880 out_end_date,
5881 out_start_date,
5882 out_modifier_level_code
5883
5884 FROM qp_list_lines l,qp_list_headers h
5885 WHERE l.list_line_id = in_list_line_id
5886 AND h.list_header_id = l.list_header_id;
5887
5888
5889 IF l_debug_level > 0 THEN
5890 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 ) ;
5891 END IF;
5892
5893 EXCEPTION
5894 when no_data_found then
5895 IF l_debug_level > 0 THEN
5896 oe_debug_pub.add( 'OE_AVAILABILITY.GET_LIST_LINE_DETAILS NO DATA FOUND' ) ;
5897 END IF;
5898 when others then
5899 IF l_debug_level > 0 THEN
5900 oe_debug_pub.add( 'OE_AVAILABILITY.GET_LIST_LINE_DETAILS WHEN OTHERS '|| SQLERRM||SQLCODE ) ;
5901 END IF;
5902
5903 END get_list_line_details;
5904
5905
5906 FUNCTION Get_qp_lookup_meaning( in_lookup_code in varchar2,
5907 in_lookup_type in varchar2) return varchar2 IS
5908
5909 l_meaning varchar2(300);
5910
5911 --
5912 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5913 --
5914 BEGIN
5915
5916 IF l_debug_level > 0 THEN
5917 oe_debug_pub.add( 'CODE='||IN_LOOKUP_CODE||' TYPE='||IN_LOOKUP_TYPE ) ;
5918 END IF;
5919
5920 SELECT meaning
5921 INTO l_meaning
5922 FROM qp_lookups
5923 WHERE lookup_type = in_lookup_type
5924 AND lookup_code = in_lookup_code;
5925
5926 IF l_meaning = fnd_api.g_miss_char then
5927 l_meaning:= Null;
5928 END IF;
5929
5930 Return l_meaning;
5931
5932 EXCEPTION
5933 when no_data_found then
5934 IF l_debug_level > 0 THEN
5935 oe_debug_pub.add( 'OE_AVAILABILITY.GET_QP_LOOKUP_MEANING NO DATA FOUND' ) ;
5936 END IF;
5937 Return Null;
5938
5939 END get_qp_lookup_meaning;
5940
5941
5942 FUNCTION get_pricing_attribute(
5943 in_CONTEXT_NAME in varchar2,
5944 in_ATTRIBUTE_NAME in varchar2
5945 ) return varchar2 IS
5946 l_pricing_attribute varchar2(300);
5947
5948 --
5949 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5950 --
5951 BEGIN
5952
5953 IF l_debug_level > 0 THEN
5954 oe_debug_pub.add( 'GET_PRICING_ATTRIBUTE '|| 'IN_CONTEXT = '||IN_CONTEXT_NAME|| 'IN_ATTRIBUTE_NAME='||IN_ATTRIBUTE_NAME ) ;
5955 END IF;
5956 l_pricing_attribute := QP_UTIL.get_attribute_name(
5957 p_application_short_name=> 'QP',
5958 P_FLEXFIELD_NAME =>'QP_ATTR_DEFNS_PRICING',
5959 P_CONTEXT_NAME =>in_context_name,
5960 P_ATTRIBUTE_NAME =>in_attribute_name
5961 );
5962 IF l_debug_level > 0 THEN
5963 oe_debug_pub.add( 'EXITING GET_PRICING_ATTRIBUTE ='||L_PRICING_ATTRIBUTE ) ;
5964 END IF;
5965
5966 return l_pricing_attribute;
5967
5968 EXCEPTION
5969
5970 WHEN others then
5971 IF l_debug_level > 0 THEN
5972 oe_debug_pub.add( 'WHEN OTHERS FOR GET_PRICING_ATTRIBUTE'|| SQLCODE||SQLERRM ) ;
5973 END IF;
5974 return null;
5975
5976 END get_pricing_attribute;
5977
5978
5979
5980 PROCEDURE get_Price_List_info(
5981 p_price_list_id IN NUMBER,
5982 out_name out nocopy varchar2,
5983
5984 out_end_date out nocopy date,
5985
5986 out_start_date out nocopy date,
5987
5988 out_automatic_flag out nocopy varchar2,
5989
5990 out_rounding_factor out nocopy varchar2,
5991
5992 out_terms_id out nocopy number,
5993
5994 out_gsa_indicator out nocopy varchar2,
5995
5996 out_currency out nocopy varchar2,
5997
5998 out_freight_terms_code out nocopy varchar2
5999
6000 ) IS
6001
6002 --
6003 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6004 --
6005 BEGIN
6006
6007 IF l_debug_level > 0 THEN
6008 oe_debug_pub.add( 'GET PRICE_LIST ID='||P_PRICE_LIST_ID ) ;
6009 END IF;
6010
6011 IF p_price_list_id IS NOT NULL THEN
6012
6013 SELECT NAME,
6014 end_date_active,
6015 start_date_active,
6016 automatic_flag,
6017 rounding_factor,
6018 terms_id,
6019 gsa_indicator,
6020 currency_code,
6021 freight_terms_code
6022 INTO out_name,
6023 out_end_date,
6024 out_start_date,
6025 out_automatic_flag,
6026 out_rounding_factor,
6027 out_terms_id,
6028 out_gsa_indicator,
6029 out_currency,
6030 out_freight_terms_code
6031
6032 FROM qp_list_headers_vl
6033 WHERE list_header_id = p_price_list_id
6034 and list_type_code in ('PRL', 'AGR');
6035
6036 END IF;
6037
6038 IF l_debug_level > 0 THEN
6039 oe_debug_pub.add( 'END_DATE='||OUT_END_DATE|| ' START_DATE='||OUT_START_DATE ) ;
6040 END IF;
6041
6042 EXCEPTION
6043
6044 WHEN NO_DATA_FOUND THEN
6045 IF l_debug_level > 0 THEN
6046 oe_debug_pub.add( 'NO DATA FOUND GET PRICE LIST_INFO' ) ;
6047 END IF;
6048
6049 WHEN OTHERS THEN
6050 IF l_debug_level > 0 THEN
6051 oe_debug_pub.add( 'WHEN OTHERS GET PRICE LIST_INFO'|| SQLCODE||SQLERRM ) ;
6052 END IF;
6053
6054 END get_Price_List_info;
6055
6056
6057
6058
6059 PROCEDURE get_item_information(
6060 in_inventory_item_id in number
6061 ,in_org_id in number
6062 ,out_item_status out nocopy varchar2
6063 ,out_wsh out nocopy varchar2
6064 ,out_wsh_name out nocopy varchar2
6065 ,out_category out nocopy varchar2
6066 ,out_lead_time out nocopy number
6067 ,out_cost out nocopy number
6068 ,out_primary_uom out nocopy varchar2
6069 ,out_user_item_type out nocopy varchar2
6070 ,out_make_or_buy out nocopy varchar2
6071 ,out_weight_uom out nocopy varchar2
6072 ,out_unit_weight out nocopy number
6073 ,out_volume_uom out nocopy varchar2
6074 ,out_unit_volume out nocopy number
6075 ,out_min_order_quantity out nocopy number
6076 ,out_max_order_quantity out nocopy number
6077 ,out_fixed_order_quantity out nocopy number
6078 ,out_customer_order_flag out nocopy varchar2
6079 ,out_internal_order_flag out nocopy varchar2
6080 ,out_stockable out nocopy varchar2
6081 ,out_reservable out nocopy varchar2
6082 ,out_returnable out nocopy varchar2
6083 ,out_shippable out nocopy varchar2
6084 ,out_orderable_on_web out nocopy varchar2
6085 ,out_taxable out nocopy varchar2
6086 ,out_serviceable out nocopy varchar2
6087 ,out_atp_flag out nocopy varchar2
6088 ,out_bom_item_type out nocopy varchar2
6089 ,out_replenish_to_order_flag out nocopy varchar2
6090 ,out_build_in_wip_flag out nocopy varchar2
6091 ,out_default_so_source_type out nocopy varchar2
6092 ) IS
6093
6094 CURSOR c_item_info IS
6095 SELECT shippable_item_flag,
6096 customer_order_enabled_flag,
6097 internal_order_enabled_flag,
6098 stock_enabled_flag,
6099 default_shipping_org,
6100 returnable_flag,
6101 source_organization_id,
6102 unit_weight,
6103 weight_uom_code,
6104 unit_volume,
6105 volume_uom_code,
6106 cum_manufacturing_lead_time,
6107 cumulative_total_lead_time,
6108 primary_unit_of_measure,
6109 inventory_item_status_code,
6110 full_lead_time,
6111 order_cost,
6112 minimum_order_quantity,
6113 maximum_order_quantity,
6114 fixed_order_quantity,
6115 reservable_type,
6116 item_type,
6117 orderable_on_web_flag,
6118 planning_make_buy_code,
6119 taxable_flag ,
6120 serviceable_product_flag,
6121 atp_flag,
6122 bom_item_type,
6123 replenish_to_order_flag,
6124 build_in_wip_flag,
6125 decode(default_so_source_type,'EXTERNAL','External','INTERNAL','Internal')
6126 FROM mtl_system_items
6127 WHERE inventory_item_id = in_inventory_item_id
6128 AND organization_id = in_org_id;
6129
6130 l_default_shipping_org number;
6131 l_source_organization_id number;
6132 l_cum_manufactureing_lead_time number;
6133 l_cummulative_total_lead_time number;
6134 l_inventory_item_status_code varchar2(10);
6135 l_full_lead_time number;
6136 l_order_cost number;
6137 l_reservable_type number;
6138 l_user_item_type varchar2(30);
6139 l_ship_from_org varchar2(200);
6140 l_ship_from_org_name varchar2(200);
6141 l_make_buy number;
6142
6143 --
6144 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6145 --
6146 l_lookup_type varchar2(50);
6147 BEGIN
6148
6149 IF l_debug_level > 0 THEN
6150 oe_debug_pub.add( 'ENTERING oe_oe_pricing_availability.GET_ITEM_INFO'||
6151 'INV_ITEM_ID='||IN_INVENTORY_ITEM_ID|| 'ORG_ID='||IN_ORG_ID ) ;
6152 END IF;
6153
6154 OPEN c_item_info;
6155 FETCH c_item_info
6156 INTO out_shippable,
6157 out_customer_order_flag,
6158 out_internal_order_flag,
6159 out_stockable,
6160 l_default_shipping_org,
6161 out_returnable,
6162 l_source_organization_id,
6163 out_unit_weight,
6164 out_weight_uom,
6165 out_unit_volume,
6166 out_volume_uom,
6167 l_cum_manufactureing_lead_time,
6168 l_cummulative_total_lead_time,
6169 out_primary_uom,
6170 l_inventory_item_status_code,
6171 l_full_lead_time,
6172 l_order_cost,
6173 out_min_order_quantity,
6174 out_max_order_quantity,
6175 out_fixed_order_quantity,
6176 l_reservable_type,
6177 l_user_item_type,
6178 out_orderable_on_web,
6179 l_make_buy,
6180 out_taxable,
6181 out_serviceable,
6182 out_atp_flag,
6183 out_bom_item_type,
6184 out_replenish_to_order_flag,
6185 out_build_in_wip_flag,
6186 out_default_so_source_type;
6187
6188 CLOSE c_item_Info;
6189
6190 out_item_status := l_inventory_item_status_code;
6191
6192 IF l_make_buy = 1 then
6193 out_make_or_buy := 'Make';
6194 ELSE
6195 out_make_or_buy := 'Buy';
6196 END IF;
6197
6198
6199 oe_oe_pricing_availability.get_Ship_From_Org
6200 ( in_org_id => in_org_id
6201 , out_code=>out_wsh
6202 , out_name =>out_wsh_name
6203 );
6204
6205 IF l_debug_level > 0 THEN
6206 oe_debug_pub.add( 'USER_ITEM_TYPE='||L_USER_ITEM_TYPE ) ;
6207 END IF;
6208
6209 out_lead_time := l_cummulative_total_lead_time;
6210 out_cost := l_order_cost;
6211
6212 IF l_reservable_type = 1 then
6213 out_reservable := 'Y';
6214 ELSE
6215 out_reservable := 'N';
6216
6217 END IF;
6218 l_lookup_type := 'ITEM_TYPE'; -- added for bug 3776769
6219 IF l_user_item_type is NOT NULL then
6220 select meaning
6221 into out_user_item_type
6222 from fnd_common_lookups
6223 where lookup_type = l_lookup_type -- added for bug 3776769
6224 and lookup_code = l_user_item_type;
6225 ELSE
6226 out_user_item_type := null;
6227
6228 END IF;
6229 IF l_debug_level > 0 THEN
6230 oe_debug_pub.add( 'EXITING oe_oe_pricing_availability.GET_ITEM_INFO'||
6231 ' ITEM_STATUS ='||OUT_ITEM_STATUS ) ;
6232 END IF;
6233
6234 EXCEPTION
6235
6236 WHEN OTHERS THEN
6237 IF c_item_info%ISOPEN then
6238 CLOSE c_item_info;
6239 END IF;
6240
6241 IF l_debug_level > 0 THEN
6242 oe_debug_pub.add( 'WHEN OTHERS oe_oe_pricing_availability.GET_ITEM_INFO '||
6243 'INV_ITEM_ID='||IN_INVENTORY_ITEM_ID|| 'ORG_ID='||IN_ORG_ID||
6244 'SQLCODE='||SQLCODE|| 'SQLERRM='||SQLERRM ) ;
6245 END IF;
6246
6247 END get_item_information;
6248
6249
6250
6251 PROCEDURE print_time(in_place in varchar2) IS
6252
6253 cursor c_hsecs is
6254 select hsecs
6255 from v$timer;
6256
6257 l_hsecs number;
6258 l_total number;
6259
6260 --
6261 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6262 --
6263 BEGIN
6264
6265 --print_time2;
6266 OPEN c_hsecs;
6267 FETCH c_hsecs
6268 INTO l_hsecs;
6269 CLOSE c_hsecs;
6270
6271 IF g_hsecs is null then
6272
6273 g_hsecs := l_hsecs;
6274 g_place := in_place;
6275 IF l_debug_level > 0 THEN
6276 oe_debug_pub.add( 'TIME STARTING AT PLACE '||G_PLACE||' TIME='||G_HSECS ) ;
6277 END IF;
6278
6279 ELSE
6280 l_total := (l_hsecs - g_hsecs)/100;
6281 g_total := g_total + l_total;
6282 IF l_debug_level > 0 THEN
6283 oe_debug_pub.add( 'TIME FROM ' ||G_PLACE||' TO '||IN_PLACE||
6284 ' TIME DIFF='|| L_TOTAL||' SECONDS'||' TOTAL SO FAR='||G_TOTAL ) ;
6285 END IF;
6286 g_hsecs := l_hsecs;
6287 g_place := in_place;
6288
6289 END IF;
6290 --print_time2;
6291
6292 END print_time;
6293
6294
6295 PROCEDURE print_time2 IS
6296
6297 cursor c2_hsecs is
6298 select hsecs
6299 from v$timer;
6300
6301 l_hsecs number;
6302 l_total number;
6303
6304 --
6305 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6306 --
6307 BEGIN
6308
6309 OPEN c2_hsecs;
6310 FETCH c2_hsecs
6311 INTO l_hsecs;
6312 CLOSE c2_hsecs;
6313
6314 IF g_total2 is null then
6315 IF l_debug_level > 0 THEN
6316 oe_debug_pub.add( 'G_TOTAL2 IS NULL L_HSECS='||L_HSECS ) ;
6317 END IF;
6318 g_total2 := l_hsecs;
6319 ELSE
6320 IF l_debug_level > 0 THEN
6321 oe_debug_pub.add( 'L_HSECS='||L_HSECS||' TOTAL2='||G_TOTAL2 ) ;
6322 END IF;
6323 l_total := (l_hsecs - g_total2)/100;
6324 IF l_debug_level > 0 THEN
6325 oe_debug_pub.add( 'G_TOTAL2='||L_TOTAL ) ;
6326 END IF;
6327 g_total2 := l_hsecs;
6328 END IF;
6329
6330 END print_time2;
6331
6332
6333 PROCEDURE get_global_availability (
6334 in_customer_id in number
6335 ,in_customer_site_id in number
6336 ,in_inventory_item_id in number
6337 ,in_org_id in number
6338 ,x_return_status out nocopy varchar2
6339 ,x_msg_data out nocopy varchar2
6340 ,x_msg_count out nocopy number
6341 ,l_source_orgs_table out nocopy source_orgs_table
6342 )IS
6343
6344 l_instance_id number;
6345 CURSOR c_instance_id IS
6346 SELECT instance_id,
6347 instance_code
6348 FROM mrp_ap_apps_instances;
6349
6350 l_mrp_atp_database_link varchar2(300);
6351 x_assignment_set_id number;
6352 x_assignment_set_name varchar2(300);
6353 x_plan_id number;
6354 x_plan_name varchar2(300);
6355 x_ret_code varchar2(300);
6356 x_err_mesg varchar2(2000);
6357 l_session_id number;
6358 --l_item_arr mrp_atp_pub.number_arr := mrp_atp_pub.number_arr(1);
6359 l_organization_id number;
6360 x_sources mrp_atp_pvt.atp_source_typ;
6361 l_calling_module number;
6362 x_error_mesg varchar2(2000);
6363 l_other_cols order_sch_wb.other_cols_typ;
6364 --l_source_orgs_table source_orgs_table;
6365 l_count number := 1;
6366 l_on_hand_qty number;
6367 l_reservable_qty number;
6368 l_available_qty number;
6369 l_ship_from_org_id number;
6370 l_available_date date;
6371 l_qty_uom varchar2(25);
6372 l_out_message varchar2(300);
6373 l_return_status VARCHAR2(1);
6374 l_msg_count NUMBER;
6375 l_msg_data VARCHAR2(2000);
6376 l_error_message varchar2(2000);
6377 l_org_id number;
6378 l_customer_id number;
6379 l_customer_site_id number;
6380 l_ship_method varchar2(30);
6381 l_dynstring VARCHAR2(500) := NULL;
6382 l_instance_code varchar2(100);
6383
6384 l_inv_ctp number;
6385
6386 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6387
6388 CURSOR c_temp_table(in_session_id in number) IS
6389 SELECT source_organization_id,
6390 sr_instance_id,
6391 ship_method,
6392 delivery_lead_time,
6393 freight_carrier
6394 FROM mrp_atp_schedule_temp
6395 WHERE session_id = in_session_id
6396 --AND status_flag = -99;
6397 AND status_flag = 22;
6398
6399 sql_stmt VARCHAR2(3200);
6400
6401 BEGIN
6402
6403 IF l_debug_level > 0 THEN
6404 oe_debug_pub.add( 'ENTERING GA IN_ORG_ID='||IN_ORG_ID|| ' IN_CUSTOMER_ID='||IN_CUSTOMER_ID
6405 || ' IN_SITE_ID ='||IN_CUSTOMER_SITE_ID|| ' IN_ITEM_ID ='||IN_INVENTORY_ITEM_ID ) ;
6406 END IF;
6407
6408 OPEN c_instance_id;
6409 FETCH c_instance_id
6410 INTO l_instance_id,
6411 l_instance_code;
6412 CLOSE c_instance_id;
6413
6414
6415 x_return_status := 'S';
6416 -- No need to check profile.. Instead get the link from
6417 -- table mrp_ap_apps_instances 4113599
6418 -- l_mrp_atp_database_link := fnd_profile.value('MRP_ATP_DATABASE_LINK');
6419
6420 --Bug 6716697: Wrong dblink name was selected. Corrcted as per ATP team
6421 select a2m_dblink
6422 into l_mrp_atp_database_link
6423 from mrp_ap_apps_instances;
6424
6425 IF l_debug_level > 0 THEN
6426 oe_debug_pub.add( 'L_INSTANCE_ID='||L_INSTANCE_ID|| ' DB LINK='
6427 ||L_MRP_ATP_DATABASE_LINK ||' Ins Code='||l_instance_code) ;
6428 END IF;
6429
6430 msc_sch_wb.get_assignment_set(
6431 x_dblink => l_mrp_atp_database_link
6432 ,x_assignment_set_id=>x_assignment_set_id
6433 ,x_assignment_set_name=>x_assignment_set_name
6434 ,x_plan_id =>x_plan_id
6435 ,x_plan_name =>x_plan_name
6436 ,x_sr_instance_id=>l_instance_id
6437 ,x_inst =>'APPS'
6438 ,x_ret_code =>x_return_status
6439 ,x_err_mesg =>x_err_mesg
6440 );
6441
6442 IF l_debug_level > 0 THEN
6443 oe_debug_pub.add( 'ASSIGNMENT_SET_ID='||X_ASSIGNMENT_SET_ID|| ' SET NAME='||
6444 X_ASSIGNMENT_SET_NAME|| ' PLAN ID='||X_PLAN_ID|| ' PLAN NAME='
6445 ||X_PLAN_NAME|| ' RET CODE='||X_RETURN_STATUS|| ' ERR MESG='||X_ERR_MESG ) ;
6446 END IF;
6447
6448 IF nvl(x_return_status,'E') = 'E'
6449 and x_assignment_set_id is null then
6450
6451 x_msg_data := x_err_mesg;
6452 IF l_debug_level > 0 THEN
6453 oe_debug_pub.add( 'RETURNING IN GA 1' ) ;
6454 END IF;
6455
6456 IF x_msg_data is not null then
6457
6458 IF l_debug_level > 0 THEN
6459 oe_debug_pub.add( 'MSG DATA IS NOT NULL' ) ;
6460 END IF;
6461 x_return_status := 'E';
6462 FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_GENERIC');
6463 IF l_debug_level > 0 THEN
6464 oe_debug_pub.add( 'MSG DATA IS NOT NULL 2' ) ;
6465 END IF;
6466 FND_MESSAGE.SET_TOKEN('TEXT',x_msg_data);
6467 OE_MSG_PUB.Add;
6468
6469 END IF;
6470
6471
6472 ELSE -- if get_assignment_set was sucessful
6473
6474
6475 SELECT mrp_atp_schedule_temp_s.nextval
6476 INTO l_session_id
6477 FROM dual;
6478
6479 x_return_status := 'S';
6480
6481 IF in_customer_site_id is not null and in_customer_id is not null then
6482 l_customer_id := in_customer_id;
6483 l_customer_site_id := in_customer_site_id;
6484 l_org_id := null;
6485 ELSE
6486 l_org_id := in_org_id;
6487 l_customer_id := null;
6488 l_customer_site_id := null;
6489 END IF;
6490
6491
6492 /*fnd_profile.get('INV_CTP',l_inv_ctp);
6493 IF l_debug_level > 0 THEN
6494 oe_debug_pub.add(' Inventory Capable to Promise='||l_inv_ctp);
6495 END IF;
6496
6497 --Profile Inventory Capable to Prmise
6498 -- 4= PDS and we need to select a plan_id for org-org sourcing
6499 -- 5= ODS and we need to pass -1 as plan_id
6500 IF l_inv_ctp = 5 then
6501 x_plan_id := -1;
6502 END IF;
6503
6504 -- if destination is the org, then for looking at the sourcing rule
6505 -- we need to pass the plan_id from the planning server
6506 -- get_assignment_set currently does not return plan_id
6507 IF l_inv_ctp <> 5 AND
6508 l_org_id is not null and
6509 (l_customer_id is null and l_customer_site_id is null) then
6510
6511 IF l_mrp_atp_database_link IS NOT NULL THEN
6512 l_dynstring := '@'||l_mrp_atp_database_link;
6513 END IF;
6514
6515 IF l_debug_level > 0 THEN
6516 oe_debug_pub.add('Getting Plan Id dynamic string='||l_dynstring);
6517 END IF;
6518
6519 sql_stmt :=
6520 ' SELECT '||
6521 ' mast.plan_id '||
6522 ' FROM msc_atp_plan_sn'||l_dynstring||' mast '||
6523 ' WHERE mast.sr_instance_id = :in_instance_id '||
6524 ' AND mast.sr_inventory_item_id = :in_inventory_item_id'||
6525 ' AND mast.organization_id = :in_org_id';
6526
6527 IF l_debug_level > 0 THEN
6528 oe_debug_pub.add('Planning Sql='||sql_stmt);
6529 END IF;
6530
6531
6532 EXECUTE IMMEDIATE sql_stmt INTO x_plan_id
6533 using l_instance_id,in_inventory_item_id,l_org_id;
6534
6535
6536 IF x_plan_id is null then
6537 fnd_message.set_name('MSC', 'MSC_NO_PLANS_DEFINED');
6538 oe_msg_pub.add;
6539 x_return_status := 'E';
6540 oe_debug_pub.add('Plan Id NOT FOUND');
6541 END IF;
6542
6543 END IF; -- if plan_id needs to be fetched */
6544
6545
6546 IF x_plan_id is null then
6547 x_plan_id := -1;
6548 END IF;
6549
6550 -- if the plan was fetched and found then continue
6551 IF nvl(x_return_status,'E') <> 'E' then
6552
6553 IF l_debug_level > 0 THEN
6554 oe_debug_pub.add(' Before inserting into temp table '||
6555 ' instance_id='||l_instance_id||
6556 ' session_id='||l_session_id||
6557 ' inv_item_id='||in_inventory_item_id||
6558 ' customer_id='||l_customer_id||
6559 ' customer_site_id='||l_customer_site_id||
6560 ' org_id='||l_org_id||
6561 ' ship_method='||l_ship_method
6562 );
6563 END IF;
6564
6565 -- insert into mrp_atp_schedule_Temp
6566 INSERT INTO MRP_ATP_SCHEDULE_TEMP(
6567 sr_instance_id,
6568 session_id,
6569 inventory_item_id,
6570 organization_id,
6571 scenario_id,
6572 customer_id,
6573 customer_site_id,
6574 ship_method,
6575 status_flag,
6576 order_line_id)
6577 VALUES
6578 (l_instance_id,
6579 l_session_id,
6580 in_inventory_item_id,
6581 l_org_id,
6582 -1,
6583 l_customer_id,
6584 l_customer_site_id,
6585 l_ship_method,
6586 4,
6587 -1
6588 );
6589
6590
6591 IF l_debug_level > 0 THEN
6592 print_time('Calling Get Supply Sources');
6593 END IF;
6594
6595 msc_sch_wb.get_supply_sources_local(
6596 x_dblink=>l_mrp_atp_database_link,
6597 x_session_id=>l_session_id,
6598 x_sr_instance_id=>l_instance_id,
6599 x_assignment_set_id=>x_assignment_set_id,
6600 x_plan_id=>x_plan_id,
6601 x_calling_inst=>'APPS',
6602 x_ret_status=>x_return_status,
6603 x_error_mesg=>x_err_mesg);
6604
6605 IF l_debug_level > 0 THEN
6606 print_time('After Calling Get Supply Sources');
6607
6608 oe_debug_pub.add( ' After CALLing get_supply_sources_local '||
6609 ' status='||x_return_status||
6610 ' message='||x_err_mesg);
6611
6612 END IF;
6613
6614 IF nvl(x_return_status,'S') <> 'S' THEN
6615 IF l_debug_level > 0 THEN
6616 oe_debug_pub.add( ' ERROR IN CALL TO get_supply_sources_local');
6617 END IF;
6618 fnd_message.set_name('MSC', x_err_mesg);
6619 oe_msg_pub.add;
6620
6621 ELSE
6622
6623 IF x_return_status IS NULL THEN
6624 x_return_status := 'S';
6625 END IF;
6626
6627 IF l_debug_level > 0 THEN
6628 oe_debug_pub.add( ' SUCCESS IN CALL TO get_supply_sources_local');
6629 END IF;
6630
6631 -- Read from mrp_atp_schedule_Temp
6632 -- Insert into l_sources_orgs_table org_id and instance_id
6633 -- delete from mrp_atp_schedule_temp
6634
6635 FOR l_temp_rec in c_temp_table(l_session_id)
6636 LOOP
6637 IF l_debug_level > 0 THEN
6638 oe_debug_pub.add( ' Reading data from temp table');
6639 END IF;
6640 l_source_orgs_table(l_count).org_id:=l_temp_rec.source_organization_id;
6641 l_source_orgs_table(l_count).instance_id:=l_temp_rec.sr_instance_id;
6642 l_source_orgs_table(l_count).ship_method:=l_temp_rec.ship_method;
6643 l_source_orgs_table(l_count).delivery_lead_time:=l_temp_rec.delivery_lead_time;
6644 l_source_orgs_table(l_count).freight_carrier:=l_temp_rec.freight_carrier;
6645 l_source_orgs_table(l_count).instance_code:=l_instance_code;
6646 l_count := l_count + 1;
6647
6648 END LOOP;
6649
6650 IF l_debug_level > 0 THEN
6651 oe_debug_pub.add( ' After Reading data from temp table');
6652 END IF;
6653
6654 IF l_source_orgs_table.COUNT > 0 then
6655 FOR i in l_source_orgs_table.FIRST..l_source_orgs_table.LAST
6656 LOOP
6657 IF l_debug_level > 0 THEN
6658 oe_debug_pub.add(' Record = '||i||
6659 ' org_id ='||l_source_orgs_table(i).org_id||
6660 ' instance_id ='||l_source_orgs_table(i).instance_id||
6661 ' ship_method ='||l_source_orgs_table(i).ship_method||
6662 ' del_lead_time ='||l_source_orgs_table(i).delivery_lead_time||
6663 ' Instance_Code ='||l_source_orgs_table(i).Instance_Code
6664 );
6665
6666 END IF;
6667
6668 END LOOP;
6669 ELSE
6670
6671 IF l_debug_level > 0 THEN
6672 oe_debug_pub.add( ' THERE ARE NO SOURCES TO BE DISPLAYED ' ) ;
6673 END IF;
6674 x_return_status := 'E';
6675 x_error_mesg := 'MRP_ATP_NO_SOURCES';
6676 FND_MESSAGE.SET_NAME('MSC','MRP_ATP_NO_SOURCES');
6677 OE_MSG_PUB.Add;
6678 x_return_status := 'E';
6679
6680 END IF; -- IF x_sources.organization_id.COUNT > 0
6681
6682 END IF; -- if get_supply_sources is not successful
6683
6684 --deleting from the temp table
6685 DELETE mrp_atp_schedule_temp
6686 WHERE session_id = l_session_id;
6687
6688 END IF; -- if the fetching of plan was successful
6689
6690 END IF; -- if get_assignment fails
6691
6692
6693 -- if it was a failure then we retrieve the message
6694 IF nvl(x_return_status,'E') <> 'S' then
6695 IF l_debug_level > 0 THEN
6696 oe_debug_pub.add( 'DOING COUNT_AND_GET' ) ;
6697 END IF;
6698 oe_msg_pub.count_and_get(p_encoded=>fnd_api.G_TRUE,
6699 p_count => x_msg_count,
6700 p_data=>x_msg_data
6701 );
6702 IF l_debug_level > 0 THEN
6703 oe_debug_pub.add( 'COUNT = '||X_MSG_COUNT||' MSG='||X_MSG_DATA ) ;
6704 END IF;
6705 END IF;
6706
6707 IF l_debug_level > 0 THEN
6708 oe_debug_pub.add( 'EXITING GA' ) ;
6709 END IF;
6710
6711 EXCEPTION
6712 WHEN OTHERS THEN
6713
6714 IF l_debug_level > 0 THEN
6715 oe_debug_pub.add( 'WHEN OTHERS OF get_global_availability' ) ;
6716 oe_debug_pub.add( 'CODE='||SQLCODE||' MSG='||SQLERRM ) ;
6717 END IF;
6718
6719 x_return_status := 'E';
6720 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
6721
6722 -- Get message count and data
6723 OE_MSG_PUB.Count_And_Get
6724 ( p_count => x_msg_count
6725 , p_data => x_msg_data
6726 );
6727
6728 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
6729 OE_MSG_PUB.Add_Exc_Msg
6730 ( G_PKG_NAME,
6731 'Get_Global_Availability');
6732 END IF;
6733
6734 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6735
6736 END get_global_availability;
6737
6738
6739
6740 PROCEDURE different_uom(
6741 in_org_id in number
6742 ,in_ordered_uom in varchar2
6743 ,in_pricing_uom in varchar2
6744 ,out_conversion_rate out nocopy number
6745
6746 )IS
6747
6748 CURSOR c_items IS
6749 SELECT primary_uom_code
6750 FROM mtl_system_items_b
6751 WHERE organization_id = in_org_id
6752 AND inventory_item_id = g_panda_rec_table(1).p_Inventory_item_id;
6753
6754 CURSOR c_class(in_ordered_uom in varchar2) is
6755 SELECT uom_Class
6756 FROM mtl_units_of_measure_tl
6757 WHERE uom_code = in_ordered_uom;
6758
6759 CURSOR c_base_uom(in_class in varchar2) IS
6760 SELECT uom_code
6761 FROM mtl_units_of_measure_tl
6762 WHERE uom_class = in_class
6763 AND base_uom_flag = 'Y';
6764
6765 l_primary_Uom varchar2(100);
6766 l_uom_class varchar2(50);
6767 l_base_uom varchar2(50);
6768 l_conversion_rate number;
6769 l_ordered_conversion number;
6770 l_pricing_conversion number;
6771
6772 --
6773 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6774 --
6775 BEGIN
6776
6777 IF l_debug_level > 0 THEN
6778 oe_debug_pub.add( 'ENTERING OE_AVAILABILITY.DIFFERENT_UOM'||
6779 ' ORDERED_UOM ='||IN_ORDERED_UOM|| ' PRICING_UOM='||
6780 IN_PRICING_UOM|| ' IN_INV_ITEM_ID='||
6781 G_panda_rec_table(1).p_INVENTORY_ITEM_ID|| ' IN_ORG_ID='||IN_ORG_ID ) ;
6782 END IF;
6783
6784 OPEN c_items;
6785 FETCH c_items
6786 INTO l_primary_uom;
6787
6788 IF c_items%FOUND then
6789
6790 OPEN c_class(l_primary_uom);
6791 FETCH c_class
6792 INTO l_uom_class;
6793
6794 IF c_class%FOUND then
6795
6796 OPEN c_base_uom(l_uom_class);
6797 FETCH c_base_Uom
6798 INTO l_base_uom;
6799
6800 IF c_base_uom%FOUND then
6801
6802 -- Both Ordered and Pricing are not Base UOM
6803 IF in_ordered_uom <> l_base_uom AND
6804 in_pricing_uom <> l_base_uom THEN
6805
6806 IF l_debug_level > 0 THEN
6807 oe_debug_pub.add( 'NEITHER THE ORDERED OR PRICING UOM IS BASE UOM' ) ;
6808 END IF;
6809
6810 l_ordered_conversion := get_conversion_rate(
6811 in_uom_code => in_ordered_uom,
6812 in_base_uom => l_base_uom
6813 );
6814 IF l_debug_level > 0 THEN
6815 oe_debug_pub.add( 'THE ORD RATE ='||L_ORDERED_CONVERSION ) ;
6816 END IF;
6817 l_pricing_conversion := get_conversion_rate(
6818 in_uom_code => in_pricing_uom,
6819 in_base_uom => l_base_uom
6820 );
6821 IF l_debug_level > 0 THEN
6822 oe_debug_pub.add( 'THE PRICING RATE ='||L_PRICING_CONVERSION ) ;
6823 END IF;
6824
6825 out_conversion_rate := l_ordered_conversion/l_pricing_conversion;
6826 IF l_debug_level > 0 THEN
6827 oe_debug_pub.add( 'THE RATE ='||OUT_CONVERSION_RATE ) ;
6828 END IF;
6829
6830 -- Ordered Uom is the Base Uom,sending the pricing uom for conversion
6831 ELSIF in_ordered_uom = l_base_uom then
6832
6833 IF l_debug_level > 0 THEN
6834 oe_debug_pub.add( 'THE ORDERED UOM IS BASE UOM' ) ;
6835 END IF;
6836
6837 l_ordered_conversion := get_conversion_rate(
6838 in_uom_code => in_pricing_uom,
6839 in_base_uom => l_base_uom
6840 );
6841 out_conversion_rate := l_ordered_conversion;
6842 IF l_debug_level > 0 THEN
6843 oe_debug_pub.add( 'THE RATE ='||OUT_CONVERSION_RATE ) ;
6844 END IF;
6845
6846 -- Pricing Uom is the Base Uom
6847 ELSIF in_pricing_uom = l_base_uom then
6848
6849 IF l_debug_level > 0 THEN
6850 oe_debug_pub.add( 'THE PRICING UOM IS BASE UOM' ) ;
6851 END IF;
6852 l_pricing_conversion := get_conversion_rate(
6853 in_uom_code => in_ordered_uom,
6854 in_base_uom => l_base_uom
6855 );
6856 out_conversion_rate := l_pricing_conversion;
6857 IF l_debug_level > 0 THEN
6858 oe_debug_pub.add( 'THE RATE ='||OUT_CONVERSION_RATE ) ;
6859 END IF;
6860
6861 END IF;
6862
6863 END IF;
6864
6865 CLOSE c_base_uom;
6866
6867 END IF;
6868
6869 CLOSE c_class;
6870
6871 END IF;
6872 CLOSE c_items;
6873
6874 EXCEPTION
6875
6876 WHEN NO_DATA_FOUND THEN
6877 IF l_debug_level > 0 THEN
6878 oe_debug_pub.add( 'NO DATA FONUNG DIFFERENT_UOM ' ) ;
6879 END IF;
6880
6881 WHEN OTHERS THEN
6882 IF c_items%ISOPEN then
6883 CLOSE c_items;
6884 END IF;
6885 IF c_class%ISOPEN then
6886 CLOSE c_class;
6887 END IF;
6888 IF c_base_uom%ISOPEN then
6889 CLOSE c_base_uom;
6890 END IF;
6891 IF l_debug_level > 0 THEN
6892 oe_debug_pub.add( 'ERROR IN DIFFERENT_UOM '|| SQLCODE||SQLERRM ) ;
6893 END IF;
6894
6895 END different_uom;
6896
6897
6898
6899 FUNCTION get_conversion_rate (in_uom_code in varchar2,
6900 in_base_uom in varchar2
6901 ) RETURN number is
6902
6903
6904 CURSOR c_item_conversion IS
6905 SELECT round(1/conversion_rate,6)
6906 FROM mtl_uom_conversions
6907 WHERE uom_code = in_uom_code
6908 AND inventory_item_id = g_panda_rec_table(1).p_inventory_item_id;
6909
6910 CURSOR c_conversion IS
6911 SELECT round(1/conversion_rate,6)
6912 FROM mtl_uom_conversions
6913 WHERE uom_Code = in_uom_code
6914 AND inventory_item_id = 0;
6915
6916 CURSOR c_inter_class IS
6917 SELECT round(1/conversion_rate,6)
6918 FROM mtl_uom_class_conversions
6919 WHERE to_uom_code = in_uom_code
6920 AND from_uom_code = in_base_uom
6921 AND inventory_item_id = g_panda_rec_table(1).p_inventory_item_id;
6922
6923 l_conversion_rate number;
6924 l_uom_code varchar2(50);
6925
6926 --
6927 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6928 --
6929 BEGIN
6930
6931 IF l_debug_level > 0 THEN
6932 oe_debug_pub.add( 'INSIDE GET_CONVERSION_RATE '|| ' IN_UOM_CODE='||IN_UOM_CODE|| ' IN_BASE_UOM='||IN_BASE_UOM ) ;
6933 END IF;
6934
6935 OPEN c_item_conversion;
6936 FETCH c_item_conversion
6937 INTO l_conversion_rate;
6938
6939 IF c_item_conversion%NOTFOUND THEN
6940
6941 IF l_debug_level > 0 THEN
6942 oe_debug_pub.add( 'ITEM SPECIFIC CONVERSION RATE NOT FOUND' ) ;
6943 END IF;
6944
6945 OPEN c_conversion;
6946 FETCH c_conversion
6947 INTO l_conversion_rate;
6948
6949 IF c_conversion%NOTFOUND THEN
6950
6951 IF l_debug_level > 0 THEN
6952 oe_debug_pub.add( 'GENERIC CONVERSION NOT FOUND' ) ;
6953 END IF;
6954 OPEN c_inter_class;
6955 FETCH c_inter_class
6956 INTO l_conversion_rate;
6957
6958 IF c_inter_class%NOTFOUND THEN
6959 IF l_debug_level > 0 THEN
6960 oe_debug_pub.add( 'INTER CLASS RETURN RATE NOT FOUND= 1' ) ;
6961 END IF;
6962 l_conversion_rate := 1;
6963
6964 ELSE
6965 IF l_debug_level > 0 THEN
6966 oe_debug_pub.add( 'INTER CLASS RETURN RATE = '||L_CONVERSION_RATE ) ;
6967 END IF;
6968
6969 END IF;
6970 CLOSE c_inter_class;
6971
6972 ELSIF c_conversion%FOUND then
6973
6974 IF l_debug_level > 0 THEN
6975 oe_debug_pub.add( 'RETURN RATE GENERIC= '||L_CONVERSION_RATE ) ;
6976 END IF;
6977
6978 END IF;
6979 CLOSE c_conversion;
6980
6981 ELSIF c_item_conversion%FOUND THEN
6982
6983 IF l_debug_level > 0 THEN
6984 oe_debug_pub.add( 'ITEM SPECIFIC CONVERSION RATE='||L_CONVERSION_RATE ) ;
6985 END IF;
6986
6987 END IF;
6988 CLOSE c_item_conversion;
6989
6990 return l_conversion_rate;
6991
6992 EXCEPTION
6993
6994 WHEN ZERO_DIVIDE THEN
6995 IF l_debug_level > 0 THEN
6996 oe_debug_pub.add( 'DIVIDE BY ZERO ERROR IN_UOM_CODE='||IN_UOM_CODE|| ' BASE UOM='||IN_BASE_UOM ) ;
6997 END IF;
6998
6999 IF c_item_conversion%ISOPEN then
7000 CLOSE c_item_conversion;
7001 END IF;
7002 IF c_conversion%ISOPEN then
7003 CLOSE c_conversion;
7004 END IF;
7005 IF c_inter_class%ISOPEN then
7006 CLOSE c_inter_class;
7007 END IF;
7008
7009 WHEN OTHERS THEN
7010
7011 IF c_item_conversion%ISOPEN then
7012 CLOSE c_item_conversion;
7013 END IF;
7014 IF c_conversion%ISOPEN then
7015 CLOSE c_conversion;
7016 END IF;
7017 IF c_inter_class%ISOPEN then
7018 CLOSE c_inter_class;
7019 END IF;
7020 IF l_debug_level > 0 THEN
7021 oe_debug_pub.add( 'ERROR IN GET_CONVERSION_RATE '|| SQLCODE||SQLERRM ) ;
7022 END IF;
7023 return 1;
7024 END get_conversion_rate;
7025
7026
7027 PROCEDURE Call_mrp_and_inventory(
7028 in_org_id in number
7029 ,out_on_hand_qty out nocopy number
7030
7031 ,out_reservable_qty out nocopy number
7032
7033 ,out_available_qty out nocopy varchar2
7034
7035 ,out_available_date out nocopy date
7036
7037 ,out_error_message out nocopy varchar2
7038
7039 ,out_qty_uom out nocopy varchar2
7040
7041 ) IS
7042
7043 l_ship_from_org_id number;
7044 l_out_message varchar2(4000);
7045 l_return_status varchar2(1);
7046 l_msg_count number;
7047 l_msg_data varchar2(4000);
7048 l_item_id number;
7049 l_org_id number;
7050 --
7051 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
7052 --
7053 BEGIN
7054
7055 l_item_id:=g_panda_rec_table(1).p_inventory_item_id;
7056 l_org_id:= in_org_id;
7057
7058 if g_upgrade_item_exists ='Y' then
7059 if g_upgrade_item_id is not null then
7060 l_item_id:= g_upgrade_item_id;
7061 end if;
7062 if g_upgrade_ship_from_org_id is not null then
7063 l_org_id:=g_upgrade_ship_from_org_id;
7064 end if;
7065 end if;
7066
7067 Query_Qty_Tree( p_org_id=>l_org_id
7068 ,p_item_id=>l_item_id
7069 ,p_sch_date=>g_panda_rec_table(1).p_request_date
7070 ,x_on_hand_qty =>out_on_hand_qty
7071 ,x_avail_to_reserve =>out_reservable_qty
7072 );
7073
7074
7075 Call_MRP_ATP(
7076 in_global_orgs => 'Y'
7077 ,in_ship_from_org_id =>in_org_id
7078 ,out_available_qty => out_available_qty
7079 ,out_ship_from_org_id =>l_ship_from_org_id
7080 ,out_available_date =>out_available_date
7081 ,out_qty_uom =>out_qty_uom
7082 ,x_out_message =>l_out_message
7083 ,x_return_status =>l_return_status
7084 ,x_msg_count =>l_msg_count
7085 ,x_msg_data =>l_msg_data
7086 ,x_error_message =>out_error_message
7087 );
7088
7089 IF l_debug_level > 0 THEN
7090 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 ) ;
7091 END IF;
7092
7093
7094 IF l_debug_level > 0 THEN
7095 oe_debug_pub.add( 'CALL_MRP_AND_INVENTORY'|| ' OUT_AVAILABLE_DATE ='||OUT_AVAILABLE_DATE|| ' OUT_AVAILABLE_QTY ='||OUT_AVAILABLE_QTY);
7096 oe_debug_pub.add( ' OUT_ON_HAND_QTY ='||OUT_ON_HAND_QTY|| ' OUT_RESERVABLE_QTY ='||OUT_RESERVABLE_QTY|| ' OUT_ERROR_MESSAGE ='||OUT_ERROR_MESSAGE ) ;
7097 END IF;
7098
7099 EXCEPTION
7100 WHEN OTHERS THEN
7101 IF l_debug_level > 0 THEN
7102 oe_debug_pub.add( 'INSIDE CALL_MRP_AND_INVENTORY '|| SQLERRM||SQLERRM ) ;
7103 END IF;
7104
7105 END call_mrp_and_inventory;
7106
7107
7108
7109 PROCEDURE set_mrp_debug(out_mrp_file out nocopy varchar2) IS
7110
7111
7112 l_session_id number;
7113 l_mrp_dir varchar2(200);
7114
7115 --
7116 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
7117 --
7118 BEGIN
7119
7120 SELECT mrp_atp_schedule_temp_s.nextval
7121 INTO l_session_id
7122 FROM dual;
7123
7124 SELECT ltrim(rtrim(substr(value, instr(value,',',-1,1)+1)))
7125 INTO l_mrp_dir
7126 FROM v$parameter
7127 WHERE name='utl_file_dir';
7128
7129 order_sch_wb.mr_debug := 'Y';
7130 order_sch_wb.debug_session_id := l_session_id;
7131
7132 IF l_debug_level > 0 THEN
7133 oe_debug_pub.add( 'MSC_ATP_DEBUG DIR='||L_MRP_DIR|| ' SESSION ID ='||L_SESSION_ID ) ;
7134 END IF;
7135 l_mrp_dir := substr(l_mrp_dir,1,18);
7136 IF l_debug_level > 0 THEN
7137 oe_debug_pub.add( 'MSC_ATP_DEBUG DIR2='||L_MRP_DIR ) ;
7138 END IF;
7139 out_mrp_file := l_mrp_dir||'/session-'||l_session_id;
7140
7141 EXCEPTION
7142 WHEN NO_DATA_FOUND THEN
7143 IF l_debug_level > 0 THEN
7144 oe_debug_pub.add( 'oe_oe_pricing_availability.SET_MRP_DEBUG NO_DATA_FOUND' ) ;
7145 END IF;
7146 WHEN OTHERS THEN
7147 IF l_debug_level > 0 THEN
7148 oe_debug_pub.add( 'WHEN OTHERS oe_oe_pricing_availability.SET_MRP_DEBUG '|| SQLCODE||SQLERRM ) ;
7149 END IF;
7150
7151 END set_mrp_debug;
7152
7153 PROCEDURE CopyINTO_PO_RecStruc
7154 ( p_header_rec in oe_oe_pricing_availability.PA_Header_Tbl_Type,
7155 p_line_tbl in Oe_Oe_Pricing_Availability.PA_Line_Tbl_Type,
7156 p_Header_Adj_tbl in Oe_Oe_Pricing_Availability.PA_H_Adj_Tbl_Type,
7157 p_Line_Adj_tbl in Oe_Oe_Pricing_Availability.PA_LAdj_Tbl_Type,
7158 p_Header_price_Att_tbl in Oe_Oe_Pricing_Availability.PA_H_PAtt_Tbl_Type,
7159 p_Header_Adj_Att_tbl in Oe_Oe_Pricing_Availability.PA_H_Adj_Att_Tbl_Type,
7160 p_Header_Adj_Assoc_tbl in Oe_Oe_Pricing_Availability.PA_H_Adj_AsTbl_Type,
7161 p_Line_price_Att_tbl in Oe_Oe_Pricing_Availability.PA_Line_PAtt_Tbl_Type,
7162 p_Line_Adj_Att_tbl in Oe_Oe_Pricing_Availability.PA_LAdj_Att_Tbl_Type,
7163 p_Line_Adj_Assoc_tbl in Oe_Oe_Pricing_Availability.PA_L_Adj_AssTbl_Type,
7164 x_header_rec out NOCOPY /* file.sql.39 change */ OE_order_pub.Header_Rec_Type,
7165 x_line_tbl out NOCOPY /* file.sql.39 change */ OE_Order_Pub.Line_Tbl_Type,
7166 x_Header_Adj_tbl out NOCOPY /* file.sql.39 change */ Oe_Order_Pub.Header_Adj_Tbl_Type,
7167 x_Line_Adj_tbl out NOCOPY /* file.sql.39 change */ Oe_Order_Pub.Line_Adj_Tbl_Type,
7168 x_Header_price_Att_tbl out NOCOPY /* file.sql.39 change */ Oe_Order_Pub.Header_Price_Att_Tbl_Type,
7169 x_Header_Adj_Att_tbl out NOCOPY /* file.sql.39 change */ Oe_Order_Pub.Header_Adj_Att_Tbl_Type,
7170 x_Header_Adj_Assoc_tbl out NOCOPY /* file.sql.39 change */ Oe_Order_Pub.Header_Adj_Assoc_Tbl_Type,
7171 x_Line_price_Att_tbl out NOCOPY /* file.sql.39 change */ Oe_Order_Pub.Line_Price_Att_Tbl_Type,
7172 x_Line_Adj_Att_tbl out NOCOPY /* file.sql.39 change */ Oe_Order_Pub.Line_Adj_Att_Tbl_Type,
7173 x_Line_Adj_Assoc_tbl out NOCOPY /* file.sql.39 change */ Oe_Order_Pub.Line_Adj_Assoc_Tbl_Type)
7174 IS
7175 j Number;
7176 Begin
7177
7178
7179
7180 IF p_header_rec.EXISTS(1) Then
7181 --copy header info
7182 x_header_rec:=OE_Order_PUB.G_MISS_HEADER_REC;
7183
7184 IF p_header_rec(1).sold_to_org_id is not null then
7185 x_header_rec.sold_to_org_id :=p_header_rec(1).sold_to_org_id;
7186 END IF;
7187
7188 IF p_header_rec(1).conversion_type_code is not null then
7189 x_header_rec.conversion_type_code := p_header_rec(1).conversion_type_code;
7190 END IF;
7191
7192 IF p_header_rec(1).conversion_rate is not null then
7193 x_header_rec.conversion_rate := p_header_rec(1).conversion_rate;
7194 END IF;
7195
7196 IF p_header_rec(1).ship_to_org_id is not null then
7197 x_header_rec.ship_to_org_id := p_header_rec(1).ship_to_org_id;
7198 END IF;
7199
7200 IF p_header_rec(1).invoice_to_org_id is not null then
7201 x_header_rec.invoice_to_org_id := p_header_rec(1).invoice_to_org_id;
7202 END IF;
7203
7204 IF p_header_rec(1).demand_class_code is not null then
7205 x_header_rec.demand_class_code :=p_header_rec(1).demand_class_code;
7206 END IF;
7207
7208 x_header_rec.ordered_date := sysdate;
7209
7210 IF p_header_rec(1).order_type_id is not null then
7211 x_header_rec.order_type_id := p_header_rec(1).order_type_id;
7212 END IF;
7213
7214 IF p_header_rec(1).pricing_date is not null then
7215 x_header_rec.pricing_date := p_header_rec(1).pricing_date;
7216 END IF;
7217
7218 IF p_header_rec(1).ship_from_org_id is not null then
7219 x_header_rec.ship_from_org_id := p_header_rec(1).ship_from_org_id;
7220 END IF;
7221 IF p_header_rec(1).request_date is not null then
7222 x_header_rec.request_date :=p_header_rec(1).request_date;
7223 END IF;
7224
7225 IF p_header_rec(1).transactional_curr_code is not null then
7226 x_header_rec.transactional_curr_code := p_header_rec(1).transactional_curr_code;
7227 END IF;
7228 IF p_header_rec(1).order_number is not null then
7229 x_header_rec.order_number := p_header_rec(1).order_number;
7230 END IF;
7231
7232 oe_debug_pub.add('=====After copying Header==================================='||
7233 ' Customer id = '||x_header_rec.sold_to_org_id||
7234 ' Currency ='||x_header_rec.transactional_curr_code||
7235 ' order_type_id ='||x_header_rec.order_type_id||
7236 ' agreement_id ='||x_header_rec.agreement_id||
7237 ' price_list_id ='||x_header_rec.price_list_id||
7238 ' ship_to_org_id ='||x_header_rec.ship_to_org_id||
7239 ' invoice_to_org_id ='||x_header_rec.invoice_to_org_id||
7240 ' Conversion_type_code ='||x_header_rec.Conversion_type_code||
7241 ' Conversion_rate ='||x_header_rec.Conversion_rate||
7242 ' Order_Number ='||x_header_rec.order_number||
7243 'Header id='||x_header_rec.header_id
7244 );
7245 End if;
7246
7247 IF p_Header_Adj_tbl.count > 0 Then
7248 -- Copy header adjustments
7249 j:=0;
7250 for i in p_Header_Adj_tbl.first..p_Header_Adj_tbl.last
7251 Loop
7252 If p_Header_Adj_tbl.Exists(i) Then
7253 j:=j+1;
7254 x_header_adj_tbl(j):= Oe_Order_Pub.G_Miss_Header_Adj_rec;
7255
7256 if p_header_adj_tbl(i).list_header_id is not null then
7257 x_header_adj_tbl(j).list_header_id:= p_header_adj_tbl(i).list_header_id;
7258 end if;
7259 if p_header_adj_tbl(i).list_line_id is not null then
7260 x_header_adj_tbl(j).list_line_id:= p_header_adj_tbl(i).list_line_id;
7261 end if;
7262 if p_header_adj_tbl(i).list_line_type_code is not null then
7263 x_header_adj_tbl(j).list_line_type_code:= p_header_adj_tbl(i).list_line_type_code;
7264 end if;
7265 if p_header_adj_tbl(i).updated_flag is not null then
7266 x_header_adj_tbl(j).updated_flag:= p_header_adj_tbl(i).updated_flag;
7267 end if;
7268
7269 if p_header_adj_tbl(i).applied_flag is not null then
7270 x_header_adj_tbl(j).applied_flag:= p_header_adj_tbl(i).applied_flag;
7271 end if;
7272
7273 if p_header_adj_tbl(i).operand is not null then
7274 x_header_adj_tbl(j).operand := p_header_adj_tbl(i).operand;
7275 end if;
7276
7277 if p_header_adj_tbl(i).arithmetic_operator is not null then
7278 x_header_adj_tbl(j).arithmetic_operator := p_header_adj_tbl(i).arithmetic_operator;
7279 end if;
7280 if p_header_adj_tbl(i).pricing_phase_id is not null then
7281 x_header_adj_tbl(j).pricing_phase_id := p_header_adj_tbl(i).pricing_phase_id;
7282 end if;
7283
7284 if p_header_adj_tbl(i).modifier_level_code is not null then
7285 x_header_adj_tbl(j).modifier_level_code := p_header_adj_tbl(i).modifier_level_code;
7286 end if;
7287 if p_header_adj_tbl(i).price_break_type_code is not null then
7288 x_header_adj_tbl(j).price_break_type_code := p_header_adj_tbl(i).price_break_type_code;
7289 end if;
7290
7291 End If;
7292 End Loop;
7293 End if;
7294
7295
7296
7297 IF p_Header_price_Att_tbl.count > 0 Then
7298 -- Copy header price attribute table
7299 j:=0;
7300 for i in p_header_price_att_tbl.first..p_header_price_att_tbl.last
7301 Loop
7302 if p_header_price_att_tbl.Exists(i) then
7303 j:=j+1;
7304 x_header_price_att_tbl(j):=OE_ORDER_PUB.G_MISS_HEADER_PRICE_ATT_REC;
7305
7306 if p_header_price_att_tbl(i).flex_title is not null then
7307 x_header_price_att_tbl(j).flex_title := p_header_price_att_tbl(i).flex_title;
7308 end if;
7309 if p_header_price_att_tbl(i).pricing_context is not null then
7310 x_header_price_att_tbl(j).pricing_context := p_header_price_att_tbl(i).pricing_context;
7311 end if;
7312 if p_header_price_att_tbl(i).pricing_attribute1 is not null then
7313 x_header_price_att_tbl(j).pricing_attribute1 := p_header_price_att_tbl(i).pricing_attribute1;
7314 end if;
7315 if p_header_price_att_tbl(i).pricing_attribute2 is not null then
7316 x_header_price_att_tbl(j).pricing_attribute2 := p_header_price_att_tbl(i).pricing_attribute2;
7317 end if;
7318 if p_header_price_att_tbl(i).pricing_attribute3 is not null then
7319 x_header_price_att_tbl(j).pricing_attribute3 := p_header_price_att_tbl(i).pricing_attribute3;
7320 end if;
7321
7322 end if;
7323 End Loop;
7324 End if;
7325
7326
7327 IF p_Header_Adj_Att_tbl.count > 0 Then
7328 -- Copy header adjustments attribute
7329 j:=0;
7330 For i in p_Header_Adj_Att_tbl.first..p_Header_Adj_Att_tbl.last
7331 Loop
7332 If p_Header_Adj_Att_tbl.Exists(i) Then
7333 j:=j+1;
7334 x_Header_Adj_Att_tbl(j):=OE_ORDER_PUB.G_MISS_HEADER_ADJ_ATT_REC;
7335
7336 End if;
7337 End Loop;
7338 End if;
7339
7340
7341 IF p_Header_Adj_Assoc_tbl.count > 0 Then
7342 -- Copy header adjustments associations
7343 j:=0;
7344 For i in p_Header_Adj_Assoc_tbl.first..p_Header_Adj_Assoc_tbl.last
7345 Loop
7346 If p_Header_Adj_Assoc_tbl.Exists(i) Then
7347 j:=j+1;
7348 x_Header_Adj_Assoc_tbl(j):=OE_ORDER_PUB.G_MISS_HEADER_ADJ_ASSOC_REC;
7349
7350 End if;
7351 End loop;
7352 End if;
7353
7354
7355 IF p_line_Tbl.count > 0 Then
7356 -- Copy line infor
7357 j:=0;
7358 For i in p_line_Tbl.first..p_line_Tbl.last
7359 Loop
7360 j:=j+1;
7361 if p_line_Tbl.Exists(i) Then
7362 x_line_Tbl(j):=OE_ORDER_PUB.G_MISS_LINE_REC;
7363
7364 if p_line_Tbl(i).agreement_id is not null then
7365 x_line_Tbl(j).agreement_id := p_line_Tbl(i).agreement_id;
7366 end if;
7367
7368 if p_line_Tbl(i).created_by is not null then
7369 x_line_Tbl(j).created_by := p_line_Tbl(i).created_by;
7370 end if;
7371 if p_line_Tbl(i).creation_date is not null then
7372 x_line_Tbl(j).creation_date := p_line_Tbl(i).creation_date;
7373 end if;
7374
7375 if p_line_Tbl(i).deliver_to_org_id is not null then
7376 x_line_Tbl(j).deliver_to_org_id := p_line_Tbl(i).deliver_to_org_id;
7377 end if;
7378
7379 if p_line_Tbl(i).demand_class_code is not null then
7380 x_line_Tbl(j).demand_class_code := p_line_Tbl(i).demand_class_code;
7381 end if;
7382
7383 if p_line_Tbl(i).inventory_item_id is not null then
7384 x_line_Tbl(j).inventory_item_id := p_line_Tbl(i).inventory_item_id;
7385 end if;
7386
7387 if p_line_Tbl(i).invoice_to_org_id is not null then
7388 x_line_Tbl(j).invoice_to_org_id := p_line_Tbl(i).invoice_to_org_id;
7389 end if;
7390
7391 if p_line_Tbl(i).ordered_item is not null then
7392 x_line_Tbl(j).ordered_item := p_line_Tbl(i).ordered_item;
7393 end if;
7394
7395 if p_line_Tbl(i).item_type_code is not null then
7396 x_line_Tbl(j).item_type_code := p_line_Tbl(i).item_type_code;
7397 end if;
7398
7399 if p_line_Tbl(i).line_type_id is not null then
7400 x_line_Tbl(j).line_type_id := p_line_Tbl(i).line_type_id;
7401 end if;
7402
7403 if p_line_Tbl(i).ordered_quantity is not null then
7404 x_line_Tbl(j).ordered_quantity := p_line_Tbl(i).ordered_quantity;
7405 end if;
7406
7407 if p_line_Tbl(i).order_quantity_uom is not null then
7408 x_line_Tbl(j).order_quantity_uom := p_line_Tbl(i).order_quantity_uom;
7409 end if;
7410
7411 if p_line_Tbl(i).price_list_id is not null then
7412 x_line_Tbl(j).price_list_id := p_line_Tbl(i).price_list_id;
7413 end if;
7414
7415 if p_line_Tbl(i).pricing_date is not null then
7416 x_line_Tbl(j).pricing_date := p_line_Tbl(i).pricing_date;
7417 end if;
7418
7419 if p_line_Tbl(i).request_date is not null then
7420 x_line_Tbl(j).request_date := p_line_Tbl(i).request_date;
7421 end if;
7422
7423 if p_line_Tbl(i).ship_from_org_id is not null then
7424 x_line_Tbl(j).ship_from_org_id := p_line_Tbl(i).ship_from_org_id;
7425 end if;
7426
7427 if p_line_Tbl(i).ship_to_org_id is not null then
7428 x_line_Tbl(j).ship_to_org_id := p_line_Tbl(i).ship_to_org_id;
7429 end if;
7430
7431 if p_line_Tbl(i).ordered_item_id is not null then
7432 x_line_Tbl(j).ordered_item_id := p_line_Tbl(i).ordered_item_id;
7433 end if;
7434 if p_line_Tbl(i).item_identifier_type is not null then
7435 x_line_Tbl(j).item_identifier_type := p_line_Tbl(i).item_identifier_type;
7436 end if;
7437
7438 if p_line_Tbl(i).Original_Inventory_Item_Id is not null then
7439 x_line_Tbl(j).Original_Inventory_Item_Id := p_line_Tbl(i).Original_Inventory_Item_Id;
7440 end if;
7441 if p_line_Tbl(i).Original_item_identifier_Type is not null then
7442 x_line_Tbl(j).Original_item_identifier_Type := p_line_Tbl(i).Original_item_identifier_Type;
7443 end if;
7444 if p_line_Tbl(i).Original_ordered_item_id is not null then
7445 x_line_Tbl(j).Original_ordered_item_id := p_line_Tbl(i).Original_ordered_item_id;
7446 end if;
7447 if p_line_Tbl(i).Original_ordered_item is not null then
7448 x_line_Tbl(j).Original_ordered_item := p_line_Tbl(i).Original_ordered_item;
7449 end if;
7450 if p_line_Tbl(i).Item_substitution_type_code is not null then
7451 x_line_Tbl(j).Item_substitution_type_code := p_line_Tbl(i).Item_substitution_type_code;
7452 end if;
7453
7454 if p_line_Tbl(i).item_relationship_type is not null then
7455 x_line_Tbl(j).item_relationship_type := p_line_Tbl(i).item_relationship_type;
7456 end if;
7457
7458 End if;
7459 End Loop;
7460 End if;
7461 oe_debug_pub.add('line_table count in copy'||x_line_tbl.count);
7462 oe_Debug_pub.add('Adjsutment table count'||p_line_adj_tbl.count);
7463 IF p_line_Adj_tbl.count > 0 Then
7464 -- Copy line adjustment table infor
7465 j:=0;
7466 For i in p_line_Adj_tbl.first..p_line_Adj_tbl.last
7467 Loop
7468 If p_line_Adj_tbl.Exists(i) then
7469 j:=j+1;
7470 x_line_Adj_tbl(j):=OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
7471
7472 if p_line_Adj_tbl(i).line_index is not null then
7473
7474 --commented for bug 3566972
7475 /*
7476 x_line_Adj_tbl(j).line_index :=1;
7477 --p_line_Adj_tbl(i).line_index;*/
7478
7479 x_line_Adj_tbl(j).line_index :=p_line_Adj_tbl(i).line_index; -- added for bug 3566972
7480
7481 end if;
7482
7483 if p_line_Adj_tbl(i).list_header_id is not null then
7484 x_line_Adj_tbl(j).list_header_id := p_line_Adj_tbl(i).list_header_id;
7485 end if;
7486 if p_line_Adj_tbl(i).list_line_id is not null then
7487 x_line_Adj_tbl(j).list_line_id :=p_line_Adj_tbl(i).list_line_id;
7488 end if;
7489 if p_line_Adj_tbl(i).list_line_type_code is not null then
7490 x_line_Adj_tbl(j).list_line_type_code :=p_line_Adj_tbl(i).list_line_type_code;
7491 end if;
7492
7493 if p_line_Adj_tbl(i).updated_flag is not null then
7494 x_line_Adj_tbl(j).updated_flag :=p_line_Adj_tbl(i).updated_flag;
7495 end if;
7496
7497 if p_line_Adj_tbl(i).applied_flag is not null then
7498 x_line_Adj_tbl(j).applied_flag:= p_line_Adj_tbl(i).applied_flag;
7499 end if;
7500
7501 if p_line_Adj_tbl(i).operand is not null then
7502 x_line_Adj_tbl(j).operand :=p_line_Adj_tbl(i).operand;
7503 end if;
7504
7505 if p_line_Adj_tbl(i).arithmetic_operator is not null then
7506 x_line_Adj_tbl(j).arithmetic_operator := p_line_Adj_tbl(i).arithmetic_operator;
7507 end if;
7508
7509 if p_line_Adj_tbl(i).pricing_phase_id is not null then
7510 x_line_Adj_tbl(j).pricing_phase_id := p_line_Adj_tbl(i).pricing_phase_id;
7511 end if;
7512
7513 if p_line_Adj_tbl(i).modifier_level_code is not null then
7514 x_line_Adj_tbl(j).modifier_level_code := p_line_Adj_tbl(i).modifier_level_code;
7515 end if;
7516 if p_line_Adj_tbl(i).price_break_type_code is not null then
7517 x_line_Adj_tbl(j).price_break_type_code := p_line_Adj_tbl(i).price_break_type_code;
7518 end if;
7519
7520 oe_Debug_pub.add('line index'||x_line_Adj_tbl(j).line_index||'list header id'||x_line_Adj_tbl(j).list_header_id
7521 ||'list line id'||x_line_Adj_tbl(j).list_line_id ||'list line type code'||x_line_Adj_tbl(j).list_line_type_code
7522 ||'applied flag'||x_line_Adj_tbl(j).applied_flag||'updated_flag'||x_line_Adj_tbl(j).updated_flag
7523 );
7524
7525 End if;
7526 End Loop;
7527 End if;
7528
7529
7530 IF p_line_price_Att_tbl.count > 0 Then
7531 -- Copy line pricing attribute table infor
7532 j:=0;
7533 For i in p_line_price_Att_tbl.first..p_line_price_Att_tbl.last
7534 Loop
7535 if p_line_price_Att_tbl.Exists(i) then
7536 j:=j+1;
7537 x_line_price_Att_tbl(j):= OE_ORDER_PUB.G_MISS_Line_Price_Att_Rec;
7538
7539 if p_line_price_Att_tbl(i).line_index is not null then
7540 x_line_price_Att_tbl(j).line_index := p_line_price_Att_tbl(i).line_index;
7541 end if;
7542
7543
7544 if p_line_price_Att_tbl(i).flex_title is not null then
7545 x_line_price_Att_tbl(j).flex_title := p_line_price_Att_tbl(i).flex_title;
7546 end if;
7547 if p_line_price_Att_tbl(i).pricing_context is not null then
7548 x_line_price_Att_tbl(j).pricing_context := p_line_price_Att_tbl(i).pricing_context;
7549 end if;
7550 if p_line_price_Att_tbl(i).pricing_attribute1 is not null then
7551 x_line_price_Att_tbl(j).pricing_attribute1 := p_line_price_Att_tbl(i).pricing_attribute1;
7552 end if;
7553 if p_line_price_Att_tbl(i).pricing_attribute2 is not null then
7554 x_line_price_Att_tbl(j).pricing_attribute2 := p_line_price_Att_tbl(i).pricing_attribute2;
7555 end if;
7556 if p_line_price_Att_tbl(i).pricing_attribute3 is not null then
7557 x_line_price_Att_tbl(j).pricing_attribute3 := p_line_price_Att_tbl(i).pricing_attribute3;
7558 end if;
7559
7560
7561 End if;
7562 End Loop;
7563 End if;
7564
7565
7566 IF p_line_Adj_Att_tbl.count > 0 Then
7567 -- Copy line adjustment attribute table
7568 j:=0;
7569 For i in p_line_Adj_Att_tbl.first..p_line_Adj_Att_tbl.last
7570 Loop
7571 if p_line_Adj_Att_tbl.Exists(i) Then
7572 j:=j+1;
7573 x_line_Adj_att_tbl(j):= OE_ORDER_PUB.G_MISS_Line_Adj_Att_Rec;
7574 if p_line_Adj_att_tbl(i).Adj_index is not null then
7575 x_line_Adj_att_tbl(j).Adj_index := p_line_Adj_att_tbl(i).Adj_index;
7576 end if;
7577 if p_line_Adj_att_tbl(i).flex_title is not null then
7578 x_line_Adj_att_tbl(j).flex_title := p_line_Adj_att_tbl(i).flex_title;
7579 end if;
7580 if p_line_Adj_att_tbl(i).pricing_context is not null then
7581 x_line_Adj_att_tbl(j).pricing_context := p_line_Adj_att_tbl(i).pricing_context;
7582 end if;
7583 if p_line_Adj_att_tbl(i).pricing_attribute is not null then
7584 x_line_Adj_att_tbl(j).pricing_attribute := p_line_Adj_att_tbl(i).pricing_attribute;
7585 end if;
7586
7587 if p_line_Adj_att_tbl(i).pricing_attr_value_from is not null then
7588 x_line_Adj_att_tbl(j).pricing_attr_value_from := p_line_Adj_att_tbl(i).pricing_attr_value_from;
7589 end if;
7590 if p_line_Adj_att_tbl(i).pricing_attr_value_to is not null then
7591 x_line_Adj_att_tbl(j).pricing_attr_value_to := p_line_Adj_att_tbl(i).pricing_attr_value_to;
7592 end if;
7593
7594 End if;
7595 End Loop;
7596 End if;
7597
7598 IF p_line_Adj_Assoc_tbl.count > 0 Then
7599 -- Copy line adjustment association table infor
7600 j:=0;
7601 For i in p_line_Adj_Assoc_tbl.first..p_line_Adj_Assoc_tbl.last
7602 Loop
7603 if p_line_Adj_Assoc_tbl.Exists(i) Then
7604 j:=j+1;
7605
7606 if p_line_Adj_Assoc_tbl(i).Line_index is not null then
7607 x_line_Adj_Assoc_tbl(j).Line_index := p_line_Adj_Assoc_tbl(i).Line_index;
7608 end if;
7609
7610 if p_line_Adj_Assoc_tbl(i).Adj_index is not null then
7611 x_line_Adj_Assoc_tbl(j).Adj_index := p_line_Adj_Assoc_tbl(i).Adj_index;
7612 end if;
7613
7614 --x_line_Adj_Assoc_tbl(j).rltd_Price_Adj_Id := p_line_Adj_Assoc_tbl(i).rltd_Price_Adj_Id;
7615 if p_line_Adj_Assoc_tbl(i).Rltd_Adj_Index is not null then
7616 x_line_Adj_Assoc_tbl(j).Rltd_Adj_Index := p_line_Adj_Assoc_tbl(i).Rltd_Adj_Index;
7617 end if;
7618
7619 End if;
7620 End Loop;
7621 End if;
7622
7623
7624 End CopyINTO_PO_RecStruc;
7625
7626
7627
7628 PROCEDURE Create_Order(
7629 in_order in varchar2,
7630 in_header_rec oe_oe_pricing_availability.PA_Header_Tbl_Type,
7631 in_line_tbl Oe_Oe_Pricing_Availability.PA_Line_Tbl_Type,
7632 in_Header_Adj_tbl Oe_Oe_Pricing_Availability.PA_H_Adj_Tbl_Type,
7633 in_Line_Adj_tbl Oe_Oe_Pricing_Availability.PA_LAdj_Tbl_Type,
7634 in_Header_price_Att_tbl Oe_Oe_Pricing_Availability.PA_H_PAtt_Tbl_Type,
7635 in_Header_Adj_Att_tbl Oe_Oe_Pricing_Availability.PA_H_Adj_Att_Tbl_Type,
7636 in_Header_Adj_Assoc_tbl Oe_Oe_Pricing_Availability.PA_H_Adj_AsTbl_Type,
7637 in_Line_price_Att_tbl Oe_Oe_Pricing_Availability.PA_Line_PAtt_Tbl_Type,
7638 in_Line_Adj_Att_tbl Oe_Oe_Pricing_Availability.PA_LAdj_Att_Tbl_Type,
7639 in_Line_Adj_Assoc_tbl Oe_Oe_Pricing_Availability.PA_L_Adj_AssTbl_Type,
7640 out_order_number out NOCOPY varchar2,
7641 out_header_id out NOCOPY number,
7642 out_order_total out NOCOPY number,
7643 out_order_amount out nocopy number,
7644 out_order_charges out nocopy number,
7645 out_order_discount out nocopy number,
7646 out_order_tax out nocopy number,
7647 out_item out nocopy varchar2,
7648 out_currency out nocopy varchar2,
7649 x_msg_count OUT NOCOPY NUMBER,
7650 x_msg_data OUT NOCOPY VARCHAR2,
7651 x_return_status OUT NOCOPY VARCHAR2
7652 ) IS
7653
7654 l_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
7655 l_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
7656 l_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
7657 l_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
7658 l_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
7659 l_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
7660 l_line_rec OE_Order_PUB.Line_Rec_Type;
7661 l_line_adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
7662 l_line_tbl OE_Order_PUB.Line_Tbl_Type;
7663 l_line_adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
7664 l_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
7665 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
7666 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
7667 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
7668 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
7669 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
7670 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
7671 l_action_request_tbl OE_Order_PUB.request_tbl_type;
7672 l_x_action_request_tbl OE_Order_PUB.request_tbl_type;
7673 l_x_lot_serial_tbl OE_Order_PUB.lot_serial_tbl_type;
7674 l_file_val Varchar2(30);
7675 x_msg_index number;
7676 v Varchar2(30);
7677 l_date date;
7678 l_booked_flag varchar2(1);
7679 l_shipping_interfaced_flag varchar2(1);
7680 l_header_rec OE_ORDER_PUB.HEADER_REC_TYPE;
7681 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
7682
7683 l_subtotal number;
7684 l_discount number;
7685 l_charges number;
7686 l_tax number;
7687 l_transaction_phase_code varchar2(30);
7688 l_x_Header_Payment_tbl OE_Order_PUB.Header_Payment_Tbl_Type;
7689 l_x_Line_Payment_tbl OE_Order_PUB.Line_Payment_Tbl_Type;
7690 p_old_line_rec OE_ORDER_PUB.Line_Rec_Type;
7691 p_x_line_rec OE_ORDER_PUB.Line_Rec_Type;
7692 BEGIN
7693
7694 IF l_debug_level > 0 THEN
7695 oe_debug_pub.add('==========================================='||
7696 ' Enter create_order database '||
7697 ' in_order = '||in_order||
7698 ' Customer id = '||in_header_rec(1).sold_to_org_id||
7699 ' Currency ='||in_header_rec(1).transactional_curr_code||
7700 ' order_type_id ='||in_header_rec(1).order_type_id||
7701 ' agreement_id ='||in_header_rec(1).agreement_id||
7702 ' price_list_id ='||in_header_rec(1).price_list_id||
7703 ' ship_to_org_id ='||in_header_rec(1).ship_to_org_id||
7704 ' invoice_to_org_id ='||in_header_rec(1).invoice_to_org_id||
7705 ' Conversion_type_code ='||in_header_rec(1).Conversion_type_code||
7706 ' Conversion_rate ='||in_header_rec(1).Conversion_rate||
7707 ' Order_Number ='||in_header_rec(1).order_number||
7708 ' line_tbl_count='||in_line_tbl.COUNT||
7709 'Line_Adj_tbl_count'||in_line_Adj_Tbl.count ||
7710 'Line_Adj_Attr_tbl'||in_line_adj_att_tbl.count
7711 );
7712 END IF;
7713
7714 IF in_order = 'Y' then
7715 l_transaction_phase_code := 'F';
7716 ELSE
7717 l_transaction_phase_code := 'N';
7718 END IF;
7719
7720
7721 -- Copy from the P_A record structure to Process Order structure is done....
7722
7723
7724 CopyINTO_PO_RecStruc
7725 ( p_header_rec=>in_header_rec,
7726 p_line_tbl=>in_line_tbl,
7727 p_Header_Adj_tbl=>in_header_adj_tbl,
7728 p_Line_Adj_tbl=> in_line_adj_tbl,
7729 p_Header_price_Att_tbl=> in_header_price_att_tbl,
7730 p_Header_Adj_Att_tbl => in_header_adj_att_tbl,
7731 p_Header_Adj_Assoc_tbl => in_header_adj_assoc_tbl,
7732 p_Line_price_Att_tbl => in_line_price_att_tbl,
7733 p_Line_Adj_Att_tbl => in_line_adj_att_tbl,
7734 p_Line_Adj_Assoc_tbl => in_line_adj_assoc_tbl,
7735 x_header_rec =>l_header_rec,
7736 x_line_tbl => l_line_tbl,
7737 x_Header_Adj_tbl=>l_Header_adj_tbl,
7738 x_Line_Adj_tbl => l_line_adj_tbl,
7739 x_Header_price_Att_tbl=> l_header_price_att_tbl,
7740 x_Header_Adj_Att_tbl => l_header_adj_att_tbl,
7741 x_Header_Adj_Assoc_tbl => l_header_adj_assoc_tbl,
7742 x_Line_price_Att_tbl => l_line_price_att_tbl,
7743 x_Line_Adj_Att_tbl => l_line_adj_att_tbl,
7744 x_Line_Adj_Assoc_tbl => l_line_adj_assoc_tbl);
7745
7746
7747 IF l_debug_level > 0 THEN
7748 IF l_line_tbl.COUNT > 0 then
7749 FOR i in l_line_tbl.FIRST..l_line_tbl.LAST
7750 LOOP
7751 oe_debug_pub.add('=========================================='||
7752 ' Line '||i||
7753 ' item_id='||l_line_Tbl(i).inventory_item_id||
7754 ' line_type_id='||l_line_Tbl(i).line_type_id||
7755 ' agreement_id='||l_line_Tbl(i).agreement_id||
7756 ' ship_to_org_id='||l_line_Tbl(i).ship_to_org_id||
7757 ' invoice_to_org_id='||l_line_Tbl(i).invoice_to_org_id||
7758 ' item_type_code='||l_line_Tbl(i).item_type_code||
7759 ' ordered_quantity='||l_line_Tbl(i).ordered_quantity||
7760 ' quantity_uom='||l_line_Tbl(i).order_quantity_uom||
7761 ' ship_from_org_id='||l_line_Tbl(i).ship_from_org_id||
7762 ' ordered_item_id='||l_line_Tbl(i).ordered_item_id||
7763 ' item_id_type='||l_line_Tbl(i).item_identifier_type||
7764 ' orig_inv_id='||l_line_Tbl(i).original_inventory_item_id||
7765 ' orig_id_type='||l_line_Tbl(i).original_item_identifier_type||
7766 ' orig_ordered_id='||l_line_Tbl(i).original_ordered_item_id||
7767 ' Price_list='||l_line_Tbl(i).price_list_id||
7768 ' line_category_code='||l_line_Tbl(i).line_category_code||
7769 ' transaction_phase_code='||l_transaction_phase_code
7770 );
7771 END LOOP;
7772 END IF;
7773 END IF;
7774 -- l_header_rec := in_header_rec; -- should copy header record values
7775
7776 l_header_rec.operation := OE_Globals.G_OPR_CREATE;
7777 --l_header_rec.order_number := null;
7778 l_header_rec.order_source_id := g_order_source_id;
7779 l_header_rec.transaction_phase_code := l_transaction_phase_code;
7780
7781
7782 -- l_line_tbl := in_line_tbl; -- should copy line table
7783 oe_debug_pub.add(' in create order line table count'||l_line_tbl.count);
7784 FOR i in l_line_tbl.FIRST..l_line_tbl.LAST
7785 LOOP
7786 l_line_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7787 l_line_tbl(i).calculate_price_flag := 'Y';
7788 l_line_tbl(i).order_source_id := g_order_source_id;
7789 l_line_tbl(i).transaction_phase_code := l_transaction_phase_code;
7790 END LOOP;
7791
7792 --IF in_line_price_att_tbl.COUNT > 0 then
7793 IF l_line_price_att_tbl.COUNT > 0 then
7794 -- l_Line_price_Att_tbl := in_line_price_att_tbl; -- copy line pricing attributes
7795 FOR i in l_line_price_att_tbl.FIRST..l_line_price_att_tbl.LAST
7796 LOOP
7797 l_line_price_att_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7798 END LOOP;
7799
7800 IF l_debug_level > 0 THEN
7801 IF l_line_price_att_tbl.COUNT > 0 then
7802 FOR i in l_line_price_att_tbl.first..l_line_price_att_tbl.last
7803 LOOP
7804 oe_debug_pub.add('BEFORE Process Order line_price_att_tbl rec='||i||
7805 ' line_index='||l_line_price_att_tbl(i).line_index||
7806 ' flex_title='||l_line_price_att_tbl(i).flex_title||
7807 ' pricing_context='||l_line_price_att_tbl(i).pricing_context||
7808 ' attr1='||l_line_price_att_tbl(i).pricing_attribute1||
7809 ' attr2='||l_line_price_att_tbl(i).pricing_attribute2||
7810 ' attr3='||l_line_price_att_tbl(i).pricing_attribute3
7811 );
7812 END LOOP;
7813 END IF;
7814 END IF; -- if debug level
7815 END IF; -- if price_atts are passed
7816
7817
7818
7819
7820 -- IF in_header_price_att_tbl.COUNT > 0 then
7821 IF l_header_price_att_tbl.COUNT > 0 then
7822 -- l_Header_price_Att_tbl := in_header_price_att_tbl; -- copy header pricing attributes
7823 FOR i in l_header_price_att_tbl.FIRST..l_header_price_att_tbl.LAST
7824 LOOP
7825 l_header_price_att_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7826 END LOOP;
7827
7828 IF l_debug_level > 0 THEN
7829 IF l_header_price_att_tbl.COUNT > 0 then
7830 FOR i in l_header_price_att_tbl.first..l_header_price_att_tbl.last
7831 LOOP
7832 oe_debug_pub.add('BEFORE Process Order Hdr_price_att_tbl rec='||i||
7833 ' flex_title='||l_header_price_att_tbl(i).flex_title||
7834 ' pricing_context='||l_header_price_att_tbl(i).pricing_context||
7835 ' attr1='||l_header_price_att_tbl(i).pricing_attribute1||
7836 ' attr2='||l_header_price_att_tbl(i).pricing_attribute2||
7837 ' attr3='||l_header_price_att_tbl(i).pricing_attribute3
7838 );
7839 END LOOP;
7840 END IF;
7841 END IF; -- if debug level
7842 END IF; -- if header price_atts are passed
7843
7844 oe_Debug_pub.add('Line adjustment count'||l_line_Adj_tbl.count);
7845 --IF in_line_adj_tbl.COUNT > 0 then
7846 IF l_line_adj_tbl.COUNT > 0 then
7847 -- l_Line_adj_tbl:= in_line_adj_tbl; -- copy line adj table
7848 FOR i in l_line_adj_tbl.FIRST..l_line_adj_tbl.LAST
7849 LOOP
7850 l_line_adj_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7851 END LOOP;
7852
7853 IF l_debug_level > 0 THEN
7854 IF l_line_adj_tbl.COUNT > 0 then
7855 FOR i in l_line_adj_tbl.first..l_line_adj_tbl.last
7856 LOOP
7857 oe_debug_pub.add('BEFORE Process Order line_adj_tbl rec='||i||
7858 ' line_index='||l_line_adj_tbl(i).line_index||
7859 ' List_line_id='||l_line_adj_tbl(i).List_line_id||
7860 ' List Header id='||l_line_adj_tbl(i).list_header_id ||
7861 ' Pricing Phase id='||l_line_adj_tbl(i).pricing_phase_id ||
7862 ' Modifier Level code='||l_line_adj_tbl(i).Modifier_level_code ||
7863 ' Operand='||l_line_adj_tbl(i).operand ||
7864 ' List line type code='||l_line_adj_tbl(i).list_line_type_code ||
7865 'Updated Flag=' ||l_line_adj_tbl(i).updated_flag ||
7866 'Applied Flag=' ||l_line_adj_tbl(i).applied_flag ||
7867 'Arithmetic Operator ='||l_line_adj_tbl(i).arithmetic_operator ||
7868 'Price Break Type code =' ||l_line_adj_tbl(i).price_break_type_code
7869 );
7870 END LOOP;
7871 END IF;
7872 END IF; -- if debug level
7873 END IF; -- if line adj being passed.
7874
7875
7876 --IF in_header_adj_tbl.COUNT > 0 then
7877 IF l_header_adj_tbl.COUNT > 0 then
7878 -- l_header_adj_tbl:= in_header_adj_tbl; -- copy header adjustments
7879 FOR i in l_header_adj_tbl.FIRST..l_header_adj_tbl.LAST
7880 LOOP
7881 l_header_adj_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7882 END LOOP;
7883
7884 IF l_debug_level > 0 THEN
7885 IF l_header_adj_tbl.COUNT > 0 then
7886 FOR i in l_header_adj_tbl.first..l_header_adj_tbl.last
7887 LOOP
7888 oe_debug_pub.add('BEFORE Process Order header_adj_tbl rec='||i||
7889 ' List_line_id='||l_header_adj_tbl(i).List_line_id||
7890 ' List Header id='||l_header_adj_tbl(i).list_header_id ||
7891 ' Pricing Phase id='||l_header_adj_tbl(i).pricing_phase_id ||
7892 ' Modifier Level code='||l_header_adj_tbl(i).Modifier_level_code ||
7893 ' Operand='||l_header_adj_tbl(i).operand ||
7894 ' List line type code='||l_header_adj_tbl(i).list_line_type_code ||
7895 'Updated Flag=' ||l_header_adj_tbl(i).updated_flag ||
7896 'Applied Flag=' ||l_header_adj_tbl(i).applied_flag ||
7897 'Arithmetic Operator ='||l_header_adj_tbl(i).arithmetic_operator ||
7898 'Price Break Type code =' ||l_header_adj_tbl(i).price_break_type_code
7899 );
7900 END LOOP;
7901 END IF;
7902 END IF; -- if debug level
7903 END IF; -- if header adj being passed.
7904
7905 --IF in_line_adj_att_tbl.COUNT > 0 then
7906 IF l_line_adj_att_tbl.COUNT > 0 then
7907 -- l_Line_adj_att_tbl:= in_line_adj_att_tbl; -- copy line_adjustemnts table
7908 FOR i in l_line_adj_att_tbl.FIRST..l_line_adj_att_tbl.LAST
7909 LOOP
7910 l_line_adj_att_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7911 END LOOP;
7912
7913 IF l_debug_level > 0 THEN
7914 IF l_line_adj_att_tbl.COUNT > 0 then
7915 FOR i in l_line_adj_att_tbl.first..l_line_adj_att_tbl.last
7916 LOOP
7917 oe_debug_pub.add('BEFORE Process Order line_adj_att_tbl rec='||i||
7918 ' line_index='||l_line_adj_att_tbl(i).adj_index||
7919 ' pricing context='||l_line_adj_att_tbl(i).pricing_context||
7920 'pricing attribute='||l_line_adj_att_tbl(i).pricing_attribute||
7921 'pricing attribute value from='||l_line_adj_att_tbl(i).pricing_attr_value_from||
7922 'pricing attribute value to=' ||l_line_adj_att_tbl(i).pricing_attr_value_to
7923 );
7924 END LOOP;
7925 END IF;
7926 END IF; -- if debug level
7927 END IF; -- if line adj attr being passed.
7928
7929 --IF in_line_adj_assoc_tbl.COUNT > 0 then
7930 IF l_line_adj_assoc_tbl.COUNT > 0 then
7931 -- l_Line_adj_assoc_tbl:= in_line_adj_assoc_tbl;
7932 FOR i in l_line_adj_assoc_tbl.FIRST..l_line_adj_assoc_tbl.LAST
7933 LOOP
7934 l_line_adj_assoc_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7935 END LOOP;
7936
7937 IF l_debug_level > 0 THEN
7938 IF l_line_adj_assoc_tbl.COUNT > 0 then
7939 FOR i in l_line_adj_assoc_tbl.first..l_line_adj_assoc_tbl.last
7940 LOOP
7941 oe_debug_pub.add('BEFORE Process Order line_adj_att_tbl rec='||i||
7942 ' line_index='||l_line_adj_assoc_tbl(i).line_index||
7943 ' Adjustment index='||l_line_adj_assoc_tbl(i).adj_index||
7944 'Related adjustment index'||l_line_adj_assoc_tbl(i).rltd_adj_index
7945 );
7946 END LOOP;
7947 END IF;
7948 END IF; -- if debug level
7949 END IF; -- if line adj assoc being passed.
7950
7951
7952 --IF in_header_adj_att_tbl.COUNT > 0 then
7953 IF l_header_adj_att_tbl.COUNT > 0 then
7954 -- l_header_adj_att_tbl:= in_header_adj_att_tbl;
7955 FOR i in l_header_adj_att_tbl.FIRST..l_header_adj_att_tbl.LAST
7956 LOOP
7957 l_header_adj_att_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7958 END LOOP;
7959
7960 IF l_debug_level > 0 THEN
7961 IF l_header_adj_att_tbl.COUNT > 0 then
7962 FOR i in l_header_adj_att_tbl.first..l_header_adj_att_tbl.last
7963 LOOP
7964 oe_debug_pub.add('BEFORE Process Order header_adj_att_tbl rec='||i||
7965 ' line_index='||l_header_adj_att_tbl(i).adj_index||
7966 ' pricing context='||l_header_adj_att_tbl(i).pricing_context||
7967 'pricing attribute='||l_header_adj_att_tbl(i).pricing_attribute||
7968 'pricing attribute value from='||l_header_adj_att_tbl(i).pricing_attr_value_from||
7969 'pricing attribute value to=' ||l_header_adj_att_tbl(i).pricing_attr_value_to
7970 );
7971 END LOOP;
7972 END IF;
7973 END IF; -- if debug level
7974 END IF; -- if header adj attr being passed.
7975
7976
7977 --IF in_header_adj_assoc_tbl.COUNT > 0 then
7978 IF l_header_adj_assoc_tbl.COUNT > 0 then
7979 -- l_header_adj_assoc_tbl:= in_header_adj_assoc_tbl;
7980 FOR i in l_header_adj_assoc_tbl.FIRST..l_header_adj_assoc_tbl.LAST
7981 LOOP
7982 l_header_adj_assoc_tbl(i).operation := OE_Globals.G_OPR_CREATE;
7983 END LOOP;
7984
7985 IF l_debug_level > 0 THEN
7986 IF l_header_adj_assoc_tbl.COUNT > 0 then
7987 FOR i in l_header_adj_assoc_tbl.first..l_header_adj_assoc_tbl.last
7988 LOOP
7989 oe_debug_pub.add('BEFORE Process Order header_adj_att_tbl rec='||i||
7990 ' line_index='||l_header_adj_assoc_tbl(i).line_index||
7991 ' Adjustment index='||l_header_adj_assoc_tbl(i).adj_index||
7992 'Related adjustment index'||l_header_adj_assoc_tbl(i).rltd_adj_index
7993 );
7994 END LOOP;
7995 END IF;
7996 END IF; -- if debug level
7997 END IF; -- if header adj assoc being passed.
7998
7999
8000 -- this is not required as it will book the order
8001 --l_action_request_tbl(1).entity_code := OE_GLOBALS.G_ENTITY_HEADER;
8002 --l_action_request_tbl(1).request_type:= OE_GLOBALS.G_BOOK_ORDER;
8003
8004 oe_debug_pub.initialize;
8005 IF l_debug_level > 0 THEN
8006 print_time('Before Calling Process Order'||l_Line_Adj_tbl.count);
8007 END IF;
8008
8009 OE_GLOBALS.g_validate_desc_flex:='Y';
8010 IF OE_ORDER_CACHE.IS_FLEX_ENABLED('OE_HEADER_ATTRIBUTES') = 'Y'
8011 AND OE_GLOBALS.g_validate_desc_flex='Y' THEN
8012
8013 IF NOT OE_VALIDATE.Header_Desc_Flex
8014 (p_context => l_header_rec.context
8015 ,p_attribute1 => l_header_rec.attribute1
8016 ,p_attribute2 => l_header_rec.attribute2
8017 ,p_attribute3 => l_header_rec.attribute3
8018 ,p_attribute4 => l_header_rec.attribute4
8019 ,p_attribute5 => l_header_rec.attribute5
8020 ,p_attribute6 => l_header_rec.attribute6
8021 ,p_attribute7 => l_header_rec.attribute7
8022 ,p_attribute8 => l_header_rec.attribute8
8023 ,p_attribute9 => l_header_rec.attribute9
8024 ,p_attribute10 => l_header_rec.attribute10
8025 ,p_attribute11 => l_header_rec.attribute11
8026 ,p_attribute12 => l_header_rec.attribute12
8027 ,p_attribute13 => l_header_rec.attribute13
8028 ,p_attribute14 => l_header_rec.attribute14
8029 ,p_attribute15 => l_header_rec.attribute15
8030 ,p_attribute16 => l_header_rec.attribute16
8031 ,p_attribute17 => l_header_rec.attribute17
8032 ,p_attribute18 => l_header_rec.attribute18
8033 ,p_attribute19 => l_header_rec.attribute19
8034 ,p_attribute20 => l_header_rec.attribute20)
8035 THEN
8036 OE_GLOBALS.g_validate_desc_flex:='N';
8037 oe_debug_pub.add('Pricing AVa, HEaderAttribue1-NOT VALID ');
8038 END IF;
8039 oe_debug_pub.add('Pricing AVa, HEaderAttribute1 '||l_header_rec.attribute1,1);
8040 END IF;
8041
8042 IF OE_ORDER_CACHE.IS_FLEX_ENABLED('OE_HEADER_GLOBAL_ATTRIBUTE') = 'Y'
8043 AND OE_GLOBALS.g_validate_desc_flex='Y' THEN
8044 IF NOT OE_VALIDATE.G_Header_Desc_Flex
8045 (p_context => l_header_rec.global_attribute_category
8046 ,p_attribute1 => l_header_rec.global_attribute1
8047 ,p_attribute2 => l_header_rec.global_attribute2
8048 ,p_attribute3 => l_header_rec.global_attribute3
8049 ,p_attribute4 => l_header_rec.global_attribute4
8050 ,p_attribute5 => l_header_rec.global_attribute5
8051 ,p_attribute6 => l_header_rec.global_attribute6
8052 ,p_attribute7 => l_header_rec.global_attribute7
8053 ,p_attribute8 => l_header_rec.global_attribute8
8054 ,p_attribute9 => l_header_rec.global_attribute9
8055 ,p_attribute10 => l_header_rec.global_attribute10
8056 ,p_attribute11 => l_header_rec.global_attribute11
8057 ,p_attribute12 => l_header_rec.global_attribute12
8058 ,p_attribute13 => l_header_rec.global_attribute13
8059 ,p_attribute14 => l_header_rec.global_attribute13
8060 ,p_attribute15 => l_header_rec.global_attribute14
8061 ,p_attribute16 => l_header_rec.global_attribute16
8062 ,p_attribute17 => l_header_rec.global_attribute17
8063 ,p_attribute18 => l_header_rec.global_attribute18
8064 ,p_attribute19 => l_header_rec.global_attribute19
8065 ,p_attribute20 => l_header_rec.global_attribute20)
8066 THEN
8067 OE_GLOBALS.g_validate_desc_flex:='N';
8068 END IF;
8069 END IF;
8070
8071 IF Oe_Order_Cache.IS_FLEX_ENABLED('OE_HEADER_TP_ATTRIBUTES') = 'Y'
8072 AND OE_GLOBALS.g_validate_desc_flex='Y' THEN
8073 IF NOT OE_VALIDATE.TP_Header_Desc_Flex
8074 (p_context => l_header_rec.tp_context
8075 ,p_attribute1 => l_header_rec.tp_attribute1
8076 ,p_attribute2 => l_header_rec.tp_attribute2
8077 ,p_attribute3 => l_header_rec.tp_attribute3
8078 ,p_attribute4 => l_header_rec.tp_attribute4
8079 ,p_attribute5 => l_header_rec.tp_attribute5
8080 ,p_attribute6 => l_header_rec.tp_attribute6
8081 ,p_attribute7 => l_header_rec.tp_attribute7
8082 ,p_attribute8 => l_header_rec.tp_attribute8
8083 ,p_attribute9 => l_header_rec.tp_attribute9
8084 ,p_attribute10 => l_header_rec.tp_attribute10
8085 ,p_attribute11 => l_header_rec.tp_attribute11
8086 ,p_attribute12 => l_header_rec.tp_attribute12
8087 ,p_attribute13 => l_header_rec.tp_attribute13
8088 ,p_attribute14 => l_header_rec.tp_attribute14
8089 ,p_attribute15 => l_header_rec.tp_attribute15) THEN
8090 OE_GLOBALS.g_validate_desc_flex:='N';
8091 END IF;
8092 END IF;
8093 IF OE_GLOBALS.g_validate_desc_flex='Y' THEN
8094 p_old_line_rec:=OE_ORDER_PUB.G_MISS_LINE_REC;
8095 FOR i in l_line_tbl.FIRST..l_line_tbl.LAST
8096 LOOP
8097 p_x_line_rec:=l_line_tbl(i);
8098 G_PR_AV:='Y' ; -- bug7380336
8099 OE_VALIDATE_LINE.Validate_Flex(
8100 p_x_line_rec => p_x_line_rec,
8101 p_old_line_rec => p_old_line_rec,
8102 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
8103 x_return_status => x_return_status
8104 );
8105 oe_debug_pub.add('Pricing AVa,Attribute1 '||p_x_line_rec.attribute1,1);
8106 oe_debug_pub.add('Pricing AVa,Attribute1-Return'||x_return_status,1);
8107 G_PR_AV:='N' ; -- bug7380336
8108
8109 IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
8110 OE_GLOBALS.g_validate_desc_flex:='N';
8111 ELSIF x_return_status = FND_API.G_RET_STS_ERROR THEN
8112 OE_GLOBALS.g_validate_desc_flex:='N';
8113 ELSIF x_return_status=FND_API.G_RET_STS_SUCCESS THEN
8114 null;
8115 END IF;
8116 x_return_status := FND_API.G_RET_STS_SUCCESS;
8117 END LOOP;
8118 END IF;
8119
8120 OE_Order_PVT.Process_order
8121 ( p_api_version_number => 1.0
8122 , p_init_msg_list => FND_API.G_TRUE
8123 , x_return_status => x_return_status
8124 , x_msg_count => x_msg_count
8125 , x_msg_data => x_msg_data
8126 -- , p_control_rec => l_control_rec
8127 -- , p_validation_level => FND_API.G_VALID_LEVEL_NONE
8128 , p_x_header_Rec => l_header_rec
8129 , p_x_line_tbl => l_line_tbl
8130 -- , p_line_adj_tbl => l_line_adj_tbl
8131 , p_x_action_request_tbl => l_action_request_tbl
8132 , p_x_Header_Adj_tbl => l_Header_Adj_tbl
8133 , p_x_Header_Payment_tbl =>l_x_Header_Payment_tbl
8134 , p_x_Header_Scredit_tbl => l_x_Header_Scredit_tbl
8135 , p_x_Line_Adj_tbl => l_Line_Adj_tbl
8136 , p_x_Line_Scredit_tbl => l_x_Line_Scredit_tbl
8137 , p_x_Lot_Serial_tbl => l_x_lot_serial_tbl
8138 , p_x_Line_Payment_tbl => l_x_Line_Payment_tbl
8139 , p_x_Header_price_Att_tbl => l_Header_price_Att_tbl
8140 , p_x_Header_Adj_Att_tbl => l_Header_Adj_Att_tbl
8141 , p_x_Header_Adj_Assoc_tbl => l_Header_Adj_Assoc_tbl
8142 , p_x_Line_price_Att_tbl => l_Line_price_Att_tbl
8143 , p_x_Line_Adj_Att_tbl => l_Line_Adj_Att_tbl
8144 , p_x_Line_Adj_Assoc_tbl => l_Line_Adj_Assoc_tbl
8145 );
8146
8147
8148 IF l_debug_level > 0 THEN
8149 print_time('After Calling Process Order Return ');
8150 END IF;
8151
8152 -- Check the status and print appropriate messages
8153 IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
8154
8155 IF l_debug_level > 0 THEN
8156 oe_debug_pub.add('error in process order 1',1);
8157 oe_Debug_pub.add('ERROR while creating order!');
8158 END IF;
8159 rollback;
8160
8161 ELSE
8162
8163 IF l_debug_level > 0 THEN
8164 oe_debug_pub.add('Header ID :' ||l_header_rec.header_id,1);
8165 oe_debug_pub.add('Order number :'||l_header_rec.order_number,1);
8166 oe_debug_pub.add('Sold To :'||l_header_rec.sold_to_org_id,1);
8167 oe_debug_pub.add('Invoice To :'||l_header_rec.invoice_to_org_id,1);
8168 oe_debug_pub.add('Ship To :'||l_header_rec.ship_to_org_id,1);
8169 END IF;
8170
8171 commit;
8172 out_header_id := l_header_rec.header_id;
8173 out_order_number := l_header_rec.order_number;
8174 out_currency := l_header_rec.transactional_curr_code;
8175
8176
8177 IF l_debug_level > 0 THEN
8178 FOR i in l_line_tbl.FIRST..l_line_tbl.LAST
8179 LOOP
8180 oe_debug_pub.add('counter = '||i||
8181 ' qty='||l_line_tbl(i).ordered_quantity||
8182 'price='||l_line_tbl(i).unit_selling_price
8183 );
8184 END LOOP;
8185 END IF;
8186
8187 oe_oe_totals_summary.order_totals(
8188 p_header_id=>out_header_id,
8189 p_subtotal=>l_subtotal,
8190 p_discount=>l_discount,
8191 p_charges=>l_charges,
8192 p_tax=>l_tax
8193 );
8194
8195 IF l_debug_level > 0 THEN
8196 oe_Debug_pub.add('After calling Order_Totals '||
8197 ' subtotal='||l_subtotal||
8198 ' discount='||l_discount||
8199 ' charges='||l_charges||
8200 ' tax='||l_tax
8201 );
8202 END IF;
8203
8204 out_order_total := l_subtotal + l_discount + l_charges + l_tax;
8205 out_order_amount := l_subtotal;
8206 out_order_charges := l_charges;
8207 out_order_discount := l_discount;
8208 out_order_tax := l_tax;
8209
8210 IF l_debug_level > 0 THEN
8211 oe_Debug_pub.add('out_order_total ='||out_order_total);
8212 END IF;
8213
8214 --out_order_total := l_line_tbl(1).ordered_quantity *
8215 -- l_line_tbl(1).unit_selling_price;
8216 -- out_item := l_line_tbl(1).ordered_item;
8217 if l_debug_level > 0 then
8218 oe_Debug_pub.add('before quering');
8219 end if;
8220 begin
8221 select booked_flag, shipping_interfaced_flag
8222 into l_booked_flag, l_shipping_interfaced_flag
8223 from oe_order_lines_all
8224 where header_id = l_header_rec.header_id
8225 and rownum = 1;
8226 oe_Debug_pub.add('booked_flag'||l_booked_flag ||'shipping interfaced flag'||l_shipping_interfaced_flag);
8227 Exception
8228 When others then
8229 oe_debug_pub.add('error while querying the oe_order_lines_all'||SQLERRM||SQLCODE);
8230 End;
8231
8232 if l_debug_level >0 then
8233 oe_Debug_pub.add('booked_flag'||l_booked_flag ||'shipping interfaced flag'||l_shipping_interfaced_flag);
8234 end if;
8235
8236 IF l_shipping_interfaced_flag <> 'Y' then
8237
8238 IF l_debug_level > 0 THEN
8239 oe_Debug_pub.add('Order was created but there was an ERROR during the order processing flow.');
8240 oe_Debug_pub.add('Order Number: '||l_header_rec.order_number);
8241 END IF;
8242
8243 if l_booked_flag <> 'Y' then
8244
8245 IF l_debug_level > 0 THEN
8246 oe_Debug_pub.add('There was an error during the booking activity.');
8247 --x_return_status := 'E'; --fnd_api.g_ret_sts_error;
8248 END IF;
8249 else
8250 IF l_debug_level > 0 THEN
8251 oe_Debug_pub.add('Order booked but line not interfaced to shipping.');
8252 oe_Debug_pub.add('There was a failure either in scheduling or shipping interface activity.');
8253 --x_return_status := fnd_api.g_ret_sts_error;
8254 END IF;
8255 end if;
8256
8257 ELSE
8258
8259 IF l_debug_level > 0 THEN
8260 oe_Debug_pub.add('Order processed successfully.');
8261 oe_Debug_pub.add('Order Number: '||l_header_rec.order_number);
8262 oe_Debug_pub.add('Order has been booked and line has been scheduled,');
8263 oe_Debug_pub.add('interfaced to shipping.');
8264 END IF;
8265
8266 END IF; -- if interfaced to shipping
8267
8268 END IF;
8269
8270 IF x_return_status <> fnd_api.g_ret_sts_success then
8271
8272 -- Print out the error messages, if any
8273
8274 IF l_debug_level > 0 THEN
8275 IF x_msg_count > 0 then
8276 oe_debug_pub.add('Number of Messages :'||x_msg_count,1);
8277 oe_Debug_pub.add('Number of Messages :'||x_msg_count);
8278 END IF;
8279 END IF;
8280
8281 FOR k in 1 .. x_msg_count loop
8282 x_msg_data := oe_msg_pub.get( p_msg_index => k,
8283 p_encoded => 'F'
8284 );
8285
8286 IF l_debug_level > 0 THEN
8287 oe_debug_pub.add(substr(x_msg_data,1,255));
8288 oe_debug_pub.add(substr(x_msg_data,255,length(x_msg_data)));
8289 oe_Debug_pub.add('Message: '||substr(x_msg_data,1,200));
8290 END IF;
8291
8292 END LOOP;
8293
8294
8295 END IF; -- if 2nd return status not success
8296
8297
8298 EXCEPTION
8299
8300 WHEN FND_API.G_EXC_ERROR THEN
8301
8302 x_return_status := FND_API.G_RET_STS_ERROR;
8303
8304 -- Get message count and data
8305
8306 OE_MSG_PUB.Count_And_Get
8307 ( p_count => x_msg_count
8308 , p_data => x_msg_data
8309 );
8310
8311 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
8312
8313 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
8314
8315 -- Get message count and data
8316
8317 OE_MSG_PUB.Count_And_Get
8318 ( p_count => x_msg_count
8319 , p_data => x_msg_data
8320 );
8321
8322 WHEN OTHERS THEN
8323
8324 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
8325
8326 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
8327 THEN
8328 OE_MSG_PUB.Add_Exc_Msg
8329 ( G_PKG_NAME
8330 , 'Create_Order'
8331 );
8332 END IF;
8333
8334 -- Get message count and data
8335
8336 OE_MSG_PUB.Count_And_Get
8337 ( p_count => x_msg_count
8338 , p_data => x_msg_data
8339 );
8340
8341
8342
8343 END Create_Order;
8344
8345
8346 PROCEDURE get_atp_flag(
8347 in_inventory_item_id in number
8348 ,in_org_id in number
8349 ,out_atp_flag out NOCOPY /* file.sql.39 change */ varchar2
8350 ,out_default_source_type out NOCOPY /* file.sql.39 change */ varchar2
8351 ) IS
8352
8353
8354 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
8355
8356 CURSOR c_atp_flag IS
8357 SELECT atp_flag,
8358 decode(default_so_source_type,'EXTERNAL','External','INTERNAL','Internal')
8359 FROM mtl_system_items
8360 WHERE inventory_item_id = in_inventory_item_id
8361 AND organization_id = in_org_id;
8362
8363 BEGIN
8364
8365 IF in_inventory_item_id is not null then
8366
8367 OPEN c_atp_flag;
8368 FETCH c_atp_flag
8369 INTO out_atp_flag,
8370 out_default_source_type;
8371 CLOSE c_atp_flag;
8372
8373 ELSE
8374 IF l_debug_level > 0 then
8375 oe_debug_pub.add('get_atp_flag in_id is null');
8376 END IF;
8377
8378 END IF;
8379
8380 EXCEPTION
8381 WHEN OTHERS THEN
8382 IF c_atp_flag%ISOPEN then
8383 CLOSE c_atp_flag;
8384 END IF;
8385 oe_debug_pub.add('get_atp_flag id='||In_inventory_item_id||
8386 SQLERRM||SQLCODE
8387 );
8388
8389 END get_atp_flag;
8390
8391
8392 FUNCTION Is_AdPricing_inst return varchar2 IS
8393
8394 l_status varchar2(10);
8395 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
8396
8397 BEGIN
8398
8399 -- we need to call qp_util.get_qp_status,
8400 -- I=advanced , S=Basic, N=No Installation
8401
8402 l_status := qp_util.get_qp_status;
8403
8404 IF l_debug_level > 0 then
8405 oe_debug_pub.add('Advanced Pricing Instaleed status ='||l_status);
8406 END IF;
8407
8408 return l_status;
8409 --return 'I';
8410 -- return 'S';
8411
8412 END Is_AdPricing_Inst;
8413
8414 -- start .Added for bug 3559935 , to avoid recompiling the pld again and again
8415 -- whenever there is a change in OEXFHDRB.pls
8416
8417 PROCEDURE RESET_DEBUG_LEVEL
8418 IS
8419
8420 BEGIN
8421 OE_DEBUG_PUB.G_DEBUG_LEVEL:=0;
8422
8423 END RESET_DEBUG_LEVEL;
8424
8425 PROCEDURE SET_DEBUG_LEVEL (p_debug_level IN NUMBER)
8426 IS
8427
8428 BEGIN
8429 OE_DEBUG_PUB.G_DEBUG_LEVEL:=p_debug_level;
8430
8431 END SET_DEBUG_LEVEL;
8432
8433
8434 PROCEDURE Get_Form_Startup_Values
8435 (Item_Id_Flex_Code IN VARCHAR2,
8436 Item_Id_Flex_Num OUT NOCOPY NUMBER) IS
8437
8438 CURSOR C_Item_Flex(X_Id_Flex_Code VARCHAR2) is
8439 SELECT id_flex_num
8440 FROM fnd_id_flex_structures
8441 WHERE id_flex_code = X_Id_Flex_Code;
8442 BEGIN
8443
8444 oe_debug_pub.add('Entering OE_OE_PRICING_AVAILABILITY.GET_FORM_STARTUP_VALUES', 1);
8445
8446 OPEN C_Item_Flex(Item_Id_Flex_Code);
8447 FETCH C_Item_Flex INTO Item_Id_Flex_Num;
8448 CLOSE C_Item_Flex;
8449
8450 oe_debug_pub.add('Exiting OE_OE_FORM_HEADER.GET_FORM_STARTUP_VALUES', 1);
8451
8452 EXCEPTION
8453 WHEN OTHERS THEN
8454 oe_debug_pub.add('In when others exception : OE_OE_PRICING_AVAILABILITY.GET_FORM_STARTUP_VALUES', 1);
8455 IF OE_MSG_PUB.Check_Msg_Level (OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
8456 THEN
8457 OE_MSG_PUB.Add_Exc_Msg
8458 ( G_PKG_NAME ,
8459 'Get_Form_Startup_Values'
8460 );
8461 END IF;
8462
8463 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8464
8465
8466 END Get_Form_Startup_Values;
8467
8468
8469 Procedure get_user_item_Pricing_Contexts(
8470 p_request_type_code IN VARCHAR2,
8471 x_user_attribs_tbl OUT NOCOPY USER_ATTRIBUTE_TBL_TYPE) IS
8472
8473 l_user_attribs_tbl QP_Attr_Mapping_PUB.USER_ATTRIBUTE_TBL_TYPE;
8474
8475
8476 Begin
8477
8478 QP_Attr_Mapping_PUB.get_user_item_Pricing_Contexts(
8479 p_request_type_code,
8480 p_user_attribs_tbl => l_user_attribs_tbl);
8481
8482 FOR I IN 1..l_user_attribs_tbl.COUNT LOOP
8483
8484 x_user_attribs_tbl(I).context_name := l_user_attribs_tbl(I).context_name;
8485 x_user_attribs_tbl(I).attribute_name := l_user_attribs_tbl(I).attribute_name;
8486 END LOOP;
8487
8488 End get_user_item_Pricing_Contexts;
8489
8490 -- end 3559935
8491
8492 --add 3245976
8493
8494
8495 FUNCTION GET_MRP_ERR_MSG_FLAG
8496 RETURN CHAR
8497 IS
8498 BEGIN
8499 return g_mrp_error_msg_flag;
8500 END GET_MRP_ERR_MSG_FLAG;
8501
8502
8503 FUNCTION GET_MRP_ERR_MSG RETURN VARCHAR
8504 IS
8505 err_msg varchar2(1000);
8506 BEGIN
8507 err_msg :=g_mrp_error_msg;
8508 g_mrp_error_msg :=NULL;
8509 g_mrp_error_msg_flag :='F';
8510 return err_msg;
8511
8512 END GET_MRP_ERR_MSG;
8513
8514 /* start bug 3440778 , Created to convert the reference to other products serverside code inside OEXPRAVA pld into a local call. to OE_OE_PRICING_AVAILABILITY package*/
8515
8516 FUNCTION Get_Cost (p_line_rec IN OE_ORDER_PUB.LINE_REC_TYPE DEFAULT OE_Order_Pub.G_MISS_LINE_REC
8517 ,p_request_rec IN Oe_Order_Pub.Request_Rec_Type DEFAULT Oe_Order_Pub.G_MISS_REQUEST_REC
8518 ,p_order_currency IN VARCHAR2 Default NULL
8519 ,p_sob_currency IN VARCHAR2 Default NULL
8520 ,p_inventory_item_id IN NUMBER Default NULL
8521 ,p_ship_from_org_id IN NUMBER Default NULL
8522 ,p_conversion_Type_code IN VARCHAR2 Default NULL
8523 ,p_conversion_rate IN NUMBER Default NULL
8524 ,p_item_type_code IN VARCHAR2 Default 'STANDARD'
8525 ,p_header_flag IN Boolean Default FALSE
8526 ,p_ordered_uom IN VARCHAR2 Default NULL -- Bug 11880399
8527 )
8528 ----------------------------------------------------------------
8529 RETURN NUMBER IS
8530
8531 l_unit_cost number;
8532 BEGIN
8533 l_unit_cost :=OE_MARGIN_PVT.Get_Cost(p_line_rec
8534 ,p_request_rec
8535 ,p_order_currency
8536 ,p_sob_currency
8537 ,p_inventory_item_id
8538 ,p_ship_from_org_id
8539 ,p_conversion_Type_code
8540 ,p_conversion_rate
8541 ,p_item_type_code
8542 ,p_header_flag
8543 ,p_ordered_uom --Bug 11880399
8544 );
8545 return (l_unit_cost);
8546 END Get_Cost;
8547
8548
8549 PROCEDURE Get_Agreement
8550 (
8551 p_sold_to_org_id IN NUMBER DEFAULT NULL
8552 ,p_transaction_type_id IN NUMBER DEFAULT NULL
8553 ,p_pricing_effective_date IN DATE
8554 ,p_agreement_tbl OUT NOCOPY agreement_tbl
8555 ) IS
8556
8557 l_agreement_tbl QP_UTIL_PUB.agreement_tbl;
8558 BEGIN
8559
8560 QP_UTIL_PUB.Get_Agreement( p_sold_to_org_id
8561 ,p_transaction_type_id
8562 ,p_pricing_effective_date
8563 ,l_agreement_tbl);
8564
8565 FOR I IN 1..l_agreement_tbl.COUNT LOOP
8566 p_agreement_tbl(I).agreement_name := l_agreement_tbl(I).agreement_name;
8567 p_agreement_tbl(I).agreement_id := l_agreement_tbl(I).agreement_id;
8568 p_agreement_tbl(I).agreement_type := l_agreement_tbl(I).agreement_type;
8569 p_agreement_tbl(I).price_list_name := l_agreement_tbl(I).price_list_name;
8570 p_agreement_tbl(I).customer_name := l_agreement_tbl(I).price_list_name;
8571 p_agreement_tbl(I).payment_term_name := l_agreement_tbl(I).payment_term_name;
8572 p_agreement_tbl(I).start_date_active := l_agreement_tbl(I).start_date_active;
8573 p_agreement_tbl(I).end_date_active := l_agreement_tbl(I).end_date_active;
8574
8575 END LOOP;
8576
8577 END Get_Agreement;
8578
8579 -- round_price.p_operand_type could be 'A' for adjustment amount or 'S' for item price
8580 PROCEDURE round_price
8581 (
8582 p_operand IN NUMBER
8583 ,p_rounding_factor IN NUMBER
8584 ,p_use_multi_currency IN VARCHAR2
8585 ,p_price_list_id IN NUMBER
8586 ,p_currency_code IN VARCHAR2
8587 ,p_pricing_effective_date IN DATE
8588 ,x_rounded_operand IN OUT NOCOPY NUMBER
8589 ,x_status_code IN OUT NOCOPY VARCHAR2
8590 ,p_operand_type IN VARCHAR2 default 'S'
8591 )
8592 IS
8593 BEGIN
8594 QP_UTIL_PUB.round_price
8595 (
8596 p_operand
8597 ,p_rounding_factor
8598 ,p_use_multi_currency
8599 ,p_price_list_id
8600 ,p_currency_code
8601 ,p_pricing_effective_date
8602 ,x_rounded_operand
8603 ,x_status_code
8604 ,p_operand_type
8605 );
8606 END round_price;
8607
8608 -- end bug 3440778
8609
8610 END oe_oe_pricing_availability;