68: -- - DEFERED
69: -- execution should be defered to background
70: -- - NOTIFIED[:
71: -- activity has notified an external entity that this
72: -- step must be performed. A call to wf_engine.CompleteActivty
73: -- will signal when this step is complete. Optional
74: -- return of notification ID and assigned user.
75: -- - ERROR[:
76: -- function encountered an error.
92: -- RUN mode - normal process execution
93: --
94: if (funcmode = 'RUN') then
95:
96: wf_engine.SetItemAttrText( itemtype => itemtype,
97: itemkey => itemkey,
98: aname => 'AME_PROCESS_STATUS',
99: avalue => 'INPROCESS');
100:
97: itemkey => itemkey,
98: aname => 'AME_PROCESS_STATUS',
99: avalue => 'INPROCESS');
100:
101: wf_engine.SetItemAttrText( itemtype => itemtype,
102: itemkey => itemkey,
103: aname => 'APPROVER_RESPONSE',
104: avalue => 'NORESPONSE');
105:
110: END IF;
111: end if;
112:
113: -- no result needed
114: resultout := wf_engine.eng_completed||':'||wf_engine.eng_null;
115: return;
116: end if;
117:
118:
121: --
122: if (funcmode = 'CANCEL') then
123:
124: -- no result needed
125: resultout := wf_engine.eng_completed||':'||wf_engine.eng_null;
126: return;
127: end if;
128:
129: --
130: -- Other execution modes may be created in the future. Your
131: -- activity will indicate that it does not implement a mode
132: -- by returning null
133: --
134: resultout := wf_engine.eng_null;
135: return;
136:
137: exception
138: when others then
186: --
187: if (funcmode = 'RUN') then
188:
189:
190: wf_engine.SetItemAttrText ( itemtype => itemtype,
191: itemkey => itemkey,
192: aname => 'AME_PROCESS_STATUS',
193: avalue => 'REJECTED');
194:
205: -- Other execution modes may be created in the future. Your
206: -- activity will indicate that it does not implement a mode
207: -- by returning null
208: --
209: resultout := wf_engine.eng_completed||':'||wf_engine.eng_null;
210: return;
211:
212: exception
213: when others then
270: FND_LOG.string(FND_LOG.level_statement, g_module_prefix || l_api_name, l_progress );
271: END IF;
272: end if;
273:
274: resultout := wf_engine.eng_completed||':'||l_profile_value;
275:
276:
277: wf_engine.SetItemAttrText ( itemtype => itemtype,
278: itemkey => itemkey,
273:
274: resultout := wf_engine.eng_completed||':'||l_profile_value;
275:
276:
277: wf_engine.SetItemAttrText ( itemtype => itemtype,
278: itemkey => itemkey,
279: aname => 'AME_ENABLED',
280: avalue => l_profile_value);
281: l_progress := 2;
280: avalue => l_profile_value);
281: l_progress := 2;
282:
283: if (l_profile_value = 'N') then
284: wf_engine.SetItemAttrText ( itemtype => itemtype,
285: itemkey => itemkey,
286: aname => 'AME_PROCESS_STATUS',
287: avalue => 'NOAME');
288: end if;
297: return;
298:
299: end if;
300:
301: resultout := wf_engine.eng_null;
302: return;
303:
304: exception
305: when others then
379: --
380: if (funcmode = 'RUN') then
381:
382:
383: wf_engine.SetItemAttrText ( itemtype => itemtype,
384: itemkey => itemkey,
385: aname => 'APPROVER_RESPONSE',
386: avalue => 'NORESPONSE');
387:
385: aname => 'APPROVER_RESPONSE',
386: avalue => 'NORESPONSE');
387:
388:
389: resultout := wf_engine.eng_completed||':'||'VALID_NEXT_APPROVER';
390:
391: -- ame_api2.clearAllApprovals( applicationIdIn=>177,
392: -- transactionTypeIn=>'POS_SUPP_APPR',
393: -- transactionIdIn=>itemkey);
408: end if;
409:
410: if (l_completeYNO = 'Y') then
411:
412: resultout := wf_engine.eng_completed||':'||'NO_NEXT_APPROVER';
413:
414: wf_engine.SetItemAttrText ( itemtype => itemtype,
415: itemkey => itemkey,
416: aname => 'AME_PROCESS_STATUS',
410: if (l_completeYNO = 'Y') then
411:
412: resultout := wf_engine.eng_completed||':'||'NO_NEXT_APPROVER';
413:
414: wf_engine.SetItemAttrText ( itemtype => itemtype,
415: itemkey => itemkey,
416: aname => 'AME_PROCESS_STATUS',
417: avalue => 'APPROVED');
418:
495: END IF;
496: end if;
497:
498:
499: wf_engine.SetItemAttrText ( itemtype => itemtype,
500: itemkey => itemkey,
501: aname => 'APPROVER_USER_NAME',
502: avalue => l_next_approver_user_name);
503:
501: aname => 'APPROVER_USER_NAME',
502: avalue => l_next_approver_user_name);
503:
504:
505: wf_engine.SetItemAttrText ( itemtype => itemtype,
506: itemkey => itemkey,
507: aname => 'APPROVER_DISPLAY_NAME',
508: avalue => l_next_approver_disp_name);
509:
506: itemkey => itemkey,
507: aname => 'APPROVER_DISPLAY_NAME',
508: avalue => l_next_approver_disp_name);
509:
510: wf_engine.SetItemAttrText ( itemtype => itemtype,
511: itemkey => itemkey,
512: aname => 'AME_APPROVER_ID',
513: avalue => g_next_approvers(l_approver_index).orig_system_id);
514:
511: itemkey => itemkey,
512: aname => 'AME_APPROVER_ID',
513: avalue => g_next_approvers(l_approver_index).orig_system_id);
514:
515: wf_engine.SetItemAttrText ( itemtype => itemtype,
516: itemkey => itemkey,
517: aname => 'APPROVER_EMPID',
518: avalue => l_next_approver_id);
519:
516: itemkey => itemkey,
517: aname => 'APPROVER_EMPID',
518: avalue => l_next_approver_id);
519:
520: wf_engine.SetItemAttrText ( itemtype => itemtype,
521: itemkey => itemkey,
522: aname => 'APPROVAL_GROUP_ID',
523: avalue => g_next_approvers(l_approver_index).group_or_chain_id);
524:
521: itemkey => itemkey,
522: aname => 'APPROVAL_GROUP_ID',
523: avalue => g_next_approvers(l_approver_index).group_or_chain_id);
524:
525: wf_engine.SetItemAttrText ( itemtype => itemtype,
526: itemkey => itemkey,
527: aname => 'AME_APPROVER_TYPE',
528: avalue => g_next_approvers(l_approver_index).orig_system);
529:
549: --
550: if (funcmode = 'CANCEL') then
551:
552: -- no result needed
553: resultout := wf_engine.eng_completed||':'||wf_engine.eng_null;
554: return;
555: end if;
556:
557: --
558: -- Other execution modes may be created in the future. Your
559: -- activity will indicate that it does not implement a mode
560: -- by returning null
561: --
562: resultout := wf_engine.eng_null;
563: return;
564:
565: exception
566: when others then
620: status := 'E';
621: return;
622: end if;
623:
624: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
625: itemkey => suppid,
626: aname => 'APPROVER_USER_NAME');
627:
628: wf_approver_response := wf_engine.GetItemAttrText(itemtype => wfItemType,
624: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
625: itemkey => suppid,
626: aname => 'APPROVER_USER_NAME');
627:
628: wf_approver_response := wf_engine.GetItemAttrText(itemtype => wfItemType,
629: itemkey => suppid,
630: aname => 'APPROVER_RESPONSE');
631:
632: l_progress := 'GET_APPROVER_IN_WF: 002 WF attribute APPROVER_USER_NAME - '||wf_approver ||
727: resultout => l_resultout);
728:
729: --end fix
730:
731: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
732: itemkey => suppid,
733: aname => 'APPROVER_USER_NAME');
734:
735: wf_approver_response := wf_engine.GetItemAttrText(itemtype => wfItemType,
731: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
732: itemkey => suppid,
733: aname => 'APPROVER_USER_NAME');
734:
735: wf_approver_response := wf_engine.GetItemAttrText(itemtype => wfItemType,
736: itemkey => suppid,
737: aname => 'APPROVER_RESPONSE');
738:
739: l_progress := 'CHECK_IF_APPROVER: 003 WF attribute APPROVER_USER_NAME - '||wf_approver ||
787: l_progress := 'GET_AME_PROCESS_STATUS: 001';
788:
789: -- Bug 9314932
790: -- Added "ignore_notfound => TRUE", so that it returns null if there is no process yet
791: process_status := wf_engine.GetItemAttrText(itemtype => wfItemType,
792: itemkey => suppid,
793: aname => 'AME_PROCESS_STATUS',
794: ignore_notfound => TRUE);
795:
845: begin
846:
847: l_progress := 'PROCESS_APPROVE: 001';
848:
849: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
850: itemkey => suppid,
851: aname => 'APPROVER_USER_NAME');
852:
853: l_progress := 'PROCESS_APPROVE: 002 username - '||approver||' approver in WF - '||wf_approver;
859: end if;
860:
861: if wf_approver = approver
862: then
863: wf_engine.SetItemAttrText ( itemtype => wfItemType,
864: itemkey => suppid,
865: aname => 'APPROVER_RESPONSE',
866: avalue => 'APPROVE');
867:
884: end if;
885:
886:
887: begin
888: wf_engine.CompleteActivity( itemtype => wfItemType,
889: itemkey => suppid,
890: activity => 'BLOCK',
891: result => null);
892: exception
976: begin
977:
978: l_progress := 'PROCESS_REJECT: 001';
979:
980: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
981: itemkey => suppid,
982: aname => 'APPROVER_USER_NAME');
983:
984: l_progress := 'PROCESS_REJECT: 002 username - '||approver||' approver in WF - '||wf_approver;
990: end if;
991:
992: if wf_approver = approver
993: then
994: wf_engine.SetItemAttrText ( itemtype => wfItemType,
995: itemkey => suppid,
996: aname => 'APPROVER_RESPONSE',
997: avalue => 'REJECT');
998:
1017: end if;
1018:
1019:
1020: begin
1021: wf_engine.CompleteActivity( itemtype => wfItemType,
1022: itemkey => suppid,
1023: activity => 'BLOCK',
1024: result => null);
1025: exception
1146: -- IF (g_po_wf_debug = 'Y') THEN
1147: -- PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_progress);
1148: --END IF;
1149:
1150: l_transaction_type := wf_engine.GetItemAttrText( itemtype => wfItemType,
1151: itemkey => suppid,
1152: aname => 'AME_TRANSACTION_TYPE');
1153:
1154: l_approver_type := wf_engine.GetItemAttrText( itemtype => wfItemType,
1150: l_transaction_type := wf_engine.GetItemAttrText( itemtype => wfItemType,
1151: itemkey => suppid,
1152: aname => 'AME_TRANSACTION_TYPE');
1153:
1154: l_approver_type := wf_engine.GetItemAttrText( itemtype => wfItemType,
1155: itemkey => suppid,
1156: aname => 'AME_APPROVER_TYPE');
1157:
1158: l_progress := 'Process_Response_Internal: 002 -- l_approver_type :' || l_approver_type ;
1171: elsif (l_approver_type = 'FND') then
1172: l_current_approver.orig_system := 'FND';
1173: else
1174: l_current_approver.orig_system := 'PER';
1175: l_current_approver.name := wf_engine.GetItemAttrText( itemtype => wfItemType,
1176: itemkey => suppid,
1177: aname => 'APPROVER_USER_NAME');
1178: end if;
1179:
1176: itemkey => suppid,
1177: aname => 'APPROVER_USER_NAME');
1178: end if;
1179:
1180: l_current_approver.name := wf_engine.GetItemAttrText( itemtype => wfItemType,
1181: itemkey => suppid,
1182: aname => 'APPROVER_USER_NAME');
1183:
1184: l_current_approver.orig_system_id := wf_engine.GetItemAttrNumber( itemtype => wfItemType,
1180: l_current_approver.name := wf_engine.GetItemAttrText( itemtype => wfItemType,
1181: itemkey => suppid,
1182: aname => 'APPROVER_USER_NAME');
1183:
1184: l_current_approver.orig_system_id := wf_engine.GetItemAttrNumber( itemtype => wfItemType,
1185: itemkey => suppid,
1186: aname => 'AME_APPROVER_ID');
1187: */
1188: --start replace
1187: */
1188: --start replace
1189: if (l_approver_type = 'POS') then
1190: l_current_approver.orig_system := 'POS';
1191: l_current_approver.name := 'POS:'||wf_engine.GetItemAttrText( itemtype => wfItemType,
1192: itemkey => suppid,
1193: aname => 'AME_APPROVER_ID');
1194: elsif (l_approver_type = 'FND') then
1195: l_current_approver.orig_system := 'FND';
1192: itemkey => suppid,
1193: aname => 'AME_APPROVER_ID');
1194: elsif (l_approver_type = 'FND') then
1195: l_current_approver.orig_system := 'FND';
1196: l_current_approver.name := wf_engine.GetItemAttrText( itemtype => wfItemType,
1197: itemkey => suppid,
1198: aname => 'APPROVER_USER_NAME');
1199: else
1200: l_current_approver.orig_system := 'PER';
1197: itemkey => suppid,
1198: aname => 'APPROVER_USER_NAME');
1199: else
1200: l_current_approver.orig_system := 'PER';
1201: l_current_approver.name := wf_engine.GetItemAttrText( itemtype => wfItemType,
1202: itemkey => suppid,
1203: aname => 'APPROVER_USER_NAME');
1204: end if;
1205:
1202: itemkey => suppid,
1203: aname => 'APPROVER_USER_NAME');
1204: end if;
1205:
1206: l_current_approver.orig_system_id := wf_engine.GetItemAttrText( itemtype => wfItemType,
1207: itemkey => suppid,
1208: aname => 'AME_APPROVER_ID');
1209: --end replace
1210:
1296: l_progress := 1;
1297:
1298: -- create workflow process
1299:
1300: wf_engine.CreateProcess(itemtype => wfItemType,
1301: itemkey => suppid, /*using suppid as the itemkey*/
1302: process => wfProcess);
1303:
1304:
1303:
1304:
1305: l_progress := 2;
1306:
1307: wf_engine.SetItemAttrText (itemtype => wfItemType,
1308: itemkey => suppid,
1309: aname => 'REQUESTOR',
1310: avalue => requestor);
1311:
1308: itemkey => suppid,
1309: aname => 'REQUESTOR',
1310: avalue => requestor);
1311:
1312: wf_engine.SetItemAttrText (itemtype => wfItemType,
1313: itemkey => suppid,
1314: aname => 'SUPPLIERNAME',
1315: avalue => suppname);
1316:
1315: avalue => suppname);
1316:
1317: l_progress := 3;
1318:
1319: wf_engine.StartProcess(itemtype => wfItemType,
1320: itemkey => suppid );
1321:
1322: l_progress := 4;
1323:
1639: if (isAmeEnabled = wf_no) then
1640: return 'Y';
1641: end if;
1642:
1643: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
1644: itemkey => suppid,
1645: aname => 'APPROVER_USER_NAME');
1646:
1647: wf_approver_response := wf_engine.GetItemAttrText(itemtype => wfItemType,
1643: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
1644: itemkey => suppid,
1645: aname => 'APPROVER_USER_NAME');
1646:
1647: wf_approver_response := wf_engine.GetItemAttrText(itemtype => wfItemType,
1648: itemkey => suppid,
1649: aname => 'APPROVER_RESPONSE');
1650:
1651:
1692: if (isAmeEnabled = wf_no) then
1693: return '';
1694: end if;
1695:
1696: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
1697: itemkey => suppid,
1698: aname => 'APPROVER_USER_NAME');
1699:
1700: wf_approver_response := wf_engine.GetItemAttrText(itemtype => wfItemType,
1696: wf_approver := wf_engine.GetItemAttrText(itemtype => wfItemType,
1697: itemkey => suppid,
1698: aname => 'APPROVER_USER_NAME');
1699:
1700: wf_approver_response := wf_engine.GetItemAttrText(itemtype => wfItemType,
1701: itemkey => suppid,
1702: aname => 'APPROVER_RESPONSE');
1703:
1704: l_progress := 'GET_APPROVER_NAME_IN_WF: 002 WF attribute APPROVER_USER_NAME - '||wf_approver ||