1 PACKAGE BODY OE_WF_UPGRADE_UTIL as
2 /* $Header: OEXWUPGB.pls 120.1 2006/06/02 19:14:48 spagadal noship $ */
3
4 PROCEDURE UPGRADE_CUSTOM_ACTIVITY_BLOCK(
5 itemtype in varchar2,
6 itemkey in varchar2,
7 actid in number,
8 funcmode in varchar2,
9 resultout in out nocopy varchar2 /* file.sql.39 change */
10 )
11 IS
12 l_status VARCHAR2(01);
13 l_Scolumn_name VARCHAR2(05);
14 l_Scolumn_value NUMBER;
15 BEGIN
16
17 --
18 -- RUN mode - normal process execution
19 --
20
21 -- start data fix project
22 OE_STANDARD_WF.Set_Msg_Context(actid);
23 -- end data fix project
24
25 if (funcmode = 'RUN') then
26
27 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress. Check if Order/Line is already
28 -- past custom activity.
29
30 -- Find out What S column the custom activity is based on ...
31
32 l_Scolumn_name := WF_ENGINE.GetActivityAttrText(itemtype, itemkey, actid, 'S_COLUMN');
33
34 l_Scolumn_value := OE_ORDER_UPGRADE_UTIL.Get_entity_Scolumn_value(itemtype, itemkey, l_Scolumn_name);
35
36 IF (l_Scolumn_value IS NOT NULL) THEN
37 IF (l_Scolumn_value = 18) THEN -- As in eligible
38 -- we set result to NOTIFIED. So that it can be externally completed.
39 resultout := wf_engine.eng_notified||':'||wf_engine.eng_null||':'||wf_engine.eng_null;
40 ELSE -- some other result, prepend with 'UPG_RC_' since that will be the internal name of the lookup.
41 resultout := 'COMPLETE:'||'UPG_RC_'||TO_CHAR(l_Scolumn_value);
42 END IF;
43
44 ELSE -- WE SHOULD NEVER COME HERE WHEN THE UPGRADE IS RUNNING. Will return NOTIFIED.
45 resultout := wf_engine.eng_notified||':'||wf_engine.eng_null||':'||wf_engine.eng_null;
46 END IF;
47
48 RETURN;
49 ELSE -- Not in upgrade mode, so return NOTIFIED. So that it can be externally completed.
50
51 -- Return Notified
52 resultout := wf_engine.eng_notified||':'||wf_engine.eng_null
53 ||':'||wf_engine.eng_null;
54
55 RETURN; -- Order should go thru normal process flow.
56
57
58 END IF;
59
60
61
62 end if; -- End for 'RUN' mode
63
64 -- CANCEL mode - activity 'compensation'
65 --
66 -- This is an event point is called with the effect of the activity must
67 -- be undone, for example when a process is reset to an earlier point
68 -- due to a loop back.
69 --
70 if (funcmode = 'CANCEL') then
71 null;
72
73 -- no result needed
74 resultout := 'COMPLETE';
75 return;
76 end if;
77
78 --
79 -- Other execution modes may be created in the future. Your
80 -- activity will indicate that it does not implement a mode
81 -- by returning null
82 --
83 -- resultout := '';
84 -- return;
85
86 exception
87 when others then
88 -- The line below records this function call in the error system
89 -- in the case of an exception.
90 wf_core.context('OE_WF_UPGRADE_UTIL', 'UPGRADE_CUSTOM_ACTIVITY_BLOCK',
91 itemtype, itemkey, to_char(actid), funcmode);
92 -- start data fix project
93 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
94 p_itemtype => itemtype,
95 p_itemkey => itemkey);
96 OE_STANDARD_WF.Save_Messages;
97 OE_STANDARD_WF.Clear_Msg_Context;
98 -- end data fix project
99 raise;
100 END UPGRADE_CUSTOM_ACTIVITY_BLOCK;
101
102 -- This procedure is called by the pre-approval(notification) activity to check whether the Order/Line is already
103 -- past the approval. If it is then we will transition past the notification activity. If the approval was eligible
104 -- then we will send out the notification during the upgrade. If the approval was in some pending state (non-passing)
105 -- then we will re-send out the notification during the upgrade.
106 PROCEDURE UPGRADE_PRE_APPROVAL(
107 itemtype in varchar2,
108 itemkey in varchar2,
109 actid in number,
110 funcmode in varchar2,
111 resultout in out nocopy varchar2 /* file.sql.39 change */
112 )
113 IS
114 l_status VARCHAR2(01);
115 l_Scolumn_name VARCHAR2(05);
116 l_Scolumn_value NUMBER;
117 BEGIN
118
119 -- start data fix project
120 OE_STANDARD_WF.Set_Msg_Context(actid);
121 -- end data fix project
122 --
123 -- RUN mode - normal process execution
124 --
125
126 if (funcmode = 'RUN') then
127
128 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress. Check if Order/Line is already
129 -- past approval
130
131 -- Find out What S column the approval is based on ...
132
133 l_Scolumn_name := WF_ENGINE.GetActivityAttrText(itemtype, itemkey, actid, 'S_COLUMN');
134
135 l_Scolumn_value := OE_ORDER_UPGRADE_UTIL.Get_entity_Scolumn_value(itemtype, itemkey, l_Scolumn_name);
136
137 -- This activity will have the same look-up as the notification activity with an additional code for
138 -- 'NOT_PROCESSED' which will transition to the notification. Runtime, the transitions will be created
139 -- appropriately.
140
141 IF (l_Scolumn_value IS NOT NULL) THEN
142
143 IF (l_Scolumn_value = 18) THEN -- Entity is eligible for Approval, so send out notification.
144 resultout := 'COMPLETE:'||'NOT_PROCESSED';
145 ELSE -- Entity is past approval with some result.
146 resultout := 'COMPLETE:'||'UPG_RC_'||TO_CHAR(l_Scolumn_value);
147 END IF;
148
149 ELSE -- WE SHOULD NEVER COME HERE WHEN THE UPGRADE IS RUNNING..
150 resultout := 'COMPLETE:'||'NOT_PROCESSED';
151 END IF;
152
153 RETURN;
154
155 ELSE -- Not in upgrade mode, so return 'NOT_PROCESSED', so that the notification goes out.
156
157 resultout := 'COMPLETE:'||'NOT_PROCESSED';
158
159 RETURN; -- Order/Line should go thru normal process flow.
160
161
162 END IF;
163
164
165
166 end if; -- End for 'RUN' mode
167
168 -- CANCEL mode - activity 'compensation'
169 --
170 -- This is an event point is called with the effect of the activity must
171 -- be undone, for example when a process is reset to an earlier point
172 -- due to a loop back.
173 --
174 if (funcmode = 'CANCEL') then
175 null;
176
177 -- no result needed
178 resultout := 'COMPLETE';
179 return;
180 end if;
181
182 --
183 -- Other execution modes may be created in the future. Your
184 -- activity will indicate that it does not implement a mode
185 -- by returning null
186 --
187 -- resultout := '';
188 -- return;
189
190 exception
191 when others then
192 -- The line below records this function call in the error system
193 -- in the case of an exception.
194 wf_core.context('OE_WF_UPGRADE_UTIL', 'UPGRADE_PRE_APPROVAL',
195 itemtype, itemkey, to_char(actid), funcmode);
196 -- start data fix project
197 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
198 p_itemtype => itemtype,
199 p_itemkey => itemkey);
200 OE_STANDARD_WF.Save_Messages;
201 OE_STANDARD_WF.Clear_Msg_Context;
202 -- end data fix project
203 raise;
204 END UPGRADE_PRE_APPROVAL;
205
206 PROCEDURE IS_ORDER_PAST_BOOKING(
207 itemtype in varchar2,
208 itemkey in varchar2,
209 actid in number,
210 funcmode in varchar2,
211 resultout in out nocopy varchar2 /* file.sql.39 change */
212 )
213 IS
214 l_booked_status VARCHAR2(01);
215 BEGIN
216
217 -- start data fix project
218 OE_STANDARD_WF.Set_Msg_Context(actid);
219 -- end data fix project
220 --
221 -- RUN mode - normal process execution
222 --
223
224 if (funcmode = 'RUN') then
225
226 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress. Check if Order is already booked.
227
228 OE_HEADER_STATUS_PUB.GET_BOOKED_STATUS(to_number(itemkey), l_booked_status);
229
230 IF (l_booked_status = 'Y') THEN
231 resultout := 'COMPLETE:Y';
232 ELSE
233 resultout := 'COMPLETE:N'; -- Order will get booked via WF
234 END IF;
235
236 RETURN;
237 ELSE -- Not in upgrade mode.
238
239 resultout := 'COMPLETE:N'; -- Order will get booked via WF
240 RETURN; -- Order should go thru normal process flow.
241
242
243 END IF;
244
245
246
247 end if; -- End for 'RUN' mode
248
249 -- CANCEL mode - activity 'compensation'
250 --
251 -- This is an event point is called with the effect of the activity must
252 -- be undone, for example when a process is reset to an earlier point
253 -- due to a loop back.
254 --
255 if (funcmode = 'CANCEL') then
256 null;
257
258 -- no result needed
259 resultout := 'COMPLETE';
260 return;
261 end if;
262
263 --
264 -- Other execution modes may be created in the future. Your
265 -- activity will indicate that it does not implement a mode
266 -- by returning null
267 --
268 -- resultout := '';
269 -- return;
270
271 exception
272 when others then
273 -- The line below records this function call in the error system
274 -- in the case of an exception.
275 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_ORDER_PAST_BOOKING',
276 itemtype, itemkey, to_char(actid), funcmode);
277 -- start data fix project
278 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
279 p_itemtype => itemtype,
280 p_itemkey => itemkey);
281 OE_STANDARD_WF.Save_Messages;
282 OE_STANDARD_WF.Clear_Msg_Context;
283 -- end data fix project
284 raise;
285 END IS_ORDER_PAST_BOOKING;
286
287 PROCEDURE IS_LINE_PAST_SHIPPING(
288 itemtype in varchar2,
289 itemkey in varchar2,
290 actid in number,
291 funcmode in varchar2,
292 resultout in out nocopy varchar2 /* file.sql.39 change */
293 )
294 IS
295 l_ship_status VARCHAR2(01);
296 BEGIN
297
298 -- start data fix project
299 OE_STANDARD_WF.Set_Msg_Context(actid);
300 -- end data fix project
301 --
302 -- RUN mode - normal process execution
303 --
304
305 if (funcmode = 'RUN') then
306
307 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress. Check if Order is already shipped.
308
309 OE_Line_Status_Pub.Get_Ship_Status(to_number(itemkey), l_ship_status);
310
311 IF (l_ship_status = 'Y') THEN
312 resultout := 'COMPLETE:Y';
313 update oe_order_lines_all
314 set flow_status_code = decode(source_type_code, 'EXTERNAL', 'SHIPPED', 'SHIPPED')
315 where line_id = to_number(itemkey);
316 ELSE
317 resultout := 'COMPLETE:N'; -- Order will get booked via WF
318 update oe_order_lines_all
319 set flow_status_code = decode(source_type_code, 'EXTERNAL', 'AWAITING_RECEIPT', 'AWAITING_SHIPPING')
320 where line_id = to_number(itemkey);
321
322 END IF;
323
324 RETURN;
325 ELSE -- Not in upgrade mode.
326
327 resultout := 'COMPLETE:N'; -- Order will get booked via WF
328 RETURN; -- Order should go thru normal process flow.
329
330
331 END IF;
332
333
334
335 end if; -- End for 'RUN' mode
336
337 -- CANCEL mode - activity 'compensation'
338 --
339 -- This is an event point is called with the effect of the activity must
340 -- be undone, for example when a process is reset to an earlier point
341 -- due to a loop back.
342 --
343 if (funcmode = 'CANCEL') then
344 null;
345
346 -- no result needed
347 resultout := 'COMPLETE';
348 return;
349 end if;
350
351 --
352 -- Other execution modes may be created in the future. Your
353 -- activity will indicate that it does not implement a mode
354 -- by returning null
355 --
356 -- resultout := '';
357 -- return;
358
359 exception
360 when others then
361 -- The line below records this function call in the error system
362 -- in the case of an exception.
363 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_PAST_SHIPPING',
364 itemtype, itemkey, to_char(actid), funcmode);
365 -- start data fix project
366 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
367 p_itemtype => itemtype,
368 p_itemkey => itemkey);
369 OE_STANDARD_WF.Save_Messages;
370 OE_STANDARD_WF.Clear_Msg_Context;
371 -- end data fix project
372 raise;
373 END IS_LINE_PAST_SHIPPING;
374
375 PROCEDURE IS_LINE_SHIP_ELIGIBLE(
376 itemtype in varchar2,
377 itemkey in varchar2,
378 actid in number,
379 funcmode in varchar2,
380 resultout in out nocopy varchar2 /* file.sql.39 change */
381 )
382 IS
383
384 l_source_type_code varchar2(30);
385
386 BEGIN
387
388 -- start data fix project
389 OE_STANDARD_WF.Set_Msg_Context(actid);
390 -- end data fix project
391 --
392 -- RUN mode - normal process execution
393 --
394
395 if (funcmode = 'RUN') then
396
397 select source_type_code
398 into l_source_type_code
399 from oe_order_lines_all
400 where line_id = to_number(itemkey);
401
402 IF nvl(l_source_type_code,'INTERNAL') = 'EXTERNAL' THEN
403 resultout := 'NOTIFIED:#NULL';
404 RETURN;
405 ELSE
406 resultout := 'COMPLETE:#NULL';
407 RETURN;
408
409 END IF;
410
411
412
413 end if; -- End for 'RUN' mode
414
415 -- CANCEL mode - activity 'compensation'
416 --
417 -- This is an event point is called with the effect of the activity must
418 -- be undone, for example when a process is reset to an earlier point
419 -- due to a loop back.
420 --
421 if (funcmode = 'CANCEL') then
422 null;
423
424 -- no result needed
425 resultout := 'COMPLETE';
426 return;
427 end if;
428
429 --
430 -- Other execution modes may be created in the future. Your
431 -- activity will indicate that it does not implement a mode
432 -- by returning null
433 --
434 -- resultout := '';
435 -- return;
436
437 exception
438 when others then
439 -- The line below records this function call in the error system
440 -- in the case of an exception.
441 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_PAST_SHIPPING',
442 itemtype, itemkey, to_char(actid), funcmode);
443 -- start data fix project
444 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
445 p_itemtype => itemtype,
446 p_itemkey => itemkey);
447 OE_STANDARD_WF.Save_Messages;
448 OE_STANDARD_WF.Clear_Msg_Context;
449 -- end data fix project
450 raise;
451 END IS_LINE_SHIP_ELIGIBLE;
452
453 PROCEDURE IS_RETURN_RECEIVED(
454 itemtype in varchar2,
455 itemkey in varchar2,
456 actid in number,
457 funcmode in varchar2,
458 resultout in out nocopy varchar2 /* file.sql.39 change */
459 )
460 IS
461 l_received_status VARCHAR2(1);
462 BEGIN
463
464 -- start data fix project
465 OE_STANDARD_WF.Set_Msg_Context(actid);
466 -- end data fix project
467 --
468 -- RUN mode - normal process execution
469 --
470
471 if (funcmode = 'RUN') then
472
473 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress. Check if return already shipped
474
475 OE_LINE_STATUS_PUB.GET_RECEIVED_STATUS(to_number(itemkey), l_received_status);
476
477 IF (l_received_status = 'Y') THEN
478 resultout := 'COMPLETE:Y';
479 update oe_order_lines_all
480 set flow_status_code = 'RETURNED'
481 where line_id = to_number(itemkey);
482 ELSE
483 resultout := 'COMPLETE:N';
484 update oe_order_lines_all
485 set flow_status_code = 'AWAITING_RETURN'
486 where line_id = to_number(itemkey);
487
488 END IF;
489
490 RETURN;
491 ELSE -- Not in upgrade mode.
492
493 resultout := 'COMPLETE:N';
494 RETURN; -- Order should go thru normal process flow.
495
496
497 END IF;
498
499
500
501 end if; -- End for 'RUN' mode
502
503 -- CANCEL mode - activity 'compensation'
504 --
505 -- This is an event point is called with the effect of the activity must
506 -- be undone, for example when a process is reset to an earlier point
507 -- due to a loop back.
508 --
509 if (funcmode = 'CANCEL') then
510 null;
511
512 -- no result needed
513 resultout := 'COMPLETE';
514 return;
515 end if;
516
517 --
518 -- Other execution modes may be created in the future. Your
519 -- activity will indicate that it does not implement a mode
520 -- by returning null
521 --
522 -- resultout := '';
523 -- return;
524
525 exception
526 when others then
527 -- The line below records this function call in the error system
528 -- in the case of an exception.
529 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_RETURN_RECEIVED',
530 itemtype, itemkey, to_char(actid), funcmode);
531 -- start data fix project
532 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
533 p_itemtype => itemtype,
534 p_itemkey => itemkey);
535 OE_STANDARD_WF.Save_Messages;
536 OE_STANDARD_WF.Clear_Msg_Context;
537 -- end data fix project
538 raise;
539 END IS_RETURN_RECEIVED;
540
541 PROCEDURE IS_RETURN_INSPECTED(
542 itemtype in varchar2,
543 itemkey in varchar2,
544 actid in number,
545 funcmode in varchar2,
546 resultout in out nocopy varchar2 /* file.sql.39 change */
547 )
548 IS
549 l_fulfilled_quantity NUMBER;
550 l_shipped_quantity NUMBER;
551 BEGIN
552
553 -- start data fix project
554 OE_STANDARD_WF.Set_Msg_Context(actid);
555 -- end data fix project
556 --
557 -- RUN mode - normal process execution
558 --
559
560 if (funcmode = 'RUN') then
561
562 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress.
563
564 -- Check if return already inspected
565 Select shipped_quantity,fulfilled_quantity
566 into l_shipped_quantity,l_fulfilled_quantity
567 from oe_order_lines_all
568 where line_id = to_number(itemkey);
569
570
571 IF (l_shipped_quantity is not NULL and
572 l_shipped_quantity = nvl(l_fulfilled_quantity,0)) THEN
573 resultout := 'COMPLETE:Y';
574 ELSE
575 resultout := 'COMPLETE:N';
576 END IF;
577
578 RETURN;
579 ELSE -- Not in upgrade mode.
580
581 resultout := 'COMPLETE:N';
582 RETURN; -- Order should go thru normal process flow.
583
584
585 END IF;
586
587
588
589 end if; -- End for 'RUN' mode
590
591 -- CANCEL mode - activity 'compensation'
592 --
593 -- This is an event point is called with the effect of the activity must
594 -- be undone, for example when a process is reset to an earlier point
595 -- due to a loop back.
596 --
597 if (funcmode = 'CANCEL') then
598 null;
599
600 -- no result needed
601 resultout := 'COMPLETE';
602 return;
603 end if;
604
605 --
606 -- Other execution modes may be created in the future. Your
607 -- activity will indicate that it does not implement a mode
608 -- by returning null
609 --
610 -- resultout := '';
611 -- return;
612
613 exception
614 when others then
615 -- The line below records this function call in the error system
616 -- in the case of an exception.
617 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_RETURN_INSPECTED',
618 itemtype, itemkey, to_char(actid), funcmode);
619 -- start data fix project
620 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
621 p_itemtype => itemtype,
622 p_itemkey => itemkey);
623 OE_STANDARD_WF.Save_Messages;
624 OE_STANDARD_WF.Clear_Msg_Context;
625 -- end data fix project
626 raise;
627 END IS_RETURN_INSPECTED;
628
629 PROCEDURE IS_LINE_PAST_INVOICING(
630 itemtype in varchar2,
631 itemkey in varchar2,
632 actid in number,
633 funcmode in varchar2,
634 resultout in out nocopy varchar2 /* file.sql.39 change */
635 )
636 IS
637 l_invoice_interface_status VARCHAR2(30);
638 BEGIN
639
640 -- start data fix project
641 OE_STANDARD_WF.Set_Msg_Context(actid);
642 -- end data fix project
643 --
644 -- RUN mode - normal process execution
645 --
646
647 if (funcmode = 'RUN') then
648
649 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress. Check if Order Line is already Invoiced.
650
651 OE_ORDER_UPGRADE_UTIL.Get_Invoice_Status_Code(to_number(itemkey), l_invoice_interface_status);
652
653 IF (l_invoice_interface_status = 'COMPLETE') THEN
654 resultout := 'COMPLETE:COMPLETE';
655 update oe_order_lines_all
656 set flow_status_code = 'INVOICED'
657 where line_id = to_number(itemkey);
658 ELSIF (l_invoice_interface_status = 'NOT_ELIGIBLE') THEN
659 resultout := 'COMPLETE:NOT_ELIGIBLE';
660 ELSIF (l_invoice_interface_status = 'RFR-PENDING' OR
661 l_invoice_interface_status = 'MANUAL-PENDING') THEN
662 resultout := 'COMPLETE:PRTL_COMPLETE';
663 update oe_order_lines_all
664 set flow_status_code = 'INVOICED_PARTIAL'
665 where line_id = to_number(itemkey);
666
667 ELSE
668 resultout := 'COMPLETE:INCOMPLETE'; -- Line will get Invoice Interfaced via WF
669 END IF;
670
671 RETURN;
672 ELSE -- Not in upgrade mode.
673
674 resultout := 'COMPLETE:INCOMPLETE'; -- Order Line will get Invoiced via WF
675 RETURN; -- Order Line should go thru normal process flow.
676
677
678 END IF;
679
680
681
682 end if; -- End for 'RUN' mode
683
684 -- CANCEL mode - activity 'compensation'
685 --
686 -- This is an event point is called with the effect of the activity must
687 -- be undone, for example when a process is reset to an earlier point
688 -- due to a loop back.
689 --
690 if (funcmode = 'CANCEL') then
691 null;
692
693 -- no result needed
694 resultout := 'COMPLETE';
695 return;
696 end if;
697
698 --
699 -- Other execution modes may be created in the future. Your
700 -- activity will indicate that it does not implement a mode
701 -- by returning null
702 --
703 -- resultout := '';
704 -- return;
705
706 exception
707 when others then
708 -- The line below records this function call in the error system
709 -- in the case of an exception.
710 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_PAST_INVOICING',
711 itemtype, itemkey, to_char(actid), funcmode);
712 -- start data fix project
713 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
714 p_itemtype => itemtype,
715 p_itemkey => itemkey);
716 OE_STANDARD_WF.Save_Messages;
717 OE_STANDARD_WF.Clear_Msg_Context;
718 -- end data fix project
719 raise;
720 END IS_LINE_PAST_INVOICING;
721
722 PROCEDURE IS_ORDER_CLOSED(
723 itemtype in varchar2,
724 itemkey in varchar2,
725 actid in number,
726 funcmode in varchar2,
727 resultout in out nocopy varchar2 /* file.sql.39 change */
728 )
729 IS
730 l_closed_status VARCHAR2(1);
731 BEGIN
732
733 -- start data fix project
734 OE_STANDARD_WF.Set_Msg_Context(actid);
735 -- end data fix project
736 --
737 -- RUN mode - normal process execution
738 --
739
740 if (funcmode = 'RUN') then
741
742 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress. Check if Order is already closed.
743
744 OE_HEADER_STATUS_PUB.GET_CLOSED_STATUS(to_number(itemkey), l_closed_status);
745
746 IF (l_closed_status = 'Y') THEN
747 resultout := 'COMPLETE:Y';
748 ELSE
749 resultout := 'COMPLETE:N'; -- Order will be closed via WF
750 END IF;
751
752 RETURN;
753 ELSE -- Not in upgrade mode.
754
755 resultout := 'COMPLETE:N'; -- Order will be closed via WF
756 RETURN; -- Order should go thru normal process flow.
757
758
759 END IF;
760
761
762
763 end if; -- End for 'RUN' mode
764
765 -- CANCEL mode - activity 'compensation'
766 --
767 -- This is an event point is called with the effect of the activity must
768 -- be undone, for example when a process is reset to an earlier point
769 -- due to a loop back.
770 --
771 if (funcmode = 'CANCEL') then
772 null;
773
774 -- no result needed
775 resultout := 'COMPLETE';
776 return;
777 end if;
778
779 --
780 -- Other execution modes may be created in the future. Your
781 -- activity will indicate that it does not implement a mode
782 -- by returning null
783 --
784 -- resultout := '';
785 -- return;
786
787 exception
788 when others then
789 -- The line below records this function call in the error system
790 -- in the case of an exception.
791 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_ORDER_CLOSED',
792 itemtype, itemkey, to_char(actid), funcmode);
793 -- start data fix project
794 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
795 p_itemtype => itemtype,
796 p_itemkey => itemkey);
797 OE_STANDARD_WF.Save_Messages;
798 OE_STANDARD_WF.Clear_Msg_Context;
799 -- end data fix project
800 raise;
801 END IS_ORDER_CLOSED;
802
803 PROCEDURE IS_LINE_CLOSED(
804 itemtype in varchar2,
805 itemkey in varchar2,
806 actid in number,
807 funcmode in varchar2,
808 resultout in out nocopy varchar2 /* file.sql.39 change */
809 )
810 IS
811 l_closed_status VARCHAR2(1);
812 BEGIN
813
814 -- start data fix project
815 OE_STANDARD_WF.Set_Msg_Context(actid);
816 -- end data fix project
817 --
818 -- RUN mode - normal process execution
819 --
820
821 if (funcmode = 'RUN') then
822
823 IF OE_STANDARD_WF.G_UPGRADE_MODE THEN -- Upgrade in progress. Check if Order Line is already closed.
824
825 OE_LINE_STATUS_PUB.GET_CLOSED_STATUS(to_number(itemkey), l_closed_status);
826
827 IF (l_closed_status = 'Y') THEN
828 resultout := 'COMPLETE:Y';
829 ELSE
830 resultout := 'COMPLETE:N'; -- Order Line will be closed via WF
831 END IF;
832
833 RETURN;
834 ELSE -- Not in upgrade mode.
835
836 resultout := 'COMPLETE:N'; -- Order Line will be closed via WF
837 RETURN; -- Order Line should go thru normal process flow.
838
839
840 END IF;
841
842
843
844 end if; -- End for 'RUN' mode
845
846 -- CANCEL mode - activity 'compensation'
847 --
848 -- This is an event point is called with the effect of the activity must
849 -- be undone, for example when a process is reset to an earlier point
850 -- due to a loop back.
851 --
852 if (funcmode = 'CANCEL') then
853 null;
854
855 -- no result needed
856 resultout := 'COMPLETE';
857 return;
858 end if;
859
860 --
861 -- Other execution modes may be created in the future. Your
862 -- activity will indicate that it does not implement a mode
863 -- by returning null
864 --
865 -- resultout := '';
866 -- return;
867
868 exception
869 when others then
870 -- The line below records this function call in the error system
871 -- in the case of an exception.
872 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_CLOSED',
873 itemtype, itemkey, to_char(actid), funcmode);
874 -- start data fix project
875 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
876 p_itemtype => itemtype,
877 p_itemkey => itemkey);
878 OE_STANDARD_WF.Save_Messages;
879 OE_STANDARD_WF.Clear_Msg_Context;
880 -- end data fix project
881 raise;
882 END IS_LINE_CLOSED;
883
884 /* --------------------------------------------------------------------
885 Procedure Name : IS_LINE_PAST_DEMAND_IFACE
886 Description : This procedure checks the demand interface cycle status
887 of the old line.If the status is eligible, it returns
888 "NO". If the status is interfaced, it returns "YES"
889
890 ----------------------------------------------------------------------- */
891
892 PROCEDURE IS_LINE_PAST_DEMAND_IFACE(
893 itemtype in varchar2,
894 itemkey in varchar2,
895 actid in number,
896 funcmode in varchar2,
897 resultout in out nocopy varchar2 /* file.sql.39 change */
898 )
899 IS
900 l_schedule_status NUMBER;
901 BEGIN
902
903 -- start data fix project
904 OE_STANDARD_WF.Set_Msg_Context(actid);
905 -- end data fix project
906 --
907 -- RUN mode - normal process execution
908 --
909
910 if (funcmode = 'RUN') then
911
912 IF OE_STANDARD_WF.G_UPGRADE_MODE
913 THEN
914 -- Upgrade in progress. Check if Order Line is already closed.
915
916 OE_ORDER_UPGRADE_UTIL.GET_DEMAND_INTERFACE_STATUS
917 (to_number(itemkey), l_schedule_status);
918
919 IF (l_schedule_status = RES_ELIGIBLE) THEN
920 -- Order Line will be scheduled via WF
921 resultout := 'COMPLETE:N';
922 ELSE
923 resultout := 'COMPLETE:Y';
924 update oe_order_lines_all
925 set flow_status_code = 'SCHEDULED'
926 where line_id = to_number(itemkey);
927 END IF;
928
929 RETURN;
930 ELSE -- Not in upgrade mode.
931
932 resultout := 'COMPLETE:N'; -- Order Line will be scheduled via WF
933 RETURN; -- Order Line should go thru normal process flow.
934
935 END IF;
936
937
938 end if; -- End for 'RUN' mode
939
940 -- CANCEL mode - activity 'compensation'
941 --
942 -- This is an event point is called with the effect of the activity must
943 -- be undone, for example when a process is reset to an earlier point
944 -- due to a loop back.
945 --
946 if (funcmode = 'CANCEL') then
947 null;
948
949 -- no result needed
950 resultout := 'COMPLETE';
951 return;
952 end if;
953
954 --
955 -- Other execution modes may be created in the future. Your
956 -- activity will indicate that it does not implement a mode
957 -- by returning null
958 --
959 -- resultout := '';
960 -- return;
961
962 exception
963 when others then
964 -- The line below records this function call in the error system
965 -- in the case of an exception.
966 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_CLOSED',
967 itemtype, itemkey, to_char(actid), funcmode);
968 -- start data fix project
969 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
970 p_itemtype => itemtype,
971 p_itemkey => itemkey);
972 OE_STANDARD_WF.Save_Messages;
973 OE_STANDARD_WF.Clear_Msg_Context;
974 -- end data fix project
975 raise;
976 END IS_LINE_PAST_DEMAND_IFACE;
977
978 /* --------------------------------------------------------------------
979 Procedure Name : CHK_MFG_RELEASE_STS
980 Description : This procedure checks the manufacturing release cycle status
981 of the old line. The way it returns results is as follows:
982 Only ATO Model line and ATO Item line would have reached
983 the workflow function where this API is called. And the only
984 status of manufacturing release we are supporing for these
985 two item types is ELIGIBLE and WORK_ORDER_COMPLETE (this
986 item types will never be NOT_APPLICABLE)
987
988
989 Cycle-Status Resultout
990 ------------ ------------
991 Eligible ELIGIBLE
992 Work-Order Complete WORK_ORDER_COMPLETE
993 ----------------------------------------------------------------------- */
994
995 PROCEDURE CHK_MFG_RELEASE_STS(
996 itemtype in varchar2,
997 itemkey in varchar2,
998 actid in number,
999 funcmode in varchar2,
1000 resultout in out nocopy varchar2 /* file.sql.39 change */
1001 )
1002 IS
1003 l_mfg_release_status NUMBER;
1004 l_item_type_code VARCHAR2(30);
1005 l_ato_line_id NUMBER;
1006 BEGIN
1007
1008 -- start data fix project
1009 OE_STANDARD_WF.Set_Msg_Context(actid);
1010 -- end data fix project
1011 --
1012 -- RUN mode - normal process execution
1013 --
1014
1015 if (funcmode = 'RUN') then
1016
1017 IF OE_STANDARD_WF.G_UPGRADE_MODE
1018 THEN
1019 -- Upgrade in progress. Check if Order Line is already closed.
1020
1021 OE_ORDER_UPGRADE_UTIL.GET_MFG_RELEASE_STATUS
1022 (to_number(itemkey), l_mfg_release_status);
1023
1024 IF (l_mfg_release_status = RES_ELIGIBLE) THEN
1025 resultout := 'COMPLETE:ELIGIBLE';
1026 -- no change in flow status here
1027
1028 ELSIF (l_mfg_release_status = RES_WORK_ORDER_COMPLETED) THEN
1029 resultout := 'COMPLETE:WORK_ORDER_COMPLETE';
1030
1031 SELECT item_type_code, ato_line_id
1032 INTO l_item_type_code, l_ato_line_id
1033 FROM OE_ORDER_LINES_ALL
1034 WHERE line_id = to_number(itemkey);
1035
1036 IF l_ato_line_id = to_number(itemkey) AND
1037 (l_item_type_code = OE_GLOBALS.G_ITEM_MODEL OR
1038 l_item_type_code = OE_GLOBALS.G_ITEM_CLASS)
1039 THEN
1040 update oe_order_lines_all
1041 set flow_status_code = 'BOOKED'
1042 where line_id = to_number(itemkey);
1043 ELSE
1044 update oe_order_lines_all
1045 set flow_status_code = 'PRODUCTION_COMPLETE'
1046 where line_id = to_number(itemkey);
1047 END IF;
1048
1049 ELSE
1050 -- CODE SHOULD NEVER COME HERE
1051 resultout := 'COMPLETE:ELIGIBLE';
1052 -- no update of flow status code
1053 END IF;
1054
1055 RETURN;
1056 ELSE -- Not in upgrade mode.
1057
1058 resultout := 'COMPLETE:ELIGIBLE';
1059 RETURN;
1060
1061 END IF;
1062
1063 end if; -- End for 'RUN' mode
1064
1065 -- CANCEL mode - activity 'compensation'
1066 --
1067 -- This is an event point is called with the effect of the activity must
1068 -- be undone, for example when a process is reset to an earlier point
1069 -- due to a loop back.
1070 --
1071 if (funcmode = 'CANCEL') then
1072 null;
1073
1074 -- no result needed
1075 resultout := 'COMPLETE';
1076 return;
1077 end if;
1078
1079 --
1080 -- Other execution modes may be created in the future. Your
1081 -- activity will indicate that it does not implement a mode
1082 -- by returning null
1083 --
1084 -- resultout := '';
1085 -- return;
1086
1087 exception
1088 when others then
1089 -- The line below records this function call in the error system
1090 -- in the case of an exception.
1091 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_CLOSED',
1092 itemtype, itemkey, to_char(actid), funcmode);
1093 -- start data fix project
1094 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
1095 p_itemtype => itemtype,
1096 p_itemkey => itemkey);
1097 OE_STANDARD_WF.Save_Messages;
1098 OE_STANDARD_WF.Clear_Msg_Context;
1099 -- end data fix project
1100 raise;
1101 END;
1102
1103
1104 /* --------------------------------------------------------------------
1105 Procedure Name : IS_LINE_PAST_MFG_RELEASE
1106 Description : This procedure checks the manufacturing release cycle status
1107 of the old line. The way it returns results is as follows:
1108
1109 Cycle-Status Resultout
1110 ------------ ------------
1111 Not-Applicable Yes
1112 Eligible Yes - But is actually not applicable
1113 (like service lines).
1114 Yes - is an ATO class or ATO option
1115 No - is an ATO model or ATO Item
1116 Work-Order Complete Yes - For ATO model and ATO item
1117 which are shipped.
1118 No - For ATO model and ATO item
1119 which are not shipped.
1120
1121 We do not need to update flow status here.
1122 A check later will do it. ex: chk_mfg_release_status
1123 will update the status.
1124 ----------------------------------------------------------------------- */
1125
1126 PROCEDURE IS_LINE_PAST_MFG_RELEASE(
1127 itemtype in varchar2,
1128 itemkey in varchar2,
1129 actid in number,
1130 funcmode in varchar2,
1131 resultout in out nocopy varchar2 /* file.sql.39 change */
1132 )
1133 IS
1134 l_mfg_release_status NUMBER;
1135 l_ato_line_id NUMBER;
1136 l_shipped_quantity NUMBER;
1137 BEGIN
1138
1139 -- start data fix project
1140 OE_STANDARD_WF.Set_Msg_Context(actid);
1141 -- end data fix project
1142 --
1143 -- RUN mode - normal process execution
1144 --
1145
1146 if (funcmode = 'RUN') then
1147
1148 IF OE_STANDARD_WF.G_UPGRADE_MODE
1149 THEN
1150 -- Upgrade in progress. Check if Order Line is already closed.
1151
1152 OE_ORDER_UPGRADE_UTIL.GET_MFG_RELEASE_STATUS
1153 (to_number(itemkey), l_mfg_release_status);
1154
1155 IF (l_mfg_release_status = RES_NOT_APPLICABLE) THEN
1156 resultout := 'COMPLETE:Y';
1157 ELSE
1158 SELECT ato_line_id,shipped_quantity
1159 INTO l_ato_line_id,l_shipped_quantity
1160 FROM oe_order_lines_all
1161 WHERE line_id = to_number(itemkey);
1162
1163 IF l_ato_line_id = to_number(itemkey) THEN
1164 -- Only ATO Models and ATO Items will have case
1165 IF l_shipped_quantity is not null THEN
1166 resultout := 'COMPLETE:Y';
1167 ELSE
1168 -- The line is not shipped and it is and ATO model or ATO
1169 -- item. This is the only case we will progress forward
1170 -- in the ATO processing.
1171 resultout := 'COMPLETE:N';
1172 END IF;
1173 ELSE
1174 resultout := 'COMPLETE:Y';
1175 END IF;
1176 END IF;
1177
1178 RETURN;
1179 ELSE -- Not in upgrade mode.
1180
1181 -- Line which reach here, were upgraded but came to manufacturing
1182 -- release activity after the upgrade. We need to check if the item
1183 -- on the line is an ATO item or model. If it is, then complete
1184 -- the activity with 'N'.
1185
1186 SELECT ato_line_id
1187 INTO l_ato_line_id
1188 FROM OE_ORDER_LINES_ALL
1189 WHERE line_id = to_number(itemkey);
1190
1191 IF l_ato_line_id = to_number(itemkey) THEN
1192
1193 -- Only ATO Models and ATO Items will have this case
1194 resultout := 'COMPLETE:N';
1195
1196 ELSE
1197
1198 resultout := 'COMPLETE:Y';
1199
1200 END IF;
1201
1202 RETURN;
1203
1204 END IF;
1205
1206 end if; -- End for 'RUN' mode
1207
1208 -- CANCEL mode - activity 'compensation'
1209 --
1210 -- This is an event point is called with the effect of the activity must
1211 -- be undone, for example when a process is reset to an earlier point
1212 -- due to a loop back.
1213 --
1214 if (funcmode = 'CANCEL') then
1215 null;
1216
1217 -- no result needed
1218 resultout := 'COMPLETE';
1219 return;
1220 end if;
1221
1222 --
1223 -- Other execution modes may be created in the future. Your
1224 -- activity will indicate that it does not implement a mode
1225 -- by returning null
1226 --
1227 -- resultout := '';
1228 -- return;
1229
1230 exception
1231 when others then
1232 -- The line below records this function call in the error system
1233 -- in the case of an exception.
1234 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_CLOSED',
1235 itemtype, itemkey, to_char(actid), funcmode);
1236 -- start data fix project
1237 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
1238 p_itemtype => itemtype,
1239 p_itemkey => itemkey);
1240 OE_STANDARD_WF.Save_Messages;
1241 OE_STANDARD_WF.Clear_Msg_Context;
1242 -- end data fix project
1243 raise;
1244 END;
1245
1246
1247 /* --------------------------------------------------------------------
1248 Procedure Name : IS_LINE_ATO_MODEL
1249 Description : This procedure returns the result of "YES", if the line
1250 is an ATO Model and No if the line is an ATO Item.
1251 This procedure will be called only for these 2 types of
1252 items in the upgrade of manufacturing release process.
1253
1254 ----------------------------------------------------------------------- */
1255
1256 PROCEDURE IS_LINE_ATO_MODEL(
1257 itemtype in varchar2,
1258 itemkey in varchar2,
1259 actid in number,
1260 funcmode in varchar2,
1261 resultout in out nocopy varchar2 /* file.sql.39 change */
1262 )
1263 IS
1264 l_ato_line_id NUMBER;
1265 l_item_type_code VARCHAR2(30);
1266 BEGIN
1267
1268 -- start data fix project
1269 OE_STANDARD_WF.Set_Msg_Context(actid);
1270 -- end data fix project
1271 --
1272 -- RUN mode - normal process execution
1273 --
1274
1275 if (funcmode = 'RUN') then
1276
1277 -- Condition Removed for 2974151
1278
1279 SELECT ato_line_id,item_type_code
1280 INTO l_ato_line_id,l_item_type_code
1281 FROM oe_order_lines_all
1282 WHERE line_id = to_number(itemkey);
1283
1284 IF l_ato_line_id = to_number(itemkey) AND
1285 (l_item_type_code = OE_GLOBALS.G_ITEM_MODEL OR
1286 l_item_type_code = OE_GLOBALS.G_ITEM_CLASS)
1287 THEN
1288 resultout := 'COMPLETE:Y';
1289 ELSE
1290 resultout := 'COMPLETE:N';
1291 END IF;
1292
1293 RETURN;
1294
1295
1296 end if; -- End for 'RUN' mode
1297
1298 -- CANCEL mode - activity 'compensation'
1299 --
1300 -- This is an event point is called with the effect of the activity must
1301 -- be undone, for example when a process is reset to an earlier point
1302 -- due to a loop back.
1303 --
1304 if (funcmode = 'CANCEL') then
1305 null;
1306
1307 -- no result needed
1308 resultout := 'COMPLETE';
1309 return;
1310 end if;
1311
1312 --
1313 -- Other execution modes may be created in the future. Your
1314 -- activity will indicate that it does not implement a mode
1315 -- by returning null
1316 --
1317 -- resultout := '';
1318 -- return;
1319
1320 exception
1321 when others then
1322 -- The line below records this function call in the error system
1323 -- in the case of an exception.
1324 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_CLOSED',
1325 itemtype, itemkey, to_char(actid), funcmode);
1326 -- start data fix project
1327 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
1328 p_itemtype => itemtype,
1329 p_itemkey => itemkey);
1330 OE_STANDARD_WF.Save_Messages;
1331 OE_STANDARD_WF.Clear_Msg_Context;
1332 -- end data fix project
1333 raise;
1334 END;
1335
1336 /* --------------------------------------------------------------------
1337 Procedure Name : IS_MODE_UPGRADE
1338 Description : This procedure returns the result of "YES", if the
1339 global OE_STANDARD_WF.G_UPGRADE_MODE is set to TRUE.
1340 We use this for the config item flow.
1341
1342 ----------------------------------------------------------------------- */
1343
1344 PROCEDURE IS_MODE_UPGRADE(
1345 itemtype in varchar2,
1346 itemkey in varchar2,
1347 actid in number,
1348 funcmode in varchar2,
1349 resultout in out nocopy varchar2 /* file.sql.39 change */
1350 )
1351 IS
1352 l_ato_line_id NUMBER;
1353 l_item_type_code NUMBER;
1354 BEGIN
1355
1356 -- start data fix project
1357 OE_STANDARD_WF.Set_Msg_Context(actid);
1358 -- end data fix project
1359 --
1360 -- RUN mode - normal process execution
1361 --
1362
1363 if (funcmode = 'RUN') then
1364
1365 IF OE_STANDARD_WF.G_UPGRADE_MODE
1366 THEN
1367 resultout := 'COMPLETE:Y';
1368 RETURN;
1369 ELSE
1370 resultout := 'COMPLETE:N';
1371 RETURN;
1372 END IF;
1373
1374 end if; -- End for 'RUN' mode
1375
1376 -- CANCEL mode - activity 'compensation'
1377 --
1378 -- This is an event point is called with the effect of the activity must
1379 -- be undone, for example when a process is reset to an earlier point
1380 -- due to a loop back.
1381 --
1382 if (funcmode = 'CANCEL') then
1383 null;
1384
1385 -- no result needed
1386 resultout := 'COMPLETE';
1387 return;
1388 end if;
1389
1390 --
1391 -- Other execution modes may be created in the future. Your
1392 -- activity will indicate that it does not implement a mode
1393 -- by returning null
1394 --
1395 -- resultout := '';
1396 -- return;
1397
1398 exception
1399 when others then
1400 -- The line below records this function call in the error system
1401 -- in the case of an exception.
1402 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_CLOSED',
1403 itemtype, itemkey, to_char(actid), funcmode);
1404 -- start data fix project
1405 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
1406 p_itemtype => itemtype,
1407 p_itemkey => itemkey);
1408 OE_STANDARD_WF.Save_Messages;
1409 OE_STANDARD_WF.Clear_Msg_Context;
1410 -- end data fix project
1411 raise;
1412 END;
1413
1414 /* --------------------------------------------------------------------
1415 Procedure Name : CHECK_PUR_REL_STATUS
1416 Description : This procedure checks the purchase release cycle status
1417 of the old line.It returns results as following:
1418 Cycle Status Resultout
1419 ------------ ---------
1420 Eligible Eligible
1421 Interfaced Interfaced
1422 Confirmed Confirmed
1423 Partial For the unshipped line: Interfaced
1424 For the shipped line : Confirmed.
1425 When the result is partial, the line was split into 2 lines
1426 in the new system.
1427
1428 Not Applicable NOTIFIED
1429 NULL NOTIFIED. The activity calling this
1430 API will stay in the notified status
1431
1432 ----------------------------------------------------------------------- */
1433
1434 PROCEDURE CHECK_PUR_REL_STATUS(
1435 itemtype in varchar2,
1436 itemkey in varchar2,
1437 actid in number,
1438 funcmode in varchar2,
1439 resultout in out nocopy varchar2 /* file.sql.39 change */
1440 )
1441 IS
1442 l_pur_release_status NUMBER;
1443 l_source_type VARCHAR2(30); ---5247444
1444 BEGIN
1445
1446 -- start data fix project
1447 OE_STANDARD_WF.Set_Msg_Context(actid);
1448 -- end data fix project
1449 --
1450 -- RUN mode - normal process execution
1451 --
1452
1453 if (funcmode = 'RUN') then
1454
1455 IF OE_STANDARD_WF.G_UPGRADE_MODE
1456 THEN
1457 -- Upgrade in progress. Check if Order Line is already closed.
1458
1459 OE_ORDER_UPGRADE_UTIL.Get_Pur_Rel_Status
1460 (to_number(itemkey), l_pur_release_status);
1461
1462 IF (l_pur_release_status = RES_ELIGIBLE) THEN
1463 resultout := 'COMPLETE:ELIGIBLE';
1464 ELSIF (l_pur_release_status = RES_CONFIRMED) THEN
1465 resultout := 'COMPLETE:CONFIRMED';
1466 ELSIF (l_pur_release_status = RES_INTERFACED) THEN
1467 resultout := 'COMPLETE:INTERFACED';
1468 --Bug2432009
1469 /*ELSIF (l_pur_release_status = RES_FAIL_NOT_APPLICABLE) THEN
1470 resultout := 'COMPLETE:CONFIRMED';
1471 Commented for the bug#5247444 */
1472 ELSIF (l_pur_release_status is null) THEN
1473 /* added for bug fix 5247444 */
1474 select source_type_code
1475 into l_source_type
1476 from oe_order_lines_all
1477 where line_id = to_number(itemkey);
1478 IF l_source_type = 'INTERNAL' THEN
1479 resultout := wf_engine.eng_notified||':'||wf_engine.eng_null||':'||wf_engine.eng_null; -- block workflow
1480 ELSE
1481 resultout := 'COMPLETE:ELIGIBLE';
1482 END IF;
1483 /* end 5247444 */
1484
1485 /* resultout := 'COMPLETE:ELIGIBLE'; This was replaced by the code just above for bug fix 5247444 */
1486 ELSE
1487 resultout := wf_engine.eng_notified||':'||wf_engine.eng_null||':'||wf_engine.eng_null;
1488 END IF;
1489
1490 RETURN;
1491 ELSE -- Not in upgrade mode.
1492
1493 resultout := 'COMPLETE:ELIGIBLE';
1494 RETURN;
1495
1496 END IF;
1497
1498
1499 end if; -- End for 'RUN' mode
1500
1501 -- CANCEL mode - activity 'compensation'
1502 --
1503 -- This is an event point is called with the effect of the activity must
1504 -- be undone, for example when a process is reset to an earlier point
1505 -- due to a loop back.
1506 --
1507 if (funcmode = 'CANCEL') then
1508 null;
1509
1510 -- no result needed
1511 resultout := 'COMPLETE';
1512 return;
1513 end if;
1514
1515 --
1516 -- Other execution modes may be created in the future. Your
1517 -- activity will indicate that it does not implement a mode
1518 -- by returning null
1519 --
1520 -- resultout := '';
1521 -- return;
1522
1523 exception
1524 when others then
1525 -- The line below records this function call in the error system
1526 -- in the case of an exception.
1527 wf_core.context('OE_WF_UPGRADE_UTIL', 'IS_LINE_CLOSED',
1528 itemtype, itemkey, to_char(actid), funcmode);
1529 -- start data fix project
1530 OE_STANDARD_WF.Add_Error_Activity_Msg(p_actid => actid,
1531 p_itemtype => itemtype,
1532 p_itemkey => itemkey);
1533 OE_STANDARD_WF.Save_Messages;
1534 OE_STANDARD_WF.Clear_Msg_Context;
1535 -- end data fix project
1536 raise;
1537 END CHECK_PUR_REL_STATUS;
1538
1539 END OE_WF_UPGRADE_UTIL;