1 PACKAGE BODY OE_ORDER_BOOK_UTIL AS
2 /* $Header: OEXUBOKB.pls 120.13.12020000.4 2013/04/09 08:02:50 spothula ship $ */
3
4 -- Global constant holding the package name
5 G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_ORDER_BOOK_UTIL';
6
7
8 /* LOCAL PROCEDURES */
9
10 -- LOCAL function: BookingIsDeferred
11 -- Called from Complete_Book_Eligible
12 -- Returns TRUE if booking has been deferred for this itemkey
13 -- and also populates a message to inform the user that booking
14 -- has been deferred.
15 ---------------------------------------------------------------
16 FUNCTION BookingIsDeferred
17 (p_itemkey IN VARCHAR2
18 )
19 RETURN BOOLEAN
20 IS
21 l_book_deferred VARCHAR2(1);
22 CURSOR book_deferred IS
23 SELECT 'Y'
24 FROM WF_ITEM_ACTIVITY_STATUSES WIAS
25 , WF_PROCESS_ACTIVITIES WPA
26 WHERE WIAS.item_type = 'OEOH'
27 AND WIAS.item_key = p_itemkey
28 AND WIAS.activity_status = 'DEFERRED'
29 AND WPA.activity_name = 'BOOK_DEFER'
30 AND WPA.instance_id = WIAS.process_activity;
31 --
32 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
33 --
34 BEGIN
35 IF l_debug_level > 0 THEN
36 oe_debug_pub.add( 'CHECK IF BOOKING IS DEFERRED' ) ;
37 END IF;
38
39 OPEN book_deferred;
40 FETCH book_deferred INTO l_book_deferred;
41
42 IF (book_deferred%FOUND) THEN
43 IF l_debug_level > 0 THEN
44 oe_debug_pub.add( 'BOOKING IS DEFERRED' ) ;
45 END IF;
46 FND_MESSAGE.SET_NAME('ONT','OE_ORDER_BOOK_DEFERRED');
47 OE_MSG_PUB.ADD;
48 CLOSE book_deferred;
49 RETURN TRUE;
50 END IF;
51
52 CLOSE book_deferred;
53 RETURN FALSE;
54
55 EXCEPTION
56 WHEN OTHERS THEN
57 if (book_deferred%isopen) then
58 close book_deferred;
59 end if;
60 RAISE;
61
62 END BookingIsDeferred;
63
64 ---------------------------------------------------------------
65 PROCEDURE Pricing_Book_Event
66 (p_x_line_tbl IN OUT NOCOPY OE_Order_PUB.Line_Tbl_Type
67 ,p_header_id IN NUMBER
68 ,x_return_status OUT NOCOPY VARCHAR2
69
70 )
71 IS
72 l_price_control_rec QP_PREQ_GRP.control_record_type;
73 l_request_rec oe_order_pub.request_rec_type;
74 --
75 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
76 --
77 BEGIN
78 -- Oe_Debug_pub.Add('Before Book_Pricing_Event');
79 l_Price_Control_Rec.pricing_event := 'BOOK';
80 l_Price_Control_Rec.calculate_flag := QP_PREQ_GRP.G_SEARCH_N_CALCULATE;
81 l_Price_Control_Rec.Simulation_Flag := 'N';
82
83 oe_order_adj_pvt.Price_line(
84 X_Return_Status => x_Return_Status
85 ,p_Header_id => p_header_id
86 ,p_Request_Type_code=> 'ONT'
87 ,p_Control_rec => l_Price_Control_Rec
88 ,p_write_to_db => TRUE
89 ,p_request_rec => l_request_rec
90 ,x_line_Tbl => p_x_Line_Tbl
91 );
92 -- Oe_Debug_pub.Add('After Book_Pricing_Event');
93
94 END Pricing_Book_Event;
95
96
97 ---------------------------------------------------------------
98 PROCEDURE Update_Booked_Flag
99 (p_header_id IN NUMBER
100 ,x_validate_cfg OUT NOCOPY BOOLEAN
101
102 ,x_freeze_inc_items OUT NOCOPY BOOLEAN
103
104 ,x_return_status OUT NOCOPY VARCHAR2
105
106 )
107 IS
108 l_index NUMBER := 1;
109 l_new_index NUMBER := 1;
110 l_loop_index NUMBER := 1; -- jolin
111 l_notify_index NUMBER; -- jolin
112 l_line_id NUMBER;
113 l_header_rec OE_ORDER_PUB.Header_Rec_Type;
114 l_old_header_rec OE_ORDER_PUB.Header_Rec_Type;
115 l_line_tbl OE_ORDER_PUB.Line_TBL_Type;
116 l_old_line_tbl OE_ORDER_PUB.Line_TBL_Type;
117 l_msg_count NUMBER;
118 l_active_phase_count NUMBER;
119 l_msg_data VARCHAR2(2000);
120 l_return_status VARCHAR2(30) := FND_API.G_RET_STS_SUCCESS;
121 l_tax_calculation_event_code varchar2(30) := NULL;
122 l_notify BOOLEAN := FALSE;
123 l_in_loop_index NUMBER := 1;
124 l_line_adj_tbl OE_ORDER_PUB.LINE_ADJ_TBL_Type;
125 l_populate_adj BOOLEAN := FALSE;
126 l_global_index NUMBER;
127 l_line_adj_index NUMBER;
128 l_org_id NUMBER(15):=MO_GLOBAL.Get_Current_Org_Id; --TaxER
129 l_hdr_chg_count NUMBER; --TaxER
130
131
132 CURSOR Query_Lines IS
133 SELECT line_id
134 , booked_flag
135 , sold_to_org_id
136 , invoice_to_org_id
137 , ship_to_org_id
138 , tax_exempt_flag
139 , inventory_item_id
140 , order_quantity_uom
141 , ordered_quantity
142 , line_category_code
143 , item_type_code
144 , price_list_id
145 , unit_list_price
146 , unit_selling_price
147 , payment_term_id
148 , ship_from_org_id
149 , request_date
150 , line_type_id
151 , tax_date
152 , tax_code
153 , service_duration
154 , reference_line_id
155 , cancelled_flag
156 , orig_sys_document_ref
157 , orig_sys_line_ref
158 , source_document_id
159 , source_document_line_id
160 , service_coterminate_flag
161 , service_reference_type_code
162 , service_start_date
163 , service_end_date
164 , service_period
165 , header_id /* renga */
166 , org_id
167 , return_context
168 , reference_customer_trx_line_id /* end renga */
169 , order_firmed_date /* Key Transaction Dates */
170 FROM OE_ORDER_LINES
171 WHERE HEADER_ID = p_header_id;
172
173 --
174 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
175 --
176 BEGIN
177 -- Added debug for bug 13435459
178 IF l_debug_level > 0 THEN
179 oe_debug_pub.add( 'ENTERING UPDATE_BOOKED_FLAG', 0.5) ;
180 END IF;
181
182 x_return_status := FND_API.G_RET_STS_SUCCESS;
183 x_validate_cfg := FALSE;
184 x_freeze_inc_items := FALSE;
185
186 -- NOTE: Process order is called twice, once to update the booked flag
187 -- on the order header and the second time to update the booked flag
188 -- on all lines on the order. This cannot be done in one call as the
189 -- process order does not process lines(or any line level validation)
190 -- if the header validation fails. In order to give user complete
191 -- feedback i.e. validation errors for lines also if any, process order
192 -- is called for lines separately even if header update returns with
193 -- a status of ERROR.
194
195
196 -- Set up the header record
197
198 OE_Header_Util.Query_Row
199 (p_header_id => p_header_id
200 ,x_header_rec => l_old_header_rec
201 );
202 l_header_rec := l_old_header_rec;
203 l_header_rec.booked_flag := 'Y';
204 l_header_rec.booked_date := sysdate;
205 l_header_rec.flow_status_code := 'BOOKED';
206 l_header_rec.last_updated_by := FND_GLOBAL.USER_ID;
207 l_header_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
208 l_header_rec.last_update_date := SYSDATE;
209 l_header_rec.lock_control := l_header_rec.lock_control + 1;
210
211 -- bug 1406890
212 -- renga: change for tax calculation event enhancement
213 BEGIN
214
215 IF l_header_rec.order_type_id is not null THEN
216 SELECT TAX_CALCULATION_EVENT_CODE
217 into l_tax_calculation_event_code
218 from oe_transaction_types_all
219 where transaction_type_id = l_header_rec.order_type_id;
220 END IF;
221
222 EXCEPTION
223 when no_data_found then
224 l_tax_calculation_event_code := NULL;
225 when others then
226 IF l_debug_level > 0 THEN
227 oe_debug_pub.add( 'REN: FAILED WHILE TRYING TO QUERY UP TAX_CALCUALTION_EVENT FOR ORDER_TYPE_ID IN UPDATE_BOOKED_FLAG' ) ;
228 END IF;
229 RAISE;
230 END;
231 -- renga: end of change for tax calculation event enhancement
232
233
234 -- Header booking validation
235
236 OE_MSG_PUB.set_msg_context(
237 p_entity_code => 'HEADER'
238 ,p_entity_id => l_header_rec.header_id
239 ,p_header_id => l_header_rec.header_id
240 ,p_line_id => null
241 ,p_order_source_id => l_header_rec.order_source_id
242 ,p_orig_sys_document_ref => l_header_rec.orig_sys_document_ref
243 ,p_orig_sys_document_line_ref => null
244 ,p_change_sequence => l_header_rec.change_sequence
245 ,p_source_document_type_id => l_header_rec.source_document_type_id
246 ,p_source_document_id => l_header_rec.source_document_id
247 ,p_source_document_line_id => null );
248
249 OE_Validate_Header.Check_Book_Reqd_Attributes
250 (p_header_rec => l_header_rec
251 ,x_return_status => l_return_status
252 );
253
254 OE_MSG_PUB.reset_msg_context('HEADER');
255
256 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
257 x_return_status := FND_API.G_RET_STS_ERROR;
258 -- if unexpected error, then do NOT validate lines.
259 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
260 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
261 RETURN;
262 END IF;
263
264 -- Check whether we need to call the Pricing at BOOKING
265 SELECT count(*)
266 INTO l_active_phase_count
267 FROM QP_EVENT_PHASES
268 WHERE pricing_event_code = 'BOOK'
269 AND trunc(sysdate) between trunc(nvl(start_date_active, sysdate)) and
270 trunc(nvl(end_date_active, sysdate));
271
272 -- Check if the ASO and EC are installed products
273 IF OE_GLOBALS.G_ASO_INSTALLED IS NULL THEN
274 OE_GLOBALS.G_ASO_INSTALLED := OE_GLOBALS.CHECK_PRODUCT_INSTALLED(697);
275 END IF;
276
277 IF OE_GLOBALS.G_EC_INSTALLED IS NULL THEN
278 OE_GLOBALS.G_EC_INSTALLED := OE_GLOBALS.CHECK_PRODUCT_INSTALLED(175);
279 END IF;
280
281 -- We need to call the Query_Rows only if Pricing is called and ASO/EC are
282 -- Installed products.
283
284 IF ( (NVL(l_active_phase_count,0) > 0) OR
285 (OE_GLOBALS.G_ASO_INSTALLED = 'Y') OR
286 (OE_GLOBALS.G_EC_INSTALLED = 'Y' ) OR
287 (NVL(FND_PROFILE.VALUE('ONT_DBI_INSTALLED'),'N') = 'Y') )
288 THEN
289 -- Set up the lines table of records
290
291 OE_Line_Util.Query_Rows
292 (p_header_id => p_header_id
293 ,x_line_tbl => l_old_line_tbl
294 );
295 ELSE
296 l_index := 1;
297
298 OPEN Query_Lines;
299 LOOP
300
301 FETCH Query_Lines INTO
302 l_old_line_tbl(l_index).line_id
303 , l_old_line_tbl(l_index).booked_flag
304 , l_old_line_tbl(l_index).sold_to_org_id
305 , l_old_line_tbl(l_index).invoice_to_org_id
306 , l_old_line_tbl(l_index).ship_to_org_id
307 , l_old_line_tbl(l_index).tax_exempt_flag
308 , l_old_line_tbl(l_index).inventory_item_id
309 , l_old_line_tbl(l_index).order_quantity_uom
310 , l_old_line_tbl(l_index).ordered_quantity
311 , l_old_line_tbl(l_index).line_category_code
312 , l_old_line_tbl(l_index).item_type_code
313 , l_old_line_tbl(l_index).price_list_id
314 , l_old_line_tbl(l_index).unit_list_price
315 , l_old_line_tbl(l_index).unit_selling_price
316 , l_old_line_tbl(l_index).payment_term_id
317 , l_old_line_tbl(l_index).ship_from_org_id
318 , l_old_line_tbl(l_index).request_date
319 , l_old_line_tbl(l_index).line_type_id
320 , l_old_line_tbl(l_index).tax_date
321 , l_old_line_tbl(l_index).tax_code
322 , l_old_line_tbl(l_index).service_duration
323 , l_old_line_tbl(l_index).reference_line_id
324 , l_old_line_tbl(l_index).cancelled_flag
325 , l_old_line_tbl(l_index).orig_sys_document_ref
326 , l_old_line_tbl(l_index).orig_sys_line_ref
327 , l_old_line_tbl(l_index).source_document_id
328 , l_old_line_tbl(l_index).source_document_line_id
329 , l_old_line_tbl(l_index).service_coterminate_flag
330 , l_old_line_tbl(l_index).service_reference_type_code
331 , l_old_line_tbl(l_index).service_start_date
332 , l_old_line_tbl(l_index).service_end_date
333 , l_old_line_tbl(l_index).service_period
334 , l_old_line_tbl(l_index).header_id /* renga */
335 , l_old_line_tbl(l_index).org_id
336 , l_old_line_tbl(l_index).return_context
337 , l_old_line_tbl(l_index).reference_customer_trx_line_id
338 /* end renga */
339 , l_old_line_tbl(l_index).order_firmed_date; /*key transaction dates */
340
341 EXIT WHEN (Query_Lines%NOTFOUND);
342
343 l_index := l_index + 1;
344
345 END LOOP;
346
347 CLOSE Query_Lines;
348
349 END IF;
350
351
352 -- (1) Lines Booking Validation
353 l_line_tbl := l_old_line_tbl;
354 l_index := l_line_tbl.FIRST;
355
356 WHILE l_index IS NOT NULL LOOP
357
358 -- for non-cancelled lines, do the booking validation and set
359 -- the booked_flag and flow_status on the new line records
360 IF nvl(l_line_tbl(l_index).cancelled_flag,'N') = 'N' THEN
361
362 IF l_line_tbl(l_index).item_type_code = 'STANDARD' THEN
363 NULL;
364 ELSIF l_line_tbl(l_index).item_type_code = 'MODEL' THEN
365 x_validate_cfg := TRUE;
366 x_freeze_inc_items := TRUE;
367 ELSIF l_line_tbl(l_index).item_type_code in ('CLASS','KIT') THEN
368 x_freeze_inc_items := TRUE;
369 END IF;
370
371 l_return_status := FND_API.G_RET_STS_SUCCESS;
372 l_line_tbl(l_index).operation := OE_GLOBALS.G_OPR_UPDATE;
373 l_line_tbl(l_index).booked_flag := 'Y';
374 l_line_tbl(l_index).flow_status_code := 'BOOKED';
375 l_line_tbl(l_index).last_updated_by := FND_GLOBAL.USER_ID;
376 l_line_tbl(l_index).last_update_login := FND_GLOBAL.LOGIN_ID;
377 l_line_tbl(l_index).last_update_date := SYSDATE;
378 l_line_tbl(l_index).lock_control := l_line_tbl(l_index).lock_control + 1;
379
380 OE_MSG_PUB.set_msg_context(
381 p_entity_code => 'LINE'
382 ,p_entity_id => l_line_tbl(l_index).line_id
383 ,p_header_id => p_header_id
384 ,p_line_id => l_line_tbl(l_index).line_id
385 ,p_order_source_id => l_line_tbl(l_index).order_source_id
386 ,p_orig_sys_document_ref => l_line_tbl(l_index).orig_sys_document_ref
387 ,p_orig_sys_document_line_ref => l_line_tbl(l_index).orig_sys_line_ref
388 ,p_orig_sys_shipment_ref => l_line_tbl(l_index).orig_sys_shipment_ref
389 ,p_change_sequence => l_line_tbl(l_index).change_sequence
390 ,p_source_document_type_id => l_line_tbl(l_index).source_document_type_id
391 ,p_source_document_id => l_line_tbl(l_index).source_document_id
392 ,p_source_document_line_id => l_line_tbl(l_index).source_document_line_id );
393
394 OE_Validate_Line.Check_Book_Reqd_Attributes
395 (p_line_rec => l_line_tbl(l_index)
396 ,p_old_line_rec => l_old_line_tbl(l_index)
397 ,x_return_status => l_return_status
398 );
399
400 OE_MSG_PUB.reset_msg_context('LINE');
401
402 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
403 x_return_status := FND_API.G_RET_STS_ERROR;
404 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
405 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
406 RETURN;
407 END IF;
408
409 -- bug 1406890
410 -- Renga - log a delayed request for calculating tax for
411 -- each of the order lines
412
413 IF l_tax_calculation_event_code = 'BOOKING' THEN
414
415 IF l_line_tbl(l_index).item_type_code not in ('INCLUDED', 'CONFIG') THEN
416
417 OE_delayed_requests_Pvt.log_request(
418 p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
419 p_entity_id => l_line_tbl(l_index).line_id,
420 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_LINE,
421 p_requesting_entity_id => l_line_tbl(l_index).line_id,
422 p_request_type => OE_GLOBALS.g_tax_line,
423 x_return_status => l_return_status);
424
425 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
426 x_return_status := FND_API.G_RET_STS_ERROR;
427 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
428 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
429 RETURN;
430 END IF;
431
432 END IF; -- if item_type_code not in INCLUDED or CONFIG
433
434 END IF; -- if tax_calculation_event is booking
435
436
437 -- end of bug 1406890
438
439
440 -- delete the cancelled lines from the lines table, these do
441 -- not need to be sent to notify_oc
442 ELSE
443 l_old_line_tbl.DELETE(l_index);
444 l_line_tbl.DELETE(l_index);
445 END IF;
446
447 l_index := l_line_tbl.NEXT(l_index);
448
449 END LOOP;
450
451 --taxER Start
452 IF l_tax_calculation_event_code = 'BOOKING' THEN
453 IF (NVL(oe_sys_parameters.value('OE_INVOICE_FREIGHT_AS_LINE',l_org_id), 'N') = 'Y') THEN
454
455 SELECT Count(1)
456 INTO l_hdr_chg_count
457 FROM oe_price_adjustments
458 WHERE header_id= l_header_rec.header_id
459 AND list_line_type_code='FREIGHT_CHARGE'
460 AND line_id IS NULL;
461
462
463 IF l_hdr_chg_count > 0 THEN
464
465
466 OE_delayed_requests_Pvt.log_request(
467 p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
468 p_entity_id => l_header_rec.header_id,
469 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
470 p_requesting_entity_id => l_header_rec.header_id,
471 p_request_type => OE_GLOBALS.g_tax_line,
472 p_param1 => NULL,
473 x_return_status => x_return_status);
474
475 END IF;
476
477 END IF;
478 END IF;
479 --taxER End
480
481 -- Return error if there were validation errors for the header/line
482 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
483 RAISE FND_API.G_EXC_ERROR;
484 END IF;
485
486
487 -- Update the booked_flag and flow_status on the tables
488 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
489
490 UPDATE oe_order_headers_all
491 SET booked_flag = 'Y'
492 , booked_date = sysdate
493 , flow_status_code = 'BOOKED'
494 , last_updated_by = FND_GLOBAL.USER_ID
495 , last_update_login = FND_GLOBAL.LOGIN_ID
496 , last_update_date = SYSDATE
497 , lock_control = lock_control + 1
498 WHERE header_id = p_header_id;
499
500 -- aksingh performance
501 -- As the update is on headers table, it is time to update
502 -- cache also!
503 OE_Order_Cache.Set_Order_Header(l_header_rec);
504
505 -- Clear cached results for constraints as order being booked
506 -- may change results of some validation packages
507 OE_PC_Constraints_Admin_PVT.Clear_Cached_Results;
508
509 UPDATE oe_order_lines_all
510 SET booked_flag = 'Y'
511 , flow_status_code = 'BOOKED'
512 , last_updated_by = FND_GLOBAL.USER_ID
513 , last_update_login = FND_GLOBAL.LOGIN_ID
514 , last_update_date = SYSDATE
515 , lock_control = lock_control + 1
516 WHERE header_id = p_header_id
517 AND nvl(cancelled_flag,'N') <> 'Y'; -- nvl added for bug 4486781
518
519 END IF;
520
521 --OIP SUN ER changes
522 IF (NVL(FND_PROFILE.VALUE('ONT_RAISE_STATUS_CHANGE_BUSINESS_EVENT'),'N') ='Y') THEN
523 OE_delayed_requests_Pvt.log_request
524 (p_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
525 p_entity_id => l_header_rec.header_id,
526 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_HEADER,
527 p_requesting_entity_id => l_header_rec.header_id,
528 p_request_type => 'OE_ORDER_BOOKED', --OE_GLOBALS.G_DFLT_HSCREDIT_FOR_SREP,
529 x_return_status => l_return_status);
530
531 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
532 x_return_status := FND_API.G_RET_STS_ERROR;
533 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
534 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
535 RETURN;
536 END IF;
537 END IF;
538 --OIP SUN ER changes End
539
540 -- Evaluate the BOOK event for pricing
541 -- Call Pricing only if there are active phases in BOOK event.
542 /*
543 IF l_active_phase_count > 0 THEN
544 Pricing_Book_Event(p_x_line_tbl => l_line_tbl
545 , p_header_id => p_header_id
546 , x_return_status => l_return_status
547 );
548 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
549 RAISE FND_API.G_EXC_ERROR;
550 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
551 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
552 END IF;
553 END IF;
554 */
555
556 -- (4) API to call notify_oc and ack with l_header_rec and l_old_header_rec
557 -- and l_line_tbl and l_old_line_tbl
558 -- bug 1406890
559 -- renga - change for tax calculation event enhancement
560
561 l_notify := FALSE;
562
563 IF ( (OE_GLOBALS.G_ASO_INSTALLED = 'Y') OR
564 (OE_GLOBALS.G_EC_INSTALLED = 'Y' ) OR
565 (NVL(FND_PROFILE.VALUE('ONT_DBI_INSTALLED'),'N') = 'Y') )
566 THEN
567 l_notify := TRUE;
568
569 /* jolin start */
570 -- AND we need to update the global picture before calling process_requests_and_notify
571 -- if we are using the new notification method
572
573 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110508' THEN
574
575 -- Need to call Update_Global_Picture to update globals on direct changes
576 -- made in the two update stmts to the headers and lines tables.
577 -- First make call for the header, then loop through all the lines
578
579 -- bug 2821129
580 oe_debug_pub.add('in OEXUBOKB header will do query');
581 oe_debug_pub.add('p_header_id is '|| p_header_id);
582 oe_debug_pub.add('l_header_rec.header_id is '|| l_header_rec.header_id);
583 OE_HEADER_ADJ_UTIL.Query_Rows
584 (p_header_id => p_header_id
585 ,x_Header_adj_Tbl => OE_ORDER_UTIL.g_header_adj_tbl);
586
587
588 -- loop to populate the operation in the global table
589 l_in_loop_index := OE_ORDER_UTIL.g_header_adj_tbl.FIRST;
590
591 while l_in_loop_index is not null loop
592 OE_ORDER_UTIL.g_header_adj_tbl(l_in_loop_index).operation := OE_GLOBALS.G_OPR_CREATE;
593 l_in_loop_index := OE_ORDER_UTIL.g_header_adj_tbl.NEXT(l_in_loop_index);
594 END LOOP;
595
596 oe_debug_pub.add('in OEXUBOKB header adj tbl count is '|| OE_ORDER_UTIL.g_header_adj_tbl.count);
597
598 IF l_debug_level > 0 THEN
599 oe_debug_pub.add( 'BEFORE ENTERING UPDATE_GLOBAL_PICTURE IN BOOKING' ) ;
600 END IF;
601 -- call notification framework to get header index position
602 IF l_debug_level > 0 THEN
603 oe_debug_pub.add( 'BEFORE UPDATE , HEADER VALUE' || OE_ORDER_UTIL.G_HEADER_REC.HEADER_ID ) ;
604 END IF;
605 IF l_debug_level > 0 THEN
606 oe_debug_pub.add( 'BEFORE UPDATE , OLD HEADER VALUE' || OE_ORDER_UTIL.G_OLD_HEADER_REC.HEADER_ID ) ;
607 END IF;
608 OE_ORDER_UTIL.Update_Global_Picture
609 (p_Upd_New_Rec_If_Exists =>FALSE
610 , p_header_rec => l_header_rec
611 , p_old_header_rec => l_old_header_rec
612 , p_header_id => l_header_rec.header_id
613 , x_index => l_notify_index
614 , x_return_status => l_return_status);
615
616 IF l_debug_level > 0 THEN
617 oe_debug_pub.add( 'UPDATE_GLOBAL RETURN STATUS FOR HDR IS: ' || L_RETURN_STATUS ) ;
618 END IF;
619 IF l_debug_level > 0 THEN
620 oe_debug_pub.add( 'HDR INDEX IS: ' || L_NOTIFY_INDEX , 1 ) ;
621 END IF;
622
623 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
624 RAISE FND_API.G_EXC_ERROR;
625 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
626 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
627 END IF;
628
629 IF l_notify_index is not null then
630 -- modify Global Picture
631 IF l_debug_level > 0 THEN
632 oe_debug_pub.add( 'JPN: OLD GLOBAL HDR REC BOOKED_FLAG IS:' || OE_ORDER_UTIL.G_OLD_HEADER_REC.BOOKED_FLAG , 1 ) ;
633 END IF;
634 OE_ORDER_UTIL.g_old_header_rec := l_old_header_rec;
635 OE_ORDER_UTIL.g_header_rec := OE_ORDER_UTIL.g_old_header_rec;
636 OE_ORDER_UTIL.g_old_header_rec.booked_flag := 'N';
637 OE_ORDER_UTIL.g_old_header_rec.booked_date := NULL;
638 OE_ORDER_UTIL.g_header_rec.booked_flag := l_header_rec.booked_flag;
639 OE_ORDER_UTIL.g_header_rec.booked_date:= l_header_rec.booked_date;
640 OE_ORDER_UTIL.g_header_rec.flow_status_code:=l_header_rec.flow_status_code;
641 OE_ORDER_UTIL.g_header_rec.last_updated_by:=l_header_rec.last_updated_by;
642 OE_ORDER_UTIL.g_header_rec.last_update_login:=l_header_rec.last_update_login;
643 OE_ORDER_UTIL.g_header_rec.last_update_date:=l_header_rec.last_update_date;
644 OE_ORDER_UTIL.g_header_rec.lock_control:= l_header_rec.lock_control;
645 OE_ORDER_UTIL.g_header_rec.operation:= l_header_rec.operation;
646
647 IF l_debug_level > 0 THEN
648 oe_debug_pub.add( 'JYOTHI:GLOBAL HDR REC BOOKED_FLAG IS: ' || OE_ORDER_UTIL.G_HEADER_REC.BOOKED_FLAG , 1 ) ;
649 END IF;
650 IF l_debug_level > 0 THEN
651 oe_debug_pub.add( 'GLOBAL HDR BOOKED_DATE IS: ' || OE_ORDER_UTIL.G_HEADER_REC.BOOKED_DATE , 1 ) ;
652 END IF;
653 IF l_debug_level > 0 THEN
654 oe_debug_pub.add( 'GLOBAL HDR FLOW_STATUS_CODE IS: ' || OE_ORDER_UTIL.G_HEADER_REC.FLOW_STATUS_CODE , 1 ) ;
655 END IF;
656
657 END IF ; /* global entity index null check */
658
659 -- update lines global picture
660 -- loop over l_line_tbl using loop_index
661
662 l_loop_index := l_line_tbl.FIRST;
663
664 <<outer>>
665
666 WHILE l_loop_index IS NOT NULL LOOP
667 IF l_debug_level > 0 THEN
668 oe_debug_pub.add( 'JFC: IN BOOKING LINES , L_LOOP_INDEX= '||L_LOOP_INDEX , 1 ) ;
669 END IF;
670 -- call notification framework to get this line's index position
671 OE_ORDER_UTIL.Update_Global_Picture
672 (p_Upd_New_Rec_If_Exists =>FALSE
673 , p_line_rec => l_line_tbl(l_loop_index)
674 , p_line_id => l_line_tbl(l_loop_index).line_id
675 , x_index => l_notify_index
676 , x_return_status => l_return_status);
677
678 IF l_debug_level > 0 THEN
679 oe_debug_pub.add( 'UPDATE_GLOBAL RETURN STATUS IN OE_ORDER_BOOK_UTIL FOR LINE_ID '||L_LINE_TBL ( L_LOOP_INDEX ) .LINE_ID ||' IS: ' || L_RETURN_STATUS , 1 ) ;
680 END IF;
681 IF l_debug_level > 0 THEN
682 oe_debug_pub.add( 'UPDATE_GLOBAL INDEX IN OE_ORDER_BOOK_UTIL FOR LINE_ID '||L_LINE_TBL ( L_LOOP_INDEX ) .LINE_ID ||' IS: ' || L_NOTIFY_INDEX , 1 ) ;
683 END IF;
684
685 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
686 RAISE FND_API.G_EXC_ERROR;
687 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
688 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
689 END IF;
690
691 IF l_notify_index is not null then
692 -- modify Global Picture
693 OE_ORDER_UTIL.g_old_line_tbl(l_notify_index):= l_old_line_tbl(l_loop_index);
694 OE_ORDER_UTIL.g_line_tbl(l_notify_index):= OE_ORDER_UTIL.g_old_line_tbl(l_notify_index);
695 OE_ORDER_UTIL.g_old_line_tbl(l_notify_index).booked_flag:='N';
696
697 OE_ORDER_UTIL.g_line_tbl(l_notify_index).line_id:= l_line_tbl(l_loop_index).line_id;
698 OE_ORDER_UTIL.g_line_tbl(l_notify_index).booked_flag:= l_line_tbl(l_loop_index).booked_flag;
699 OE_ORDER_UTIL.g_line_tbl(l_notify_index).flow_status_code:=l_line_tbl(l_loop_index).flow_status_code;
700 OE_ORDER_UTIL.g_line_tbl(l_notify_index).last_updated_by:= l_line_tbl(l_loop_index).last_updated_by;
701 OE_ORDER_UTIL.g_line_tbl(l_notify_index).last_update_login:=l_line_tbl(l_loop_index).last_update_login;
702 OE_ORDER_UTIL.g_line_tbl(l_notify_index).last_update_date:=l_line_tbl(l_loop_index).last_update_date;
703 OE_ORDER_UTIL.g_line_tbl(l_notify_index).lock_control:= l_line_tbl(l_loop_index).lock_control;
704 OE_ORDER_UTIL.g_line_tbl(l_notify_index).operation:=l_line_tbl(l_loop_index).operation;
705
706 IF l_debug_level > 0 THEN
707 oe_debug_pub.add( 'IN BOOKING , AFTER UPDATE LINE GLOBAL PICTURE' ) ;
708 END IF;
709 IF l_debug_level > 0 THEN
710 oe_debug_pub.add( 'GLOBAL LINE BOOKED_FLAG IS: ' || OE_ORDER_UTIL.G_LINE_TBL ( L_NOTIFY_INDEX ) .BOOKED_FLAG , 1 ) ;
711 END IF;
712 IF l_debug_level > 0 THEN
713 oe_debug_pub.add( 'GLOBAL LINE FLOW_STATUS_CODE IS: ' || OE_ORDER_UTIL.G_LINE_TBL ( L_NOTIFY_INDEX ) .FLOW_STATUS_CODE , 1 ) ;
714 END IF;
715 IF l_debug_level > 0 THEN
716 oe_debug_pub.add( 'GLOBAL OLD LINE BOOKED_FLAG IS: ' || OE_ORDER_UTIL.G_OLD_LINE_TBL ( L_NOTIFY_INDEX ) .BOOKED_FLAG , 1 ) ;
717 END IF;
718 IF l_debug_level > 0 THEN
719 oe_debug_pub.add( 'GLOBAL LINE OPERATION IS: ' || OE_ORDER_UTIL.G_LINE_TBL ( L_NOTIFY_INDEX ) .OPERATION , 1 ) ;
720 END IF;
721 END IF ; /* global entity index null check */
722
723 -- bug 2821129
724
725 oe_debug_pub.add('p_header_id is '|| p_header_id);
726 oe_debug_pub.add('line_id is '|| l_line_tbl(l_loop_index).line_id);
727
728 oe_debug_pub.add('in OEXUBOKB start g line adj tbl count is '|| OE_ORDER_UTIL.g_line_adj_tbl.count);
729
730 OE_LINE_ADJ_UTIL.Query_Rows
731 (
732 p_line_id => l_line_tbl(l_loop_index).line_id
733 ,p_header_id => p_header_id
734 ,x_Line_Adj_Tbl => l_line_adj_tbl);
735
736
737 oe_debug_pub.add('in OEXUBOKB line adj tbl count from query row is '|| l_line_adj_tbl.count);
738
739
740 l_in_loop_index := l_line_adj_tbl.FIRST;
741
742 While l_in_loop_index is not NULL LOOP
743
744 OE_ORDER_UTIL.Update_Global_Picture
745 (p_Upd_New_Rec_If_Exists =>FALSE
746 , p_line_adj_id => l_line_adj_tbl(l_in_loop_index).price_adjustment_id
747 , x_index => l_notify_index
748 , x_return_status => l_return_status);
749
750 OE_ORDER_UTIL.g_line_adj_tbl(l_notify_index) := l_line_adj_tbl(l_in_loop_index);
751 OE_ORDER_UTIL.g_line_adj_tbl(l_notify_index).operation := OE_GLOBALS.G_OPR_CREATE;
752 oe_debug_pub.add('in OEXUBOKB after insert into global table, line_id is ' || OE_ORDER_UTIL.g_line_adj_tbl(l_notify_index).line_id);
753 oe_debug_pub.add('in OEXUBOKB after insert into global table, operation is ' || OE_ORDER_UTIL.g_line_adj_tbl(l_notify_index).operation);
754
755 l_in_loop_index := l_line_adj_tbl.NEXT(l_in_loop_index);
756
757 END LOOP;
758
759 oe_debug_pub.add('in OEXUBOKB at end g line adj tbl count is '|| OE_ORDER_UTIL.g_line_adj_tbl.count);
760
761 l_loop_index := l_line_tbl.NEXT(l_loop_index);
762
763 END LOOP outer; -- over each line to update global picture
764
765 -- notification framework end
766 -- no need to call process_requests_and_notify in new framework
767
768 ELSE -- ASO or EC are installed and we are using the old framework
769
770 -- Process request is set to FALSE here but this api will
771 -- be again called with process_requests = TRUE at the end
772 -- of the main Book_Order procedure. This will take care of
773 -- executing the tax requests that may have been logged in
774 -- this procedure.
775 OE_Order_PVT.Process_Requests_And_Notify
776 ( p_process_requests => FALSE
777 , p_notify => l_notify
778 , x_return_status => l_return_status
779 , p_header_rec => l_header_rec
780 , p_old_header_rec => l_old_header_rec
781 , p_line_tbl => l_line_tbl
782 , p_old_line_tbl => l_old_line_tbl
783 );
784
785 -- renga -end change for tax calculation event enhancement
786
787 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
788 RAISE FND_API.G_EXC_ERROR;
789 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
790 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
791 END IF;
792
793 END IF; /* code set is pack H or higher */
794 /* jolin end*/
795
796 END IF; -- ASO or EC are installed
797
798 /* Call the pricing event in the end after all the processing */
799
800 -- Evaluate the BOOK event for pricing
801 -- Call Pricing only if there are active phases in BOOK event.
802
803 IF l_active_phase_count > 0 THEN
804 -- Added debug for bug 13435459
805 IF l_debug_level > 0 THEN
806 oe_debug_pub.add( 'AFTER PRICING BOOK EVENT', 0.5) ;
807 END IF;
808
809 Pricing_Book_Event(p_x_line_tbl => l_line_tbl
810 , p_header_id => p_header_id
811 , x_return_status => l_return_status
812 );
813 -- Added debug for bug 13435459
814 IF l_debug_level > 0 THEN
815 oe_debug_pub.add( 'AFTER PRICING BOOK EVENT', 0.5) ;
816 END IF;
817 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
818 RAISE FND_API.G_EXC_ERROR;
819 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
820 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
821 END IF;
822 END IF;
823
824 IF OE_FEATURES_PVT.Is_Margin_Avail THEN
825 --Evaluate margin hold;
826 Oe_Margin_Pvt.Margin_Hold(p_header_id);
827 END IF;
828 -- Added debug for bug 13435459
829 IF l_debug_level > 0 THEN
830 oe_debug_pub.add( 'EXITING UPDATE_BOOKED_FLAG', 0.5) ;
831 END IF;
832 EXCEPTION
833 WHEN FND_API.G_EXC_ERROR THEN
834 x_return_status := FND_API.G_RET_STS_ERROR;
835 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
836 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
837 WHEN OTHERS THEN
838 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
839 IF FND_MSG_PUB.Check_Msg_Level
840 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
841 THEN
842 OE_MSG_PUB.Add_Exc_Msg
843 ( G_PKG_NAME
844 , 'Update_Booked_Flag'
845 );
846 END IF;
847 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
848 END Update_Booked_Flag;
849
850 PROCEDURE Verify_Payment_AT_Booking
851 ( p_header_id IN NUMBER
852 , x_return_status OUT NOCOPY VARCHAR2
853
854 )
855 IS
856 l_msg_count NUMBER;
857 l_msg_data VARCHAR2(2000);
858 --
859 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
860 --
861 BEGIN
862
863 -- If Payment Verification Fails then the Order is
864 -- Automatically Put on a Credit Checking Hold or
865 -- a Credit Card Processing Hold.
866 IF l_debug_level > 0 THEN
867 oe_debug_pub.add( 'BEFORE CALLING VERIFY PAYMENT' ) ;
868 END IF;
869 --
870 OE_Verify_Payment_PUB.Verify_Payment
871 ( p_header_id => p_header_id
872 , p_calling_action => 'BOOKING'
873 , p_msg_count => l_msg_count
874 , p_msg_data => l_msg_data
875 , p_return_status => x_return_status
876 );
877
878 EXCEPTION
879 WHEN OTHERS THEN
880 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
881 IF FND_MSG_PUB.Check_Msg_Level
882 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
883 THEN
884 OE_MSG_PUB.Add_Exc_Msg
885 ( G_PKG_NAME
886 , 'Verify_Payment_AT_Booking'
887 );
888 END IF;
889 END Verify_Payment_AT_Booking;
890
891 PROCEDURE Validate_Sales_Credits
892 ( p_header_id IN NUMBER
893 , x_return_status OUT NOCOPY VARCHAR2
894
895 )
896 IS
897 l_return_status VARCHAR2(30);
898 h_return_status VARCHAR2(30);
899 --
900 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
901 --
902 --FP bug 3872166
903 CURSOR line_ids(p_header_id IN NUMBER) IS
904 SELECT line_id
905 FROM oe_order_lines_all
906 WHERE header_id = p_header_id;
907 BEGIN
908 IF l_debug_level > 0 THEN
909 oe_debug_pub.add('Entering Oe_Order_Book_Util.Validate_sales_Credits' ) ;
910 END IF;
911
912 h_return_status := FND_API.G_RET_STS_SUCCESS;
913 -- Validate Header Sales Credits
914 OE_Validate_Header_Scredit.Validate_HSC_TOTAL_FOR_BK
915 ( p_header_id => p_header_id
916 , x_return_status => x_return_status );
917
918 IF l_debug_level > 0 THEN
919 oe_debug_pub.add( 'RETURN STATUS AFTER HSC:'||X_RETURN_STATUS ) ;
920 END IF;
921
922 -- FP bug 4697708
923 -- h_return_status := x_return_status;
924 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
925 h_return_status := x_return_status;
926 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
927 RETURN;
928 END IF;
929
930
931 l_return_status := FND_API.G_RET_STS_SUCCESS;
932
933 -- commented out for FP 4697708
934 /*
935 -- IF added for nocopy analysis
936 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
937 x_return_status := FND_API.G_RET_STS_ERROR;
938 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
939 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
940 RETURN ;
941 ELSE
942 x_return_status := FND_API.G_RET_STS_SUCCESS;
943 END IF;
944 */
945
946 --FP bug 3872166 start
947 FOR l_line_id IN line_ids(p_header_id) LOOP
948 OE_Validate_Line_Scredit.Validate_LSC_QUOTA_TOTAL
949 ( x_return_status => x_return_status
950 ,p_line_id => l_line_id.line_id);
951
952 IF l_debug_level > 0 THEN
953 oe_debug_pub.add( 'RETURN STATUS AFTER LSC FOR LINE '||l_line_id.line_id|| 'IS '||X_RETURN_STATUS ) ;
954 END IF;
955
956 -- FP bug 4697708
957 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
958 l_return_status := x_return_status;
959 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
960 RETURN;
961 END IF;
962 END LOOP;
963 --FP bug 3872166 end
964
965 IF l_debug_level > 0 THEN
966 oe_debug_pub.add( 'RETURN STATUS AFTER LSC:'||L_RETURN_STATUS ) ;
967 END IF;
968
969 -- FP bug 4697708
970 /*
971 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
972 l_return_status := x_return_status;
973 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
974 -- x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
975 RETURN;
976 ELSE -- nocopy analysis
977 l_return_status := FND_API.G_RET_STS_SUCCESS;
978 END IF;
979 */
980
981 IF h_return_status = FND_API.G_RET_STS_ERROR OR l_return_status = FND_API.G_RET_STS_ERROR THEN
982 x_return_status := FND_API.G_RET_STS_ERROR;
983 ELSIF h_return_status = FND_API.G_RET_STS_UNEXP_ERROR OR l_return_status
984 = FND_API.G_RET_STS_UNEXP_ERROR THEN
985 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
986 ELSE
987 x_return_status := FND_API.G_RET_STS_SUCCESS;
988 END IF;
989
990 IF l_debug_level > 0 THEN
991 oe_debug_pub.add('Exiting Oe_Order_Book_Util.Validate_sales_Credits: '||x_return_status ) ;
992 END IF;
993
994 EXCEPTION
995 WHEN OTHERS THEN
996 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
997 IF FND_MSG_PUB.Check_Msg_Level
998 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
999 THEN
1000 OE_MSG_PUB.Add_Exc_Msg
1001 ( G_PKG_NAME
1002 , 'Validate_Sales_Credits'
1003 );
1004 END IF;
1005 END Validate_Sales_Credits;
1006
1007
1008 /* PUBLIC PROCEDURES */
1009
1010 ---------------------------------------------------------------
1011 PROCEDURE Check_Booking_Holds
1012 (p_header_id IN NUMBER
1013 ,x_return_status OUT NOCOPY VARCHAR2
1014
1015 )
1016 IS
1017 l_check_holds_result VARCHAR2(30);
1018 l_msg_count NUMBER;
1019 l_msg_data VARCHAR2(2000);
1020 l_dummy VARCHAR2(30);
1021 p_hold_rec OE_HOLDS_PUB.any_line_hold_rec;
1022
1023 --
1024 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1025 --
1026 BEGIN
1027
1028 IF l_debug_level > 0 THEN
1029 oe_debug_pub.add( 'ENTER OE_ORDER_BOOK_UTIL.CHECK_BOOKING_HOLDS' , 1 ) ;
1030 END IF;
1031
1032 -- Check if there are any generic or Booking holds
1033
1034 -- Fix bug
1035 -- Removed p_entity_id parameter
1036 OE_HOLDS_PUB.Check_Holds
1037 (p_api_version => 1.0
1038 ,p_header_id => p_header_id
1039 ,p_wf_item => 'OEOH'
1040 ,p_wf_activity => 'BOOK_ORDER'
1041 ,x_result_out => l_check_holds_result
1042 ,x_return_status => x_return_status
1043 ,x_msg_count => l_msg_count
1044 ,x_msg_data => l_msg_data
1045 );
1046
1047
1048 IF ( x_return_status = FND_API.G_RET_STS_SUCCESS AND
1049 l_check_holds_result = FND_API.G_TRUE )
1050 THEN
1051 FND_MESSAGE.SET_NAME('ONT','OE_BOOKING_HOLD_EXISTS');
1052 OE_MSG_PUB.ADD;
1053 x_return_status := FND_API.G_RET_STS_ERROR;
1054 /* Changes for bug#2673236:Begin */
1055 ELSIF (x_return_status = FND_API.G_RET_STS_SUCCESS AND
1056 l_check_holds_result = FND_API.G_FALSE )
1057 THEN
1058 IF nvl(fnd_profile.value('ONT_PREVENT_BOOKING'),'N')='Y' THEN
1059 IF l_debug_level > 0 THEN
1060 oe_debug_pub.add( 'Profile ont_prevent_booking is set' , 1 ) ;
1061 END IF;
1062
1063 BEGIN
1064 SELECT
1065 'EXISTS' INTO l_dummy
1066 FROM oe_order_lines_all
1067 WHERE header_id = p_header_id and
1068 ROWNUM = 1;
1069
1070 IF sql%found THEN
1071 p_hold_rec.header_id := p_header_id;
1072 p_hold_rec.wf_item_type := 'OEOH';
1073 p_hold_rec.wf_activity_name := 'BOOK_ORDER';
1074
1075 IF l_debug_level > 0 THEN
1076 oe_debug_pub.add( 'Before calling Check_Any_Line_Hold' , 1 ) ;
1077 END IF;
1078
1079 OE_HOLDS_PUB.Check_Any_Line_Hold
1080 (x_hold_rec => p_hold_rec
1081 ,x_return_status => x_return_status
1082 ,x_msg_count => l_msg_count
1083 ,x_msg_data => l_msg_data
1084 );
1085
1086
1087 IF ( x_return_status = FND_API.G_RET_STS_SUCCESS AND
1088 p_hold_rec.x_result_out = FND_API.G_TRUE )
1089 THEN
1090 FND_MESSAGE.SET_NAME('ONT','OE_BOOKING_HOLD_EXISTS');
1091 OE_MSG_PUB.ADD;
1092 x_return_status := FND_API.G_RET_STS_ERROR;
1093 END IF;
1094 END IF;
1095 EXCEPTION
1096 WHEN NO_DATA_FOUND THEN
1097 null;
1098 END;
1099 END IF;
1100 END IF;
1101 /* Changes for bug#2673236:End */
1102 IF l_debug_level > 0 THEN
1103 oe_debug_pub.add( 'EXIT OE_ORDER_BOOK_UTIL.CHECK_BOOKING_HOLDS' , 1 ) ;
1104 END IF;
1105
1106 EXCEPTION
1107 WHEN OTHERS THEN
1108 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1109 IF FND_MSG_PUB.Check_Msg_Level
1110 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1111 THEN
1112 OE_MSG_PUB.Add_Exc_Msg
1113 ( G_PKG_NAME
1114 , 'Check_Booking_Holds'
1115 );
1116 END IF;
1117 END Check_Booking_Holds;
1118
1119 ---------------------------------------------------------------
1120 PROCEDURE BOOK_ORDER
1121 (p_api_version_number IN NUMBER
1122 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
1123 ,p_header_id IN NUMBER
1124 ,x_return_status OUT NOCOPY VARCHAR2
1125
1126 ,x_msg_count OUT NOCOPY NUMBER
1127
1128 ,x_msg_data OUT NOCOPY VARCHAR2
1129
1130 )
1131 IS
1132 l_api_name CONSTANT VARCHAR2(30) := 'BOOK_ORDER';
1133 l_api_version_number CONSTANT NUMBER := 1.0;
1134 l_return_status VARCHAR2(1);
1135 l_validate_cfg BOOLEAN;
1136 l_freeze_inc_items BOOLEAN;
1137 --
1138 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1139 --
1140
1141 l_msg_count NUMBER;
1142 l_msg_data VARCHAR2(2000);
1143 l_count NUMBER;
1144
1145 l_qa_return_status VARCHAR2(1);
1146
1147
1148 BEGIN
1149 IF l_debug_level > 0 THEN
1150 oe_debug_pub.add( 'ENTER OE_ORDER_BOOK.BOOK_ORDER',0.5 ) ; -- debug level 0.5 added for bug 13435459
1151 END IF;
1152
1153 SAVEPOINT BOOK_ORDER;
1154
1155 -- Initialize API return status to success
1156 x_return_status := FND_API.G_RET_STS_SUCCESS;
1157
1158 -- Standard call to check for call compatibility
1159
1160 IF NOT FND_API.Compatible_API_Call
1161 ( l_api_version_number
1162 , p_api_version_number
1163 , l_api_name
1164 , G_PKG_NAME
1165 )
1166 THEN
1167 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1168 END IF;
1169
1170 -- Initialize message list.
1171
1172 IF FND_API.to_Boolean(p_init_msg_list) THEN
1173 OE_MSG_PUB.initialize;
1174 END IF;
1175
1176
1177 -- Validate if revenue sales credits on the header and on each line
1178 -- add upto 100%. There is no check for error after this as all the
1179 -- order validation feedback should be given together. The check
1180 -- for error is therefore, after the next call which would validate
1181 -- the header and the lines
1182
1183 Validate_Sales_Credits
1184 ( p_header_id => p_header_id
1185 , x_return_status => l_return_status
1186 );
1187
1188 IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510' THEN
1189 OE_Header_Scredit_Util.Redefault_Sales_Group(p_header_id=>p_header_id,
1190 p_date=> nvl(OE_ORDER_UTIL.g_header_rec.booked_date,SYSDATE));
1191 END IF;
1192
1193 -- if unexpected error, then go to exception handler. If there
1194 -- were validation failures, then it is expected error therefore
1195 -- go to order and line validation and then raise error.
1196 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1197 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1198 END IF;
1199
1200 IF l_debug_level > 0 THEN
1201 oe_debug_pub.add( 'RETURN STATUS AFTER SALES CREDITS:'||L_RETURN_STATUS ) ;
1202 END IF;
1203
1204 -- Call process order to update the booked_flag on header and
1205 -- on all the order lines. This will also check for all the fields
1206 -- that are required on the order and the lines at booking
1207
1208 Update_Booked_Flag(p_header_id => p_header_id
1209 , x_validate_cfg => l_validate_cfg
1210 , x_freeze_inc_items => l_freeze_inc_items
1211 , x_return_status => x_return_status
1212 );
1213
1214 IF l_debug_level > 0 THEN
1215 oe_debug_pub.add( 'RETURN STATUS AFTER UPDATE BOOKED:'||X_RETURN_STATUS ) ;
1216 END IF;
1217
1218 -- if failure during validate sales credits OR during order and
1219 -- line validation, raise error
1220 IF (x_return_status = FND_API.G_RET_STS_ERROR OR
1221 l_return_status = FND_API.G_RET_STS_ERROR ) THEN
1222 RAISE FND_API.G_EXC_ERROR;
1223 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1224 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1225 END IF;
1226
1227
1228 -- Validate configurations, if any, in this order
1229 IF (l_validate_cfg) THEN
1230 -- Added debug for bug 13435459
1231 IF l_debug_level > 0 THEN
1232 oe_debug_pub.add( 'BEFORE VALIDATE CFGS', 0.5) ;
1233 END IF;
1234
1235 l_return_status := OE_Config_Util.Validate_Cfgs_In_Order
1236 (p_header_id => p_header_id);
1237 IF l_debug_level > 0 THEN
1238 oe_debug_pub.add( 'RETURN STATUS AFTER VALIDATE CFGS:'||L_RETURN_STATUS,0.5 ) ; -- debug level 0.5 added for bug 13435459
1239 END IF;
1240
1241 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
1242 RAISE FND_API.G_EXC_ERROR;
1243 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1244 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1245 END IF;
1246
1247 END IF;
1248
1249
1250 -- Freeze included items, if any, for this order
1251 IF (l_freeze_inc_items
1252 AND FND_PROFILE.VALUE('ONT_INCLUDED_ITEM_FREEZE_METHOD') =
1253 OE_GLOBALS.G_IIFM_BOOKING )
1254 THEN
1255 -- Added debug for bug 13435459
1256 IF l_debug_level > 0 THEN
1257 oe_debug_pub.add( 'BEFORE FREEZE INC', 0.5) ;
1258 END IF;
1259
1260 l_return_status := OE_Config_Util.Freeze_Inc_Items_For_Order
1261 (p_header_id => p_header_id);
1262
1263 IF l_debug_level > 0 THEN
1264 oe_debug_pub.add( 'RETURN STATUS AFTER FREEZE INC:'||L_RETURN_STATUS,0.5 ) ; -- debug level 0.5 added for bug 13435459
1265 END IF;
1266
1267 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
1268 RAISE FND_API.G_EXC_ERROR;
1269 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1270 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1271 END IF;
1272
1273 END IF;
1274
1275
1276 -- Execute any delayed requests and flow starts
1277 -- Will also take care of executing other delayed requests like
1278 -- tax which may have been logged in update_booked_flag and
1279 -- other procedures called by book_order.
1280 -- NOTE: This should be executed before verify payment call
1281 -- as credit check needs to look at the updated tax amounts.
1282
1283 OE_Order_PVT.Process_Requests_And_Notify
1284 ( p_process_requests => TRUE
1285 , p_notify => FALSE
1286 , x_return_status => l_return_status
1287 );
1288
1289 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
1290 RAISE FND_API.G_EXC_ERROR;
1291 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1292 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1293 END IF;
1294
1295
1296 -- ABH
1297 -- run QA for current order
1298 IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110510' THEN
1299
1300
1301 /****************************************************
1302 l_header_id_char := TO_CHAR(p_header_id);
1303 --This procedure would return status of FND_API.G_RET_STS_SUCCESS only if the order passed QA check
1304 QA_Order(
1305 p_api_version_number => 1.0,
1306 p_init_msg_list => 'T',
1307 p_header_id_list => l_header_id_char,
1308 p_header_count => l_count,
1309 x_error_count => l_error_count,
1310 x_return_status => l_return_status,
1311 x_msg_count => l_msg_count,
1312 x_msg_data => l_msg_data
1313 );
1314
1315 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
1316 RAISE FND_API.G_EXC_ERROR;
1317 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1318 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1319 END IF;
1320 ****************************************************/
1321
1322 --Check for licensing
1323 IF OE_Contracts_util.check_license() <> 'Y' THEN
1324 IF l_debug_level > 0 THEN
1325 oe_debug_pub.add('Contractual option not licensed, hence not performing article QA ', 3);
1326 END IF;
1327 ELSE
1328
1329
1330 OE_CONTRACTS_UTIL.qa_articles (
1331 p_api_version => 1.0,
1332 p_doc_type => OE_CONTRACTS_UTIL.G_SO_DOC_TYPE,
1333 p_doc_id => p_header_id,
1334 x_qa_return_status => l_qa_return_status,
1335 x_return_status => l_return_status,
1336 x_msg_count => l_msg_count,
1337 x_msg_data => l_msg_data);
1338
1339
1340 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
1341
1342 IF l_qa_return_status = FND_API.G_RET_STS_ERROR THEN
1343 RAISE FND_API.G_EXC_ERROR;
1344 ELSIF l_qa_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1345 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1346 END IF;
1347
1348 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1349 RAISE FND_API.G_EXC_ERROR;
1350 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1351 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1352 END IF;
1353
1354
1355 END IF;
1356
1357
1358 END IF;
1359 -- ABH
1360
1361 -- From Order Import we will make a call to Verfify Payment, only after committing the data.
1362 -- The call to Verify Payment from Booking code is suppressed for Order Import flow.
1363 -- This change is only for Verify Payment call that is triggered as part of Booking.
1364 IF NOT OE_GLOBALS.G_ORDER_IMPORT_CALL THEN -- Bug 7367433
1365
1366 -- Payment Verification is done at the end of booking
1367 -- because it is an expensive operation.
1368
1369 --R12 CVV2
1370 IF nvl(OE_GLOBALS.G_PAYMENT_PROCESSED, 'N') <> 'Y' THEN
1371 -- Added debug for bug 13435459
1372 IF l_debug_level > 0 THEN
1373 oe_debug_pub.add( 'BEFORE VERIFY PAYMENT', 0.5) ;
1374 END IF;
1375 Verify_Payment_AT_Booking
1376 (p_header_id => p_header_id
1377 , x_return_status => l_return_status
1378 );
1379 -- Added debug for bug 13435459
1380 IF l_debug_level > 0 THEN
1381 oe_debug_pub.add( 'AFTER VERIFY PAYMENT', 0.5) ;
1382 END IF;
1383 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
1384 RAISE FND_API.G_EXC_ERROR;
1385 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1386 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1387 END IF;
1388 END IF;
1389 ELSE
1390 IF nvl(OE_GLOBALS.G_PAYMENT_PROCESSED, 'N') <> 'Y' THEN
1391 OE_GLOBALS.G_PAYMENT_PROCESSED := 'O';
1392 END IF;
1393 END IF; -- Bug 7367433
1394
1395 OE_MSG_PUB.Count_And_Get
1396 ( p_count => x_msg_count
1397 , p_data => x_msg_data
1398 );
1399
1400 IF l_debug_level > 0 THEN
1401 oe_debug_pub.add( 'EXIT OE_ORDER_BOOK.BOOK_ORDER' , 0.5 ) ; -- debug level changed to 0.5 for bug 13435459
1402 END IF;
1403
1404 EXCEPTION
1405 -- Bug 2285308: Clear Delayed Requests when there is an error.
1406 -- Pricing/Inc Item Explosion API calls can log delayed requests but
1407 -- execution of requests is only towards the end, just before Verify_Payments.
1408 -- If there is an error in between logging and execution of requests,
1409 -- requests were not cleared from the cache earlier resulting
1410 -- in bugs like 2285308.
1411 WHEN FND_API.G_EXC_ERROR THEN
1412 IF l_debug_level > 0 THEN
1413 oe_debug_pub.add( 'EXP. ERROR IN OE_ORDER_BOOK.BOOK_ORDER' , 0.5 ) ; -- debug level changed to 0.5 for bug 13435459
1414 END IF;
1415 x_return_status := FND_API.G_RET_STS_ERROR;
1416 OE_Delayed_Requests_PVT.Clear_Request(l_return_status);
1417 OE_MSG_PUB.Count_And_Get
1418 ( p_count => x_msg_count
1419 , p_data => x_msg_data
1420 );
1421 ROLLBACK TO BOOK_ORDER;
1422 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1423 IF l_debug_level > 0 THEN
1424 oe_debug_pub.add( 'UNEXP. ERROR IN OE_ORDER_BOOK.BOOK_ORDER' ,0.5 ) ; -- debug level changed to 0.5 for bug 13435459
1425 END IF;
1426 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1427 OE_Delayed_Requests_PVT.Clear_Request(l_return_status);
1428 OE_MSG_PUB.Count_And_Get
1429 ( p_count => x_msg_count
1430 , p_data => x_msg_data
1431 );
1432 ROLLBACK TO BOOK_ORDER;
1433 WHEN OTHERS THEN
1434 IF l_debug_level > 0 THEN
1435 oe_debug_pub.add( 'OTHERS ERROR IN OE_ORDER_BOOK.BOOK_ORDER' , 0.5 ) ; -- debug level changed to 0.5 for bug 13435459
1436 END IF;
1437 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1438 OE_Delayed_Requests_PVT.Clear_Request(l_return_status);
1439 IF FND_MSG_PUB.Check_Msg_Level
1440 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1441 THEN
1442 OE_MSG_PUB.Add_Exc_Msg
1443 ( G_PKG_NAME
1444 , l_api_name
1445 );
1446 END IF;
1447 OE_MSG_PUB.Count_And_Get
1448 ( p_count => x_msg_count
1449 , p_data => x_msg_data
1450 );
1451 ROLLBACK TO BOOK_ORDER;
1452 END BOOK_ORDER;
1453
1454
1455 -- Complete_Book_Eligible
1456 -- Checks if the order is eligible for booking and if not, populates
1457 -- an error message and returns an expected error status.
1458 -- If it is eligible, it progresses the order workflow to complete
1459 -- the booking process.
1460 -- If booking has been deferred, then it informs the caller by
1461 -- adding a message to the stack.
1462 ---------------------------------------------------------------------
1463 PROCEDURE Complete_Book_Eligible
1464 (p_api_version_number IN NUMBER
1465 , p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
1466 , p_header_id IN NUMBER
1467 , x_return_status OUT NOCOPY VARCHAR2
1468
1469 , x_msg_count OUT NOCOPY NUMBER
1470
1471 , x_msg_data OUT NOCOPY VARCHAR2
1472
1473 )
1474 IS
1475 l_api_name CONSTANT VARCHAR2(30) := 'COMPLETE_BOOK_ELIGIBLE';
1476 l_api_version_number CONSTANT NUMBER := 1.0;
1477 l_itemkey VARCHAR2(30);
1478 l_booked_flag VARCHAR2(1);
1479 l_book_eligible VARCHAR2(1);
1480 l_booking_errored_flag VARCHAR2(1);
1481 l_order_source_id NUMBER;
1482 l_orig_sys_document_ref VARCHAR2(50);
1483 l_change_sequence VARCHAR2(50);
1484 l_source_document_type_id NUMBER;
1485 l_source_document_id NUMBER;
1486 l_event_name VARCHAR2(100); -- added for 13536089
1487 l_nameVal_tbl OE_ORDER_UTIL.nameVal_Tbl_Type; -- added for 13536089
1488 l_count NUMBER; -- added for 13536089
1489 l_flow_status_code VARCHAR2(100); --added for 13536089. modified for 14352532
1490 CURSOR book_eligible IS
1491 SELECT 'Y'
1492 FROM WF_ITEM_ACTIVITY_STATUSES WIAS
1493 , WF_PROCESS_ACTIVITIES WPA
1494 WHERE WIAS.item_type = 'OEOH'
1495 AND WIAS.item_key = l_itemkey
1496 AND WIAS.activity_status = 'NOTIFIED'
1497 AND WPA.activity_name = 'BOOK_ELIGIBLE'
1498 AND WPA.instance_id = WIAS.process_activity;
1499 --For bug 3493374
1500 CURSOR booking_errored IS
1501 SELECT 'Y'
1502 FROM WF_ITEM_ACTIVITY_STATUSES WIAS
1503 , WF_PROCESS_ACTIVITIES WPA
1504 WHERE WIAS.item_type = 'OEOH'
1505 AND WIAS.item_key = l_itemkey
1506 AND WIAS.activity_status = 'ERROR'
1507 AND WPA.activity_name = 'BOOK_ORDER'
1508 AND WPA.instance_id = WIAS.process_activity;
1509 --
1510 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1511 --
1512 BEGIN
1513 IF l_debug_level > 0 THEN
1514 oe_debug_pub.add( 'ENTER OE_ORDER_BOOK.COMPLETE_BOOK_ELIGIBLE' , 1 ) ;
1515 END IF;
1516
1517 -- Initialize API return status to success
1518 x_return_status := FND_API.G_RET_STS_SUCCESS;
1519
1520 -- Standard call to check for call compatibility
1521
1522 IF NOT FND_API.Compatible_API_Call
1523 ( l_api_version_number
1524 , p_api_version_number
1525 , l_api_name
1526 , G_PKG_NAME
1527 )
1528 THEN
1529 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1530 END IF;
1531
1532 -- Initialize message list.
1533
1534 IF FND_API.to_Boolean(p_init_msg_list) THEN
1535 OE_MSG_PUB.initialize;
1536 END IF;
1537 -- modified the following query to fetch flow_status_code for 13536089
1538 SELECT order_source_id, orig_sys_document_ref, change_sequence, source_document_type_id, source_document_id,flow_status_code
1539 INTO l_order_source_id, l_orig_sys_document_ref, l_change_sequence, l_source_document_type_id, l_source_document_id,l_flow_status_code
1540 FROM OE_ORDER_HEADERS_ALL
1541 WHERE HEADER_ID = p_header_id;
1542
1543 OE_MSG_PUB.set_msg_context(
1544 p_entity_code => 'HEADER'
1545 ,p_entity_id => p_header_id
1546 ,p_header_id => p_header_id
1547 ,p_line_id => null
1548 ,p_order_source_id => l_order_source_id
1549 ,p_orig_sys_document_ref => l_orig_sys_document_ref
1550 ,p_orig_sys_document_line_ref => null
1551 ,p_change_sequence => l_change_sequence
1552 ,p_source_document_type_id => l_source_document_type_id
1553 ,p_source_document_id => l_source_document_id
1554 ,p_source_document_line_id => null );
1555
1556 l_itemkey := to_char(p_header_id);
1557
1558 -- Check if for this header, the BOOK_ELIGIBLE activity is in a
1559 -- notified state
1560
1561 IF l_debug_level > 0 THEN
1562 oe_debug_pub.add( 'OPEN BOOK_ELIGIBLE' ) ;
1563 END IF;
1564 OPEN book_eligible;
1565 FETCH book_eligible INTO l_book_eligible;
1566
1567 IF (book_eligible%NOTFOUND) THEN
1568 IF l_debug_level > 0 THEN
1569 oe_debug_pub.add( 'BOOKING NOT ELIGIBLE' ) ;
1570 END IF;
1571
1572 -- Booking could be a high cost activity and could have been deferred
1573 -- due to a prior request. If the activity is in a deferred status,
1574 -- then inform the user.
1575
1576 IF BookingIsDeferred(l_itemkey)
1577 THEN
1578
1579 OE_MSG_PUB.Count_And_Get
1580 ( p_count => x_msg_count
1581 , p_data => x_msg_data
1582 );
1583 CLOSE book_eligible;
1584 RETURN;
1585 --For bug 3493374.Booking errored out
1586 ELSE
1587 OPEN booking_errored;
1588 FETCH booking_errored INTO l_booking_errored_flag;
1589 IF (booking_errored%FOUND)
1590 THEN
1591 FND_MESSAGE.SET_NAME('ONT','OE_ORDER_BOOK_ERRORED');
1592 OE_MSG_PUB.ADD;
1593 RAISE FND_API.G_EXC_ERROR;
1594 -- Else the order is NOT eligible for booking: raise an error.
1595 ELSE
1596 FND_MESSAGE.SET_NAME('ONT','OE_ORDER_NOT_BOOK_ELIGIBLE');
1597 OE_MSG_PUB.ADD;
1598 RAISE FND_API.G_EXC_ERROR;
1599 END IF;
1600 CLOSE booking_errored;
1601 END IF;
1602 END IF;
1603
1604 CLOSE book_eligible;
1605 IF l_debug_level > 0 THEN
1606 oe_debug_pub.add( 'CLOSE BOOK_ELIGIBLE' ) ;
1607 END IF;
1608
1609
1610 -- Lock the order: header, lines , sales credits and price adjustments
1611 -- This will prevent another user from working on the same order
1612 -- and needs to be done before calling the wf_engine as the workflow
1613 -- engine will hang if another user is trying to book the same order
1614
1615 OE_ORDER_UTIL.Lock_Order_Object
1616 (p_header_id => p_header_id
1617 ,x_return_status => x_return_status
1618 );
1619 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1620 RAISE FND_API.G_EXC_ERROR;
1621 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1622 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1623 END IF;
1624
1625 -- Call WF_ENGINE to complete the BOOK_ELIGIBLE activity and proceed
1626 -- to the next activity in the order workflow
1627
1628 BEGIN
1629 WF_ENGINE.CompleteActivityInternalName
1630 ( itemtype => 'OEOH'
1631 , itemkey => l_itemkey
1632 , activity => 'BOOK_ELIGIBLE'
1633 , result => NULL
1634 , raise_engine_exception => TRUE --15870313
1635 );
1636
1637 EXCEPTION
1638 WHEN OTHERS THEN
1639 oe_debug_pub.add('Workflow complete activity failed. Raising');
1640 RAISE ;
1641 END ;
1642
1643 IF l_debug_level > 0 THEN
1644 oe_debug_pub.add( 'AFTER CALLING WF_ENGINE' ) ;
1645 END IF;
1646
1647 -- if order was booked, the flag on the order header would have
1648 -- been updated.
1649
1650 SELECT booked_flag
1651 INTO l_booked_flag
1652 FROM OE_ORDER_HEADERS_ALL
1653 WHERE HEADER_ID = p_header_id;
1654
1655 OE_MSG_PUB.set_msg_context(
1656 p_entity_code => 'HEADER'
1657 ,p_entity_id => p_header_id
1658 ,p_header_id => p_header_id
1659 ,p_line_id => null
1660 ,p_order_source_id => l_order_source_id
1661 ,p_orig_sys_document_ref => l_orig_sys_document_ref
1662 ,p_orig_sys_document_line_ref => null
1663 ,p_change_sequence => l_change_sequence
1664 ,p_source_document_type_id => l_source_document_type_id
1665 ,p_source_document_id => l_source_document_id
1666 ,p_source_document_line_id => null );
1667
1668 -- if order has been booked, inform the user
1669
1670 IF l_booked_flag = 'Y' THEN
1671
1672 FND_MESSAGE.SET_NAME('ONT','OE_ORDER_BOOKED');
1673 OE_MSG_PUB.ADD;
1674
1675 -- if order has NOT been booked, then check if booking has been deferred
1676
1677 ELSE
1678
1679 -- if order is neither booked nor booking has been deferred,
1680 -- then raise an expected error: booking might have failed.
1681 -- Error messages would have been populated in the
1682 -- BOOK_ORDER activity
1683 IF NOT BookingIsDeferred(l_itemkey)
1684 THEN
1685
1686 -- Bug 2437258 - raise error only if order is back at
1687 -- book eligible status. As booking workflows should be
1688 -- defined to transition to book eligible for errors.
1689 -- If it is NOT at book eligible, there was probably a
1690 -- customization between book eligible and book order
1691 -- (e.g. WF approval notification) due to which order
1692 -- did not even reach book order activity.
1693 IF l_debug_level > 0 THEN
1694 oe_debug_pub.add( 'AGAIN OPEN BOOK_ELIGIBLE' ) ;
1695 END IF;
1696 OPEN book_eligible;
1697 FETCH book_eligible INTO l_book_eligible;
1698 /* FOLLOWING CALL TO RAISE_BUSINESS_EVENT IS ADDED TO RAISE BUSINESS EVENT DURING ORDER BOOKING FAILURE.
1699 THESE CHANGES ARE DONE FOR 13536089
1700 */
1701 IF (book_eligible%FOUND) THEN
1702 -- START OF FIX 13536089
1703 If (l_debug_level > 0) THEN
1704 oe_debug_pub.add('Calling Process Failure Event for Booking process for header_id '||p_header_id);
1705 END IF;
1706
1707 l_count := 1;
1708
1709 l_nameVal_tbl(l_count).name := 'PROCESS_NAME';
1710 l_nameVal_tbl(l_count).value := 'BOOK_ORDER';
1711
1712 oe_order_util.raise_business_event( p_header_id => p_header_id,
1713 p_status=>l_flow_status_code,
1714 p_event_name => 'oracle.apps.ont.oip.processfailure.update',
1715 p_nameVal_tbl => l_nameVal_tbl);
1716 -- END OF FIX 13536089
1717 RAISE FND_API.G_EXC_ERROR;
1718 END IF;
1719 CLOSE book_eligible;
1720
1721 END IF;
1722
1723 END IF;
1724
1725 OE_MSG_PUB.Count_And_Get
1726 ( p_count => x_msg_count
1727 , p_data => x_msg_data
1728 );
1729
1730 OE_MSG_PUB.Reset_Msg_Context(p_entity_code => 'HEADER');
1731
1732 IF l_debug_level > 0 THEN
1733 oe_debug_pub.add( 'EXIT OE_ORDER_BOOK.COMPLETE_BOOK_ELIGIBLE' , 1 ) ;
1734 END IF;
1735
1736 EXCEPTION
1737 WHEN FND_API.G_EXC_ERROR THEN
1738 x_return_status := FND_API.G_RET_STS_ERROR;
1739 IF (book_eligible%ISOPEN) THEN
1740 CLOSE book_eligible;
1741 END IF;
1742 OE_MSG_PUB.Count_And_Get
1743 ( p_count => x_msg_count
1744 , p_data => x_msg_data
1745 );
1746 OE_MSG_PUB.Reset_Msg_Context(p_entity_code => 'HEADER');
1747 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1748 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1749 IF (book_eligible%ISOPEN) THEN
1750 CLOSE book_eligible;
1751 END IF;
1752 OE_MSG_PUB.Count_And_Get
1753 ( p_count => x_msg_count
1754 , p_data => x_msg_data
1755 );
1756 OE_MSG_PUB.Reset_Msg_Context(p_entity_code => 'HEADER');
1757 WHEN OTHERS THEN
1758 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1759 IF (book_eligible%ISOPEN) THEN
1760 CLOSE book_eligible;
1761 END IF;
1762 IF OE_MSG_PUB.Check_Msg_Level
1763 (OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1764 THEN
1765 OE_MSG_PUB.Add_Exc_Msg
1766 ( G_PKG_NAME
1767 , l_api_name
1768 );
1769 END IF;
1770 OE_MSG_PUB.Count_And_Get
1771 ( p_count => x_msg_count
1772 , p_data => x_msg_data
1773 );
1774 OE_MSG_PUB.Reset_Msg_Context(p_entity_code => 'HEADER');
1775
1776 END Complete_Book_Eligible;
1777
1778
1779 -- PROCEDURE Book_Multiple_Orders
1780 -- This procedure accepts a list of header IDs in a string separated
1781 -- by commas (e.g. 1234,3567.8945) and the number of orders
1782 -- (p_header_count) to be booked.
1783 -- And it progresses each order through the booking activity in its
1784 -- workflow by calling complete_book_eligible.
1785 -- The return status is SUCCESS only if all orders are processed
1786 -- successfully.
1787 -- The number of orders that are processed with errors can be retrieved
1788 -- from the OUT variable, x_error_count.
1789 -- Called from the form package OE_ORDER_CONTROL.Book_Order_Button
1790 -- for booking multi_selected orders.
1791 ---------------------------------------------------------------------
1792 PROCEDURE Book_Multiple_Orders
1793 (p_api_version_number IN NUMBER
1794 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
1795 ,p_header_id_list IN OE_GLOBALS.Selected_Record_Tbl
1796 ,p_header_count IN NUMBER
1797 ,x_error_count OUT NOCOPY NUMBER
1798
1799 ,x_return_status OUT NOCOPY VARCHAR2
1800
1801 ,x_msg_count OUT NOCOPY NUMBER
1802
1803 ,x_msg_data OUT NOCOPY VARCHAR2
1804
1805 )
1806 IS
1807 l_api_name CONSTANT VARCHAR2(30) := 'BOOK_MULTIPLE_ORDERS';
1808 l_api_version_number CONSTANT NUMBER := 1.0;
1809 l_header_id NUMBER;
1810 l_Transaction_Phase_Code VARCHAR2(30);
1811 l_msg_count NUMBER;
1812 l_msg_data VARCHAR2(2000);
1813 I NUMBER;
1814 initial NUMBER;
1815 nextpos NUMBER;
1816 l_return_status VARCHAR2(30);
1817 l_orgid number;
1818 --
1819 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1820 --
1821 BEGIN
1822 IF l_debug_level > 0 THEN
1823 oe_debug_pub.add( 'ENTER OE_ORDER_BOOK.BOOK_MULTIPLE_ORDERS' , 1 ) ;
1824 END IF;
1825
1826 -- Initialize API return status to success
1827 x_return_status := FND_API.G_RET_STS_SUCCESS;
1828 x_error_count := 0;
1829
1830 -- Standard call to check for call compatibility
1831
1832 IF NOT FND_API.Compatible_API_Call
1833 ( l_api_version_number
1834 , p_api_version_number
1835 , l_api_name
1836 , G_PKG_NAME
1837 )
1838 THEN
1839 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1840 END IF;
1841
1842 -- Initialize message list.
1843
1844 IF FND_API.to_Boolean(p_init_msg_list) THEN
1845 OE_MSG_PUB.initialize;
1846 END IF;
1847 initial := 1;
1848 FOR I IN 1..p_header_count LOOP
1849
1850 IF l_debug_level > 0 THEN
1851 oe_debug_pub.add( 'Enter Loop headercount'|| p_header_count , 1 ) ;
1852 END IF;
1853 /* changes for MOAC, not required since the input is the table
1854 IF I = p_header_count THEN
1855 nextpos := length(p_header_id_list)+1.0;
1856 ELSE
1857 nextpos := INSTR(p_header_id_list,',',initial,1);
1858 END IF;
1859 */
1860
1861 l_header_id := p_header_id_list(i).id1;
1862 IF l_orgid is null OR p_header_id_list(i).org_id <> l_orgid THEN
1863 l_orgid := p_header_id_list(i).Org_Id;
1864
1865 Mo_Global.Set_Policy_Context (p_access_mode => 'S',
1866 p_org_id => p_header_id_list(i).Org_Id);
1867
1868 END IF;
1869
1870 IF l_debug_level > 0 THEN
1871 oe_debug_pub.add( 'HEADER ID: '||L_HEADER_ID , 1 ) ;
1872 END IF;
1873 --For CC Project
1874 SELECT h.Transaction_Phase_Code
1875 INTO l_Transaction_Phase_Code
1876 FROM oe_order_headers_all h
1877 WHERE l_header_id=h.header_id;
1878 IF (l_Transaction_Phase_Code='N' ) THEN
1879 OE_Order_Wf_Util.Complete_eligible_and_Book(
1880 p_api_version_number => 1.0
1881 , p_init_msg_list => FND_API.G_FALSE
1882 , p_header_id => l_header_id
1883 , x_return_status => l_return_status
1884 , x_msg_count => l_msg_count
1885 , x_msg_data => l_msg_data );
1886 ELSE
1887 OE_Order_Book_Util.Complete_Book_Eligible (
1888 p_api_version_number => 1.0
1889 , p_init_msg_list => FND_API.G_FALSE
1890 , p_header_id => l_header_id
1891 , x_return_status => l_return_status
1892 , x_msg_count => l_msg_count
1893 , x_msg_data => l_msg_data);
1894 END IF ;
1895
1896 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
1897 x_error_count := x_error_count + 1.0;
1898 x_return_status := FND_API.G_RET_STS_ERROR;
1899 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1900 x_error_count := x_error_count + 1.0;
1901 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1902 END IF;
1903
1904 initial := nextpos + 1.0;
1905 END LOOP;
1906
1907 IF l_debug_level > 0 THEN
1908 oe_debug_pub.add( 'EXIT OE_ORDER_BOOK.BOOK_MULTIPLE_ORDERS' , 1 ) ;
1909 END IF;
1910
1911 EXCEPTION
1912 WHEN FND_API.G_EXC_ERROR THEN
1913 x_return_status := FND_API.G_RET_STS_ERROR;
1914 OE_MSG_PUB.Count_And_Get
1915 ( p_count => x_msg_count
1916 , p_data => x_msg_data
1917 );
1918 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1919 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1920 OE_MSG_PUB.Count_And_Get
1921 ( p_count => x_msg_count
1922 , p_data => x_msg_data
1923 );
1924 WHEN OTHERS THEN
1925 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1926 IF OE_MSG_PUB.Check_Msg_Level
1927 (OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1928 THEN
1929 OE_MSG_PUB.Add_Exc_Msg
1930 ( G_PKG_NAME
1931 , l_api_name
1932 );
1933 END IF;
1934 OE_MSG_PUB.Count_And_Get
1935 ( p_count => x_msg_count
1936 , p_data => x_msg_data
1937 );
1938
1939 END Book_Multiple_Orders;
1940
1941
1942
1943 /******************************************************************************
1944 --ABH
1945 -- This procedure accepts a list of header IDs in a string separated
1946 -- by commas (e.g. 1234,3567,8945) and the number of orders
1947 -- (p_header_count) to be QA'd.
1948 -- In case of a single order, we have just one header id in the string.
1949 -- The return status is SUCCESS only if all orders are processed
1950 -- successfully.
1951 -- The number of orders that are processed with errors (i.e. QA returned error) can be retrieved
1952 -- from the OUT variable, x_error_count.
1953 -- Called from the form package OE_ORDER_CONTROL.Book_Order_Button
1954 -- for QA'ing multi_selected orders or just a single order.
1955 PROCEDURE QA_Order
1956 (p_api_version_number IN NUMBER
1957 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
1958 ,p_header_id_list IN OUT NOCOPY VARCHAR2
1959 ,p_header_count IN NUMBER
1960 ,x_error_count OUT NOCOPY NUMBER
1961 ,x_return_status OUT NOCOPY VARCHAR2
1962 ,x_msg_count OUT NOCOPY NUMBER
1963 ,x_msg_data OUT NOCOPY VARCHAR2
1964 ) IS
1965
1966 l_api_name CONSTANT VARCHAR2(30) := 'QA_ORDER';
1967 l_api_version_number CONSTANT NUMBER := 1.0;
1968 l_header_id NUMBER;
1969 l_msg_count NUMBER;
1970 l_msg_data VARCHAR2(2000);
1971 I NUMBER;
1972 initial NUMBER;
1973 nextpos NUMBER;
1974 l_return_status VARCHAR2(30);
1975
1976 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1977
1978 TYPE header_id_tbl_type IS TABLE OF VARCHAR2(50) INDEX BY BINARY_INTEGER;
1979 l_header_id_tbl header_id_tbl_type;
1980 TYPE delete_header_id_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
1981 l_delete_header_id_tbl delete_header_id_tbl_type;
1982 J NUMBER;
1983 l_qa_return_status VARCHAR2(1);
1984 l_record_ids VARCHAR2(32000);
1985
1986 BEGIN
1987 IF l_debug_level > 0 THEN
1988 oe_debug_pub.add('ENTER OE_ORDER_BOOK.QA_ORDER' , 1 ) ;
1989 oe_debug_pub.add('p_header_count: ' || p_header_count, 1);
1990 END IF;
1991
1992 -- Initialize API return status to success
1993 x_return_status := FND_API.G_RET_STS_SUCCESS;
1994 x_error_count := 0;
1995
1996 --Check for licensing
1997 IF OE_Contracts_util.check_license() <> 'Y' THEN
1998 IF l_debug_level > 0 THEN
1999 oe_debug_pub.add('Contractual option not licensed, hence not performing article QA ', 3);
2000 END IF;
2001 RETURN;
2002 END IF;
2003
2004
2005
2006 -- Standard call to check for call compatibility
2007
2008 IF NOT FND_API.Compatible_API_Call
2009 ( l_api_version_number
2010 , p_api_version_number
2011 , l_api_name
2012 , G_PKG_NAME
2013 )
2014 THEN
2015 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2016 END IF;
2017
2018 -- Initialize message list.
2019
2020 IF FND_API.to_Boolean(p_init_msg_list) THEN
2021 OE_MSG_PUB.initialize;
2022 END IF;
2023
2024 --initialize PL/SQL tables
2025 l_header_id_tbl.DELETE;
2026 l_delete_header_id_tbl.DELETE;
2027
2028
2029
2030 --convert the header id's separated by commas in p_header_id_list into a PL/SQL table l_header_id_tbl
2031 initial := 1;
2032 FOR I IN 1..p_header_count LOOP
2033
2034 IF I = p_header_count THEN
2035 nextpos := length(p_header_id_list)+1.0;
2036 ELSE
2037 nextpos := INSTR(p_header_id_list,',',initial,1);
2038 END IF;
2039
2040 l_header_id := to_number(substr(p_header_id_list,initial, nextpos-initial));
2041 IF l_debug_level > 0 THEN
2042 oe_debug_pub.add( 'adding to PL/SQL table HEADER ID: '||L_HEADER_ID , 1 ) ;
2043 END IF;
2044
2045 --transfer into PL/SQL table
2046 l_header_id_tbl(I) := l_header_id;
2047
2048 initial := nextpos + 1.0;
2049 END LOOP;
2050
2051 IF l_debug_level > 0 THEN
2052 oe_debug_pub.add('l_header_id_tbl.COUNT: ' || l_header_id_tbl.COUNT);
2053 END IF;
2054
2055
2056 --now run QA on header id's contained in PL/SQL table l_header_id_tbl
2057 J := 1;
2058 FOR I IN 1..p_header_count LOOP
2059 IF l_debug_level > 0 THEN
2060 oe_debug_pub.add('Calling OE_CONTRACTS_UTIL.qa_articles for l_header_id_tbl('||I||'): '||l_header_id_tbl(I));
2061 END IF;
2062
2063 OE_CONTRACTS_UTIL.qa_articles (
2064 p_api_version => 1.0,
2065 p_doc_type => OE_CONTRACTS_UTIL.G_SO_DOC_TYPE,
2066 p_doc_id => TO_NUMBER(l_header_id_tbl(I)),
2067 x_qa_return_status => l_qa_return_status,
2068 x_return_status => l_return_status,
2069 x_msg_count => l_msg_count,
2070 x_msg_data => l_msg_data);
2071
2072
2073
2074
2075 IF l_debug_level > 0 THEN
2076 oe_debug_pub.add('l_return_status for l_header_id_tbl('||I||'): '||l_header_id_tbl(I)||' is '|| l_return_status);
2077 oe_debug_pub.add('l_qa_return_status for l_header_id_tbl('||I||'): '||l_header_id_tbl(I)||' is '|| l_qa_return_status);
2078 END IF;
2079
2080 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
2081 IF l_qa_return_status = FND_API.G_RET_STS_ERROR THEN
2082 l_delete_header_id_tbl(J) := I; --keep track of which header id to delete later
2083 J := J + 1;
2084 x_error_count := x_error_count + 1.0;
2085 x_return_status := FND_API.G_RET_STS_ERROR;
2086
2087 ELSIF l_qa_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2088 l_delete_header_id_tbl(J) := I; --keep track of which header id to delete later
2089 J := J + 1;
2090 x_error_count := x_error_count + 1.0;
2091 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2092
2093 END IF;
2094
2095 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2096 RAISE FND_API.G_EXC_ERROR;
2097 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2098 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2099 END IF;
2100
2101
2102 END LOOP;
2103
2104
2105 IF l_debug_level > 0 THEN
2106 oe_debug_pub.add('l_delete_header_id_tbl.COUNT: ' || l_delete_header_id_tbl.COUNT);
2107 oe_debug_pub.add('l_header_id_tbl.COUNT before deleting: ' || l_header_id_tbl.COUNT);
2108 END IF;
2109
2110 --delete the header id's that failed QA from the PL/SQL table l_header_id_tbl
2111 FOR J IN 1..l_delete_header_id_tbl.COUNT LOOP
2112 l_header_id_tbl.DELETE(l_delete_header_id_tbl(J));
2113
2114 IF l_debug_level > 0 THEN
2115 oe_debug_pub.add('Deleted element with index ' || J || ' from l_header_id_tbl');
2116 END IF;
2117 END LOOP;
2118
2119 IF l_debug_level > 0 THEN
2120 oe_debug_pub.add('l_header_id_tbl.COUNT after deleting: ' || l_header_id_tbl.COUNT);
2121 END IF;
2122
2123
2124
2125 -- finally transfer the remaining QA passed header ids in PL/SQL table l_header_id_tbl back to comma separated
2126 -- form in p_header_id_list
2127 l_record_ids := NULL; --initialize
2128 I := l_header_id_tbl.FIRST;
2129 WHILE I IS NOT NULL LOOP
2130
2131 IF (I = l_header_id_tbl.LAST OR l_header_id_tbl.COUNT = 1) THEN
2132 l_record_ids := l_record_ids || l_header_id_tbl(I);
2133 ELSE
2134 l_record_ids := l_record_ids || l_header_id_tbl(I) || ',';
2135 END IF;
2136
2137 I := l_header_id_tbl.NEXT(I);
2138
2139 END LOOP;
2140
2141 p_header_id_list := l_record_ids;
2142
2143 IF l_debug_level > 0 THEN
2144 oe_debug_pub.add('Length of string l_record_ids: ' || LENGTH(l_record_ids));
2145 oe_debug_pub.add('Length of string p_header_id_list: ' || LENGTH(p_header_id_list));
2146 END IF;
2147
2148
2149
2150 IF l_debug_level > 0 THEN
2151 oe_debug_pub.add( 'EXIT OE_ORDER_BOOK.QA_ORDER' , 1 ) ;
2152 END IF;
2153
2154 EXCEPTION
2155 WHEN FND_API.G_EXC_ERROR THEN
2156 x_return_status := FND_API.G_RET_STS_ERROR;
2157 OE_MSG_PUB.Count_And_Get
2158 ( p_count => x_msg_count
2159 , p_data => x_msg_data
2160 );
2161 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2162 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2163 OE_MSG_PUB.Count_And_Get
2164 ( p_count => x_msg_count
2165 , p_data => x_msg_data
2166 );
2167 WHEN OTHERS THEN
2168 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2169 IF OE_MSG_PUB.Check_Msg_Level
2170 (OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2171 THEN
2172 OE_MSG_PUB.Add_Exc_Msg
2173 ( G_PKG_NAME
2174 , l_api_name
2175 );
2176 END IF;
2177 OE_MSG_PUB.Count_And_Get
2178 ( p_count => x_msg_count
2179 , p_data => x_msg_data
2180 );
2181
2182
2183 END QA_Order;
2184 --ABH
2185 ******************************************************************************/
2186
2187
2188 END OE_ORDER_BOOK_UTIL;