1 PACKAGE BODY Eng_Workflow_Pub AS
2 /* $Header: ENGBWKFB.pls 120.8 2010/08/18 06:24:05 maychen ship $ */
3
4
5 -- PROCEDURE CHECK_HEADER_OR_LINE
6 PROCEDURE CHECK_HEADER_OR_LINE(
7 itemtype in varchar2,
8 itemkey in varchar2,
9 actid in number,
10 funcmode in varchar2,
11 result in out NOCOPY varchar2)
12 IS
13
14 l_change_id NUMBER ;
15 l_change_line_id NUMBER ;
16
17
18 BEGIN
19
20 --
21 -- RUN mode - normal process execution
22 --
23 if (funcmode = 'RUN') then
24
25 -- Get Chagne Id
26 Eng_Workflow_Util.GetChangeObject
27 ( p_item_type => itemtype
28 , p_item_key => itemkey
29 , x_change_id => l_change_id
30 ) ;
31
32
33 -- Get Chagne Line Id
34 Eng_Workflow_Util.GetChangeLineObject
35 ( p_item_type => itemtype
36 , p_item_key => itemkey
37 , x_change_line_id => l_change_line_id
38 ) ;
39
40
41 IF NVL(l_change_line_id,0) > 0 THEN
42
43 -- set result
44 result := 'COMPLETE:N';
45 return;
46
47 ELSIF NVL(l_change_id,0) > 0 AND NVL(l_change_line_id,0) <= 0 THEN
48
49 -- set result
50 result := 'COMPLETE:Y';
51 return;
52
53
54 ELSIF NVL(l_change_id,0) <= 0 AND NVL(l_change_line_id,0) <= 0 THEN
55 -- Unexpected Exception
56 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
57
58 END IF ;
59
60 end if ; -- funcmode : RUN
61
62 --
63 -- CANCEL mode - activity 'compensation'
64 --
65 -- This is in the event that the activity must be undone,
66 -- for example when a process is reset to an earlier point
67 -- due to a loop back.
68 --
69 if (funcmode = 'CANCEL') then
70
71 -- your cancel code goes here
72 null;
73
74 -- no result needed
75 result := 'COMPLETE';
76 return;
77 end if;
78
79
80 --
81 -- Other execution modes may be created in the future. Your
82 -- activity will indicate that it does not implement a mode
83 -- by returning null
84 --
85 result := '';
86 return;
87
88 EXCEPTION
89
90 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
91 -- The line below records this function call in the error system
92 -- in the case of an exception.
93 wf_core.context('Eng_Workflow_Pub', 'CHECK_HEADER_OR_LINE',
94 itemtype, itemkey, to_char(actid), funcmode);
95 raise;
96
97 WHEN OTHERS THEN
98 -- The line below records this function call in the error system
99 -- in the case of an exception.
100 wf_core.context('Eng_Workflow_Pub', 'CHECK_HEADER_OR_LINE',
101 itemtype, itemkey, to_char(actid), funcmode);
102 raise;
103
104 END CHECK_HEADER_OR_LINE ;
105
106
107
108 -- PROCEDURE SELECT_ADHOC_PARTY
109 PROCEDURE SELECT_ADHOC_PARTY(
110 itemtype in varchar2,
111 itemkey in varchar2,
112 actid in number,
113 funcmode in varchar2,
114 result in out NOCOPY varchar2)
115 IS
116
117 l_action_id NUMBER ;
118 l_adhoc_party_list VARCHAR2(2000) ;
119
120 l_return_status VARCHAR2(1);
121 l_msg_count NUMBER ;
122 l_msg_data VARCHAR2(200);
123
124
125 CURSOR c_action_attr ( p_action_id NUMBER )
126 IS
127 SELECT party_id_list adhoc_party_list
128 , TRUNC(response_by_date) response_by_date
129 , sysdate
130 FROM ENG_CHANGE_ACTIONS
131 WHERE action_id = p_action_id ;
132
133
134 BEGIN
135
136 --
137 -- RUN mode - normal process execution
138 --
139 if (funcmode = 'RUN') then
140
141 -- Get Adhoc Party List
142 l_adhoc_party_list := WF_ENGINE.GetItemAttrText( itemtype
143 , itemkey
144 , 'ADHOC_PARTY_LIST');
145
146 IF l_adhoc_party_list IS NULL THEN
147
148 -- Get Action Id
149 Eng_Workflow_Util.GetActionId
150 ( p_item_type => itemtype
151 , p_item_key => itemkey
152 , x_action_id => l_action_id
153 ) ;
154
155
156 -- Get party list from action table
157 FOR i IN c_action_attr (p_action_id => l_action_id )
158 LOOP
159
160 l_adhoc_party_list := i.adhoc_party_list ;
161
162 WF_ENGINE.SetItemAttrText( itemtype
163 , itemkey
164 , 'ADHOC_PARTY_LIST'
165 , l_adhoc_party_list );
166
167
168 END LOOP ;
169
170 END IF ;
171
172
173 IF l_adhoc_party_list IS NULL THEN
174 result := 'COMPLETE:NONE';
175 return;
176 END IF ;
177
178 -- Set Adhoc Party Role
179 Eng_Workflow_Util.SetAdhocPartyRole
180 ( x_return_status => l_return_status
181 , x_msg_count => l_msg_count
182 , x_msg_data => l_msg_data
183 , p_item_type => itemtype
184 , p_item_key => itemkey
185 , p_adhoc_party_list => l_adhoc_party_list
186 ) ;
187
188
189 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
190
191 -- set result
192 result := 'COMPLETE';
193 return;
194
195 -- None
196 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
197
198 -- set result
199 result := 'COMPLETE:NONE';
200 return;
201 ELSE
202
203 -- Unexpected Exception
204 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
205
206 END IF ;
207
208 end if ; -- funcmode : RUN
209
210
211 --
212 -- CANCEL mode - activity 'compensation'
213 --
214 -- This is in the event that the activity must be undone,
215 -- for example when a process is reset to an earlier point
216 -- due to a loop back.
217 --
218 if (funcmode = 'CANCEL') then
219
220 -- your cancel code goes here
221 null;
222
223 -- no result needed
224 result := 'COMPLETE';
225 return;
226 end if;
227
228
229 --
230 -- Other execution modes may be created in the future. Your
231 -- activity will indicate that it does not implement a mode
232 -- by returning null
233 --
234 result := '';
235 return;
236
237 EXCEPTION
238
239 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
240 -- The line below records this function call in the error system
241 -- in the case of an exception.
242 wf_core.context('Eng_Workflow_Pub', 'SELECT_ADHOC_PARTY',
243 itemtype, itemkey, to_char(actid), funcmode);
244 raise;
245
246
247 WHEN OTHERS THEN
248 -- The line below records this function call in the error system
249 -- in the case of an exception.
250 wf_core.context('Eng_Workflow_Pub', 'SELECT_ADHOC_PARTY',
251 itemtype, itemkey, to_char(actid), funcmode);
252 raise;
253
254 END SELECT_ADHOC_PARTY ;
255
256
257
258 PROCEDURE SELECT_ASSIGNEE (
259 itemtype in varchar2,
260 itemkey in varchar2,
261 actid in number,
262 funcmode in varchar2,
263 result in out NOCOPY varchar2)
264 IS
265
266 l_return_status VARCHAR2(1);
267 l_msg_count NUMBER ;
268 l_msg_data VARCHAR2(200);
269
270 l_debug_flag BOOLEAN := FALSE ; -- For TEST : FALSE ;
271 l_output_dir VARCHAR2(80) ;
272 l_debug_filename VARCHAR2(30) ; -- 'SelectAssignee.log' ;
273
274 BEGIN
275
276 --
277 -- RUN mode - normal process execution
278 --
279 if (funcmode = 'RUN') then
280
281
282 Eng_Workflow_Util.Get_Debug_Mode
283 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
284
285 -- For Test/Debug
286 IF l_debug_flag THEN
287 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
288 , l_debug_filename || actid ) ;
289 END IF ;
290
291
292 -- Set Adhoc Party Role
293 Eng_Workflow_Util.SetAssigneeRole
294 ( x_return_status => l_return_status
295 , x_msg_count => l_msg_count
296 , x_msg_data => l_msg_data
297 , p_item_type => itemtype
298 , p_item_key => itemkey
299 ) ;
300
301
302 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
303
304
305 IF l_debug_flag THEN
306 Eng_Workflow_Util.Close_Debug_Session ;
307 END IF ;
308
309 -- set result
310 result := 'COMPLETE';
311 return;
312
313 -- None
314 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
315
316 -- set result
317 result := 'COMPLETE:NONE';
318
319 IF l_debug_flag THEN
320 Eng_Workflow_Util.Close_Debug_Session ;
321 END IF ;
322
323 return;
324 ELSE
325
326 -- Unexpected Exception
327 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
328
329 END IF ;
330
331 end if ; -- funcmode : RUN
332
333
334 --
335 -- CANCEL mode - activity 'compensation'
336 --
337 -- This is in the event that the activity must be undone,
338 -- for example when a process is reset to an earlier point
339 -- due to a loop back.
340 --
341 if (funcmode = 'CANCEL') then
342
343 -- your cancel code goes here
344 null;
345
346 -- no result needed
347 result := 'COMPLETE';
348 return;
349 end if;
350
351
352 --
353 -- Other execution modes may be created in the future. Your
354 -- activity will indicate that it does not implement a mode
355 -- by returning null
356 --
357 result := '';
358 return;
359
360 EXCEPTION
361
362 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
363
364 IF l_debug_flag THEN
365 Eng_Workflow_Util.Close_Debug_Session ;
366 END IF ;
367
368 -- The line below records this function call in the error system
369 -- in the case of an exception.
370 wf_core.context('Eng_Workflow_Pub', 'SELECT_ASSIGNEE',
371 itemtype, itemkey, to_char(actid), funcmode);
372 raise;
373
374
375 WHEN OTHERS THEN
376
377 IF l_debug_flag THEN
378 Eng_Workflow_Util.Close_Debug_Session ;
379 END IF ;
380
381 -- The line below records this function call in the error system
382 -- in the case of an exception.
383 wf_core.context('Eng_Workflow_Pub', 'SELECT_ASSIGNEE',
384 itemtype, itemkey, to_char(actid), funcmode);
385 raise;
386
387 END SELECT_ASSIGNEE ;
388
389
390 -- PROCEDURE SELECT_STD_REVIEWERS
391 PROCEDURE SELECT_STD_REVIEWERS(
392 itemtype in varchar2,
393 itemkey in varchar2,
394 actid in number,
395 funcmode in varchar2,
396 result in out NOCOPY varchar2)
397 IS
398
399 l_return_status VARCHAR2(1);
400 l_msg_count NUMBER ;
401 l_msg_data VARCHAR2(200);
402
403
404 BEGIN
405
406 --
407 -- RUN mode - normal process execution
408 --
409 if (funcmode = 'RUN') then
410
411 -- Set Reviewers Role
412 Eng_Workflow_Util.SetReviewersRole
413 ( x_return_status => l_return_status
414 , x_msg_count => l_msg_count
415 , x_msg_data => l_msg_data
416 , p_item_type => itemtype
417 , p_item_key => itemkey
418 , p_reviewer_type => 'STD'
419 ) ;
420
421
422 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
423
424 -- set result
425 result := 'COMPLETE';
426 return;
427
428 -- None
429 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
430
431 -- set result
432 result := 'COMPLETE:NONE';
433 return;
434 ELSE
435
436 -- Unexpected Exception
437 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
438
439 END IF ;
440
441 end if ; -- funcmode : RUN
442
443
444 --
445 -- CANCEL mode - activity 'compensation'
446 --
447 -- This is in the event that the activity must be undone,
448 -- for example when a process is reset to an earlier point
449 -- due to a loop back.
450 --
451 if (funcmode = 'CANCEL') then
452
453 -- your cancel code goes here
454 null;
455
456 -- no result needed
457 result := 'COMPLETE';
458 return;
459 end if;
460
461
462 --
463 -- Other execution modes may be created in the future. Your
464 -- activity will indicate that it does not implement a mode
465 -- by returning null
466 --
467 result := '';
468 return;
469
470 EXCEPTION
471
472 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
473 -- The line below records this function call in the error system
474 -- in the case of an exception.
475 wf_core.context('Eng_Workflow_Pub', 'SELECT_STD_REVIEWERS',
476 itemtype, itemkey, to_char(actid), funcmode);
477 raise;
478
479
480 WHEN OTHERS THEN
481 -- The line below records this function call in the error system
482 -- in the case of an exception.
483 wf_core.context('Eng_Workflow_Pub', 'SELECT_STD_REVIEWERS',
484 itemtype, itemkey, to_char(actid), funcmode);
485 raise;
486
487 END SELECT_STD_REVIEWERS;
488
489
490 -- PROCEDURE SELECT_REVIEWERS
491 PROCEDURE SELECT_REVIEWERS(
492 itemtype in varchar2,
493 itemkey in varchar2,
494 actid in number,
495 funcmode in varchar2,
496 result in out NOCOPY varchar2)
497 IS
498
499 l_return_status VARCHAR2(1);
500 l_msg_count NUMBER ;
501 l_msg_data VARCHAR2(200);
502
503
504 BEGIN
505
506 --
507 -- RUN mode - normal process execution
508 --
509 if (funcmode = 'RUN') then
510
511 -- Set Reviewers Role
512 Eng_Workflow_Util.SetReviewersRole
513 ( x_return_status => l_return_status
514 , x_msg_count => l_msg_count
515 , x_msg_data => l_msg_data
516 , p_item_type => itemtype
517 , p_item_key => itemkey
518 , p_reviewer_type => 'NO_ASSIGNEE'
519 ) ;
520
521
522 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
523
524 -- set result
525 result := 'COMPLETE';
526 return;
527
528 -- None
529 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
530
531 -- set result
532 result := 'COMPLETE:NONE';
533 return;
534 ELSE
535
536 -- Unexpected Exception
537 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
538
539 END IF ;
540
541 end if ; -- funcmode : RUN
542
543
544 --
545 -- CANCEL mode - activity 'compensation'
546 --
547 -- This is in the event that the activity must be undone,
548 -- for example when a process is reset to an earlier point
549 -- due to a loop back.
550 --
551 if (funcmode = 'CANCEL') then
552
553 -- your cancel code goes here
554 null;
555
556 -- no result needed
557 result := 'COMPLETE';
558 return;
559 end if;
560
561 --
562 -- Other execution modes may be created in the future. Your
563 -- activity will indicate that it does not implement a mode
564 -- by returning null
565 --
566 result := '';
567 return;
568
569 EXCEPTION
570
571 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
572 -- The line below records this function call in the error system
573 -- in the case of an exception.
574 wf_core.context('Eng_Workflow_Pub', 'SELECT_REVIEWERS',
575 itemtype, itemkey, to_char(actid), funcmode);
576 raise;
577
578
579 WHEN OTHERS THEN
580 -- The line below records this function call in the error system
581 -- in the case of an exception.
582 wf_core.context('Eng_Workflow_Pub', 'SELECT_REVIEWERS',
583 itemtype, itemkey, to_char(actid), funcmode);
584 raise;
585
586 END SELECT_REVIEWERS;
587
588
589 PROCEDURE SELECT_LINE_ASSIGNEE (
590 itemtype in varchar2,
591 itemkey in varchar2,
592 actid in number,
593 funcmode in varchar2,
594 result in out NOCOPY varchar2)
595 IS
596
597 l_return_status VARCHAR2(1);
598 l_msg_count NUMBER ;
599 l_msg_data VARCHAR2(200);
600
601 l_debug_flag BOOLEAN := FALSE ; -- For Debug: TRUE;
602 l_output_dir VARCHAR2(80) ;
603 l_debug_filename VARCHAR2(30) ; -- 'SelectLineAssignee.log' ;
604
605 BEGIN
606
607 --
608 -- RUN mode - normal process execution
609 --
610 if (funcmode = 'RUN') then
611
612
613 Eng_Workflow_Util.Get_Debug_Mode
614 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
615
616 -- For Test/Debug
617 IF l_debug_flag THEN
618 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
619 , l_debug_filename || actid ) ;
620 END IF ;
621
622 -- Set Adhoc Party Role
623 Eng_Workflow_Util.SetLineAssigneeRole
624 ( x_return_status => l_return_status
625 , x_msg_count => l_msg_count
626 , x_msg_data => l_msg_data
627 , p_item_type => itemtype
628 , p_item_key => itemkey
629 ) ;
630
631
632 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
633
634 IF l_debug_flag THEN
635 Eng_Workflow_Util.Close_Debug_Session ;
636 END IF ;
637
638 -- set result
639 result := 'COMPLETE';
640 return;
641
642 -- None
643 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
644
645 -- set result
646 result := 'COMPLETE:NONE';
647
648 IF l_debug_flag THEN
649 Eng_Workflow_Util.Close_Debug_Session ;
650 END IF ;
651
652 return;
653 ELSE
654
655 -- Unexpected Exception
656 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
657
658 END IF ;
659
660 end if ; -- funcmode : RUN
661
662
663 --
664 -- CANCEL mode - activity 'compensation'
665 --
666 -- This is in the event that the activity must be undone,
667 -- for example when a process is reset to an earlier point
668 -- due to a loop back.
669 --
670 if (funcmode = 'CANCEL') then
671
672 -- your cancel code goes here
673 null;
674
675 -- no result needed
676 result := 'COMPLETE';
677 return;
678 end if;
679
680 --
681 -- Other execution modes may be created in the future. Your
682 -- activity will indicate that it does not implement a mode
683 -- by returning null
684 --
685 result := '';
686 return;
687
688 EXCEPTION
689
690 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
691
692 IF l_debug_flag THEN
693 Eng_Workflow_Util.Close_Debug_Session ;
694 END IF ;
695
696 -- The line below records this function call in the error system
697 -- in the case of an exception.
698 wf_core.context('Eng_Workflow_Pub', 'SELECT_LINE_ASSIGNEE',
699 itemtype, itemkey, to_char(actid), funcmode);
700 raise;
701
702
703 WHEN OTHERS THEN
704
705 IF l_debug_flag THEN
706 Eng_Workflow_Util.Close_Debug_Session ;
707 END IF ;
708
709 -- The line below records this function call in the error system
710 -- in the case of an exception.
711 wf_core.context('Eng_Workflow_Pub', 'SELECT_LINE_ASSIGNEE',
712 itemtype, itemkey, to_char(actid), funcmode);
713 raise;
714
715 END SELECT_LINE_ASSIGNEE ;
716
717
718 -- PROCEDURE SELECT_STD_LINE_REVIEWERS
719 PROCEDURE SELECT_STD_LINE_REVIEWERS(
720 itemtype in varchar2,
721 itemkey in varchar2,
722 actid in number,
723 funcmode in varchar2,
724 result in out NOCOPY varchar2)
725 IS
726
727 l_return_status VARCHAR2(1);
728 l_msg_count NUMBER ;
729 l_msg_data VARCHAR2(200);
730
731 l_debug_flag BOOLEAN := FALSE ;
732 l_output_dir VARCHAR2(80) ;
733 l_debug_filename VARCHAR2(30) ;
734
735 BEGIN
736
737 --
738 -- RUN mode - normal process execution
739 --
740 if (funcmode = 'RUN') then
741
742 Eng_Workflow_Util.Get_Debug_Mode
743 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
744
745 -- For Test/Debug
746 IF l_debug_flag THEN
747
748 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
749 , l_debug_filename || actid ) ;
750 END IF ;
751
752 -- Set Reviewers Role
753 Eng_Workflow_Util.SetLineReviewersRole
754 ( x_return_status => l_return_status
755 , x_msg_count => l_msg_count
756 , x_msg_data => l_msg_data
757 , p_item_type => itemtype
758 , p_item_key => itemkey
759 , p_reviewer_type => 'STD'
760 ) ;
761
762
763
764 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
765
766 IF l_debug_flag THEN
767 Eng_Workflow_Util.Close_Debug_Session ;
768 END IF ;
769
770
771 -- set result
772 result := 'COMPLETE';
773 return;
774
775 -- None
776 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
777
778 IF l_debug_flag THEN
779 Eng_Workflow_Util.Close_Debug_Session ;
780 END IF ;
781
782
783 -- set result
784 result := 'COMPLETE:NONE';
785 return;
786 ELSE
787
788 -- Unexpected Exception
789 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
790
791 END IF ;
792
793 end if ; -- funcmode : RUN
794
795
796 --
797 -- CANCEL mode - activity 'compensation'
798 --
799 -- This is in the event that the activity must be undone,
800 -- for example when a process is reset to an earlier point
801 -- due to a loop back.
802 --
803 if (funcmode = 'CANCEL') then
804
805 -- your cancel code goes here
806 null;
807
808 -- no result needed
809 result := 'COMPLETE';
810 return;
811 end if;
812
813
814 --
815 -- Other execution modes may be created in the future. Your
816 -- activity will indicate that it does not implement a mode
817 -- by returning null
818 --
819 result := '';
820 return;
821
822 EXCEPTION
823
824 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
825 IF l_debug_flag THEN
826 Eng_Workflow_Util.Close_Debug_Session ;
827 END IF ;
828
829 -- The line below records this function call in the error system
830 -- in the case of an exception.
831 wf_core.context('Eng_Workflow_Pub', 'SELECT_STD_LINE_REVIEWERS',
832 itemtype, itemkey, to_char(actid), funcmode);
833 raise;
834
835
836 WHEN OTHERS THEN
837 IF l_debug_flag THEN
838 Eng_Workflow_Util.Close_Debug_Session ;
839 END IF ;
840
841 -- The line below records this function call in the error system
842 -- in the case of an exception.
843 wf_core.context('Eng_Workflow_Pub', 'SELECT_STD_LINE_REVIEWERS',
844 itemtype, itemkey, to_char(actid), funcmode);
845 raise;
846
847 END SELECT_STD_LINE_REVIEWERS;
848
849
850 -- PROCEDURE SELECT_LINE_REVIEWERS
851 PROCEDURE SELECT_LINE_REVIEWERS(
852 itemtype in varchar2,
853 itemkey in varchar2,
854 actid in number,
855 funcmode in varchar2,
856 result in out NOCOPY varchar2)
857 IS
858
859 l_return_status VARCHAR2(1);
860 l_msg_count NUMBER ;
861 l_msg_data VARCHAR2(200);
862
863
864 BEGIN
865
866 --
867 -- RUN mode - normal process execution
868 --
869 if (funcmode = 'RUN') then
870
871 -- Set Reviewers Role
872 Eng_Workflow_Util.SetLineReviewersRole
873 ( x_return_status => l_return_status
874 , x_msg_count => l_msg_count
875 , x_msg_data => l_msg_data
876 , p_item_type => itemtype
877 , p_item_key => itemkey
878 , p_reviewer_type => 'NO_ASSIGNEE'
879 ) ;
880
881
882 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
883
884 -- set result
885 result := 'COMPLETE';
886 return;
887
888 -- None
889 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
890
891 -- set result
892 result := 'COMPLETE:NONE';
893 return;
894 ELSE
895
896 -- Unexpected Exception
897 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
898
899 END IF ;
900
901 end if ; -- funcmode : RUN
902
903
904 --
905 -- CANCEL mode - activity 'compensation'
906 --
907 -- This is in the event that the activity must be undone,
908 -- for example when a process is reset to an earlier point
909 -- due to a loop back.
910 --
911 if (funcmode = 'CANCEL') then
912
913 -- your cancel code goes here
914 null;
915
916 -- no result needed
917 result := 'COMPLETE';
918 return;
919 end if;
920
921 --
922 -- Other execution modes may be created in the future. Your
923 -- activity will indicate that it does not implement a mode
924 -- by returning null
925 --
926 result := '';
927 return;
928
929 EXCEPTION
930
931 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
932 -- The line below records this function call in the error system
933 -- in the case of an exception.
934 wf_core.context('Eng_Workflow_Pub', 'SELECT_LINE_REVIEWERS',
935 itemtype, itemkey, to_char(actid), funcmode);
936 raise;
937
938 WHEN OTHERS THEN
939 -- The line below records this function call in the error system
940 -- in the case of an exception.
941 wf_core.context('Eng_Workflow_Pub', 'SELECT_LINE_REVIEWERS',
942 itemtype, itemkey, to_char(actid), funcmode);
943 raise;
944
945 END SELECT_LINE_REVIEWERS;
946
947 -- INITIATE_LINES
948 PROCEDURE INITIATE_LINES(
949 itemtype in varchar2,
950 itemkey in varchar2,
951 actid in number,
952 funcmode in varchar2,
953 result in out NOCOPY varchar2)
954 IS
955
956 l_change_id NUMBER ;
957 l_wf_user_id NUMBER ;
958 l_host_url VARCHAR2(256) ;
959
960 l_return_status VARCHAR2(1);
961 l_msg_count NUMBER ;
962 l_msg_data VARCHAR2(200);
963
964
965 BEGIN
966
967 --
968 -- RUN mode - normal process execution
969 --
970 if (funcmode = 'RUN') then
971
972
973 -- Get Chagne Id
974 Eng_Workflow_Util.GetChangeObject
975 ( p_item_type => itemtype
976 , p_item_key => itemkey
977 , x_change_id => l_change_id
978 ) ;
979
980 -- Get Host URL
981 Eng_Workflow_Util.GetHostURL
982 ( p_item_type => itemtype
983 , p_item_key => itemkey
984 , x_host_url => l_host_url
985 ) ;
986
987 -- Get WF User Id
988 Eng_Workflow_Util.GetWFUserId
989 ( p_item_type => itemtype
990 , p_item_key => itemkey
991 , x_wf_user_id => l_wf_user_id
992 ) ;
993
994
995
996 -- Start Change Lines Initiate Change Workflows
997 -- ENGCLACT:INITIATE_CHANGE
998 Eng_Workflow_Util.StartAllLineWorkflows
999 ( x_return_status => l_return_status
1000 , x_msg_count => l_msg_count
1001 , x_msg_data => l_msg_data
1002 , p_item_type => itemtype
1003 , p_item_key => itemkey
1004 , p_change_id => l_change_id
1005 , p_wf_user_id => l_wf_user_id
1006 , p_host_url => l_host_url
1007 , p_line_item_type => Eng_Workflow_Util.G_CHANGE_LINE_ACTION_ITEM_TYPE
1008 , p_line_process_name => Eng_Workflow_Util.G_CL_INITIATE_CHANGE_PROC
1009 ) ;
1010
1011 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
1012
1013 result := 'COMPLETE';
1014 return;
1015
1016 ELSE
1017
1018 -- Unexpected Exception
1019 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
1020
1021 END IF ;
1022
1023 end if ; -- funcmode : RUN
1024
1025 --
1026 -- CANCEL mode - activity 'compensation'
1027 --
1028 -- This is in the event that the activity must be undone,
1029 -- for example when a process is reset to an earlier point
1030 -- due to a loop back.
1031 --
1032 if (funcmode = 'CANCEL') then
1033
1034 -- your cancel code goes here
1035 null;
1036
1037 -- no result needed
1038 result := 'COMPLETE';
1039 return;
1040
1041 end if;
1042
1043 --
1044 -- Other execution modes may be created in the future. Your
1045 -- activity will indicate that it does not implement a mode
1046 -- by returning null
1047 --
1048 result := '';
1049 return;
1050
1051 EXCEPTION
1052
1053 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1054 -- The line below records this function call in the error system
1055 -- in the case of an exception.
1056 wf_core.context('Eng_Workflow_Pub', 'INITIATE_LINES',
1057 itemtype, itemkey, to_char(actid), funcmode);
1058 raise;
1059
1060 WHEN OTHERS THEN
1061 -- The line below records this function call in the error system
1062 -- in the case of an exception.
1063 wf_core.context('Eng_Workflow_Pub', 'INITIATE_LINES',
1064 itemtype, itemkey, to_char(actid), funcmode);
1065 raise;
1066
1067 END INITIATE_LINES;
1068
1069
1070 -- PROCEDURE SELECT_ROUTE_PEOPLE
1071 PROCEDURE SELECT_ROUTE_PEOPLE(
1072 itemtype in varchar2,
1073 itemkey in varchar2,
1074 actid in number,
1075 funcmode in varchar2,
1076 result in out NOCOPY varchar2)
1077 IS
1078
1079 l_return_status VARCHAR2(1);
1080 l_msg_count NUMBER ;
1081 l_msg_data VARCHAR2(200);
1082
1083
1084 BEGIN
1085
1086 --
1087 -- RUN mode - normal process execution
1088 --
1089 if (funcmode = 'RUN') then
1090
1091 -- Set Adhoc Party Role
1092 Eng_Workflow_Util.SetRoutePeopleRole
1093 ( x_return_status => l_return_status
1094 , x_msg_count => l_msg_count
1095 , x_msg_data => l_msg_data
1096 , p_item_type => itemtype
1097 , p_item_key => itemkey
1098 ) ;
1099
1100
1101 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
1102
1103 -- set result
1104 result := 'COMPLETE';
1105 return;
1106
1107 -- None
1108 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
1109
1110 -- set result
1111 result := 'COMPLETE:NONE';
1112 return;
1113 ELSE
1114
1115 -- Unexpected Exception
1116 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
1117
1118 END IF ;
1119
1120 end if ; -- funcmode : RUN
1121
1122
1123 --
1124 -- CANCEL mode - activity 'compensation'
1125 --
1126 -- This is in the event that the activity must be undone,
1127 -- for example when a process is reset to an earlier point
1128 -- due to a loop back.
1129 --
1130 if (funcmode = 'CANCEL') then
1131
1132 -- your cancel code goes here
1133 null;
1134
1135 -- no result needed
1136 result := 'COMPLETE';
1137 return;
1138 end if;
1139
1140
1141 --
1142 -- Other execution modes may be created in the future. Your
1143 -- activity will indicate that it does not implement a mode
1144 -- by returning null
1145 --
1146 result := '';
1147 return;
1148
1149 EXCEPTION
1150
1151 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1152 -- The line below records this function call in the error system
1153 -- in the case of an exception.
1154 wf_core.context('Eng_Workflow_Pub', 'SELECT_ROUTE_PEOPLE',
1155 itemtype, itemkey, to_char(actid), funcmode);
1156 raise;
1157
1158
1159 WHEN OTHERS THEN
1160 -- The line below records this function call in the error system
1161 -- in the case of an exception.
1162 wf_core.context('Eng_Workflow_Pub', 'SELECT_ROUTE_PEOPLE',
1163 itemtype, itemkey, to_char(actid), funcmode);
1164 raise;
1165
1166 END SELECT_ROUTE_PEOPLE ;
1167
1168
1169 -- PROCEDURE SELECT_STEP_PEOPLE
1170 PROCEDURE SELECT_STEP_PEOPLE(
1171 itemtype in varchar2,
1172 itemkey in varchar2,
1173 actid in number,
1174 funcmode in varchar2,
1175 result in out NOCOPY varchar2)
1176 IS
1177
1178 l_return_status VARCHAR2(1);
1179 l_msg_count NUMBER ;
1180 l_msg_data VARCHAR2(200);
1181
1182
1183 BEGIN
1184
1185 --
1186 -- RUN mode - normal process execution
1187 --
1188 if (funcmode = 'RUN') then
1189
1190 -- Set Adhoc Party Role
1191 Eng_Workflow_Util.SetStepPeopleRole
1192 ( x_return_status => l_return_status
1193 , x_msg_count => l_msg_count
1194 , x_msg_data => l_msg_data
1195 , p_item_type => itemtype
1196 , p_item_key => itemkey
1197 ) ;
1198
1199
1200 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
1201
1202 -- set result
1203 result := 'COMPLETE';
1204 return;
1205
1206 -- None
1207 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
1208
1209 -- set result
1210 result := 'COMPLETE:NONE';
1211 return;
1212 ELSE
1213
1214 -- Unexpected Exception
1215 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
1216
1217 END IF ;
1218
1219 end if ; -- funcmode : RUN
1220
1221
1222 --
1223 -- CANCEL mode - activity 'compensation'
1224 --
1225 -- This is in the event that the activity must be undone,
1226 -- for example when a process is reset to an earlier point
1227 -- due to a loop back.
1228 --
1229 if (funcmode = 'CANCEL') then
1230
1231 -- your cancel code goes here
1232 null;
1233
1234 -- no result needed
1235 result := 'COMPLETE';
1236 return;
1237 end if;
1238
1239
1240 --
1241 -- Other execution modes may be created in the future. Your
1242 -- activity will indicate that it does not implement a mode
1243 -- by returning null
1244 --
1245 result := '';
1246 return;
1247
1248 EXCEPTION
1249
1250 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1251 -- The line below records this function call in the error system
1252 -- in the case of an exception.
1253 wf_core.context('Eng_Workflow_Pub', 'SELECT_STEP_PEOPLE',
1254 itemtype, itemkey, to_char(actid), funcmode);
1255 raise;
1256
1257
1258 WHEN OTHERS THEN
1259 -- The line below records this function call in the error system
1260 -- in the case of an exception.
1261 wf_core.context('Eng_Workflow_Pub', 'SELECT_STEP_PEOPLE',
1262 itemtype, itemkey, to_char(actid), funcmode);
1263 raise;
1264
1265 END SELECT_STEP_PEOPLE;
1266
1267
1268
1269 PROCEDURE DELETE_ADHOC_ROLES_AND_USERS(
1270 itemtype in varchar2,
1271 itemkey in varchar2,
1272 actid in number,
1273 funcmode in varchar2,
1274 result in out NOCOPY varchar2)
1275 IS
1276
1277 l_return_status VARCHAR2(1);
1278 l_msg_count NUMBER ;
1279 l_msg_data VARCHAR2(200);
1280
1281
1282 BEGIN
1283
1284 --
1285 -- RUN mode - normal process execution
1286 --
1287 if (funcmode = 'RUN') then
1288
1289 -- Delete Workflow Adhoc Role and Local Users
1290 Eng_Workflow_Util.DeleteAdhocRolesAndUsers
1291 ( x_return_status => l_return_status
1292 , x_msg_count => l_msg_count
1293 , x_msg_data => l_msg_data
1294 , p_item_type => itemtype
1295 , p_item_key => itemkey
1296 ) ;
1297
1298
1299 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
1300
1301 -- set result
1302 result := 'COMPLETE';
1303 return;
1304
1305 ELSE
1306
1307 -- Unexpected Exception
1308 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
1309
1310 END IF ;
1311
1312 end if ; -- funcmode : RUN
1313
1314
1315 --
1316 -- CANCEL mode - activity 'compensation'
1317 --
1318 -- This is in the event that the activity must be undone,
1319 -- for example when a process is reset to an earlier point
1320 -- due to a loop back.
1321 --
1322 if (funcmode = 'CANCEL') then
1323
1324 -- your cancel code goes here
1325 null;
1326
1327 -- no result needed
1328 result := 'COMPLETE';
1329 return;
1330 end if;
1331
1332
1333 --
1334 -- Other execution modes may be created in the future. Your
1335 -- activity will indicate that it does not implement a mode
1336 -- by returning null
1337 --
1338 result := '';
1339 return;
1340
1341 EXCEPTION
1342
1343 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1344 -- The line below records this function call in the error system
1345 -- in the case of an exception.
1346 wf_core.context('Eng_Workflow_Pub', 'DELETE_ADHOC_ROLES_AND_USERS',
1347 itemtype, itemkey, to_char(actid), funcmode);
1348 raise;
1349
1350
1351 WHEN OTHERS THEN
1352 -- The line below records this function call in the error system
1353 -- in the case of an exception.
1354 wf_core.context('Eng_Workflow_Pub', 'DELETE_ADHOC_ROLES_AND_USERS',
1355 itemtype, itemkey, to_char(actid), funcmode);
1356 raise;
1357
1358 END DELETE_ADHOC_ROLES_AND_USERS ;
1359
1360
1361 PROCEDURE SET_REQUEST_OPTIONS(
1362 itemtype in varchar2,
1363 itemkey in varchar2,
1364 actid in number,
1365 funcmode in varchar2,
1366 result in out NOCOPY varchar2)
1367 IS
1368
1369 l_action_id NUMBER ;
1370 l_timeout_min NUMBER ;
1371 l_response_by_date DATE ;
1372
1373 CURSOR c_action_attr ( p_action_id NUMBER )
1374 IS
1375 SELECT TRUNC(response_by_date) response_by_date
1376 FROM ENG_CHANGE_ACTIONS
1377 WHERE action_id = p_action_id ;
1378
1379 BEGIN
1380
1381 --
1382 -- RUN mode - normal process execution
1383 --
1384 if (funcmode = 'RUN') then
1385
1386 -- Get Response Timeout Min
1387 Eng_Workflow_Util.GetNtfResponseTimeOut
1388 ( p_item_type => itemtype
1389 , p_item_key => itemkey
1390 , x_timeout_min => l_timeout_min
1391 ) ;
1392
1393 IF l_timeout_min IS NULL
1394 THEN
1395 -- Get Action Id
1396 Eng_Workflow_Util.GetActionId
1397 ( p_item_type => itemtype
1398 , p_item_key => itemkey
1399 , x_action_id => l_action_id
1400 ) ;
1401
1402 -- Get Response By Date from action table
1403 FOR i IN c_action_attr (p_action_id => l_action_id )
1404 LOOP
1405
1406 l_response_by_date := i.response_by_date ;
1407
1408 END LOOP ;
1409
1410 -- 115.10
1411 -- The Response By Date is still null for Reqeust Comment Action
1412 -- This call is just for fugure reference
1413 -- Set Response Timeout Min
1414 Eng_Workflow_Util.SetNtfResponseTimeOut
1415 ( p_item_type => itemtype
1416 , p_item_key => itemkey
1417 , p_response_by_date => l_response_by_date
1418 ) ;
1419
1420
1421 END IF ;
1422
1423
1424 end if ; -- funcmode : RUN
1425
1426 --
1427 -- CANCEL mode - activity 'compensation'
1428 --
1429 -- This is in the event that the activity must be undone,
1430 -- for example when a process is reset to an earlier point
1431 -- due to a loop back.
1432 --
1433 if (funcmode = 'CANCEL') then
1434
1435 -- your cancel code goes here
1436 null;
1437
1438 -- no result needed
1439 result := 'COMPLETE';
1440 return;
1441 end if;
1442
1443
1444 --
1445 -- Other execution modes may be created in the future. Your
1446 -- activity will indicate that it does not implement a mode
1447 -- by returning null
1448 --
1449 result := '';
1450 return;
1451
1452 EXCEPTION
1453
1454 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1455 -- The line below records this function call in the error system
1456 -- in the case of an exception.
1457 wf_core.context('Eng_Workflow_Pub', 'SET_REQUEST_OPTIONS',
1458 itemtype, itemkey, to_char(actid), funcmode);
1459 raise;
1460
1461
1462 WHEN OTHERS THEN
1463 -- The line below records this function call in the error system
1464 -- in the case of an exception.
1465 wf_core.context('Eng_Workflow_Pub', 'SET_REQUEST_OPTIONS',
1466 itemtype, itemkey, to_char(actid), funcmode);
1467 raise;
1468
1469
1470 END SET_REQUEST_OPTIONS ;
1471
1472
1473 PROCEDURE SET_STEP_ACT_OPTIONS(
1474 itemtype in varchar2,
1475 itemkey in varchar2,
1476 actid in number,
1477 funcmode in varchar2,
1478 result in out NOCOPY varchar2)
1479 IS
1480
1481 l_route_step_id NUMBER ;
1482 l_timeout_min NUMBER ;
1483 l_required_relative_days NUMBER ;
1484 l_response_by_date DATE ;
1485 l_condition_type_code VARCHAR2(30) ;
1486
1487 CURSOR c_step_act( p_step_id NUMBER )
1488 IS
1489 SELECT TRUNC(required_date) response_by_date
1490 , condition_type_code
1491 , required_relative_days required_relative_days
1492 FROM ENG_CHANGE_ROUTE_STEPS
1493 WHERE step_id = p_step_id ;
1494
1495 BEGIN
1496
1497 --
1498 -- RUN mode - normal process execution
1499 --
1500 if (funcmode = 'RUN') then
1501
1502 -- Get Route Step Id
1503 Eng_Workflow_Util.GetRouteStepId
1504 ( p_item_type => itemtype
1505 , p_item_key => itemkey
1506 , x_route_step_id => l_route_step_id
1507 ) ;
1508
1509 -- Get Step Activity Options
1510 FOR i IN c_step_act (p_step_id => l_route_step_id )
1511 LOOP
1512
1513 l_response_by_date := i.response_by_date ;
1514 l_condition_type_code := i.condition_type_code ;
1515 l_required_relative_days := i.required_relative_days ;
1516
1517 END LOOP ;
1518
1519 -- Set Step Action Voting Option based on step condition type
1520 -- code
1521 Eng_Workflow_Util.SetStepActVotingOption
1522 ( p_item_type => itemtype
1523 , p_item_key => itemkey
1524 , p_condition_type_code => l_condition_type_code
1525 ) ;
1526
1527 -- Get Response Timeout Min
1528 Eng_Workflow_Util.GetNtfResponseTimeOut
1529 ( p_item_type => itemtype
1530 , p_item_key => itemkey
1531 , x_timeout_min => l_timeout_min
1532 ) ;
1533
1534
1535 IF l_timeout_min IS NULL
1536 THEN
1537 --
1538 -- Comment out for reminder notification
1539 -- We disabled time out functionality
1540 --
1541 -- Set Response Timeout Min
1542 -- Eng_Workflow_Util.SetNtfResponseTimeOut
1543 -- ( p_item_type => itemtype
1544 -- , p_item_key => itemkey
1545 -- , p_response_by_date => l_response_by_date
1546 -- ) ;
1547 --
1548
1549 -- Use the number of days to set Response TimeOut
1550 -- Set Response Timeout Min
1551 Eng_Workflow_Util.SetNtfResponseTimeOut
1552 ( p_item_type => itemtype
1553 , p_item_key => itemkey
1554 , p_required_relative_days => l_required_relative_days
1555 ) ;
1556
1557
1558
1559 END IF ;
1560
1561
1562
1563
1564 end if ; -- funcmode : RUN
1565
1566 --
1567 -- CANCEL mode - activity 'compensation'
1568 --
1569 -- This is in the event that the activity must be undone,
1570 -- for example when a process is reset to an earlier point
1571 -- due to a loop back.
1572 --
1573 if (funcmode = 'CANCEL') then
1574
1575 -- your cancel code goes here
1576 null;
1577
1578 -- no result needed
1579 result := 'COMPLETE';
1580 return;
1581 end if;
1582
1583
1584 --
1585 -- Other execution modes may be created in the future. Your
1586 -- activity will indicate that it does not implement a mode
1587 -- by returning null
1588 --
1589 result := '';
1590 return;
1591
1592 EXCEPTION
1593
1594 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1595 -- The line below records this function call in the error system
1596 -- in the case of an exception.
1597 wf_core.context('Eng_Workflow_Pub', 'SET_STEP_ACT_OPTIONS',
1598 itemtype, itemkey, to_char(actid), funcmode);
1599 raise;
1600
1601
1602 WHEN OTHERS THEN
1603 -- The line below records this function call in the error system
1604 -- in the case of an exception.
1605 wf_core.context('Eng_Workflow_Pub', 'SET_STEP_ACT_OPTIONS',
1606 itemtype, itemkey, to_char(actid), funcmode);
1607 raise;
1608
1609
1610 END SET_STEP_ACT_OPTIONS ;
1611
1612
1613
1614 PROCEDURE RESPOND_TO_COMMENT_REQUEST (
1615 itemtype in varchar2,
1616 itemkey in varchar2,
1617 actid in number,
1618 funcmode in varchar2,
1619 result in out NOCOPY varchar2)
1620 IS
1621
1622 l_return_status VARCHAR2(1);
1623 l_msg_count NUMBER ;
1624 l_msg_data VARCHAR2(200);
1625
1626 l_action_id NUMBER ;
1627 l_timeout_min NUMBER ;
1628 l_response_code VARCHAR2(30) ;
1629 l_response_by_date DATE ;
1630 l_sysdate DATE ;
1631
1632 l_created_action_id NUMBER ;
1633 l_child_item_type VARCHAR2(8) ;
1634 l_child_item_key VARCHAR2(240) ;
1635
1636
1637 CURSOR c_action_attr ( p_action_id NUMBER )
1638 IS
1639 SELECT TRUNC(response_by_date) response_by_date
1640 , sysdate
1641 FROM ENG_CHANGE_ACTIONS
1642 WHERE action_id = p_action_id ;
1643
1644
1645 l_debug_flag BOOLEAN := FALSE ; -- For TEST : FALSE ;
1646 l_output_dir VARCHAR2(80) ;
1647 l_debug_filename VARCHAR2(30) ;
1648
1649 l_attr_value varchar2(4000); --bug 10033738 , consistent to the maxsize in wf_notification.GetAttrText, comment max lenght 4000 bytes
1650 l_nid number;
1651
1652 BEGIN
1653
1654 --
1655 -- RUN mode - normal process execution
1656 --
1657 if (funcmode = 'RUN') then
1658
1659
1660 Eng_Workflow_Util.Get_Debug_Mode
1661 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
1662
1663 -- For Test/Debug
1664 IF l_debug_flag THEN
1665 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
1666 , 'RUN:RESPOND_TO_COMMENT_REQUEST-' || actid ) ;
1667 END IF ;
1668
1669 IF l_debug_flag THEN
1670 Eng_Workflow_Util.Write_Debug('calling VoteForReuslt. . . ' ) ;
1671 END IF ;
1672
1673
1674 /* Bug2885157
1675 WF_STANDARD.VoteForResultType ( itemtype
1676 , itemkey
1677 , actid
1678 , funcmode
1679 , result ) ;
1680 */
1681
1682 Eng_Workflow_Util.RouteStepVoteForResultType
1683 ( itemtype
1684 , itemkey
1685 , actid
1686 , funcmode
1687 , result ) ;
1688
1689
1690 IF l_debug_flag THEN
1691 Eng_Workflow_Util.Close_Debug_Session ;
1692 END IF ;
1693
1694 return;
1695
1696 end if ; -- funcmode : RUN
1697
1698
1699 --
1700 -- RESPOND mode -
1701 --
1702 -- Notificaction Response
1703 --
1704 if (funcmode = 'RESPOND') then
1705
1706
1707 Eng_Workflow_Util.Get_Debug_Mode
1708 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
1709
1710 -- For Test/Debug
1711 IF l_debug_flag THEN
1712 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
1713 , l_debug_filename || actid ) ;
1714 END IF ;
1715
1716
1717
1718 l_response_code := WF_NOTIFICATION.GetAttrText
1719 ( nid => WF_ENGINE.context_nid
1720 , aname => 'RESULT'
1721 );
1722
1723 -- Record Action
1724 Eng_Workflow_Util.CreateAction
1725 ( x_return_status => l_return_status
1726 , x_msg_count => l_msg_count
1727 , x_msg_data => l_msg_data
1728 , p_item_type => itemtype
1729 , p_item_key => itemkey
1730 , p_notification_id => WF_ENGINE.context_nid
1731 , p_action_type => Eng_Workflow_Util.G_ACT_REPLIED
1732 , x_action_id => l_created_action_id
1733 , p_raise_event_flag => FND_API.G_TRUE -- R12
1734 ) ;
1735
1736
1737 IF l_debug_flag THEN
1738 Eng_Workflow_Util.Write_Debug('After call Eng_Workflow_Util.CreateAction: Return: ' || l_return_status ) ;
1739 END IF ;
1740
1741
1742 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1743
1744 -- Unexpected Exception
1745 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
1746
1747 END IF ;
1748
1749
1750
1751 -- Send Reponse FYI notification to original requestor of
1752 -- the comment request from Response FYI process
1753 Eng_Workflow_Util.START_RESPONSE_FYI_PROCESS
1754 ( p_itemtype => itemtype
1755 , p_itemkey => itemkey
1756 , p_orig_response_option => NULL
1757 , p_responded_ntf_id => WF_ENGINE.context_nid
1758 , p_responded_comment_id => l_created_action_id
1759 , x_msg_count => l_msg_count
1760 , x_msg_data => l_msg_data
1761 , x_return_status => l_return_status
1762 ) ;
1763
1764
1765 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
1766
1767 -- set result
1768 result := 'COMPLETE';
1769
1770 IF l_debug_flag THEN
1771 Eng_Workflow_Util.Close_Debug_Session ;
1772 END IF ;
1773
1774 return;
1775
1776 ELSE
1777
1778 -- Unexpected Exception
1779 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
1780
1781 END IF ;
1782
1783
1784 end if;
1785
1786
1787 --
1788 -- TRANSFER or FORWARD mode -
1789 --
1790 -- Notificaction Reassignment
1791 --
1792 if (funcmode = 'TRANSFER' OR funcmode = 'FORWARD' )
1793 then
1794 -- Future Enh
1795 NULL ;
1796 end if;
1797
1798
1799
1800 --
1801 -- CANCEL mode - activity 'compensation'
1802 --
1803 -- This is in the event that the activity must be undone,
1804 -- for example when a process is reset to an earlier point
1805 -- due to a loop back.
1806 --
1807 if (funcmode = 'CANCEL') then
1808
1809 -- your cancel code goes here
1810 null;
1811
1812 -- no result needed
1813 result := 'COMPLETE';
1814 return;
1815 end if;
1816 -- Bug 10033738 to make Comment text input required in Change Action 'request comment' notification
1817 if (funcmode = 'VALIDATE') then
1818 l_nid := wf_engine.context_nid;
1819 -- Retrieve the respond attribute value
1820 l_attr_value := wf_notification.GetAttrText(l_nid,'WF_NOTE');
1821
1822 -- Use WF_CORE API to raise a translated error message back to the
1823 -- notification page
1824 if (l_attr_value is null) then
1825 wf_core.raise(FND_MESSAGE.get_string('ENG','ENG_COMMENT_IS_REQUIRED'));
1826 end if;
1827 end if;
1828
1829 --
1830 -- Other execution modes may be created in the future. Your
1831 -- activity will indicate that it does not implement a mode
1832 -- by returning null
1833 --
1834 result := '';
1835 return;
1836
1837 EXCEPTION
1838
1839 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1840
1841 IF l_debug_flag THEN
1842 Eng_Workflow_Util.Close_Debug_Session ;
1843 END IF ;
1844
1845 -- The line below records this function call in the error system
1846 -- in the case of an exception.
1847 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_COMMENT_REQUEST',
1848 itemtype, itemkey, to_char(actid), funcmode);
1849 raise;
1850
1851
1852 WHEN OTHERS THEN
1853
1854 IF l_debug_flag THEN
1855 Eng_Workflow_Util.Close_Debug_Session ;
1856 END IF ;
1857
1858 -- The line below records this function call in the error system
1859 -- in the case of an exception.
1860 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_COMMENT_REQUEST',
1861 itemtype, itemkey, to_char(actid), funcmode);
1862 raise;
1863
1864 END RESPOND_TO_COMMENT_REQUEST ;
1865
1866
1867 PROCEDURE RESPOND_TO_ROUTE_APPROVAL_REQ (
1868 itemtype in varchar2,
1869 itemkey in varchar2,
1870 actid in number,
1871 funcmode in varchar2,
1872 result in out NOCOPY varchar2)
1873 IS
1874
1875 l_return_status VARCHAR2(1);
1876 l_msg_count NUMBER ;
1877 l_msg_data VARCHAR2(200);
1878
1879 l_response_code VARCHAR2(30) ;
1880
1881 l_debug_flag BOOLEAN := FALSE ; -- For TEST : FALSE ;
1882 l_output_dir VARCHAR2(80) ; -- := '/sqlcom/log/plm115d' ;
1883 l_debug_filename VARCHAR2(30) ; -- 'ResToRouteAppr' ;
1884
1885
1886
1887 BEGIN
1888
1889 --
1890 -- RUN mode - normal process execution
1891 --
1892 if (funcmode = 'RUN') then
1893
1894 Eng_Workflow_Util.Get_Debug_Mode
1895 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
1896
1897 -- For Test/Debug
1898 IF l_debug_flag THEN
1899 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
1900 , l_debug_filename || '-' || funcmode || '-' || actid ) ;
1901 END IF ;
1902
1903 IF l_debug_flag THEN
1904 Eng_Workflow_Util.Write_Debug('calling VoteForReuslt. . . ' ) ;
1905 END IF ;
1906
1907
1908 /* Bug2885157
1909 WF_STANDARD.VoteForResultType ( itemtype
1910 , itemkey
1911 , actid
1912 , funcmode
1913 , result ) ;
1914 */
1915
1916 Eng_Workflow_Util.RouteStepVoteForResultType
1917 ( itemtype
1918 , itemkey
1919 , actid
1920 , funcmode
1921 , result ) ;
1922
1923
1924 -- For Test/Debug
1925 IF l_debug_flag THEN
1926 Eng_Workflow_Util.Write_Debug('itemtype: ' || itemtype ) ;
1927 Eng_Workflow_Util.Write_Debug('itemkey: ' || itemkey ) ;
1928 Eng_Workflow_Util.Write_Debug('actid: ' || actid ) ;
1929 Eng_Workflow_Util.Write_Debug('funcmode: ' || funcmode ) ;
1930 Eng_Workflow_Util.Write_Debug('result: ' || result ) ;
1931 END IF ;
1932
1933
1934 IF l_debug_flag THEN
1935 Eng_Workflow_Util.Close_Debug_Session ;
1936 END IF ;
1937
1938 return;
1939
1940 end if ; -- funcmode : RUN
1941
1942 --
1943 -- RESPOND mode -
1944 --
1945 -- Notificaction Response
1946 --
1947 if (funcmode = 'RESPOND') then
1948
1949
1950 -- Eng_Workflow_Util.Get_Debug_Mode
1951 -- (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
1952
1953 -- For Test/Debug
1954 IF l_debug_flag THEN
1955 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
1956 , l_debug_filename || actid ) ;
1957 END IF ;
1958
1959 l_response_code := WF_NOTIFICATION.GetAttrText
1960 ( nid => WF_ENGINE.context_nid
1961 , aname => 'RESULT'
1962 );
1963
1964 -- Record Route Response
1965 Eng_Workflow_Util.SetRouteResponse
1966 ( x_return_status => l_return_status
1967 , x_msg_count => l_msg_count
1968 , x_msg_data => l_msg_data
1969 , p_item_type => itemtype
1970 , p_item_key => itemkey
1971 , p_notification_id => WF_ENGINE.context_nid
1972 , p_response_code => l_response_code
1973 , p_actid => actid
1974 , p_funcmode => funcmode
1975 ) ;
1976
1977
1978 IF l_debug_flag THEN
1979 Eng_Workflow_Util.Write_Debug('After call Eng_Workflow_Util.SetRouteResponse: Return: ' || l_return_status ) ;
1980 END IF ;
1981
1982
1983 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
1984
1985 -- set result
1986 result := 'COMPLETE';
1987
1988 IF l_debug_flag THEN
1989 Eng_Workflow_Util.Close_Debug_Session ;
1990 END IF ;
1991
1992 return;
1993
1994 ELSE
1995
1996 -- Unexpected Exception
1997 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
1998
1999 END IF ;
2000
2001
2002 end if;
2003
2004
2005
2006 --
2007 -- TRANSFER or FORWARD mode -
2008 --
2009 -- Notificaction Reassignment
2010 --
2011 if (funcmode = 'TRANSFER' OR funcmode = 'FORWARD' )
2012 then
2013 Eng_Workflow_Util.reassignRoutePeople( x_return_status => l_return_status
2014 , x_msg_count => l_msg_count
2015 , x_msg_data => l_msg_data
2016 , p_item_type => itemtype
2017 , p_item_key => itemkey
2018 , p_notification_id => WF_ENGINE.context_nid
2019 , p_reassign_mode => funcmode);
2020 result := 'COMPLETE';
2021 return;
2022
2023 end if;
2024
2025
2026 --
2027 -- CANCEL mode - activity 'compensation'
2028 --
2029 -- This is in the event that the activity must be undone,
2030 -- for example when a process is reset to an earlier point
2031 -- due to a loop back.
2032 --
2033 if (funcmode = 'CANCEL') then
2034
2035 -- your cancel code goes here
2036 null;
2037
2038 -- no result needed
2039 result := 'COMPLETE';
2040 return;
2041 end if;
2042
2043
2044 --
2045 -- Other execution modes may be created in the future. Your
2046 -- activity will indicate that it does not implement a mode
2047 -- by returning null
2048 --
2049 result := '';
2050 return;
2051
2052 EXCEPTION
2053
2054 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2055
2056 IF l_debug_flag THEN
2057 Eng_Workflow_Util.Close_Debug_Session ;
2058 END IF ;
2059
2060 -- The line below records this function call in the error system
2061 -- in the case of an exception.
2062 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_APPROVAL_REQ',
2063 itemtype, itemkey, to_char(actid), funcmode);
2064 raise;
2065
2066
2067 WHEN OTHERS THEN
2068
2069 IF l_debug_flag THEN
2070 Eng_Workflow_Util.Close_Debug_Session ;
2071 END IF ;
2072
2073 -- The line below records this function call in the error system
2074 -- in the case of an exception.
2075 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_APPROVAL_REQ',
2076 itemtype, itemkey, to_char(actid), funcmode);
2077 raise;
2078
2079 END RESPOND_TO_ROUTE_APPROVAL_REQ ;
2080
2081
2082
2083 PROCEDURE RESPOND_TO_ROUTE_COMMENT_REQ (
2084 itemtype in varchar2,
2085 itemkey in varchar2,
2086 actid in number,
2087 funcmode in varchar2,
2088 result in out NOCOPY varchar2)
2089 IS
2090
2091 l_return_status VARCHAR2(1);
2092 l_msg_count NUMBER ;
2093 l_msg_data VARCHAR2(200);
2094
2095 l_response_code VARCHAR2(30) ;
2096
2097 l_debug_flag BOOLEAN := FALSE ; -- For TEST : TRUE ;
2098 l_output_dir VARCHAR2(80) ; -- '/appslog/bis_top/utl/plm115dv/log' ;
2099 l_debug_filename VARCHAR2(30) ; -- 'RespRtComReq.log'
2100
2101
2102
2103 BEGIN
2104
2105
2106 --
2107 -- RUN mode - normal process execution
2108 --
2109 if (funcmode = 'RUN') then
2110
2111 Eng_Workflow_Util.Get_Debug_Mode
2112 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
2113
2114
2115 -- For Test/Debug
2116 IF l_debug_flag THEN
2117 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
2118 , l_debug_filename || actid ) ;
2119 END IF ;
2120
2121 IF l_debug_flag THEN
2122 Eng_Workflow_Util.Write_Debug('calling VoteForReuslt. . . ' ) ;
2123 END IF ;
2124
2125 /* Bug2885157
2126 WF_STANDARD.VoteForResultType ( itemtype
2127 , itemkey
2128 , actid
2129 , funcmode
2130 , result ) ;
2131 */
2132
2133 Eng_Workflow_Util.RouteStepVoteForResultType
2134 ( itemtype
2135 , itemkey
2136 , actid
2137 , funcmode
2138 , result ) ;
2139
2140
2141 IF l_debug_flag THEN
2142 Eng_Workflow_Util.Close_Debug_Session ;
2143 END IF ;
2144
2145 return;
2146
2147 end if ; -- funcmode : RUN
2148
2149
2150 --
2151 -- RESPOND mode -
2152 --
2153 -- Notificaction Response
2154 --
2155 if (funcmode = 'RESPOND') then
2156
2157
2158 Eng_Workflow_Util.Get_Debug_Mode
2159 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
2160
2161 -- For Test/Debug
2162 IF l_debug_flag THEN
2163 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
2164 , l_debug_filename || actid ) ;
2165 END IF ;
2166
2167
2168
2169 l_response_code := WF_NOTIFICATION.GetAttrText
2170 ( nid => WF_ENGINE.context_nid
2171 , aname => 'RESULT'
2172 );
2173
2174 -- Record Route Response
2175 Eng_Workflow_Util.SetRouteResponse
2176 ( x_return_status => l_return_status
2177 , x_msg_count => l_msg_count
2178 , x_msg_data => l_msg_data
2179 , p_item_type => itemtype
2180 , p_item_key => itemkey
2181 , p_notification_id => WF_ENGINE.context_nid
2182 , p_response_code => Eng_Workflow_Util.G_RT_REPLIED
2183 , p_actid => actid
2184 , p_funcmode => funcmode
2185 ) ;
2186
2187 IF l_debug_flag THEN
2188 Eng_Workflow_Util.Write_Debug('After call Eng_Workflow_Util.SetRouteResponse: Return: ' || l_return_status ) ;
2189 END IF ;
2190
2191
2192 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
2193
2194 -- set result
2195 result := 'COMPLETE';
2196
2197 IF l_debug_flag THEN
2198 Eng_Workflow_Util.Close_Debug_Session ;
2199 END IF ;
2200
2201
2202 return;
2203
2204 ELSE
2205
2206 -- Unexpected Exception
2207 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
2208
2209 END IF ;
2210
2211
2212 /*
2213 -- Send Reponse FYI notification to original requestor of
2214 -- the comment request from Response FYI process
2215 Eng_Workflow_Util.START_RESPONSE_FYI_PROCESS
2216 ( p_itemtype => itemtype
2217 , p_itemkey => itemkey
2218 , p_orig_response_option => NULL
2219 , p_responded_ntf_id => WF_ENGINE.context_nid
2220 , p_responded_comment_id => l_created_action_id
2221 , x_msg_count => l_msg_count
2222 , x_msg_data => l_msg_data
2223 , x_return_status => l_return_status
2224 ) ;
2225
2226
2227 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
2228
2229 -- set result
2230 result := 'COMPLETE';
2231
2232 IF l_debug_flag THEN
2233 Eng_Workflow_Util.Close_Debug_Session ;
2234 END IF ;
2235
2236 return;
2237
2238 ELSE
2239
2240 -- Unexpected Exception
2241 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
2242
2243 END IF ;
2244 */
2245
2246 end if;
2247
2248 --
2249 -- TRANSFER or FORWARD mode -
2250 --
2251 -- Notificaction Reassignment
2252 --
2253 if (funcmode = 'TRANSFER' OR funcmode = 'FORWARD' )
2254 then
2255 Eng_Workflow_Util.reassignRoutePeople( x_return_status => l_return_status
2256 , x_msg_count => l_msg_count
2257 , x_msg_data => l_msg_data
2258 , p_item_type => itemtype
2259 , p_item_key => itemkey
2260 , p_notification_id => WF_ENGINE.context_nid
2261 , p_reassign_mode => funcmode);
2262 result := 'COMPLETE';
2263 return;
2264
2265 end if;
2266
2267
2268
2269 --
2270 -- CANCEL mode - activity 'compensation'
2271 --
2272 -- This is in the event that the activity must be undone,
2273 -- for example when a process is reset to an earlier point
2274 -- due to a loop back.
2275 --
2276 if (funcmode = 'CANCEL') then
2277
2278 -- your cancel code goes here
2279 null;
2280
2281 -- no result needed
2282 result := 'COMPLETE';
2283 return;
2284 end if;
2285
2286
2287 --
2288 -- Other execution modes may be created in the future. Your
2289 -- activity will indicate that it does not implement a mode
2290 -- by returning null
2291 --
2292 result := '';
2293 return;
2294
2295 EXCEPTION
2296
2297 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2298
2299 IF l_debug_flag THEN
2300 Eng_Workflow_Util.Close_Debug_Session ;
2301 END IF ;
2302
2303 -- The line below records this function call in the error system
2304 -- in the case of an exception.
2305 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_COMMENT_REQ',
2306 itemtype, itemkey, to_char(actid), funcmode);
2307 raise;
2308
2309
2310 WHEN OTHERS THEN
2311
2312 IF l_debug_flag THEN
2313 Eng_Workflow_Util.Close_Debug_Session ;
2314 END IF ;
2315
2316 -- The line below records this function call in the error system
2317 -- in the case of an exception.
2318 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_COMMENT_REQ',
2319 itemtype, itemkey, to_char(actid), funcmode);
2320 raise;
2321
2322 END RESPOND_TO_ROUTE_COMMENT_REQ ;
2323
2324
2325 PROCEDURE RESPOND_TO_ROUTE_DEF_REQ(
2326 itemtype in varchar2,
2327 itemkey in varchar2,
2328 actid in number,
2329 funcmode in varchar2,
2330 result in out NOCOPY varchar2)
2331 IS
2332
2333 l_return_status VARCHAR2(1);
2334 l_msg_count NUMBER ;
2335 l_msg_data VARCHAR2(200);
2336
2337 l_response_code VARCHAR2(30) ;
2338
2339 l_debug_flag BOOLEAN := FALSE ; -- For TEST : FALSE ;
2340 l_output_dir VARCHAR2(80) ; -- := '/sqlcom/log/plm115d' ;
2341 l_debug_filename VARCHAR2(30) ; -- 'ResToRouteDef' ;
2342
2343 l_route_id NUMBER ;
2344 l_route_step_id NUMBER ;
2345 l_wf_user_id NUMBER ;
2346 l_host_url VARCHAR2(256) ;
2347 l_val_def_item_key VARCHAR2(240) ;
2348
2349
2350 BEGIN
2351
2352 --
2353 -- RUN mode - normal process execution
2354 --
2355 if (funcmode = 'RUN') then
2356
2357 Eng_Workflow_Util.Get_Debug_Mode
2358 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
2359
2360
2361 -- For Test/Debug
2362 IF l_debug_flag THEN
2363 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
2364 , l_debug_filename || '-' || funcmode || '-' || actid ) ;
2365 END IF ;
2366
2367 IF l_debug_flag THEN
2368 Eng_Workflow_Util.Write_Debug('calling VoteForReuslt. . . ' ) ;
2369 END IF ;
2370
2371
2372 /* Bug2885157
2373 WF_STANDARD.VoteForResultType ( itemtype
2374 , itemkey
2375 , actid
2376 , funcmode
2377 , result ) ;
2378 */
2379
2380 Eng_Workflow_Util.RouteStepVoteForResultType
2381 ( itemtype
2382 , itemkey
2383 , actid
2384 , funcmode
2385 , result ) ;
2386
2387
2388 -- For Test/Debug
2389 IF l_debug_flag THEN
2390 Eng_Workflow_Util.Write_Debug('itemtype: ' || itemtype ) ;
2391 Eng_Workflow_Util.Write_Debug('itemkey: ' || itemkey ) ;
2392 Eng_Workflow_Util.Write_Debug('actid: ' || actid ) ;
2393 Eng_Workflow_Util.Write_Debug('funcmode: ' || funcmode ) ;
2394 Eng_Workflow_Util.Write_Debug('result: ' || result ) ;
2395 END IF ;
2396
2397
2398 IF l_debug_flag THEN
2399 Eng_Workflow_Util.Close_Debug_Session ;
2400 END IF ;
2401
2402 return;
2403
2404 end if ; -- funcmode : RUN
2405
2406 --
2407 -- RESPOND mode -
2408 --
2409 -- Notificaction Response
2410 --
2411 if (funcmode = 'RESPOND') then
2412
2413
2414 Eng_Workflow_Util.Get_Debug_Mode
2415 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
2416
2417 -- For Test/Debug
2418 IF l_debug_flag THEN
2419 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
2420 , l_debug_filename || actid ) ;
2421 END IF ;
2422
2423 l_response_code := WF_NOTIFICATION.GetAttrText
2424 ( nid => WF_ENGINE.context_nid
2425 , aname => 'RESULT'
2426 );
2427
2428 -- Record Route Response
2429 Eng_Workflow_Util.SetRouteResponse
2430 ( x_return_status => l_return_status
2431 , x_msg_count => l_msg_count
2432 , x_msg_data => l_msg_data
2433 , p_item_type => itemtype
2434 , p_item_key => itemkey
2435 , p_notification_id => WF_ENGINE.context_nid
2436 , p_response_code => l_response_code
2437 , p_actid => actid
2438 , p_funcmode => funcmode
2439 ) ;
2440
2441
2442 IF l_debug_flag THEN
2443 Eng_Workflow_Util.Write_Debug('After call Eng_Workflow_Util.SetRouteResponse: Return: ' || l_return_status ) ;
2444 END IF ;
2445
2446 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2447 -- Unexpected Exception
2448 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
2449
2450 END IF ;
2451
2452
2453 -- Get Host URL
2454 Eng_Workflow_Util.GetHostURL
2455 ( p_item_type => itemtype
2456 , p_item_key => itemkey
2457 , x_host_url => l_host_url
2458 ) ;
2459
2460 -- Get WF User Id
2461 Eng_Workflow_Util.GetWFUserId
2462 ( p_item_type => itemtype
2463 , p_item_key => itemkey
2464 , x_wf_user_id => l_wf_user_id
2465 ) ;
2466
2467 -- Get Route Id
2468 Eng_Workflow_Util.GetRouteId
2469 ( p_item_type => itemtype
2470 , p_item_key => itemkey
2471 , x_route_id => l_route_id
2472 ) ;
2473
2474 -- Get Route Step Id
2475 Eng_Workflow_Util.GetRouteStepId
2476 ( p_item_type => itemtype
2477 , p_item_key => itemkey
2478 , x_route_step_id => l_route_step_id
2479 ) ;
2480
2481
2482 --
2483 -- Decided not to start Validation Def process which
2484 -- is place folder for customization
2485 -- Starting a place folder def process with no validation
2486 -- per each response does not seem to be right
2487 -- Also we don't document this yet
2488 -- Start Workflow to validate definitions
2489 -- Eng_Workflow_Util.StartValidateDefProcess
2490 -- ( x_msg_count => l_msg_count
2491 -- , x_msg_data => l_msg_data
2492 -- , x_return_status => l_return_status
2493 -- , x_val_def_item_key => l_val_def_item_key
2494 -- , p_step_item_type => itemtype
2495 -- , p_step_item_key => itemkey
2496 -- , p_responded_ntf_id => WF_ENGINE.context_nid
2497 -- , p_route_id => l_route_id
2498 -- , p_route_step_id => l_route_step_id
2499 -- , p_val_def_item_type => Eng_Workflow_Util.G_CHANGE_ROUTE_STEP_ITEM_TYPE
2500 -- , p_val_def_process_name => Eng_Workflow_Util.G_VALIDATE_DEFINITION_PROC
2501 -- , p_host_url => l_host_url
2502 -- , p_orig_response => l_response_code
2503 -- ) ;
2504 --
2505
2506 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
2507
2508 -- set result
2509 result := 'COMPLETE';
2510
2511 IF l_debug_flag THEN
2512 Eng_Workflow_Util.Close_Debug_Session ;
2513 END IF ;
2514
2515 return;
2516
2517 ELSE
2518
2519 -- Unexpected Exception
2520 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
2521
2522 END IF ;
2523
2524
2525 end if;
2526
2527
2528
2529 --
2530 -- TRANSFER or FORWARD mode -
2531 --
2532 -- Notificaction Reassignment
2533 --
2534 if (funcmode = 'TRANSFER' OR funcmode = 'FORWARD' )
2535 then
2536 Eng_Workflow_Util.reassignRoutePeople( x_return_status => l_return_status
2537 , x_msg_count => l_msg_count
2538 , x_msg_data => l_msg_data
2539 , p_item_type => itemtype
2540 , p_item_key => itemkey
2541 , p_notification_id => WF_ENGINE.context_nid
2542 , p_reassign_mode => funcmode);
2543 result := 'COMPLETE';
2544 return;
2545
2546 end if;
2547
2548 --
2549 -- CANCEL mode - activity 'compensation'
2550 --
2551 -- This is in the event that the activity must be undone,
2552 -- for example when a process is reset to an earlier point
2553 -- due to a loop back.
2554 --
2555 if (funcmode = 'CANCEL') then
2556
2557 -- your cancel code goes here
2558 null;
2559
2560 -- no result needed
2561 result := 'COMPLETE';
2562 return;
2563 end if;
2564
2565
2566 --
2567 -- Other execution modes may be created in the future. Your
2568 -- activity will indicate that it does not implement a mode
2569 -- by returning null
2570 --
2571 result := '';
2572 return;
2573
2574
2575
2576 EXCEPTION
2577
2578 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2579
2580 IF l_debug_flag THEN
2581 Eng_Workflow_Util.Close_Debug_Session ;
2582 END IF ;
2583
2584 -- The line below records this function call in the error system
2585 -- in the case of an exception.
2586 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_DEF_REQ',
2587 itemtype, itemkey, to_char(actid), funcmode);
2588 raise;
2589
2590
2591 WHEN OTHERS THEN
2592
2593 IF l_debug_flag THEN
2594 Eng_Workflow_Util.Close_Debug_Session ;
2595 END IF ;
2596
2597 -- The line below records this function call in the error system
2598 -- in the case of an exception.
2599 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_DEF_REQ',
2600 itemtype, itemkey, to_char(actid), funcmode);
2601 raise;
2602
2603 END RESPOND_TO_ROUTE_DEF_REQ ;
2604
2605
2606 PROCEDURE RESPOND_TO_ROUTE_DEF_APPR_REQ(
2607 itemtype in varchar2,
2608 itemkey in varchar2,
2609 actid in number,
2610 funcmode in varchar2,
2611 result in out NOCOPY varchar2)
2612 IS
2613
2614 l_return_status VARCHAR2(1);
2615 l_msg_count NUMBER ;
2616 l_msg_data VARCHAR2(200);
2617
2618 l_response_code VARCHAR2(30) ;
2619
2620 l_debug_flag BOOLEAN := FALSE ; -- For TEST : FALSE ;
2621 l_output_dir VARCHAR2(80) ; -- := '/sqlcom/log/plm115d' ;
2622 l_debug_filename VARCHAR2(30) ; -- 'ResToRouteDefAppr' ;
2623
2624
2625 l_route_id NUMBER ;
2626 l_route_step_id NUMBER ;
2627 l_wf_user_id NUMBER ;
2628 l_host_url VARCHAR2(256) ;
2629 l_val_def_item_key VARCHAR2(240) ;
2630
2631 BEGIN
2632
2633 --
2634 -- RUN mode - normal process execution
2635 --
2636 if (funcmode = 'RUN') then
2637
2638 Eng_Workflow_Util.Get_Debug_Mode
2639 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
2640
2641
2642 -- For Test/Debug
2643 IF l_debug_flag THEN
2644 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
2645 , l_debug_filename || '-' || funcmode || '-' || actid ) ;
2646 END IF ;
2647
2648 IF l_debug_flag THEN
2649 Eng_Workflow_Util.Write_Debug('calling VoteForReuslt. . . ' ) ;
2650 END IF ;
2651
2652
2653 /* Bug2885157
2654 WF_STANDARD.VoteForResultType ( itemtype
2655 , itemkey
2656 , actid
2657 , funcmode
2658 , result ) ;
2659 */
2660
2661 Eng_Workflow_Util.RouteStepVoteForResultType
2662 ( itemtype
2663 , itemkey
2664 , actid
2665 , funcmode
2666 , result ) ;
2667
2668
2669 -- For Test/Debug
2670 IF l_debug_flag THEN
2671 Eng_Workflow_Util.Write_Debug('itemtype: ' || itemtype ) ;
2672 Eng_Workflow_Util.Write_Debug('itemkey: ' || itemkey ) ;
2673 Eng_Workflow_Util.Write_Debug('actid: ' || actid ) ;
2674 Eng_Workflow_Util.Write_Debug('funcmode: ' || funcmode ) ;
2675 Eng_Workflow_Util.Write_Debug('result: ' || result ) ;
2676 END IF ;
2677
2678
2679 IF l_debug_flag THEN
2680 Eng_Workflow_Util.Close_Debug_Session ;
2681 END IF ;
2682
2683 return;
2684
2685 end if ; -- funcmode : RUN
2686
2687 --
2688 -- RESPOND mode -
2689 --
2690 -- Notificaction Response
2691 --
2692 if (funcmode = 'RESPOND') then
2693
2694
2695 Eng_Workflow_Util.Get_Debug_Mode
2696 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
2697
2698 -- For Test/Debug
2699 IF l_debug_flag THEN
2700 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
2701 , l_debug_filename || actid ) ;
2702 END IF ;
2703
2704 l_response_code := WF_NOTIFICATION.GetAttrText
2705 ( nid => WF_ENGINE.context_nid
2706 , aname => 'RESULT'
2707 );
2708
2709 -- Record Route Response
2710 Eng_Workflow_Util.SetRouteResponse
2711 ( x_return_status => l_return_status
2712 , x_msg_count => l_msg_count
2713 , x_msg_data => l_msg_data
2714 , p_item_type => itemtype
2715 , p_item_key => itemkey
2716 , p_notification_id => WF_ENGINE.context_nid
2717 , p_response_code => l_response_code
2718 , p_actid => actid
2719 , p_funcmode => funcmode
2720 ) ;
2721
2722
2723 IF l_debug_flag THEN
2724 Eng_Workflow_Util.Write_Debug('After call Eng_Workflow_Util.SetRouteResponse: Return: ' || l_return_status ) ;
2725 END IF ;
2726
2727 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2728 -- Unexpected Exception
2729 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
2730
2731 END IF ;
2732
2733
2734 -- Need to call validation workflow only in case that response is Approved
2735 IF l_response_code = Eng_Workflow_Util.G_RT_APPROVED
2736 THEN
2737
2738
2739 -- Get Host URL
2740 Eng_Workflow_Util.GetHostURL
2741 ( p_item_type => itemtype
2742 , p_item_key => itemkey
2743 , x_host_url => l_host_url
2744 ) ;
2745
2746 -- Get WF User Id
2747 Eng_Workflow_Util.GetWFUserId
2748 ( p_item_type => itemtype
2749 , p_item_key => itemkey
2750 , x_wf_user_id => l_wf_user_id
2751 ) ;
2752
2753 -- Get Route Id
2754 Eng_Workflow_Util.GetRouteId
2755 ( p_item_type => itemtype
2756 , p_item_key => itemkey
2757 , x_route_id => l_route_id
2758 ) ;
2759
2760 -- Get Route Step Id
2761 Eng_Workflow_Util.GetRouteStepId
2762 ( p_item_type => itemtype
2763 , p_item_key => itemkey
2764 , x_route_step_id => l_route_step_id
2765 ) ;
2766
2767
2768 --
2769 -- Decided not to start Validation Def process which
2770 -- is place folder for customization
2771 -- Starting a place folder def process with no validation
2772 -- per each response does not seem to be right
2773 -- Also we don't document this yet
2774 -- Start Workflow to validate definitions
2775 -- Eng_Workflow_Util.StartValidateDefProcess
2776 -- ( x_msg_count => l_msg_count
2777 -- , x_msg_data => l_msg_data
2778 -- , x_return_status => l_return_status
2779 -- , x_val_def_item_key => l_val_def_item_key
2780 -- , p_step_item_type => itemtype
2781 -- , p_step_item_key => itemkey
2782 -- , p_responded_ntf_id => WF_ENGINE.context_nid
2783 -- , p_route_id => l_route_id
2784 -- , p_route_step_id => l_route_step_id
2785 -- , p_val_def_item_type => Eng_Workflow_Util.G_CHANGE_ROUTE_STEP_ITEM_TYPE
2786 -- , p_val_def_process_name => Eng_Workflow_Util.G_VALIDATE_DEFINITION_PROC
2787 -- , p_host_url => l_host_url
2788 -- , p_orig_response => l_response_code
2789 -- ) ;
2790 --
2791 --
2792
2793
2794 END IF ;
2795
2796 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
2797
2798 -- set result
2799 result := 'COMPLETE';
2800
2801 IF l_debug_flag THEN
2802 Eng_Workflow_Util.Close_Debug_Session ;
2803 END IF ;
2804
2805 return;
2806
2807 ELSE
2808
2809 -- Unexpected Exception
2810 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
2811
2812 END IF ;
2813
2814 end if;
2815
2816
2817 --
2818 -- TRANSFER or FORWARD mode -
2819 --
2820 -- Notificaction Reassignment
2821 --
2822 if (funcmode = 'TRANSFER' OR funcmode = 'FORWARD' )
2823 then
2824 Eng_Workflow_Util.reassignRoutePeople( x_return_status => l_return_status
2825 , x_msg_count => l_msg_count
2826 , x_msg_data => l_msg_data
2827 , p_item_type => itemtype
2828 , p_item_key => itemkey
2829 , p_notification_id => WF_ENGINE.context_nid
2830 , p_reassign_mode => funcmode);
2831 result := 'COMPLETE';
2832 return;
2833
2834 end if;
2835
2836
2837 --
2838 -- CANCEL mode - activity 'compensation'
2839 --
2840 -- This is in the event that the activity must be undone,
2841 -- for example when a process is reset to an earlier point
2842 -- due to a loop back.
2843 --
2844 if (funcmode = 'CANCEL') then
2845
2846 -- your cancel code goes here
2847 null;
2848
2849 -- no result needed
2850 result := 'COMPLETE';
2851 return;
2852 end if;
2853
2854
2855 --
2856 -- Other execution modes may be created in the future. Your
2857 -- activity will indicate that it does not implement a mode
2858 -- by returning null
2859 --
2860 result := '';
2861 return;
2862
2863 EXCEPTION
2864
2865 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2866
2867 IF l_debug_flag THEN
2868 Eng_Workflow_Util.Close_Debug_Session ;
2869 END IF ;
2870
2871 -- The line below records this function call in the error system
2872 -- in the case of an exception.
2873 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_DEF_APPR_REQ',
2874 itemtype, itemkey, to_char(actid), funcmode);
2875 raise;
2876
2877
2878 WHEN OTHERS THEN
2879
2880 IF l_debug_flag THEN
2881 Eng_Workflow_Util.Close_Debug_Session ;
2882 END IF ;
2883
2884 -- The line below records this function call in the error system
2885 -- in the case of an exception.
2886 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_DEF_APPR_REQ',
2887 itemtype, itemkey, to_char(actid), funcmode);
2888 raise;
2889
2890 END RESPOND_TO_ROUTE_DEF_APPR_REQ ;
2891
2892
2893 -- RESPOND_TO_ROUTE_CORRECT_REQ
2894 PROCEDURE RESPOND_TO_ROUTE_CORRECT_REQ(
2895 itemtype in varchar2,
2896 itemkey in varchar2,
2897 actid in number,
2898 funcmode in varchar2,
2899 result in out NOCOPY varchar2)
2900 IS
2901
2902 l_return_status VARCHAR2(1);
2903 l_msg_count NUMBER ;
2904 l_msg_data VARCHAR2(200);
2905
2906 l_response_code VARCHAR2(30) ;
2907
2908 l_debug_flag BOOLEAN := FALSE ; -- For TEST : FALSE ;
2909 l_output_dir VARCHAR2(80) ;
2910 l_debug_filename VARCHAR2(30) ; -- 'RespToRtCorrectReq.log' ;
2911
2912
2913
2914 BEGIN
2915
2916 --
2917 -- RUN mode - normal process execution
2918 --
2919 if (funcmode = 'RUN') then
2920
2921 -- For Test/Debug
2922 IF l_debug_flag THEN
2923 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
2924 , l_debug_filename || actid ) ;
2925 END IF ;
2926
2927 IF l_debug_flag THEN
2928 Eng_Workflow_Util.Write_Debug('calling VoteForReuslt. . . ' ) ;
2929 END IF ;
2930
2931 /* Bug2885157
2932 WF_STANDARD.VoteForResultType ( itemtype
2933 , itemkey
2934 , actid
2935 , funcmode
2936 , result ) ;
2937 */
2938
2939 Eng_Workflow_Util.RouteStepVoteForResultType
2940 ( itemtype
2941 , itemkey
2942 , actid
2943 , funcmode
2944 , result ) ;
2945
2946
2947 IF l_debug_flag THEN
2948 Eng_Workflow_Util.Close_Debug_Session ;
2949 END IF ;
2950
2951 return;
2952
2953 end if ; -- funcmode : RUN
2954
2955
2956 --
2957 -- RESPOND mode -
2958 --
2959 -- Notificaction Response
2960 --
2961 if (funcmode = 'RESPOND') then
2962
2963
2964 Eng_Workflow_Util.Get_Debug_Mode
2965 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
2966
2967 -- For Test/Debug
2968 IF l_debug_flag THEN
2969 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
2970 , l_debug_filename || actid ) ;
2971 END IF ;
2972
2973
2974 l_response_code := WF_NOTIFICATION.GetAttrText
2975 ( nid => WF_ENGINE.context_nid
2976 , aname => 'RESULT'
2977 );
2978
2979
2980 l_return_status := FND_API.G_RET_STS_SUCCESS ;
2981
2982 --
2983 -- Put business logic here in future
2984 --
2985
2986
2987 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
2988
2989 -- set result
2990 result := 'COMPLETE';
2991
2992 IF l_debug_flag THEN
2993 Eng_Workflow_Util.Close_Debug_Session ;
2994 END IF ;
2995
2996
2997 return;
2998
2999 ELSE
3000 -- Unexpected Exception
3001 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
3002
3003 END IF ;
3004
3005
3006 end if;
3007
3008 --
3009 -- CANCEL mode - activity 'compensation'
3010 --
3011 -- This is in the event that the activity must be undone,
3012 -- for example when a process is reset to an earlier point
3013 -- due to a loop back.
3014 --
3015 if (funcmode = 'CANCEL') then
3016
3017 -- your cancel code goes here
3018 null;
3019
3020 -- no result needed
3021 result := 'COMPLETE';
3022 return;
3023 end if;
3024
3025
3026 --
3027 -- Other execution modes may be created in the future. Your
3028 -- activity will indicate that it does not implement a mode
3029 -- by returning null
3030 --
3031 result := '';
3032 return;
3033
3034 EXCEPTION
3035
3036 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3037
3038 IF l_debug_flag THEN
3039 Eng_Workflow_Util.Close_Debug_Session ;
3040 END IF ;
3041
3042 -- The line below records this function call in the error system
3043 -- in the case of an exception.
3044 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_CORRECT_REQ',
3045 itemtype, itemkey, to_char(actid), funcmode);
3046 raise;
3047
3048
3049 WHEN OTHERS THEN
3050
3051 IF l_debug_flag THEN
3052 Eng_Workflow_Util.Close_Debug_Session ;
3053 END IF ;
3054
3055 -- The line below records this function call in the error system
3056 -- in the case of an exception.
3057 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_CORRECT_REQ',
3058 itemtype, itemkey, to_char(actid), funcmode);
3059 raise;
3060
3061 END RESPOND_TO_ROUTE_CORRECT_REQ ;
3062
3063
3064 --
3065 -- R12B
3066 -- PROCEDURE RESPOND_TO_ROUTE_RESPONSE_REQ
3067 --
3068 PROCEDURE RESPOND_TO_ROUTE_RESPONSE_REQ (
3069 itemtype in varchar2,
3070 itemkey in varchar2,
3071 actid in number,
3072 funcmode in varchar2,
3073 result in out NOCOPY varchar2)
3074 IS
3075
3076 l_return_status VARCHAR2(1);
3077 l_msg_count NUMBER ;
3078 l_msg_data VARCHAR2(200);
3079
3080 l_response_code VARCHAR2(30) ;
3081
3082 l_debug_flag BOOLEAN := FALSE ; -- For TEST : TRUE ;
3083 l_output_dir VARCHAR2(80) ; -- '/appslog/bis_top/utl/plm115dv/log' ;
3084 l_debug_filename VARCHAR2(30) ; -- 'RespRtComReq.log'
3085
3086
3087
3088 BEGIN
3089
3090
3091 --
3092 -- RUN mode - normal process execution
3093 --
3094 if (funcmode = 'RUN') then
3095
3096 Eng_Workflow_Util.Get_Debug_Mode
3097 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
3098
3099
3100
3101 -- For Test/Debug
3102 IF l_debug_flag THEN
3103 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
3104 , l_debug_filename || actid ) ;
3105 END IF ;
3106
3107
3108 IF l_debug_flag THEN
3109 Eng_Workflow_Util.Write_Debug('calling VoteForReuslt. . . ' ) ;
3110 END IF ;
3111
3112 Eng_Workflow_Util.RouteStepVoteForResultType
3113 ( itemtype
3114 , itemkey
3115 , actid
3116 , funcmode
3117 , result ) ;
3118
3119
3120 IF l_debug_flag THEN
3121 Eng_Workflow_Util.Close_Debug_Session ;
3122 END IF ;
3123
3124 return;
3125
3126 end if ; -- funcmode : RUN
3127
3128
3129 --
3130 -- RESPOND mode -
3131 --
3132 -- Notificaction Response
3133 --
3134 if (funcmode = 'RESPOND') then
3135
3136
3137 Eng_Workflow_Util.Get_Debug_Mode
3138 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
3139
3140 -- For Test/Debug
3141 IF l_debug_flag THEN
3142 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
3143 , l_debug_filename || actid ) ;
3144 END IF ;
3145
3146
3147
3148 l_response_code := WF_NOTIFICATION.GetAttrText
3149 ( nid => WF_ENGINE.context_nid
3150 , aname => 'RESULT'
3151 );
3152
3153 --
3154 -- R12B Modified to support AUTO_REVOKE_RESPONSE NTF Attribute
3155 -- If the response is the value specified in AUTO_REVOKE_RESPONSE NTF Attribute
3156 -- we will revoke roles on this wf assignee
3157 -- Record Route Response
3158 Eng_Workflow_Util.SetRouteResponse
3159 ( x_return_status => l_return_status
3160 , x_msg_count => l_msg_count
3161 , x_msg_data => l_msg_data
3162 , p_item_type => itemtype
3163 , p_item_key => itemkey
3164 , p_notification_id => WF_ENGINE.context_nid
3165 , p_response_code => l_response_code
3166 , p_actid => actid
3167 , p_funcmode => funcmode
3168 ) ;
3169
3170 IF l_debug_flag THEN
3171 Eng_Workflow_Util.Write_Debug('After call Eng_Workflow_Util.SetRouteResponse: Return: ' || l_return_status ) ;
3172 END IF ;
3173
3174
3175 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
3176
3177 -- set result
3178 result := 'COMPLETE';
3179
3180 IF l_debug_flag THEN
3181 Eng_Workflow_Util.Close_Debug_Session ;
3182 END IF ;
3183
3184
3185 return;
3186
3187 ELSE
3188
3189 -- Unexpected Exception
3190 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
3191
3192 END IF ;
3193
3194
3195 /*
3196 -- Send Reponse FYI notification to original requestor of
3197 -- the comment request from Response FYI process
3198 Eng_Workflow_Util.START_RESPONSE_FYI_PROCESS
3199 ( p_itemtype => itemtype
3200 , p_itemkey => itemkey
3201 , p_orig_response_option => NULL
3202 , p_responded_ntf_id => WF_ENGINE.context_nid
3203 , p_responded_comment_id => l_created_action_id
3204 , x_msg_count => l_msg_count
3205 , x_msg_data => l_msg_data
3206 , x_return_status => l_return_status
3207 ) ;
3208
3209
3210 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
3211
3212 -- set result
3213 result := 'COMPLETE';
3214
3215 IF l_debug_flag THEN
3216 Eng_Workflow_Util.Close_Debug_Session ;
3217 END IF ;
3218
3219 return;
3220
3221 ELSE
3222
3223 -- Unexpected Exception
3224 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
3225
3226 END IF ;
3227 */
3228
3229 end if;
3230
3231 --
3232 -- TRANSFER or FORWARD mode -
3233 --
3234 -- Notificaction Reassignment
3235 --
3236 if (funcmode = 'TRANSFER' OR funcmode = 'FORWARD' )
3237 then
3238 Eng_Workflow_Util.reassignRoutePeople( x_return_status => l_return_status
3239 , x_msg_count => l_msg_count
3240 , x_msg_data => l_msg_data
3241 , p_item_type => itemtype
3242 , p_item_key => itemkey
3243 , p_notification_id => WF_ENGINE.context_nid
3244 , p_reassign_mode => funcmode);
3245 result := 'COMPLETE';
3246 return;
3247
3248 end if;
3249
3250
3251
3252 --
3253 -- CANCEL mode - activity 'compensation'
3254 --
3255 -- This is in the event that the activity must be undone,
3256 -- for example when a process is reset to an earlier point
3257 -- due to a loop back.
3258 --
3259 if (funcmode = 'CANCEL') then
3260
3261 -- your cancel code goes here
3262 null;
3263
3264 -- no result needed
3265 result := 'COMPLETE';
3266 return;
3267 end if;
3268
3269
3270 --
3271 -- Other execution modes may be created in the future. Your
3272 -- activity will indicate that it does not implement a mode
3273 -- by returning null
3274 --
3275 result := '';
3276 return;
3277
3278 EXCEPTION
3279
3280 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3281
3282 IF l_debug_flag THEN
3283 Eng_Workflow_Util.Close_Debug_Session ;
3284 END IF ;
3285
3286 -- The line below records this function call in the error system
3287 -- in the case of an exception.
3288 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_RESPONSE_REQ',
3289 itemtype, itemkey, to_char(actid), funcmode);
3290 raise;
3291
3292
3293 WHEN OTHERS THEN
3294
3295 IF l_debug_flag THEN
3296 Eng_Workflow_Util.Close_Debug_Session ;
3297 END IF ;
3298
3299 -- The line below records this function call in the error system
3300 -- in the case of an exception.
3301 wf_core.context('Eng_Workflow_Pub', 'RESPOND_TO_ROUTE_RESPONSE_REQ',
3302 itemtype, itemkey, to_char(actid), funcmode);
3303 raise;
3304
3305 END RESPOND_TO_ROUTE_RESPONSE_REQ ;
3306
3307
3308
3309
3310
3311
3312 -- PROCEDURE START_ROUTE_STEP
3313 PROCEDURE START_ROUTE_STEP(
3314 itemtype in varchar2,
3315 itemkey in varchar2,
3316 actid in number,
3317 funcmode in varchar2,
3318 result in out NOCOPY varchar2)
3319 IS
3320
3321 l_return_status VARCHAR2(1);
3322 l_msg_count NUMBER ;
3323 l_msg_data VARCHAR2(200);
3324
3325 l_route_id NUMBER ;
3326 l_action_id NUMBER ;
3327 l_change_id NUMBER ;
3328 l_change_line_id NUMBER ;
3329 l_wf_user_id NUMBER ;
3330 l_host_url VARCHAR2(256) ;
3331 l_route_step_id NUMBER ;
3332 l_step_item_type VARCHAR2(8) ;
3333 l_step_item_key VARCHAR2(240) ;
3334
3335 l_debug_flag BOOLEAN := FALSE ; -- For TEST : TRUE;
3336
3337 BEGIN
3338
3339 --
3340 -- RUN mode - normal process execution
3341 --
3342 if (funcmode = 'RUN') then
3343
3344
3345 IF l_debug_flag THEN
3346 Eng_Workflow_Util.Write_Debug('In START_ROUTE_STEP . . . ' ) ;
3347 END IF ;
3348
3349 -- Get Chagne Id
3350 Eng_Workflow_Util.GetChangeObject
3351 ( p_item_type => itemtype
3352 , p_item_key => itemkey
3353 , x_change_id => l_change_id
3354 ) ;
3355
3356
3357 -- Get Chagne Line Id
3358 Eng_Workflow_Util.GetChangeLineObject
3359 ( p_item_type => itemtype
3360 , p_item_key => itemkey
3361 , x_change_line_id => l_change_line_id
3362 ) ;
3363
3364 -- Get Host URL
3365 Eng_Workflow_Util.GetHostURL
3366 ( p_item_type => itemtype
3367 , p_item_key => itemkey
3368 , x_host_url => l_host_url
3369 ) ;
3370
3371 -- Get WF User Id
3372 Eng_Workflow_Util.GetWFUserId
3373 ( p_item_type => itemtype
3374 , p_item_key => itemkey
3375 , x_wf_user_id => l_wf_user_id
3376 ) ;
3377
3378 -- Get Route Id
3379 Eng_Workflow_Util.GetRouteId
3380 ( p_item_type => itemtype
3381 , p_item_key => itemkey
3382 , x_route_id => l_route_id
3383 ) ;
3384
3385 IF l_debug_flag THEN
3386 Eng_Workflow_Util.Write_Debug('calling Eng_Workflow_Util.StartNextRouteStep. . . ' ) ;
3387 END IF ;
3388
3389
3390 -- Get Action Id for Parent Route to record
3391 -- Individual User Response for the Step into Action log
3392 -- as a child of Parent Action correctly
3393 Eng_Workflow_Util.GetActionId
3394 ( p_item_type => itemtype
3395 , p_item_key => itemkey
3396 , x_action_id => l_action_id
3397 ) ;
3398
3399
3400 -- Start Next Route Step Workflow
3401 Eng_Workflow_Util.StartNextRouteStep
3402 ( x_return_status => l_return_status
3403 , x_msg_count => l_msg_count
3404 , x_msg_data => l_msg_data
3405 , p_route_item_type => itemtype
3406 , p_route_item_key => itemkey
3407 , p_route_id => l_route_id
3408 , p_route_action_id => l_action_id
3409 , p_change_id => l_change_id
3410 , p_change_line_id => l_change_line_id
3411 , p_wf_user_id => l_wf_user_id
3412 , p_host_url => l_host_url
3413 , x_step_id => l_route_step_id
3414 , x_step_item_type => l_step_item_type
3415 , x_step_item_key => l_step_item_key
3416 ) ;
3417
3418 IF l_debug_flag THEN
3419 Eng_Workflow_Util.Write_Debug('after calling Eng_Workflow_Util.StartNextRouteStep. . . ' ) ;
3420 END IF ;
3421
3422
3423 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
3424
3425
3426 IF l_debug_flag THEN
3427 Eng_Workflow_Util.Write_Debug('Set route step id. ' || to_char(l_route_step_id) ) ;
3428 END IF ;
3429
3430 -- Set started Step Id as current step id
3431 Eng_Workflow_Util.SetRouteStepId
3432 ( p_item_type => itemtype
3433 , p_item_key => itemkey
3434 , p_route_step_id =>l_route_step_id
3435 ) ;
3436
3437 result := 'COMPLETE';
3438 return;
3439
3440 -- None
3441 ELSIF l_return_status = Eng_Workflow_Util.G_RET_STS_NONE THEN
3442
3443 result := 'COMPLETE:NONE';
3444 return;
3445 ELSE
3446
3447 -- Unexpected Exception
3448 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
3449
3450 END IF ;
3451
3452 end if ; -- funcmode : RUN
3453
3454 --
3455 -- CANCEL mode - activity 'compensation'
3456 --
3457 -- This is in the event that the activity must be undone,
3458 -- for example when a process is reset to an earlier point
3459 -- due to a loop back.
3460 --
3461 if (funcmode = 'CANCEL') then
3462
3463 -- your cancel code goes here
3464 null;
3465
3466 -- no result needed
3467 result := 'COMPLETE';
3468 return;
3469 end if;
3470
3471 --
3472 -- Other execution modes may be created in the future. Your
3473 -- activity will indicate that it does not implement a mode
3474 -- by returning null
3475 --
3476 result := '';
3477 return;
3478
3479 EXCEPTION
3480
3481 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3482 -- The line below records this function call in the error system
3483 -- in the case of an exception.
3484 wf_core.context('Eng_Workflow_Pub', 'START_ROUTE_STEP',
3485 itemtype, itemkey, to_char(actid), funcmode);
3486 raise;
3487
3488
3489 WHEN OTHERS THEN
3490 -- The line below records this function call in the error system
3491 -- in the case of an exception.
3492 wf_core.context('Eng_Workflow_Pub', 'START_ROUTE_STEP',
3493 itemtype, itemkey, to_char(actid), funcmode);
3494 raise;
3495
3496 END START_ROUTE_STEP ;
3497
3498
3499 PROCEDURE CHECK_STEP_RESULT(
3500 itemtype in varchar2,
3501 itemkey in varchar2,
3502 actid in number,
3503 funcmode in varchar2,
3504 result in out NOCOPY varchar2)
3505 IS
3506
3507 l_route_step_id NUMBER ;
3508 l_step_status_code VARCHAR2(30) ;
3509
3510 BEGIN
3511
3512 --
3513 -- RUN mode - normal process execution
3514 --
3515 if (funcmode = 'RUN') then
3516
3517 -- Get Route Step Id
3518 Eng_Workflow_Util.GetRouteStepId
3519 ( p_item_type => itemtype
3520 , p_item_key => itemkey
3521 , x_route_step_id => l_route_step_id
3522 ) ;
3523
3524 -- Get Route Step Status
3525 Eng_Workflow_Util.GetRouteStepStatus
3526 ( p_item_type => itemtype
3527 , p_item_key => itemkey
3528 , p_route_step_id => l_route_step_id
3529 , x_status_code => l_step_status_code
3530 ) ;
3531
3532 -- set result
3533 result := 'COMPLETE:' || l_step_status_code ;
3534 return;
3535
3536
3537 end if ; -- funcmode : RUN
3538
3539
3540 --
3541 -- CANCEL mode - activity 'compensation'
3542 --
3543 -- This is in the event that the activity must be undone,
3544 -- for example when a process is reset to an earlier point
3545 -- due to a loop back.
3546 --
3547 if (funcmode = 'CANCEL') then
3548
3549 -- your cancel code goes here
3550 null;
3551
3552 -- no result needed
3553 result := 'COMPLETE';
3554 return;
3555 end if;
3556
3557 --
3558 -- Other execution modes may be created in the future. Your
3559 -- activity will indicate that it does not implement a mode
3560 -- by returning null
3561 --
3562 result := '';
3563 return;
3564
3565 EXCEPTION
3566
3567 WHEN OTHERS THEN
3568 -- The line below records this function call in the error system
3569 -- in the case of an exception.
3570 wf_core.context('Eng_Workflow_Pub', 'CHECK_STEP_RESULT',
3571 itemtype, itemkey, to_char(actid), funcmode);
3572 raise;
3573
3574 END CHECK_STEP_RESULT ;
3575
3576
3577 -- PROCEDURE CHECK_LINE_APPROVALS
3578 PROCEDURE CHECK_LINE_APPROVALS(
3579 itemtype in varchar2,
3580 itemkey in varchar2,
3581 actid in number,
3582 funcmode in varchar2,
3583 result in out NOCOPY varchar2)
3584 IS
3585 l_return_status VARCHAR2(1);
3586 l_msg_count NUMBER ;
3587 l_msg_data VARCHAR2(200);
3588 l_change_id NUMBER ;
3589 l_line_approval_status NUMBER ;
3590
3591
3592 BEGIN
3593
3594 --
3595 -- RUN mode - normal process execution
3596 --
3597 if (funcmode = 'RUN') then
3598
3599 -- Get Chagne Id
3600 Eng_Workflow_Util.GetChangeObject
3601 ( p_item_type => itemtype
3602 , p_item_key => itemkey
3603 , x_change_id => l_change_id
3604 ) ;
3605
3606
3607 Eng_Workflow_Util.CheckAllLineApproved
3608 ( x_return_status => l_return_status
3609 , x_msg_count => l_msg_count
3610 , x_msg_data => l_msg_data
3611 , p_change_id => l_change_id
3612 , x_line_approval_status => l_line_approval_status
3613 ) ;
3614
3615
3616 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
3617
3618 -- set result
3619 result := 'COMPLETE:' || l_line_approval_status ;
3620 return;
3621
3622 ELSE
3623
3624 -- Unexpected Exception
3625 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
3626
3627 END IF ;
3628
3629 end if ; -- funcmode : RUN
3630
3631 --
3632 -- CANCEL mode - activity 'compensation'
3633 --
3634 -- This is in the event that the activity must be undone,
3635 -- for example when a process is reset to an earlier point
3636 -- due to a loop back.
3637 --
3638 if (funcmode = 'CANCEL') then
3639
3640 -- your cancel code goes here
3641 null;
3642
3643 -- no result needed
3644 result := 'COMPLETE';
3645 return;
3646 end if;
3647
3648 --
3649 -- Other execution modes may be created in the future. Your
3650 -- activity will indicate that it does not implement a mode
3651 -- by returning null
3652 --
3653 result := '';
3654 return;
3655
3656 EXCEPTION
3657 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3658 -- The line below records this function call in the error system
3659 -- in the case of an exception.
3660 wf_core.context('Eng_Workflow_Pub', 'CHECK_LINE_APPROVALS',
3661 itemtype, itemkey, to_char(actid), funcmode);
3662 raise;
3663
3664
3665 WHEN OTHERS THEN
3666 -- The line below records this function call in the error system
3667 -- in the case of an exception.
3668 wf_core.context('Eng_Workflow_Pub', 'CHECK_LINE_APPROVALS',
3669 itemtype, itemkey, to_char(actid), funcmode);
3670 raise;
3671
3672 END CHECK_LINE_APPROVALS ;
3673
3674
3675 -- FIND_WAITING_STEP
3676 PROCEDURE FIND_WAITING_STEP (
3677 itemtype in varchar2,
3678 itemkey in varchar2,
3679 actid in number,
3680 funcmode in varchar2,
3681 result in out NOCOPY varchar2)
3682 IS
3683
3684 l_return_status VARCHAR2(1);
3685 l_msg_count NUMBER ;
3686 l_msg_data VARCHAR2(200);
3687
3688 l_route_id NUMBER ;
3689 l_route_step_id NUMBER ;
3690 l_step_item_type VARCHAR2(8) ;
3691 l_step_process_name VARCHAR2(30) ;
3692
3693 BEGIN
3694
3695 --
3696 -- RUN mode - normal process execution
3697 --
3698 if (funcmode = 'RUN') then
3699
3700 -- Get Route Id
3701 Eng_Workflow_Util.GetRouteId
3702 ( p_item_type => itemtype
3703 , p_item_key => itemkey
3704 , x_route_id => l_route_id
3705 ) ;
3706
3707
3708 -- Find Next Route Step Workflow
3709 Eng_Workflow_Util.FindNextRouteStep
3710 ( x_return_status => l_return_status
3711 , x_msg_count => l_msg_count
3712 , x_msg_data => l_msg_data
3713 , p_route_id => l_route_id
3714 , x_step_id => l_route_step_id
3715 , x_step_item_type => l_step_item_type
3716 , x_step_process_name => l_step_process_name
3717 ) ;
3718
3719
3720
3721 IF l_route_step_id IS NOT NULL AND
3722 l_return_status = FND_API.G_RET_STS_SUCCESS
3723 THEN
3724
3725 -- set result
3726 result := 'COMPLETE:' || FND_API.G_TRUE;
3727 return;
3728
3729 ELSIF l_route_step_id IS NULL AND
3730 l_return_status = FND_API.G_RET_STS_SUCCESS
3731 THEN
3732
3733 -- set result
3734 result := 'COMPLETE:' || FND_API.G_FALSE;
3735 return;
3736
3737 ELSE
3738
3739 -- Unexpected Exception
3740 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
3741
3742 END IF ;
3743
3744
3745 end if ; -- funcmode : RUN
3746
3747 --
3748 -- CANCEL mode - activity 'compensation'
3749 --
3750 -- This is in the event that the activity must be undone,
3751 -- for example when a process is reset to an earlier point
3752 -- due to a loop back.
3753 --
3754 if (funcmode = 'CANCEL') then
3755
3756 -- your cancel code goes here
3757 null;
3758
3759 -- no result needed
3760 result := 'COMPLETE';
3761 return;
3762 end if;
3763
3764 --
3765 -- Other execution modes may be created in the future. Your
3766 -- activity will indicate that it does not implement a mode
3767 -- by returning null
3768 --
3769 result := '';
3770 return;
3771
3772 EXCEPTION
3773 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3774 -- The line below records this function call in the error system
3775 -- in the case of an exception.
3776 wf_core.context('Eng_Workflow_Pub', 'FIND_WAITING_STEP',
3777 itemtype, itemkey, to_char(actid), funcmode);
3778 raise;
3779
3780
3781 WHEN OTHERS THEN
3782 -- The line below records this function call in the error system
3783 -- in the case of an exception.
3784 wf_core.context('Eng_Workflow_Pub', 'FIND_WAITING_STEP',
3785 itemtype, itemkey, to_char(actid), funcmode);
3786 raise;
3787
3788 END FIND_WAITING_STEP ;
3789
3790 -- ROUTE_APPROVE_CHANGE
3791 PROCEDURE ROUTE_APPROVE_CHANGE(
3792 itemtype in varchar2,
3793 itemkey in varchar2,
3794 actid in number,
3795 funcmode in varchar2,
3796 result in out NOCOPY varchar2)
3797 IS
3798
3799 l_return_status VARCHAR2(1);
3800 l_msg_count NUMBER ;
3801 l_msg_data VARCHAR2(200);
3802
3803 l_wf_user_id NUMBER ;
3804 l_change_id NUMBER ;
3805 l_change_line_id NUMBER ;
3806 l_change_notice VARCHAR2(10) ;
3807 l_organization_id NUMBER ;
3808 l_route_id NUMBER ;
3809 l_route_type_code VARCHAR2(30) ;
3810 l_route_compl_status_code VARCHAR2(30) ;
3811 l_action_id NUMBER ;
3812 l_action_type VARCHAR2(30) ;
3813 l_parent_action_id NUMBER ;
3814
3815
3816 BEGIN
3817
3818 --
3819 -- RUN mode - normal process execution
3820 --
3821 if (funcmode = 'RUN') then
3822
3823 -- Get WF User Id
3824 Eng_Workflow_Util.GetWFUserId
3825 ( p_item_type => itemtype
3826 , p_item_key => itemkey
3827 , x_wf_user_id => l_wf_user_id
3828 ) ;
3829
3830 -- Get Change Object Identifier
3831 Eng_Workflow_Util.GetChangeObject
3832 ( p_item_type => itemtype
3833 , p_item_key => itemkey
3834 , x_change_id => l_change_id
3835 ) ;
3836
3837 -- Get Chagne Line Id
3838 Eng_Workflow_Util.GetChangeLineObject
3839 ( p_item_type => itemtype
3840 , p_item_key => itemkey
3841 , x_change_line_id => l_change_line_id
3842 ) ;
3843
3844
3845 -- Get Route Id
3846 Eng_Workflow_Util.GetRouteId
3847 ( p_item_type => itemtype
3848 , p_item_key => itemkey
3849 , x_route_id => l_route_id
3850 ) ;
3851
3852 -- Get Route Type Code
3853 Eng_Workflow_Util.GetRouteTypeCode
3854 ( p_route_id => l_route_id
3855 , x_route_type_code => l_route_type_code
3856 ) ;
3857
3858
3859 -- Get Route Status Completion Code
3860 Eng_Workflow_Util.GetRouteComplStatusCode
3861 ( p_route_id => l_route_id
3862 , p_route_type_code => l_route_type_code
3863 , x_route_compl_status_code => l_route_compl_status_code
3864 ) ;
3865
3866
3867 -- Set Route Status
3868 Eng_Workflow_Util.SetRouteStatus
3869 ( p_item_type => itemtype
3870 , p_item_key => itemkey
3871 , p_wf_user_id => l_wf_user_id
3872 , p_route_id => l_route_id
3873 , p_new_status_code => l_route_compl_status_code
3874 , p_change_id => l_change_id
3875 , p_change_line_id => l_change_line_id -- Added in R12B
3876 ) ;
3877
3878
3879 -- In case that Route Object is Change Object
3880 IF l_change_id IS NOT NULL AND l_change_id > 0
3881 THEN
3882
3883 -- Get Action Id and set this as parent action id
3884 Eng_Workflow_Util.GetActionId
3885 ( p_item_type => itemtype
3886 , p_item_key => itemkey
3887 , x_action_id => l_parent_action_id
3888 ) ;
3889
3890
3891 /*************************************************
3892 -- in 115.10, Workflow Routing will not update
3893 -- Approval Status of Change Object
3894 -- Set Approval Status
3895 -- Eng_Workflow_Util.SetChangeApprovalStatus
3896 -- ( x_return_status => l_return_status
3897 -- , x_msg_count => l_msg_count
3898 -- , x_msg_data => l_msg_data
3899 -- , p_item_type => itemtype
3900 -- , p_item_key => itemkey
3901 -- , p_change_id => l_change_id
3902 -- , p_change_line_id => l_change_line_id
3903 -- , p_wf_user_id => l_wf_user_id
3904 -- , p_sync_lines => 1 -- Set sync mode: True
3905 -- , p_new_appr_status_type => Eng_Workflow_Util.G_APPROVED
3906 -- ) ;
3907
3908 -- IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3909
3910 -- Unexpected Exception
3911 -- RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
3912
3913 -- END IF ;
3914 **************************************************/
3915
3916
3917 l_action_type := Eng_Workflow_Util.ConvertRouteStatusToActionType
3918 ( p_route_status_code => l_route_compl_status_code
3919 , p_convert_type => 'WF_PROCESS' ) ;
3920
3921 Eng_Workflow_Util.CreateRouteAction
3922 ( x_return_status => l_return_status
3923 , x_msg_count => l_msg_count
3924 , x_msg_data => l_msg_data
3925 , p_change_id => l_change_id
3926 , p_change_line_id => l_change_line_id
3927 , p_action_type => l_action_type
3928 , p_user_id => Eng_Workflow_Util.G_ACT_SYSTEM_USER_ID
3929 , p_parent_action_id => l_parent_action_id
3930 , p_route_id => l_route_id
3931 , p_comment => NULL
3932 , x_action_id => l_action_id
3933 ) ;
3934
3935
3936 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
3937
3938 -- set result
3939 result := 'COMPLETE';
3940 return;
3941
3942 ELSE
3943
3944 -- Unexpected Exception
3945 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
3946
3947 END IF ;
3948
3949 END IF ;
3950
3951 end if ; -- funcmode : RUN
3952
3953 --
3954 -- CANCEL mode - activity 'compensation'
3955 --
3956 -- This is in the event that the activity must be undone,
3957 -- for example when a process is reset to an earlier point
3958 -- due to a loop back.
3959 --
3960 if (funcmode = 'CANCEL') then
3961
3962 -- your cancel code goes here
3963 null;
3964
3965 -- no result needed
3966 result := 'COMPLETE';
3967 return;
3968 end if;
3969
3970 --
3971 -- Other execution modes may be created in the future. Your
3972 -- activity will indicate that it does not implement a mode
3973 -- by returning null
3974 --
3975 result := '';
3976 return;
3977
3978 EXCEPTION
3979
3980 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3981 -- The line below records this function call in the error system
3982 -- in the case of an exception.
3983 wf_core.context('Eng_Workflow_Pub', 'ROUTE_APPROVE_CHANGE',
3984 itemtype, itemkey, to_char(actid), funcmode);
3985 raise;
3986
3987
3988 WHEN OTHERS THEN
3989 -- The line below records this function call in the error system
3990 -- in the case of an exception.
3991 wf_core.context('Eng_Workflow_Pub', 'ROUTE_APPROVE_CHANGE',
3992 itemtype, itemkey, to_char(actid), funcmode);
3993 raise;
3994
3995 END ROUTE_APPROVE_CHANGE ;
3996
3997 -- ROUTE_REJECT_CHANGE
3998 PROCEDURE ROUTE_REJECT_CHANGE(
3999 itemtype in varchar2,
4000 itemkey in varchar2,
4001 actid in number,
4002 funcmode in varchar2,
4003 result in out NOCOPY varchar2)
4004 IS
4005
4006 l_return_status VARCHAR2(1);
4007 l_msg_count NUMBER ;
4008 l_msg_data VARCHAR2(200);
4009
4010 l_wf_user_id NUMBER ;
4011 l_change_id NUMBER ;
4012 l_change_line_id NUMBER ;
4013 l_route_id NUMBER ;
4014 l_action_id NUMBER ;
4015 l_parent_action_id NUMBER ;
4016 l_action_type VARCHAR2(30) ;
4017
4018 BEGIN
4019
4020 --
4021 -- RUN mode - normal process execution
4022 --
4023 if (funcmode = 'RUN') then
4024
4025 -- Get WF User Id
4026 Eng_Workflow_Util.GetWFUserId
4027 ( p_item_type => itemtype
4028 , p_item_key => itemkey
4029 , x_wf_user_id => l_wf_user_id
4030 ) ;
4031
4032
4033 -- Get Change Object Identifier
4034 Eng_Workflow_Util.GetChangeObject
4035 ( p_item_type => itemtype
4036 , p_item_key => itemkey
4037 , x_change_id => l_change_id
4038 ) ;
4039
4040 -- Get Chagne Line Id
4041 Eng_Workflow_Util.GetChangeLineObject
4042 ( p_item_type => itemtype
4043 , p_item_key => itemkey
4044 , x_change_line_id => l_change_line_id
4045 ) ;
4046
4047 -- Get Route Id
4048 Eng_Workflow_Util.GetRouteId
4049 ( p_item_type => itemtype
4050 , p_item_key => itemkey
4051 , x_route_id => l_route_id
4052 ) ;
4053
4054
4055 -- Set Route Status
4056 Eng_Workflow_Util.SetRouteStatus
4057 ( p_item_type => itemtype
4058 , p_item_key => itemkey
4059 , p_wf_user_id => l_wf_user_id
4060 , p_route_id => l_route_id
4061 , p_new_status_code => Eng_Workflow_Util.G_RT_REJECTED
4062 , p_change_id => l_change_id
4063 , p_change_line_id => l_change_line_id -- Added in R12B
4064 ) ;
4065
4066
4067
4068 -- In case that Route Object is Change Object
4069 IF l_change_id IS NOT NULL AND l_change_id > 0
4070 THEN
4071
4072 /*************************************************
4073 -- in 115.10, Workflow Routing will not update
4074 -- Approval Status of Change Object
4075 -- Set Approval Status
4076 -- Eng_Workflow_Util.SetChangeApprovalStatus
4077 -- ( x_return_status => l_return_status
4078 -- , x_msg_count => l_msg_count
4079 -- , x_msg_data => l_msg_data
4080 -- , p_item_type => itemtype
4081 -- , p_item_key => itemkey
4082 -- , p_change_id => l_change_id
4083 -- , p_change_line_id => l_change_line_id
4084 -- , p_wf_user_id => l_wf_user_id
4085 -- , p_new_appr_status_type => Eng_Workflow_Util.G_REJECTED
4086 -- ) ;
4087
4088
4089 -- IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4090
4091 -- Unexpected Exception
4092 -- RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
4093
4094 -- END IF ;
4095 *************************************************/
4096
4097
4098 -- Get Action Id and set this as parent action id
4099 Eng_Workflow_Util.GetActionId
4100 ( p_item_type => itemtype
4101 , p_item_key => itemkey
4102 , x_action_id => l_parent_action_id
4103 ) ;
4104
4105 l_action_type := Eng_Workflow_Util.ConvertRouteStatusToActionType
4106 ( p_route_status_code => Eng_Workflow_Util.G_RT_REJECTED
4107 , p_convert_type => 'WF_PROCESS' ) ;
4108
4109
4110 Eng_Workflow_Util.CreateRouteAction
4111 ( x_return_status => l_return_status
4112 , x_msg_count => l_msg_count
4113 , x_msg_data => l_msg_data
4114 , p_change_id => l_change_id
4115 , p_change_line_id => l_change_line_id
4116 , p_action_type => l_action_type
4117 , p_user_id => Eng_Workflow_Util.G_ACT_SYSTEM_USER_ID
4118 , p_parent_action_id => l_parent_action_id
4119 , p_route_id => l_route_id
4120 , p_comment => NULL
4121 , x_action_id => l_action_id
4122 ) ;
4123
4124 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
4125
4126 -- set result
4127 result := 'COMPLETE';
4128 return;
4129
4130 ELSE
4131
4132 -- Unexpected Exception
4133 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
4134
4135 END IF ;
4136
4137 END IF ;
4138
4139 end if ; -- funcmode : RUN
4140
4141 --
4142 -- CANCEL mode - activity 'compensation'
4143 --
4144 -- This is in the event that the activity must be undone,
4145 -- for example when a process is reset to an earlier point
4146 -- due to a loop back.
4147 --
4148 if (funcmode = 'CANCEL') then
4149
4150 -- your cancel code goes here
4151 null;
4152
4153 -- no result needed
4154 result := 'COMPLETE';
4155 return;
4156 end if;
4157
4158 --
4159 -- Other execution modes may be created in the future. Your
4160 -- activity will indicate that it does not implement a mode
4161 -- by returning null
4162 --
4163 result := '';
4164 return;
4165
4166 EXCEPTION
4167
4168 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4169 -- The line below records this function call in the error system
4170 -- in the case of an exception.
4171 wf_core.context('Eng_Workflow_Pub', 'ROUTE_REJECT_CHANGE',
4172 itemtype, itemkey, to_char(actid), funcmode);
4173 raise;
4174
4175
4176 WHEN OTHERS THEN
4177 -- The line below records this function call in the error system
4178 -- in the case of an exception.
4179 wf_core.context('Eng_Workflow_Pub', 'ROUTE_REJECT_CHANGE',
4180 itemtype, itemkey, to_char(actid), funcmode);
4181 raise;
4182
4183 END ROUTE_REJECT_CHANGE ;
4184
4185 -- ROUTE_SET_TIMEOUT
4186 PROCEDURE ROUTE_SET_TIMEOUT(
4187 itemtype in varchar2,
4188 itemkey in varchar2,
4189 actid in number,
4190 funcmode in varchar2,
4191 result in out NOCOPY varchar2)
4192 IS
4193
4194 l_return_status VARCHAR2(1);
4195 l_msg_count NUMBER ;
4196 l_msg_data VARCHAR2(200);
4197
4198 l_wf_user_id NUMBER ;
4199 l_change_id NUMBER ;
4200 l_change_line_id NUMBER ;
4201 l_route_id NUMBER ;
4202 l_action_id NUMBER ;
4203 l_parent_action_id NUMBER ;
4204 l_action_type VARCHAR2(30) ;
4205
4206 BEGIN
4207
4208 --
4209 -- RUN mode - normal process execution
4210 --
4211 if (funcmode = 'RUN') then
4212
4213 -- Get WF User Id
4214 Eng_Workflow_Util.GetWFUserId
4215 ( p_item_type => itemtype
4216 , p_item_key => itemkey
4217 , x_wf_user_id => l_wf_user_id
4218 ) ;
4219
4220
4221 -- Get Change Object Identifier
4222 Eng_Workflow_Util.GetChangeObject
4223 ( p_item_type => itemtype
4224 , p_item_key => itemkey
4225 , x_change_id => l_change_id
4226 ) ;
4227
4228 -- Get Chagne Line Id
4229 Eng_Workflow_Util.GetChangeLineObject
4230 ( p_item_type => itemtype
4231 , p_item_key => itemkey
4232 , x_change_line_id => l_change_line_id
4233 ) ;
4234
4235
4236 -- Get Route Id
4237 Eng_Workflow_Util.GetRouteId
4238 ( p_item_type => itemtype
4239 , p_item_key => itemkey
4240 , x_route_id => l_route_id
4241 ) ;
4242
4243
4244 -- Set Route Status
4245 Eng_Workflow_Util.SetRouteStatus
4246 ( p_item_type => itemtype
4247 , p_item_key => itemkey
4248 , p_wf_user_id => l_wf_user_id
4249 , p_route_id => l_route_id
4250 , p_new_status_code => Eng_Workflow_Util.G_RT_TIME_OUT
4251 , p_change_id => l_change_id
4252 , p_change_line_id => l_change_line_id -- Added in R12B
4253 ) ;
4254
4255
4256 -- In case that Route Object is Change Object
4257 IF l_change_id IS NOT NULL AND l_change_id > 0
4258 THEN
4259
4260 /*************************************************
4261 -- in 115.10, Workflow Routing will not update
4262 -- Approval Status of Change Object
4263 -- Set Approval Status
4264 -- Eng_Workflow_Util.SetChangeApprovalStatus
4265 -- ( x_return_status => l_return_status
4266 -- , x_msg_count => l_msg_count
4267 -- , x_msg_data => l_msg_data
4268 -- , p_item_type => itemtype
4269 -- , p_item_key => itemkey
4270 -- , p_change_id => l_change_id
4271 -- , p_change_line_id => l_change_line_id
4272 -- , p_wf_user_id => l_wf_user_id
4273 -- , p_new_appr_status_type => Eng_Workflow_Util.G_TIME_OUT
4274 -- ) ;
4275
4276 -- IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4277
4278 -- Unexpected Exception
4279 -- RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
4280
4281 -- END IF ;
4282 *************************************************/
4283
4284
4285 -- Get Action Id and set this as parent action id
4286 Eng_Workflow_Util.GetActionId
4287 ( p_item_type => itemtype
4288 , p_item_key => itemkey
4289 , x_action_id => l_parent_action_id
4290 ) ;
4291
4292
4293 l_action_type := Eng_Workflow_Util.ConvertRouteStatusToActionType
4294 ( p_route_status_code => Eng_Workflow_Util.G_RT_TIME_OUT
4295 , p_convert_type => 'WF_PROCESS' ) ;
4296
4297
4298 Eng_Workflow_Util.CreateRouteAction
4299 ( x_return_status => l_return_status
4300 , x_msg_count => l_msg_count
4301 , x_msg_data => l_msg_data
4302 , p_change_id => l_change_id
4303 , p_change_line_id => l_change_line_id
4304 , p_action_type => l_action_type
4305 , p_user_id => Eng_Workflow_Util.G_ACT_SYSTEM_USER_ID
4306 , p_parent_action_id => l_parent_action_id
4307 , p_route_id => l_route_id
4308 , p_comment => NULL
4309 , x_action_id => l_action_id
4310 ) ;
4311
4312 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
4313
4314 -- set result
4315 result := 'COMPLETE';
4316 return;
4317
4318 ELSE
4319
4320 -- Unexpected Exception
4321 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
4322
4323 END IF ;
4324
4325 END IF ;
4326
4327 end if ; -- funcmode : RUN
4328
4329 --
4330 -- CANCEL mode - activity 'compensation'
4331 --
4332 -- This is in the event that the activity must be undone,
4333 -- for example when a process is reset to an earlier point
4334 -- due to a loop back.
4335 --
4336 if (funcmode = 'CANCEL') then
4337
4338 -- your cancel code goes here
4339 null;
4340
4341 -- no result needed
4342 result := 'COMPLETE';
4343 return;
4344 end if;
4345
4346 --
4347 -- Other execution modes may be created in the future. Your
4348 -- activity will indicate that it does not implement a mode
4349 -- by returning null
4350 --
4351 result := '';
4352 return;
4353
4354 EXCEPTION
4355
4356 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4357 -- The line below records this function call in the error system
4358 -- in the case of an exception.
4359 wf_core.context('Eng_Workflow_Pub', 'ROUTE_SET_TIMEOUT',
4360 itemtype, itemkey, to_char(actid), funcmode);
4361 raise;
4362
4363 WHEN OTHERS THEN
4364 -- The line below records this function call in the error system
4365 -- in the case of an exception.
4366 wf_core.context('Eng_Workflow_Pub', 'ROUTE_SET_TIMEOUT',
4367 itemtype, itemkey, to_char(actid), funcmode);
4368 raise;
4369
4370 END ROUTE_SET_TIMEOUT ;
4371
4372
4373
4374 -- STEP_COMPLETE_ACTIVITY
4375 PROCEDURE STEP_COMPLETE_ACTIVITY (
4376 itemtype in varchar2,
4377 itemkey in varchar2,
4378 actid in number,
4379 funcmode in varchar2,
4380 result in out NOCOPY varchar2)
4381 IS
4382
4383 l_wf_user_id NUMBER ;
4384 l_route_id NUMBER ;
4385 l_route_step_id NUMBER ;
4386
4387 BEGIN
4388
4389 --
4390 -- RUN mode - normal process execution
4391 --
4392 if (funcmode = 'RUN') then
4393
4394
4395 -- Get WF User Id
4396 Eng_Workflow_Util.GetWFUserId
4397 ( p_item_type => itemtype
4398 , p_item_key => itemkey
4399 , x_wf_user_id => l_wf_user_id
4400 ) ;
4401
4402
4403 -- Get Route Id
4404 Eng_Workflow_Util.GetRouteId
4405 ( p_item_type => itemtype
4406 , p_item_key => itemkey
4407 , x_route_id => l_route_id
4408 ) ;
4409
4410
4411 -- Get Route Step Id
4412 Eng_Workflow_Util.GetRouteStepId
4413 ( p_item_type => itemtype
4414 , p_item_key => itemkey
4415 , x_route_step_id => l_route_step_id
4416 ) ;
4417
4418 -- Set Route Step Status
4419 Eng_Workflow_Util.SetRouteStepStatus
4420 ( p_item_type => itemtype
4421 , p_item_key => itemkey
4422 , p_wf_user_id => l_wf_user_id
4423 , p_route_id => l_route_id
4424 , p_route_step_id => l_route_step_id
4425 , p_new_status_code => Eng_Workflow_Util.G_RT_COMPLETED
4426 ) ;
4427
4428 -- set result
4429 result := 'COMPLETE';
4430 return;
4431
4432 end if ; -- funcmode : RUN
4433
4434 --
4435 -- CANCEL mode - activity 'compensation'
4436 --
4437 -- This is in the event that the activity must be undone,
4438 -- for example when a process is reset to an earlier point
4439 -- due to a loop back.
4440 --
4441 if (funcmode = 'CANCEL') then
4442
4443 -- your cancel code goes here
4444 null;
4445
4446 -- no result needed
4447 result := 'COMPLETE';
4448 return;
4449 end if;
4450
4451 --
4452 -- Other execution modes may be created in the future. Your
4453 -- activity will indicate that it does not implement a mode
4454 -- by returning null
4455 --
4456 result := '';
4457 return;
4458
4459 EXCEPTION
4460
4461 WHEN OTHERS THEN
4462 -- The line below records this function call in the error system
4463 -- in the case of an exception.
4464 wf_core.context('Eng_Workflow_Pub', 'STEP_COMPLETE_ACTIVITY',
4465 itemtype, itemkey, to_char(actid), funcmode);
4466 raise;
4467
4468
4469 END STEP_COMPLETE_ACTIVITY ;
4470
4471 -- STEP_APPROVE_CHANGE
4472 PROCEDURE STEP_APPROVE_CHANGE(
4473 itemtype in varchar2,
4474 itemkey in varchar2,
4475 actid in number,
4476 funcmode in varchar2,
4477 result in out NOCOPY varchar2)
4478 IS
4479
4480 l_wf_user_id NUMBER ;
4481 l_route_id NUMBER ;
4482 l_route_step_id NUMBER ;
4483
4484 BEGIN
4485
4486 --
4487 -- RUN mode - normal process execution
4488 --
4489 if (funcmode = 'RUN') then
4490
4491 -- Get WF User Id
4492 Eng_Workflow_Util.GetWFUserId
4493 ( p_item_type => itemtype
4494 , p_item_key => itemkey
4495 , x_wf_user_id => l_wf_user_id
4496 ) ;
4497
4498
4499 -- Get Route Id
4500 Eng_Workflow_Util.GetRouteId
4501 ( p_item_type => itemtype
4502 , p_item_key => itemkey
4503 , x_route_id => l_route_id
4504 ) ;
4505
4506
4507 -- Get Route Step Id
4508 Eng_Workflow_Util.GetRouteStepId
4509 ( p_item_type => itemtype
4510 , p_item_key => itemkey
4511 , x_route_step_id => l_route_step_id
4512 ) ;
4513
4514 -- Set Route Step Status
4515 Eng_Workflow_Util.SetRouteStepStatus
4516 ( p_item_type => itemtype
4517 , p_item_key => itemkey
4518 , p_wf_user_id => l_wf_user_id
4519 , p_route_id => l_route_id
4520 , p_route_step_id => l_route_step_id
4521 , p_new_status_code => Eng_Workflow_Util.G_RT_APPROVED
4522 ) ;
4523
4524 -- set result
4525 result := 'COMPLETE';
4526 return;
4527
4528 end if ; -- funcmode : RUN
4529
4530 --
4531 -- CANCEL mode - activity 'compensation'
4532 --
4533 -- This is in the event that the activity must be undone,
4534 -- for example when a process is reset to an earlier point
4535 -- due to a loop back.
4536 --
4537 if (funcmode = 'CANCEL') then
4538
4539 -- your cancel code goes here
4540 null;
4541
4542 -- no result needed
4543 result := 'COMPLETE';
4544 return;
4545 end if;
4546
4547 --
4548 -- Other execution modes may be created in the future. Your
4549 -- activity will indicate that it does not implement a mode
4550 -- by returning null
4551 --
4552 result := '';
4553 return;
4554
4555 EXCEPTION
4556
4557 WHEN OTHERS THEN
4558 -- The line below records this function call in the error system
4559 -- in the case of an exception.
4560 wf_core.context('Eng_Workflow_Pub', 'STEP_APPROVE_CHANGE',
4561 itemtype, itemkey, to_char(actid), funcmode);
4562 raise;
4563
4564 END STEP_APPROVE_CHANGE ;
4565
4566 -- STEP_REJECT_CHANGE
4567 PROCEDURE STEP_REJECT_CHANGE(
4568 itemtype in varchar2,
4569 itemkey in varchar2,
4570 actid in number,
4571 funcmode in varchar2,
4572 result in out NOCOPY varchar2)
4573 IS
4574 l_wf_user_id NUMBER ;
4575 l_route_id NUMBER ;
4576 l_route_step_id NUMBER ;
4577
4578 BEGIN
4579
4580 --
4581 -- RUN mode - normal process execution
4582 --
4583 if (funcmode = 'RUN') then
4584
4585 -- Get WF User Id
4586 Eng_Workflow_Util.GetWFUserId
4587 ( p_item_type => itemtype
4588 , p_item_key => itemkey
4589 , x_wf_user_id => l_wf_user_id
4590 ) ;
4591
4592 -- Get Route Id
4593 Eng_Workflow_Util.GetRouteId
4594 ( p_item_type => itemtype
4595 , p_item_key => itemkey
4596 , x_route_id => l_route_id
4597 ) ;
4598
4599 -- Get Route Step Id
4600 Eng_Workflow_Util.GetRouteStepId
4601 ( p_item_type => itemtype
4602 , p_item_key => itemkey
4603 , x_route_step_id => l_route_step_id
4604 ) ;
4605
4606 -- Set Route Step Status
4607 Eng_Workflow_Util.SetRouteStepStatus
4608 ( p_item_type => itemtype
4609 , p_item_key => itemkey
4610 , p_wf_user_id => l_wf_user_id
4611 , p_route_id => l_route_id
4612 , p_route_step_id => l_route_step_id
4613 , p_new_status_code => Eng_Workflow_Util.G_RT_REJECTED
4614 ) ;
4615
4616 -- set result
4617 result := 'COMPLETE';
4618 return;
4619
4620 end if ; -- funcmode : RUN
4621
4622 --
4623 -- CANCEL mode - activity 'compensation'
4624 --
4625 -- This is in the event that the activity must be undone,
4626 -- for example when a process is reset to an earlier point
4627 -- due to a loop back.
4628 --
4629 if (funcmode = 'CANCEL') then
4630
4631 -- your cancel code goes here
4632 null;
4633
4634 -- no result needed
4635 result := 'COMPLETE';
4636 return;
4637 end if;
4638
4639 --
4640 -- Other execution modes may be created in the future. Your
4641 -- activity will indicate that it does not implement a mode
4642 -- by returning null
4643 --
4644 result := '';
4645 return;
4646
4647 EXCEPTION
4648
4649 WHEN OTHERS THEN
4650 -- The line below records this function call in the error system
4651 -- in the case of an exception.
4652 wf_core.context('Eng_Workflow_Pub', 'STEP_REJECT_CHANGE',
4653 itemtype, itemkey, to_char(actid), funcmode);
4654 raise;
4655
4656 END STEP_REJECT_CHANGE ;
4657
4658
4659 -- STEP_SET_TIMEOUT
4660 PROCEDURE STEP_SET_TIMEOUT(
4661 itemtype in varchar2,
4662 itemkey in varchar2,
4663 actid in number,
4664 funcmode in varchar2,
4665 result in out NOCOPY varchar2)
4666 IS
4667
4668 l_wf_user_id NUMBER ;
4669 l_route_id NUMBER ;
4670 l_route_step_id NUMBER ;
4671
4672 BEGIN
4673
4674 --
4675 -- RUN mode - normal process execution
4676 --
4677 if (funcmode = 'RUN') then
4678
4679
4680 -- Get WF User Id
4681 Eng_Workflow_Util.GetWFUserId
4682 ( p_item_type => itemtype
4683 , p_item_key => itemkey
4684 , x_wf_user_id => l_wf_user_id
4685 ) ;
4686
4687 -- Get Route Id
4688 Eng_Workflow_Util.GetRouteId
4689 ( p_item_type => itemtype
4690 , p_item_key => itemkey
4691 , x_route_id => l_route_id
4692 ) ;
4693
4694 -- Get Route Step Id
4695 Eng_Workflow_Util.GetRouteStepId
4696 ( p_item_type => itemtype
4697 , p_item_key => itemkey
4698 , x_route_step_id => l_route_step_id
4699 ) ;
4700
4701 -- Set Route Step Status
4702 Eng_Workflow_Util.SetRouteStepStatus
4703 ( p_item_type => itemtype
4704 , p_item_key => itemkey
4705 , p_wf_user_id => l_wf_user_id
4706 , p_route_id => l_route_id
4707 , p_route_step_id => l_route_step_id
4708 , p_new_status_code => Eng_Workflow_Util.G_RT_TIME_OUT
4709 ) ;
4710
4711 -- set result
4712 result := 'COMPLETE';
4713 return;
4714
4715 end if ; -- funcmode : RUN
4716
4717 --
4718 -- CANCEL mode - activity 'compensation'
4719 --
4720 -- This is in the event that the activity must be undone,
4721 -- for example when a process is reset to an earlier point
4722 -- due to a loop back.
4723 --
4724 if (funcmode = 'CANCEL') then
4725
4726 -- your cancel code goes here
4727 null;
4728
4729 -- no result needed
4730 result := 'COMPLETE';
4731 return;
4732 end if;
4733
4734 --
4735 -- Other execution modes may be created in the future. Your
4736 -- activity will indicate that it does not implement a mode
4737 -- by returning null
4738 --
4739 result := '';
4740 return;
4741
4742 EXCEPTION
4743
4744 WHEN OTHERS THEN
4745 -- The line below records this function call in the error system
4746 -- in the case of an exception.
4747 wf_core.context('Eng_Workflow_Pub', 'STEP_SET_TIMEOUT',
4748 itemtype, itemkey, to_char(actid), funcmode);
4749 raise;
4750
4751 END STEP_SET_TIMEOUT ;
4752
4753 -- GRANT_ROLE_TO_STEP_PEOPLE
4754 PROCEDURE GRANT_ROLE_TO_STEP_PEOPLE(
4755 itemtype in varchar2,
4756 itemkey in varchar2,
4757 actid in number,
4758 funcmode in varchar2,
4759 result in out NOCOPY varchar2)
4760 IS
4761
4762 l_return_status VARCHAR2(1);
4763 l_msg_count NUMBER ;
4764 l_msg_data VARCHAR2(200);
4765
4766 l_change_id NUMBER ;
4767 l_route_step_id NUMBER ;
4768
4769 BEGIN
4770
4771 --
4772 -- RUN mode - normal process execution
4773 --
4774 if (funcmode = 'RUN') then
4775
4776
4777 -- Get Chagne Id
4778 Eng_Workflow_Util.GetChangeObject
4779 ( p_item_type => itemtype
4780 , p_item_key => itemkey
4781 , x_change_id => l_change_id
4782 ) ;
4783
4784 -- Get Route Step Id
4785 Eng_Workflow_Util.GetRouteStepId
4786 ( p_item_type => itemtype
4787 , p_item_key => itemkey
4788 , x_route_step_id => l_route_step_id
4789 ) ;
4790
4791
4792 -- Grant Role to Step People
4793 Eng_Workflow_Util.GrantChangeRoleToStepPeople
4794 ( x_return_status => l_return_status
4795 , x_msg_count => l_msg_count
4796 , x_msg_data => l_msg_data
4797 , p_item_type => itemtype
4798 , p_item_key => itemkey
4799 , p_change_id => l_change_id
4800 , p_step_id => l_route_step_id
4801 ) ;
4802
4803
4804 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
4805
4806 result := 'COMPLETE';
4807 return;
4808
4809 ELSE
4810
4811 -- Unexpected Exception
4812 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
4813
4814 END IF ;
4815
4816 end if ; -- funcmode : RUN
4817
4818 --
4819 -- CANCEL mode - activity 'compensation'
4820 --
4821 -- This is in the event that the activity must be undone,
4822 -- for example when a process is reset to an earlier point
4823 -- due to a loop back.
4824 --
4825 if (funcmode = 'CANCEL') then
4826
4827 -- your cancel code goes here
4828 null;
4829
4830 -- no result needed
4831 result := 'COMPLETE';
4832 return;
4833 end if;
4834
4835 --
4836 -- Other execution modes may be created in the future. Your
4837 -- activity will indicate that it does not implement a mode
4838 -- by returning null
4839 --
4840 result := '';
4841 return;
4842
4843 EXCEPTION
4844
4845 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4846 -- The line below records this function call in the error system
4847 -- in the case of an exception.
4848 wf_core.context('Eng_Workflow_Pub', 'GRANT_ROLE_TO_STEP_PEOPLE',
4849 itemtype, itemkey, to_char(actid), funcmode);
4850 raise;
4851
4852 WHEN OTHERS THEN
4853 -- The line below records this function call in the error system
4854 -- in the case of an exception.
4855 wf_core.context('Eng_Workflow_Pub', 'GRANT_ROLE_TO_STEP_PEOPLE',
4856 itemtype, itemkey, to_char(actid), funcmode);
4857 raise;
4858
4859 END GRANT_ROLE_TO_STEP_PEOPLE ;
4860
4861
4862 -- CHECK_DEFINITIONS
4863 PROCEDURE CHECK_DEFINITIONS(
4864 itemtype in varchar2,
4865 itemkey in varchar2,
4866 actid in number,
4867 funcmode in varchar2,
4868 result in out NOCOPY varchar2)
4869 IS
4870
4871 l_return_status VARCHAR2(1);
4872 l_msg_count NUMBER ;
4873 l_msg_data VARCHAR2(200);
4874
4875 l_route_id NUMBER ;
4876 l_route_step_id NUMBER ;
4877 l_step_item_type VARCHAR2(8) ;
4878 l_step_process_name VARCHAR2(30) ;
4879
4880 BEGIN
4881
4882 --
4883 -- RUN mode - normal process execution
4884 --
4885 if (funcmode = 'RUN') then
4886
4887 -- Get Route Step Id
4888 -- Eng_Workflow_Util.GetRouteStepId
4889 -- ( p_item_type => itemtype
4890 -- , p_item_key => itemkey
4891 -- , x_route_step_id => l_route_step_id
4892 -- ) ;
4893
4894
4895 --
4896 -- Check Definitions
4897 --
4898
4899 -- By default alyways set result
4900 result := 'COMPLETE:' || FND_API.G_TRUE;
4901 return;
4902
4903 -- Based on your result, you can launch another workflow
4904 -- and make this activity DEFFERED
4905 -- result := wf_engine.eng_notified ||':'||
4906 -- wf_engine.eng_null ||':'||
4907 -- wf_engine.eng_null;
4908 --
4909 -- Then your another workflow, continue to this activity
4910 -- using wf_engine.CompleteActivity api
4911 --
4912 -- Or just return False
4913 -- set result
4914 -- result := 'COMPLETE:' || FND_API.G_FALSE;
4915 -- return;
4916 -- In this case you need to modify transition in workflow definition
4917 --
4918 --
4919
4920 -- For unexpeced exception
4921 -- Unexpected Exception
4922 -- RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
4923
4924
4925 end if ; -- funcmode : RUN
4926
4927 --
4928 -- CANCEL mode - activity 'compensation'
4929 --
4930 -- This is in the event that the activity must be undone,
4931 -- for example when a process is reset to an earlier point
4932 -- due to a loop back.
4933 --
4934 if (funcmode = 'CANCEL') then
4935
4936 -- your cancel code goes here
4937 null;
4938
4939 -- no result needed
4940 result := 'COMPLETE';
4941 return;
4942 end if;
4943
4944 --
4945 -- Other execution modes may be created in the future. Your
4946 -- activity will indicate that it does not implement a mode
4947 -- by returning null
4948 --
4949 result := '';
4950 return;
4951
4952 EXCEPTION
4953 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4954 -- The line below records this function call in the error system
4955 -- in the case of an exception.
4956 wf_core.context('Eng_Workflow_Pub', 'CHECK_DEFINITIONS',
4957 itemtype, itemkey, to_char(actid), funcmode);
4958 raise;
4959
4960
4961 WHEN OTHERS THEN
4962 -- The line below records this function call in the error system
4963 -- in the case of an exception.
4964 wf_core.context('Eng_Workflow_Pub', 'CHECK_DEFINITIONS',
4965 itemtype, itemkey, to_char(actid), funcmode);
4966 raise;
4967
4968 END CHECK_DEFINITIONS ;
4969
4970
4971 -- CHECK_ROUTE_OBJECT
4972 PROCEDURE CHECK_ROUTE_OBJECT(
4973 itemtype in varchar2,
4974 itemkey in varchar2,
4975 actid in number,
4976 funcmode in varchar2,
4977 result in out NOCOPY varchar2)
4978 IS
4979
4980 l_route_object VARCHAR2(30) ;
4981
4982 BEGIN
4983
4984 --
4985 -- RUN mode - normal process execution
4986 --
4987 if (funcmode = 'RUN') then
4988
4989 -- Get Route Object
4990 Eng_Workflow_Util.GetRouteObject
4991 ( p_item_type => itemtype
4992 , p_item_key => itemkey
4993 , x_route_object => l_route_object
4994 ) ;
4995
4996
4997 -- By default alyways set result
4998 result := 'COMPLETE:' || l_route_object ;
4999 return;
5000
5001 end if ; -- funcmode : RUN
5002
5003 --
5004 -- CANCEL mode - activity 'compensation'
5005 --
5006 -- This is in the event that the activity must be undone,
5007 -- for example when a process is reset to an earlier point
5008 -- due to a loop back.
5009 --
5010 if (funcmode = 'CANCEL') then
5011
5012 -- your cancel code goes here
5013 null;
5014
5015 -- no result needed
5016 result := 'COMPLETE';
5017 return;
5018 end if;
5019
5020 --
5021 -- Other execution modes may be created in the future. Your
5022 -- activity will indicate that it does not implement a mode
5023 -- by returning null
5024 --
5025 result := '';
5026 return;
5027
5028 EXCEPTION
5029 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5030 -- The line below records this function call in the error system
5031 -- in the case of an exception.
5032 wf_core.context('Eng_Workflow_Pub', 'CHECK_ROUTE_OBJECT',
5033 itemtype, itemkey, to_char(actid), funcmode);
5034 raise;
5035
5036
5037 WHEN OTHERS THEN
5038 -- The line below records this function call in the error system
5039 -- in the case of an exception.
5040 wf_core.context('Eng_Workflow_Pub', 'CHECK_ROUTE_OBJECT',
5041 itemtype, itemkey, to_char(actid), funcmode);
5042 raise;
5043
5044 END CHECK_ROUTE_OBJECT ;
5045
5046
5047
5048 --
5049 -- SYNC_CHANGE_LC_PHASE
5050 PROCEDURE SYNC_CHANGE_LC_PHASE(
5051 itemtype in varchar2,
5052 itemkey in varchar2,
5053 actid in number,
5054 funcmode in varchar2,
5055 result in out NOCOPY varchar2)
5056 IS
5057
5058 l_return_status VARCHAR2(1);
5059 l_msg_count NUMBER ;
5060 l_msg_data VARCHAR2(200);
5061
5062 l_route_id NUMBER ;
5063
5064 BEGIN
5065
5066 --
5067 -- RUN mode - normal process execution
5068 --
5069 if (funcmode = 'RUN') then
5070
5071 -- Get Route Id
5072 Eng_Workflow_Util.GetRouteId
5073 ( p_item_type => itemtype
5074 , p_item_key => itemkey
5075 , x_route_id => l_route_id
5076 ) ;
5077
5078
5079 -- Call Sync Change Lifecycle Phase API
5080 Eng_Workflow_Util.SyncChangeLCPhase
5081 ( x_return_status => l_return_status
5082 , x_msg_count => l_msg_count
5083 , x_msg_data => l_msg_data
5084 , p_route_id => l_route_id
5085 , p_api_caller => Eng_Workflow_Util.G_WF_CALL
5086 ) ;
5087
5088 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
5089
5090 -- set result
5091 result := 'COMPLETE';
5092 return;
5093
5094 ELSE
5095
5096 -- Unexpected Exception
5097 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
5098
5099 END IF ;
5100
5101
5102 end if ; -- funcmode : RUN
5103
5104 --
5105 -- CANCEL mode - activity 'compensation'
5106 --
5107 -- This is in the event that the activity must be undone,
5108 -- for example when a process is reset to an earlier point
5109 -- due to a loop back.
5110 --
5111 if (funcmode = 'CANCEL') then
5112
5113 -- your cancel code goes here
5114 null;
5115
5116 -- no result needed
5117 result := 'COMPLETE';
5118 return;
5119 end if;
5120
5121 --
5122 -- Other execution modes may be created in the future. Your
5123 -- activity will indicate that it does not implement a mode
5124 -- by returning null
5125 --
5126 result := '';
5127 return;
5128
5129 EXCEPTION
5130 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5131 -- The line below records this function call in the error system
5132 -- in the case of an exception.
5133 wf_core.context('Eng_Workflow_Pub', 'SYNC_CHANGE_LC_PHASE',
5134 itemtype, itemkey, to_char(actid), funcmode);
5135 raise;
5136
5137
5138 WHEN OTHERS THEN
5139 -- The line below records this function call in the error system
5140 -- in the case of an exception.
5141 wf_core.context('Eng_Workflow_Pub', 'SYNC_CHANGE_LC_PHASE',
5142 itemtype, itemkey, to_char(actid), funcmode);
5143 raise;
5144
5145 END SYNC_CHANGE_LC_PHASE ;
5146
5147
5148
5149
5150
5151
5152 --
5153 -- PROCEDURE CHECK_CHANGE_APPR_STATUS
5154 --
5155 -- result
5156 -- - COMPLETE[:<ENG_ECN_APPROVAL_STATUS lookup codes>] or NULL
5157 -- activity has completed with the step result
5158 PROCEDURE CHECK_CHANGE_APPR_STATUS(
5159 itemtype in varchar2,
5160 itemkey in varchar2,
5161 actid in number,
5162 funcmode in varchar2,
5163 result in out NOCOPY varchar2)
5164 IS
5165
5166 l_change_id NUMBER ;
5167 l_appr_status NUMBER ;
5168
5169
5170 CURSOR c_chg_appr ( c_change_id NUMBER )
5171 IS
5172 SELECT approval_status_type
5173 FROM ENG_ENGINEERING_CHANGES
5174 WHERE change_id = c_change_id ;
5175
5176 BEGIN
5177
5178 --
5179 -- RUN mode - normal process execution
5180 --
5181 if (funcmode = 'RUN') then
5182
5183
5184 -- Get Chagne Id
5185 Eng_Workflow_Util.GetChangeObject
5186 ( p_item_type => itemtype
5187 , p_item_key => itemkey
5188 , x_change_id => l_change_id
5189 ) ;
5190
5191
5192 -- Get Approval Status
5193 OPEN c_chg_appr(c_change_id => l_change_id) ;
5194 FETCH c_chg_appr into l_appr_status ;
5195 IF (c_chg_appr%notfound) THEN
5196 CLOSE c_chg_appr;
5197 END IF;
5198
5199 IF (c_chg_appr%ISOPEN) THEN
5200 CLOSE c_chg_appr;
5201 END IF;
5202
5203 -- no result needed
5204 result := 'COMPLETE:' || to_char(l_appr_status) ;
5205 return;
5206
5207
5208 end if ; -- funcmode : RUN
5209
5210 --
5211 -- CANCEL mode - activity 'compensation'
5212 --
5213 -- This is in the event that the activity must be undone,
5214 -- for example when a process is reset to an earlier point
5215 -- due to a loop back.
5216 --
5217 if (funcmode = 'CANCEL') then
5218
5219 -- your cancel code goes here
5220 null;
5221
5222 -- no result needed
5223 result := 'COMPLETE';
5224 return;
5225 end if;
5226
5227 --
5228 -- Other execution modes may be created in the future. Your
5229 -- activity will indicate that it does not implement a mode
5230 -- by returning null
5231 --
5232 result := '';
5233 return;
5234
5235 EXCEPTION
5236 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5237 -- The line below records this function call in the error system
5238 -- in the case of an exception.
5239 wf_core.context('Eng_Workflow_Pub', 'CHECK_CHANGE_APPR_STATUS',
5240 itemtype, itemkey, to_char(actid), funcmode);
5241 raise;
5242
5243
5244 WHEN OTHERS THEN
5245 -- The line below records this function call in the error system
5246 -- in the case of an exception.
5247 wf_core.context('Eng_Workflow_Pub', 'CHECK_CHANGE_APPR_STATUS',
5248 itemtype, itemkey, to_char(actid), funcmode);
5249 raise;
5250
5251 END CHECK_CHANGE_APPR_STATUS ;
5252
5253
5254 --
5255 -- PROCEDURE CHECK_BASE_CM_TYPE_CODE
5256 --
5257 -- Check Approval Status
5258 -- Bug5136260
5259 --
5260 -- IN
5261 -- itemtype - type of the current item
5262 -- itemkey - key of the current item
5263 -- actid - process activity instance id
5264 -- funcmode - function execution mode ('RUN', 'CANCEL', 'TIMEOUT', ...)
5265 -- OUT
5266 -- result
5267 -- - COMPLETE[:<ENG_BASE_CM_TYPE_CODES lookup codes>] or NULL
5268 -- activity has completed with the step result
5269 PROCEDURE CHECK_BASE_CM_TYPE_CODE(
5270 itemtype in varchar2,
5271 itemkey in varchar2,
5272 actid in number,
5273 funcmode in varchar2,
5274 result in out NOCOPY varchar2
5275 )
5276 IS
5277
5278 l_change_id NUMBER ;
5279 l_base_cm_type_code VARCHAR2(30) ;
5280
5281
5282 BEGIN
5283
5284 --
5285 -- RUN mode - normal process execution
5286 --
5287 if (funcmode = 'RUN') then
5288
5289
5290 -- Get Chagne Id
5291 Eng_Workflow_Util.GetChangeObject
5292 ( p_item_type => itemtype
5293 , p_item_key => itemkey
5294 , x_change_id => l_change_id
5295 ) ;
5296
5297 -- Get Base CM Type code
5298 l_base_cm_type_code := Eng_Workflow_Util.GetBaseChangeMgmtTypeCode(l_change_id) ;
5299
5300 -- no result needed
5301 result := 'COMPLETE:' || l_base_cm_type_code ;
5302 return;
5303
5304
5305 end if ; -- funcmode : RUN
5306
5307 --
5308 -- CANCEL mode - activity 'compensation'
5309 --
5310 -- This is in the event that the activity must be undone,
5311 -- for example when a process is reset to an earlier point
5312 -- due to a loop back.
5313 --
5314 if (funcmode = 'CANCEL') then
5315
5316 -- your cancel code goes here
5317 null;
5318
5319 -- no result needed
5320 result := 'COMPLETE';
5321 return;
5322 end if;
5323
5324 --
5325 -- Other execution modes may be created in the future. Your
5326 -- activity will indicate that it does not implement a mode
5327 -- by returning null
5328 --
5329 result := '';
5330 return;
5331
5332 EXCEPTION
5333 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5334 -- The line below records this function call in the error system
5335 -- in the case of an exception.
5336 wf_core.context('Eng_Workflow_Pub', 'CHECK_BASE_CM_TYPE_CODE',
5337 itemtype, itemkey, to_char(actid), funcmode);
5338 raise;
5339
5340
5341 WHEN OTHERS THEN
5342 -- The line below records this function call in the error system
5343 -- in the case of an exception.
5344 wf_core.context('Eng_Workflow_Pub', 'CHECK_BASE_CM_TYPE_CODE',
5345 itemtype, itemkey, to_char(actid), funcmode);
5346 raise;
5347
5348 END CHECK_BASE_CM_TYPE_CODE ;
5349
5350
5351
5352
5353 --
5354 -- PROCEDURE SET_CO_MRP_FLAG_ACTIVE
5355 --
5356 PROCEDURE SET_CO_MRP_FLAG_ACTIVE(
5357 itemtype in varchar2,
5358 itemkey in varchar2,
5359 actid in number,
5360 funcmode in varchar2,
5361 result in out NOCOPY varchar2)
5362 IS
5363
5364 l_return_status VARCHAR2(1);
5365 l_msg_count NUMBER ;
5366 l_msg_data VARCHAR2(200);
5367
5368 l_change_id NUMBER ;
5369 l_wf_user_id NUMBER ;
5370
5371
5372 BEGIN
5373
5374 --
5375 -- RUN mode - normal process execution
5376 --
5377 if (funcmode = 'RUN') then
5378
5379
5380 -- Get Chagne Id
5381 Eng_Workflow_Util.GetChangeObject
5382 ( p_item_type => itemtype
5383 , p_item_key => itemkey
5384 , x_change_id => l_change_id
5385 ) ;
5386
5387
5388 -- Get WF User Id
5389 Eng_Workflow_Util.GetWFUserId
5390 ( p_item_type => itemtype
5391 , p_item_key => itemkey
5392 , x_wf_user_id => l_wf_user_id
5393 ) ;
5394
5395 -- Call SetChangeOrderMRPFlag
5396 Eng_Workflow_Util.SetChangeOrderMRPFlag
5397 ( x_return_status => l_return_status
5398 , x_msg_count => l_msg_count
5399 , x_msg_data => l_msg_data
5400 , p_change_id => l_change_id
5401 , p_mrp_flag => Eng_Workflow_Util.G_MRP_FLAG_YES
5402 , p_wf_user_id => l_wf_user_id
5403 , p_api_caller => Eng_Workflow_Util.G_WF_CALL
5404 ) ;
5405
5406 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
5407
5408 -- set result
5409 result := 'COMPLETE';
5410 return;
5411
5412 ELSE
5413
5414 -- Unexpected Exception
5415 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
5416
5417 END IF ;
5418
5419
5420 end if ; -- funcmode : RUN
5421
5422 --
5423 -- CANCEL mode - activity 'compensation'
5424 --
5425 -- This is in the event that the activity must be undone,
5426 -- for example when a process is reset to an earlier point
5427 -- due to a loop back.
5428 --
5429 if (funcmode = 'CANCEL') then
5430
5431 -- your cancel code goes here
5432 null;
5433
5434 -- no result needed
5435 result := 'COMPLETE';
5436 return;
5437 end if;
5438
5439 --
5440 -- Other execution modes may be created in the future. Your
5441 -- activity will indicate that it does not implement a mode
5442 -- by returning null
5443 --
5444 result := '';
5445 return;
5446
5447 EXCEPTION
5448 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5449 -- The line below records this function call in the error system
5450 -- in the case of an exception.
5451 wf_core.context('Eng_Workflow_Pub', 'SET_CO_MRP_FLAG_ACTIVE',
5452 itemtype, itemkey, to_char(actid), funcmode);
5453 raise;
5454
5455
5456 WHEN OTHERS THEN
5457 -- The line below records this function call in the error system
5458 -- in the case of an exception.
5459 wf_core.context('Eng_Workflow_Pub', 'SET_CO_MRP_FLAG_ACTIVE',
5460 itemtype, itemkey, to_char(actid), funcmode);
5461 raise;
5462
5463 END SET_CO_MRP_FLAG_ACTIVE ;
5464
5465
5466
5467 --
5468 -- PROCEDURE SET_CO_MRP_FLAG_INACTIVE
5469 --
5470 PROCEDURE SET_CO_MRP_FLAG_INACTIVE(
5471 itemtype in varchar2,
5472 itemkey in varchar2,
5473 actid in number,
5474 funcmode in varchar2,
5475 result in out NOCOPY varchar2)
5476 IS
5477
5478 l_return_status VARCHAR2(1);
5479 l_msg_count NUMBER ;
5480 l_msg_data VARCHAR2(200);
5481
5482 l_change_id NUMBER ;
5483 l_wf_user_id NUMBER ;
5484
5485 BEGIN
5486
5487 --
5488 -- RUN mode - normal process execution
5489 --
5490 if (funcmode = 'RUN') then
5491
5492
5493 -- Get Chagne Id
5494 Eng_Workflow_Util.GetChangeObject
5495 ( p_item_type => itemtype
5496 , p_item_key => itemkey
5497 , x_change_id => l_change_id
5498 ) ;
5499
5500
5501 -- Get WF User Id
5502 Eng_Workflow_Util.GetWFUserId
5503 ( p_item_type => itemtype
5504 , p_item_key => itemkey
5505 , x_wf_user_id => l_wf_user_id
5506 ) ;
5507
5508
5509 -- Call SetChangeOrderMRPFlag
5510 Eng_Workflow_Util.SetChangeOrderMRPFlag
5511 ( x_return_status => l_return_status
5512 , x_msg_count => l_msg_count
5513 , x_msg_data => l_msg_data
5514 , p_change_id => l_change_id
5515 , p_mrp_flag => Eng_Workflow_Util.G_MRP_FLAG_NO
5516 , p_wf_user_id => l_wf_user_id
5517 , p_api_caller => Eng_Workflow_Util.G_WF_CALL
5518 ) ;
5519
5520 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
5521
5522 -- set result
5523 result := 'COMPLETE';
5524 return;
5525
5526 ELSE
5527
5528 -- Unexpected Exception
5529 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
5530
5531 END IF ;
5532
5533
5534 end if ; -- funcmode : RUN
5535
5536 --
5537 -- CANCEL mode - activity 'compensation'
5538 --
5539 -- This is in the event that the activity must be undone,
5540 -- for example when a process is reset to an earlier point
5541 -- due to a loop back.
5542 --
5543 if (funcmode = 'CANCEL') then
5544
5545 -- your cancel code goes here
5546 null;
5547
5548 -- no result needed
5549 result := 'COMPLETE';
5550 return;
5551 end if;
5552
5553 --
5554 -- Other execution modes may be created in the future. Your
5555 -- activity will indicate that it does not implement a mode
5556 -- by returning null
5557 --
5558 result := '';
5559 return;
5560
5561 EXCEPTION
5562 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5563 -- The line below records this function call in the error system
5564 -- in the case of an exception.
5565 wf_core.context('Eng_Workflow_Pub', 'SET_CO_MRP_FLAG_INACTIVE',
5566 itemtype, itemkey, to_char(actid), funcmode);
5567 raise;
5568
5569
5570 WHEN OTHERS THEN
5571 -- The line below records this function call in the error system
5572 -- in the case of an exception.
5573 wf_core.context('Eng_Workflow_Pub', 'SET_CO_MRP_FLAG_INACTIVE',
5574 itemtype, itemkey, to_char(actid), funcmode);
5575 raise;
5576
5577 END SET_CO_MRP_FLAG_INACTIVE ;
5578
5579
5580
5581 --
5582 -- PROCEDURE SET_ADMIN_STATUS_MONITOR_URL
5583 --
5584 -- Set WF Admin Status Monigor URL to Item Attribute: STATUS_MONITOR_URL
5585 -- Called from ENGWFSTD/TEST_CM_EVENT Process
5586 --
5587 PROCEDURE SET_ADMIN_STATUS_MONITOR_URL(
5588 itemtype in varchar2,
5589 itemkey in varchar2,
5590 actid in number,
5591 funcmode in varchar2,
5592 result in out NOCOPY varchar2)
5593
5594 IS
5595 l_return_status VARCHAR2(1);
5596 l_msg_count NUMBER ;
5597 l_msg_data VARCHAR2(200);
5598
5599 l_url VARCHAR2(2000);
5600
5601 BEGIN
5602
5603 --
5604 -- RUN mode - normal process execution
5605 --
5606 if (funcmode = 'RUN') then
5607
5608
5609
5610 -- Get WF Admin Statuss Monigor URL
5611 Eng_Workflow_Util.GetWorkflowMonitorURL
5612 ( p_api_version => 1.0
5613 , p_init_msg_list => FND_API.G_FALSE
5614 , p_commit => FND_API.G_FALSE
5615 , p_validation_level => FND_API.G_VALID_LEVEL_FULL
5616 , x_return_status => l_return_status
5617 , x_msg_count => l_msg_count
5618 , x_msg_data => l_msg_data
5619 , p_item_type => itemtype
5620 , p_item_key => itemkey
5621 , p_url_type => Eng_Workflow_Util.G_MONITOR_ADVANCED_ENVELOPE
5622 , p_admin_mode => FND_API.G_TRUE
5623 -- , p_admin_mode => FND_API.G_FALSE
5624 , p_option => 'ALL'
5625 , x_url => l_url
5626 ) ;
5627
5628
5629 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
5630
5631 -- for Notification
5632 WF_ENGINE.SetItemAttrText( itemtype
5633 , itemkey
5634 , 'STATUS_MONITOR_URL'
5635 , l_url);
5636
5637
5638 -- set result
5639 result := 'COMPLETE';
5640 return;
5641
5642 ELSE
5643
5644 -- Unexpected Exception
5645 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
5646
5647 END IF ;
5648
5649
5650 end if ; -- funcmode : RUN
5651
5652 --
5653 -- CANCEL mode - activity 'compensation'
5654 --
5655 -- This is in the event that the activity must be undone,
5656 -- for example when a process is reset to an earlier point
5657 -- due to a loop back.
5658 --
5659 if (funcmode = 'CANCEL') then
5660
5661 -- your cancel code goes here
5662 null;
5663
5664 -- no result needed
5665 result := 'COMPLETE';
5666 return;
5667 end if;
5668
5669 --
5670 -- Other execution modes may be created in the future. Your
5671 -- activity will indicate that it does not implement a mode
5672 -- by returning null
5673 --
5674 result := '';
5675 return;
5676
5677 EXCEPTION
5678 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5679 -- The line below records this function call in the error system
5680 -- in the case of an exception.
5681 wf_core.context('Eng_Workflow_Pub', 'SET_ADMIN_STATUS_MONITOR_URL',
5682 itemtype, itemkey, to_char(actid), funcmode);
5683 raise;
5684
5685
5686 WHEN OTHERS THEN
5687 -- The line below records this function call in the error system
5688 -- in the case of an exception.
5689 wf_core.context('Eng_Workflow_Pub', 'SET_ADMIN_STATUS_MONITOR_URL',
5690 itemtype, itemkey, to_char(actid), funcmode);
5691 raise;
5692
5693 END SET_ADMIN_STATUS_MONITOR_URL ;
5694
5695
5696
5697 --
5698 -- PROCEDURE SET_EVENT_CHANGE_OBJECT_INFO
5699 --
5700 -- Set Event and Change Object info for CM Event
5701 -- Called from ENGWFSTD/TEST_CM_EVENT Process
5702 --
5703 PROCEDURE SET_EVENT_CHANGE_OBJECT_INFO
5704 (
5705 itemtype in varchar2,
5706 itemkey in varchar2,
5707 actid in number,
5708 funcmode in varchar2,
5709 result in out NOCOPY varchar2
5710 )
5711 IS
5712 l_return_status VARCHAR2(1);
5713 l_msg_count NUMBER ;
5714 l_msg_data VARCHAR2(200);
5715
5716 l_text_attr_name_tbl WF_ENGINE.NameTabTyp;
5717 l_text_attr_value_tbl WF_ENGINE.TextTabTyp;
5718
5719 l_num_attr_name_tbl WF_ENGINE.NameTabTyp;
5720 l_num_attr_value_tbl WF_ENGINE.NumTabTyp;
5721
5722 l_date_attr_name_tbl WF_ENGINE.NameTabTyp;
5723 l_date_attr_value_tbl WF_ENGINE.DateTabTyp;
5724
5725 I PLS_INTEGER ;
5726
5727 l_event_name VARCHAR2(200) ;
5728 l_event_key VARCHAR2(200) ;
5729 l_change_id NUMBER ;
5730 l_change_notice VARCHAR2(10) ;
5731 l_organization_id NUMBER ;
5732 l_organization_code VARCHAR2(3) ;
5733 l_change_managemtent_type VARCHAR2(80) ;
5734 l_base_cm_type_code VARCHAR2(30) ;
5735 l_change_name VARCHAR2(240) ;
5736 l_description VARCHAR2(2000) ;
5737 l_change_order_type VARCHAR2(80) ;
5738 l_organization_name VARCHAR2(60) ;
5739 l_eco_department VARCHAR2(60) ;
5740 l_change_status VARCHAR2(80) ;
5741 l_change_lc_phase VARCHAR2(80) ;
5742 l_approval_status VARCHAR2(80) ;
5743 l_priority VARCHAR2(50) ;
5744 l_reason VARCHAR2(50) ;
5745 l_assignee VARCHAR2(360) ;
5746 l_assignee_company VARCHAR2(360) ;
5747
5748 l_batch_id NUMBER ;
5749
5750 l_event_t wf_event_t;
5751 l_subscription RAW(16);
5752 l_url varchar2(4000);
5753 l_eventdataurl varchar2(4000);
5754 l_source varchar2(8);
5755
5756
5757 BEGIN
5758
5759 --
5760 -- RUN mode - normal process execution
5761 --
5762 if (funcmode = 'RUN') then
5763
5764
5765
5766 -- Get Adhoc Party List
5767 l_event_key := WF_ENGINE.GetItemAttrText( itemtype
5768 , itemkey
5769 , 'EVENT_KEY');
5770
5771 l_event_name := WF_ENGINE.GetItemAttrText( itemtype
5772 , itemkey
5773 , 'EVENT_NAME');
5774
5775
5776 --
5777 -- Get the Event Item Attribute
5778 --
5779 l_event_t := WF_ENGINE.GetItemAttrEvent(
5780 itemtype => itemtype,
5781 itemkey => itemkey,
5782 name => 'EVENT_MESSAGE' );
5783
5784
5785
5786 -- Generate the URL
5787 l_eventdataurl := wf_oam_util.GetViewXMLURL(p_eventattribute => 'EVENT_MESSAGE',
5788 p_itemtype => itemtype,
5789 p_itemkey => itemkey);
5790
5791
5792 IF l_event_name = ENG_CHANGE_BES_UTIL.G_CMBE_IMPORT_COMPLETE
5793 THEN
5794 l_batch_id := TO_NUMBER(l_event_key) ;
5795 ELSE
5796 l_change_id := TO_NUMBER(l_event_key) ;
5797 END IF ;
5798
5799 BEGIN
5800
5801 IF l_change_id IS NOT NULL
5802 THEN
5803
5804 -- Get Change Object Info
5805 Eng_Workflow_Util.GetChangeObjectInfo
5806 ( p_change_id => l_change_id
5807 , x_change_notice => l_change_notice
5808 , x_organization_id => l_organization_id
5809 , x_change_name => l_change_name
5810 , x_description => l_description
5811 , x_change_status => l_change_status
5812 , x_change_lc_phase => l_change_lc_phase
5813 , x_approval_status => l_approval_status
5814 , x_priority => l_priority
5815 , x_reason => l_reason
5816 , x_change_managemtent_type => l_change_managemtent_type
5817 , x_change_order_type => l_change_order_type
5818 , x_eco_department => l_eco_department
5819 , x_assignee => l_assignee
5820 , x_assignee_company => l_assignee_company
5821 ) ;
5822
5823
5824 -- Get Organization Info
5825 Eng_Workflow_Util.GetOrgInfo
5826 ( p_organization_id => l_organization_id
5827 , x_organization_code => l_organization_code
5828 , x_organization_name => l_organization_name ) ;
5829
5830 END IF ;
5831
5832 EXCEPTION
5833 WHEN OTHERS THEN
5834 NULL ;
5835 END ;
5836
5837 -- Set Dummy values for Wf Messages
5838 IF l_change_id IS NULL
5839 THEN
5840 l_change_notice := 'na' ;
5841 l_organization_code := 'na' ;
5842 END IF ;
5843
5844 -- Text Item Attributes
5845 -- Using SetItemAttrTextArray():
5846 I := 0 ;
5847
5848 -- Change Object Number
5849 I := I + 1 ;
5850 l_text_attr_name_tbl(I) := 'ITEMTYPE' ;
5851 l_text_attr_value_tbl(I) := itemtype ;
5852
5853 -- Change Object Number
5854 I := I + 1 ;
5855 l_text_attr_name_tbl(I) := 'ITEMKEY' ;
5856 l_text_attr_value_tbl(I) := itemkey ;
5857
5858 -- Change Object Number
5859 I := I + 1 ;
5860 l_text_attr_name_tbl(I) := 'CHANGE_NOTICE' ;
5861 l_text_attr_value_tbl(I) := l_change_notice ;
5862
5863 -- Change Object Name
5864 I := I + 1 ;
5865 l_text_attr_name_tbl(I) := 'CHANGE_NAME' ;
5866 l_text_attr_value_tbl(I) := l_change_name ;
5867
5868 -- Organization Code
5869 I := I + 1 ;
5870 l_text_attr_name_tbl(I) := 'ORGANIZATION_CODE' ;
5871 l_text_attr_value_tbl(I) := l_organization_code ;
5872
5873 -- Organization Name
5874 -- I := I + 1 ;
5875 -- l_text_attr_name_tbl(I) := 'ORGANIZATION_NAME' ;
5876 -- l_text_attr_value_tbl(I) := l_organization_name ;
5877
5878 -- Change Management Type
5879 I := I + 1 ;
5880 l_text_attr_name_tbl(I) := 'CHANGE_MANAGEMENT_TYPE' ;
5881 l_text_attr_value_tbl(I) := l_change_managemtent_type ;
5882
5883
5884 -- Set the PL/SQL Document for the Event Details
5885 I := I + 1 ;
5886 l_text_attr_name_tbl(I) := 'EVENT_DETAILS' ;
5887 l_text_attr_value_tbl(I) := 'PLSQL:WF_STANDARD.EVENTDETAILS/'||ItemType||':'||ItemKey ;
5888
5889
5890 -- Set the Value for the Event Data URL
5891 I := I + 1 ;
5892 l_text_attr_name_tbl(I) := 'EVENT_DATA_URL' ;
5893 l_text_attr_value_tbl(I) := l_eventdataurl ;
5894
5895
5896
5897 IF l_change_id IS NOT NULL
5898 THEN
5899
5900 -- Change Detail Page URL
5901 I := I + 1 ;
5902 l_text_attr_name_tbl(I) := 'CHANGE_DETAIL_PAGE_URL' ;
5903 l_text_attr_value_tbl(I) := 'JSP:/OA_HTML/OA.jsp?OAFunc=ENG_CHANGE_DETAIL_PAGE'
5904 || '&changeId=-&CHANGE_ID-' ;
5905 END IF ;
5906
5907 -- Set Text Attributes
5908 WF_ENGINE.SetItemAttrTextArray
5909 ( itemtype => itemtype
5910 , itemkey => itemkey
5911 , aname => l_text_attr_name_tbl
5912 , avalue => l_text_attr_value_tbl
5913 ) ;
5914
5915 -- Number Item Attributes
5916 -- Using SetItemAttrNumberArray():
5917 I := 0 ;
5918
5919 -- Change Id
5920 I := I + 1 ;
5921 l_num_attr_name_tbl(I) := 'CHANGE_ID' ;
5922 l_num_attr_value_tbl(I) := l_change_id ;
5923
5924 -- Organization Id
5925 I := I + 1 ;
5926 l_num_attr_name_tbl(I) := 'ORGANIZATION_ID' ;
5927 l_num_attr_value_tbl(I) := l_organization_id ;
5928
5929 -- Batch Id
5930 I := I + 1 ;
5931 l_num_attr_name_tbl(I) := 'BATCH_ID' ;
5932 l_num_attr_value_tbl(I) := l_batch_id ;
5933
5934 -- Set Number Attributes
5935 WF_ENGINE.SetItemAttrNumberArray
5936 ( itemtype => itemtype
5937 , itemkey => itemkey
5938 , aname => l_num_attr_name_tbl
5939 , avalue => l_num_attr_value_tbl
5940 ) ;
5941
5942 -- set result
5943 result := 'COMPLETE';
5944 return;
5945
5946
5947 end if ; -- funcmode : RUN
5948
5949 --
5950 -- CANCEL mode - activity 'compensation'
5951 --
5952 -- This is in the event that the activity must be undone,
5953 -- for example when a process is reset to an earlier point
5954 -- due to a loop back.
5955 --
5956 if (funcmode = 'CANCEL') then
5957
5958 -- your cancel code goes here
5959 null;
5960
5961 -- no result needed
5962 result := 'COMPLETE';
5963 return;
5964 end if;
5965
5966 --
5967 -- Other execution modes may be created in the future. Your
5968 -- activity will indicate that it does not implement a mode
5969 -- by returning null
5970 --
5971 result := '';
5972 return;
5973
5974 EXCEPTION
5975 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5976 -- The line below records this function call in the error system
5977 -- in the case of an exception.
5978 wf_core.context('Eng_Workflow_Pub', 'SET_EVENT_CHANGE_OBJECT_INFO',
5979 itemtype, itemkey, to_char(actid), funcmode);
5980 raise;
5981
5982
5983 WHEN OTHERS THEN
5984 -- The line below records this function call in the error system
5985 -- in the case of an exception.
5986 wf_core.context('Eng_Workflow_Pub', 'SET_EVENT_CHANGE_OBJECT_INFO',
5987 itemtype, itemkey, to_char(actid), funcmode);
5988 raise;
5989
5990 END SET_EVENT_CHANGE_OBJECT_INFO ;
5991
5992
5993
5994
5995
5996 /****************************************************
5997 -- Not Supported in 115.10
5998 -- CONTINUE_HEADER_ROUTE
5999 PROCEDURE CONTINUE_HEADER_ROUTE(
6000 itemtype in varchar2,
6001 itemkey in varchar2,
6002 actid in number,
6003 funcmode in varchar2,
6004 result in out NOCOPY varchar2)
6005
6006 IS
6007
6008 l_return_status VARCHAR2(1);
6009 l_msg_count NUMBER ;
6010 l_msg_data VARCHAR2(200);
6011
6012 l_waiting_activity VARCHAR2(30);
6013 l_waiting_flow_type VARCHAR2(30);
6014
6015
6016 l_debug_flag BOOLEAN := FALSE ; -- For TEST : FALSE ;
6017 l_output_dir VARCHAR2(80) ; -- '/sqlcom/log/plm115d' ;
6018 l_debug_filename VARCHAR2(30) ; -- 'ContinueHdrRoute' ;
6019
6020
6021 BEGIN
6022
6023 --
6024 -- RUN mode - normal process execution
6025 --
6026 if (funcmode = 'RUN') then
6027
6028
6029 Eng_Workflow_Util.Get_Debug_Mode
6030 (itemtype, itemkey, l_debug_flag, l_output_dir , l_debug_filename);
6031
6032 -- For Test/Debug
6033 IF l_debug_flag THEN
6034 Eng_Workflow_Util.Open_Debug_Session( l_output_dir
6035 , l_debug_filename || actid ) ;
6036 Eng_Workflow_Util.Write_Debug('Get activity params . . . ' ) ;
6037 END IF ;
6038
6039
6040 l_waiting_activity := UPPER(Wf_Engine.GetActivityAttrText(
6041 itemtype, itemkey, actid,'WAITING_ACTIVITY'));
6042 l_waiting_flow_type := UPPER(Wf_Engine.GetActivityAttrText(
6043 itemtype, itemkey, actid,'WAITING_FLOW_TYPE'));
6044
6045 IF l_debug_flag THEN
6046 Eng_Workflow_Util.Write_Debug('WAITING_ACTIVITY : ' || l_waiting_activity ) ;
6047 Eng_Workflow_Util.Write_Debug('WAITING_FLOW_TYPE : ' || l_waiting_flow_type ) ;
6048 END IF ;
6049
6050
6051 -- Currently we are supporting only for Header Route Approval Flow.
6052 -- e.g. seeded WAITING_FLOW value is 'APPROVAL'
6053 -- In future, we may need to support other type of flow
6054 --
6055 -- if ( l_waiting_flow = 'APPROVAL' ) then
6056 -- Eng_Workflow_Util.WaitForLineApprovalFlow . . .
6057 -- elsif ( l_waiting_flow = 'XXXX' ) then
6058 -- null
6059 -- else
6060 -- raise exception ;
6061 -- call WF_STANDARD.WaitForFlow
6062 -- end if;
6063 --
6064
6065 IF l_debug_flag THEN
6066 Eng_Workflow_Util.Write_Debug('Calling Eng_Workflow_Util.ContinueHeaderRoute. . . ' ) ;
6067 END IF ;
6068
6069
6070 Eng_Workflow_Util.ContinueHeaderRoute
6071 ( x_return_status => l_return_status
6072 , x_msg_count => l_msg_count
6073 , x_msg_data => l_msg_data
6074 , p_item_type => itemtype
6075 , p_item_key => itemkey
6076 , p_actid => actid
6077 , p_waiting_activity => l_waiting_activity
6078 , p_waiting_flow_type => NVL(l_waiting_flow_type, 'APPROVAL')
6079 , x_resultout => result
6080 ) ;
6081
6082 IF l_debug_flag THEN
6083 Eng_Workflow_Util.Write_Debug('Return Status : ' || l_return_status ) ;
6084 Eng_Workflow_Util.Write_Debug('Result : ' || result ) ;
6085 END IF ;
6086
6087
6088 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
6089
6090 IF l_debug_flag THEN
6091 Eng_Workflow_Util.Close_Debug_Session ;
6092 END IF ;
6093
6094 -- Unexpected Exception
6095 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
6096
6097 END IF ;
6098
6099 IF l_debug_flag THEN
6100 Eng_Workflow_Util.Close_Debug_Session ;
6101 END IF ;
6102
6103 -- result is set by ContinueHeaderRoute util api
6104 return;
6105
6106
6107 end if ; -- funcmode : RUN
6108
6109
6110 --
6111 -- This is in the event that the activity must be undone,
6112 -- for example when a process is reset to an earlier point
6113 -- due to a loop back.
6114 --
6115 if (funcmode = 'CANCEL') then
6116
6117 -- your cancel code goes here
6118 null;
6119
6120 -- no result needed
6121 result := 'COMPLETE';
6122 return;
6123 end if;
6124
6125 --
6126 -- Other execution modes may be created in the future. Your
6127 -- activity will indicate that it does not implement a mode
6128 -- by returning null
6129 --
6130 result := '';
6131 return;
6132
6133 EXCEPTION
6134
6135 WHEN OTHERS THEN
6136
6137 IF l_debug_flag THEN
6138 Eng_Workflow_Util.Close_Debug_Session ;
6139 END IF ;
6140
6141 -- The line below records this function call in the error system
6142 -- in the case of an exception.
6143 wf_core.context('Eng_Workflow_Pub', 'CONTINUE_HEADER_ROUTE',
6144 itemtype, itemkey, to_char(actid), funcmode);
6145 raise;
6146
6147 END CONTINUE_HEADER_ROUTE ;
6148
6149
6150 -- PROCEDURE WAIT_FOR_LINE_ROUTE
6151 PROCEDURE WAIT_FOR_LINE_ROUTE(
6152 itemtype in varchar2,
6153 itemkey in varchar2,
6154 actid in number,
6155 funcmode in varchar2,
6156 result in out NOCOPY varchar2)
6157 IS
6158
6159 l_continuation_activity VARCHAR2(30);
6160 l_continuation_flow_type VARCHAR2(30);
6161
6162 l_return_status VARCHAR2(1);
6163 l_msg_count NUMBER ;
6164 l_msg_data VARCHAR2(200);
6165
6166 BEGIN
6167
6168 --
6169 -- RUN mode - normal process execution
6170 --
6171 if (funcmode = 'RUN') then
6172
6173
6174 l_continuation_activity := UPPER(WF_ENGINE.GETACTIVITYATTRTEXT(
6175 itemtype, itemkey, actid,
6176 'CONTINUATION_ACTIVITY'));
6177
6178
6179 l_continuation_flow_type := UPPER(WF_ENGINE.GetActivityAttrText(
6180 itemtype,itemkey,actid,
6181 'CONTINUATION_FLOW_TYPE'));
6182
6183 -- Currently we are supporting only for Line Route Approval Flow.
6184 -- e.g. seeded CONTINUATION_FLOW value is 'APPROVAL'
6185 -- In future, we may need to support other type of flow
6186 --
6187 -- if ( l_continuation_flow_type = 'APPROVAL' ) then
6188 -- Eng_Workflow_Util.WaitForLineApprovalFlow . . .
6189 -- elsif ( l_continuation_flow_type = 'XXXX' ) then
6190 -- null
6191 -- else
6192 -- call ContinueFlow.WaitForFlow
6193 -- end if;
6194 --
6195
6196 Eng_Workflow_Util.WaitForLineRoute
6197 ( x_return_status => l_return_status
6198 , x_msg_count => l_msg_count
6199 , x_msg_data => l_msg_data
6200 , p_item_type => itemtype
6201 , p_item_key => itemkey
6202 , p_actid => actid
6203 , p_continuation_activity => l_continuation_activity
6204 , p_continuation_flow_type => NVL(l_continuation_flow_type, 'APPROVAL')
6205 , x_resultout => result
6206 ) ;
6207
6208 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
6209
6210 -- Unexpected Exception
6211 RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
6212
6213 END IF ;
6214
6215 -- result is set by WaitForLineRoute util api
6216 return;
6217
6218 end if ; -- funcmode : RUN
6219
6220
6221 --
6222 -- This is in the event that the activity must be undone,
6223 -- for example when a process is reset to an earlier point
6224 -- due to a loop back.
6225 --
6226 if (funcmode = 'CANCEL') then
6227
6228 -- your cancel code goes here
6229 null;
6230
6231 -- no result needed
6232 result := wf_engine.eng_null ;
6233 return;
6234 end if;
6235
6236 --
6237 -- Other execution modes may be created in the future. Your
6238 -- activity will indicate that it does not implement a mode
6239 -- by returning null
6240 --
6241 result := '';
6242 return;
6243
6244 EXCEPTION
6245
6246 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
6247 -- The line below records this function call in the error system
6248 -- in the case of an exception.
6249 wf_core.context('Eng_Workflow_Pub', 'WAIT_FOR_LINE_ROUTE',
6250 itemtype, itemkey, to_char(actid), funcmode);
6251 raise;
6252
6253
6254 WHEN OTHERS THEN
6255 -- The line below records this function call in the error system
6256 -- in the case of an exception.
6257 wf_core.context('Eng_Workflow_Pub', 'WAIT_FOR_LINE_ROUTE',
6258 itemtype, itemkey, to_char(actid), funcmode);
6259 raise;
6260
6261 END WAIT_FOR_LINE_ROUTE ;
6262 -- Not Supported in 115.10
6263 *****************************************************/
6264
6265
6266
6267
6268 END Eng_Workflow_Pub ;