57: -- RUN mode - normal process execution
58:
59: if (funcmode = 'RUN') then
60:
61: i_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, name => 'EVENT_MESSAGE');
62:
63: /** get the Values from the EventMessage **/
64: return_code := i_event.getValueForParameter('ECX_RETURN_CODE');
65: error_msg := i_event.getValueForParameter('ECX_ERROR_MSG');
89: *** We could just continually reference back to the source of
90: *** of our errors, but safer to get our own copy.
91: **/
92:
93: wf_engine.SetItemAttrText ( itemtype => itemtype,
94: itemkey => itemkey,
95: aname => 'ECX_RETURN_CODE',
96: avalue => return_code);
97:
94: itemkey => itemkey,
95: aname => 'ECX_RETURN_CODE',
96: avalue => return_code);
97:
98: wf_engine.SetItemAttrText ( itemtype => itemtype,
99: itemkey => itemkey,
100: aname => 'ECX_ERROR_MSG',
101: avalue => error_msg);
102:
99: itemkey => itemkey,
100: aname => 'ECX_ERROR_MSG',
101: avalue => error_msg);
102:
103: wf_engine.SetItemAttrText ( itemtype => itemtype,
104: itemkey => itemkey,
105: aname => 'ECX_ERROR_TYPE',
106: avalue => error_type);
107:
104: itemkey => itemkey,
105: aname => 'ECX_ERROR_TYPE',
106: avalue => error_type);
107:
108: wf_engine.SetItemAttrText ( itemtype => itemtype,
109: itemkey => itemkey,
110: aname => 'ECX_TRANSACTION_TYPE',
111: avalue => transaction_type);
112:
109: itemkey => itemkey,
110: aname => 'ECX_TRANSACTION_TYPE',
111: avalue => transaction_type);
112:
113: wf_engine.SetItemAttrText ( itemtype => itemtype,
114: itemkey => itemkey,
115: aname => 'ECX_TRANSACTION_SUBTYPE',
116: avalue => transaction_subtype);
117:
114: itemkey => itemkey,
115: aname => 'ECX_TRANSACTION_SUBTYPE',
116: avalue => transaction_subtype);
117:
118: wf_engine.SetItemAttrText ( itemtype => itemtype,
119: itemkey => itemkey,
120: aname => 'ECX_PARTY_SITE_ID',
121: avalue => party_site_id);
122:
119: itemkey => itemkey,
120: aname => 'ECX_PARTY_SITE_ID',
121: avalue => party_site_id);
122:
123: wf_engine.SetItemAttrText ( itemtype => itemtype,
124: itemkey => itemkey,
125: aname => 'ECX_PARTY_ID',
126: avalue => party_id);
127:
124: itemkey => itemkey,
125: aname => 'ECX_PARTY_ID',
126: avalue => party_id);
127:
128: wf_engine.SetItemAttrText ( itemtype => itemtype,
129: itemkey => itemkey,
130: aname => 'ECX_PARTY_ADMIN_EMAIL',
131: avalue => i_admin_email);
132: /* Bug #2183619 */
130: aname => 'ECX_PARTY_ADMIN_EMAIL',
131: avalue => i_admin_email);
132: /* Bug #2183619 */
133: begin
134: wf_engine.SetItemAttrText ( itemtype => itemtype,
135: itemkey => itemkey,
136: aname => 'ECX_PARTY_TYPE',
137: avalue => party_type);
138: exception
137: avalue => party_type);
138: exception
139: when others then
140: if(wf_core.error_name = 'WFENG_ITEM_ATTR') then
141: wf_engine.addItemAttr(itemtype, itemkey, 'ECX_PARTY_TYPE');
142: wf_engine.SetItemAttrText ( itemtype => itemtype,
143: itemkey => itemkey,
144: aname => 'ECX_PARTY_TYPE',
145: avalue => party_type);
138: exception
139: when others then
140: if(wf_core.error_name = 'WFENG_ITEM_ATTR') then
141: wf_engine.addItemAttr(itemtype, itemkey, 'ECX_PARTY_TYPE');
142: wf_engine.SetItemAttrText ( itemtype => itemtype,
143: itemkey => itemkey,
144: aname => 'ECX_PARTY_TYPE',
145: avalue => party_type);
146: else
148: end if;
149: end;
150:
151: /* Bug 2260180 */
152: wf_engine.SetItemAttrText ( itemtype => itemtype,
153: itemkey => itemkey,
154: aname => 'ECX_TP_HEADER_ID',
155: avalue => tp_header_id);
156:
228: **/
229:
230: /** Get the Error Item Type and Error Item Key **/
231:
232: error_item_type := wf_engine.GetItemAttrText(
233: itemtype => itemtype,
234: itemkey => itemkey,
235: aname => 'ERROR_ITEM_TYPE' );
236:
233: itemtype => itemtype,
234: itemkey => itemkey,
235: aname => 'ERROR_ITEM_TYPE' );
236:
237: error_item_key := wf_engine.GetItemAttrText(
238: itemtype => itemtype,
239: itemkey => itemkey,
240: aname => 'ERROR_ITEM_KEY' );
241:
238: itemtype => itemtype,
239: itemkey => itemkey,
240: aname => 'ERROR_ITEM_KEY' );
241:
242: error_activity_id := wf_engine.GetItemAttrNumber(
243: itemtype => itemtype,
244: itemkey => itemkey,
245: aname => 'ERROR_ACTIVITY_ID' );
246:
243: itemtype => itemtype,
244: itemkey => itemkey,
245: aname => 'ERROR_ACTIVITY_ID' );
246:
247: transaction_type := wf_engine.GetActivityAttrText(
248: itemtype,
249: itemkey,
250: error_activity_id,
251: 'ECX_TRANSACTION_TYPE',
250: error_activity_id,
251: 'ECX_TRANSACTION_TYPE',
252: true);
253:
254: transaction_subtype := wf_engine.GetActivityAttrText(
255: itemtype,
256: itemkey,
257: error_activity_id,
258: 'ECX_TRANSACTION_SUBTYPE',
262: -- Are we sure all of these item attributes will exist
263: -- If some are optional, pass ignore_notfound
264:
265:
266: party_id := wf_engine.GetItemAttrText(
267: itemtype => error_item_type,
268: itemkey => error_item_key,
269: aname => 'ECX_PARTY_ID',
270: ignore_notfound=> true );
268: itemkey => error_item_key,
269: aname => 'ECX_PARTY_ID',
270: ignore_notfound=> true );
271:
272: party_site_id := wf_engine.GetItemAttrText(
273: itemtype => error_item_type,
274: itemkey => error_item_key,
275: aname => 'ECX_PARTY_SITE_ID',
276: ignore_notfound=> true );
274: itemkey => error_item_key,
275: aname => 'ECX_PARTY_SITE_ID',
276: ignore_notfound=> true );
277:
278: document_id := wf_engine.GetItemAttrText(
279: itemtype => error_item_type,
280: itemkey => error_item_key,
281: aname => 'ECX_DOCUMENT_ID' ,
282: ignore_notfound=> true);
281: aname => 'ECX_DOCUMENT_ID' ,
282: ignore_notfound=> true);
283:
284: /* start of chnages for bug #2183619 */
285: party_type := wf_engine.GetItemAttrText(
286: itemtype => error_item_type,
287: itemkey => error_item_key,
288: aname => 'ECX_PARTY_TYPE' ,
289: ignore_notfound=> true);
290: /* End of changes for bug #2183619*/
291:
292:
293: if transaction_type is null then
294: transaction_type := wf_engine.GetItemAttrText(
295: itemtype => error_item_type,
296: itemkey => error_item_key,
297: aname => 'ECX_TRANSACTION_TYPE' ,
298: ignore_notfound=> true);
298: ignore_notfound=> true);
299: end if;
300:
301: if transaction_subtype is null then
302: transaction_subtype := wf_engine.GetItemAttrText(
303: itemtype => error_item_type,
304: itemkey => error_item_key,
305: aname => 'ECX_TRANSACTION_SUBTYPE' ,
306: ignore_notfound=> true);
308:
309: /** This won't be set because of the rollback **/
310:
311: /**
312: error_type := wf_engine.GetItemAttrText(
313: itemtype => error_item_type,
314: itemkey => error_item_key,
315: aname => 'ECX_ERROR_TYPE' );
316:
313: itemtype => error_item_type,
314: itemkey => error_item_key,
315: aname => 'ECX_ERROR_TYPE' );
316:
317: error_msg := wf_engine.GetItemAttrText(
318: itemtype => error_item_type,
319: itemkey => error_item_key,
320: aname => 'ECX_ERROR_MSG' );
321:
318: itemtype => error_item_type,
319: itemkey => error_item_key,
320: aname => 'ECX_ERROR_MSG' );
321:
322: return_code := wf_engine.GetItemAttrText(
323: itemtype => error_item_type,
324: itemkey => error_item_key,
325: aname => 'ECX_RETURN_CODE' );
326: **/
330: *** We could just continually reference back to the source of
331: *** of our errors, but safer to get our own copy.
332: **/
333:
334: wf_engine.SetItemAttrText ( itemtype => itemtype,
335: itemkey => itemkey,
336: aname => 'ECX_PARTY_ID',
337: avalue => party_id);
338:
335: itemkey => itemkey,
336: aname => 'ECX_PARTY_ID',
337: avalue => party_id);
338:
339: wf_engine.SetItemAttrText ( itemtype => itemtype,
340: itemkey => itemkey,
341: aname => 'ECX_PARTY_SITE_ID',
342: avalue => party_site_id);
343:
340: itemkey => itemkey,
341: aname => 'ECX_PARTY_SITE_ID',
342: avalue => party_site_id);
343:
344: wf_engine.SetItemAttrText ( itemtype => itemtype,
345: itemkey => itemkey,
346: aname => 'ECX_DOCUMENT_ID',
347: avalue => document_id);
348:
345: itemkey => itemkey,
346: aname => 'ECX_DOCUMENT_ID',
347: avalue => document_id);
348:
349: wf_engine.SetItemAttrText ( itemtype => itemtype,
350: itemkey => itemkey,
351: aname => 'ECX_TRANSACTION_TYPE',
352: avalue => transaction_type);
353:
350: itemkey => itemkey,
351: aname => 'ECX_TRANSACTION_TYPE',
352: avalue => transaction_type);
353:
354: wf_engine.SetItemAttrText ( itemtype => itemtype,
355: itemkey => itemkey,
356: aname => 'ECX_TRANSACTION_SUBTYPE',
357: avalue => transaction_subtype);
358:
357: avalue => transaction_subtype);
358:
359: /* Start of changes for bug #2183619 */
360: begin
361: wf_engine.SetItemAttrText ( itemtype => itemtype,
362: itemkey => itemkey,
363: aname => 'ECX_PARTY_TYPE',
364: avalue => party_type);
365: exception
364: avalue => party_type);
365: exception
366: when others then
367: if(wf_core.error_name = 'WFENG_ITEM_ATTR') then
368: wf_engine.addItemAttr(itemtype, itemkey, 'ECX_PARTY_TYPE');
369: wf_engine.SetItemAttrText ( itemtype => itemtype,
370: itemkey => itemkey,
371: aname => 'ECX_PARTY_TYPE',
372: avalue => party_type);
365: exception
366: when others then
367: if(wf_core.error_name = 'WFENG_ITEM_ATTR') then
368: wf_engine.addItemAttr(itemtype, itemkey, 'ECX_PARTY_TYPE');
369: wf_engine.SetItemAttrText ( itemtype => itemtype,
370: itemkey => itemkey,
371: aname => 'ECX_PARTY_TYPE',
372: avalue => party_type);
373: else
380:
381: /* Using g_rec_tp_id here as inbound and passthroughs
382: will use the GetInErrorDetails
383: which gets tp_header_id from the error event. */
384: wf_engine.SetItemAttrText ( itemtype => itemtype,
385: itemkey => itemkey,
386: aname => 'ECX_TP_HEADER_ID',
387: avalue => ecx_utils.g_rec_tp_id);
388:
385: itemkey => itemkey,
386: aname => 'ECX_TP_HEADER_ID',
387: avalue => ecx_utils.g_rec_tp_id);
388:
389: wf_engine.SetItemAttrText ( itemtype => itemtype,
390: itemkey => itemkey,
391: aname => 'ECX_RETURN_CODE',
392: avalue => ecx_utils.i_ret_code);
393:
390: itemkey => itemkey,
391: aname => 'ECX_RETURN_CODE',
392: avalue => ecx_utils.i_ret_code);
393:
394: wf_engine.SetItemAttrText ( itemtype => itemtype,
395: itemkey => itemkey,
396: aname => 'ECX_ERROR_MSG',
397: avalue => error_msg);
398:
395: itemkey => itemkey,
396: aname => 'ECX_ERROR_MSG',
397: avalue => error_msg);
398:
399: wf_engine.SetItemAttrText ( itemtype => itemtype,
400: itemkey => itemkey,
401: aname => 'ECX_ERROR_TYPE',
402: avalue => ecx_utils.error_type);
403:
486:
487:
488: /** Get the Transaction Type , Transaction Subtype, Party_id, Party_site_id from Item Attributes ***/
489:
490: transaction_type := wf_engine.GetItemAttrText(
491: itemtype => itemtype,
492: itemkey => itemkey,
493: aname => 'ECX_TRANSACTION_TYPE' );
494:
491: itemtype => itemtype,
492: itemkey => itemkey,
493: aname => 'ECX_TRANSACTION_TYPE' );
494:
495: transaction_subtype := wf_engine.GetItemAttrText(
496: itemtype => itemtype,
497: itemkey => itemkey,
498: aname => 'ECX_TRANSACTION_SUBTYPE' );
499:
496: itemtype => itemtype,
497: itemkey => itemkey,
498: aname => 'ECX_TRANSACTION_SUBTYPE' );
499:
500: party_id := wf_engine.GetItemAttrText(
501: itemtype => itemtype,
502: itemkey => itemkey,
503: aname => 'ECX_PARTY_ID' );
504:
501: itemtype => itemtype,
502: itemkey => itemkey,
503: aname => 'ECX_PARTY_ID' );
504:
505: party_site_id := wf_engine.GetItemAttrText(
506: itemtype => itemtype,
507: itemkey => itemkey,
508: aname => 'ECX_PARTY_SITE_ID' );
509:
506: itemtype => itemtype,
507: itemkey => itemkey,
508: aname => 'ECX_PARTY_SITE_ID' );
509:
510: email_address := wf_engine.GetItemAttrText(
511: itemtype => itemtype,
512: itemkey => itemkey,
513: aname => 'ECX_PARTY_ADMIN_EMAIL',
514: ignore_notfound => true);
512: itemkey => itemkey,
513: aname => 'ECX_PARTY_ADMIN_EMAIL',
514: ignore_notfound => true);
515: /* Start of changes for bug #2183619 */
516: party_type := wf_engine.GetItemAttrText(
517: itemtype => itemtype,
518: itemkey => itemkey,
519: aname => 'ECX_PARTY_TYPE',
520: ignore_notfound => true);
519: aname => 'ECX_PARTY_TYPE',
520: ignore_notfound => true);
521: /* End of changes for bug #2183619 */
522:
523: tp_header_id := wf_engine.GetItemAttrText(
524: itemtype => itemtype,
525: itemkey => itemkey,
526: aname => 'ECX_TP_HEADER_ID',
527: ignore_notfound => true);
652:
653: end if;
654: end if;
655:
656: wf_engine.SetItemAttrText ( itemtype => itemtype,
657: itemkey => itemkey,
658: aname => 'ECX_TP_ROLE',
659: avalue => rname);
660:
836:
837: end if;
838: end if;
839:
840: wf_engine.SetItemAttrText ( itemtype => itemtype,
841: itemkey => itemkey,
842: aname => 'ECX_SA_ROLE',
843: avalue => rname);
844:
898:
899: BEGIN
900:
901: IF (funcmode='RUN') THEN
902: i_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, name => 'EVENT_MESSAGE');
903: i_retry_count :=wf_engine.GetItemAttrText ( itemtype => itemtype,
904: itemkey => itemkey,
905: aname => 'ECX_ATTRIBUTE2');
906: i_prof_error_count:=fnd_profile.value_specific(name=>'ECX_MAX_RETRY',
899: BEGIN
900:
901: IF (funcmode='RUN') THEN
902: i_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, name => 'EVENT_MESSAGE');
903: i_retry_count :=wf_engine.GetItemAttrText ( itemtype => itemtype,
904: itemkey => itemkey,
905: aname => 'ECX_ATTRIBUTE2');
906: i_prof_error_count:=fnd_profile.value_specific(name=>'ECX_MAX_RETRY',
907: user_id=>0,
912:
913: IF (to_number(i_retry_count) < i_prof_error_count) then
914: i_retry_count :=i_retry_count+1;
915: i_event.addParameterToList('ECX_ATTRIBUTE2',i_retry_count);
916: wf_engine.SetItemAttrEvent(itemtype,itemkey,'EVENT_MESSAGE',i_event);
917: result:='COMPLETE:'||'Y'; -- retry
918: return;
919:
920: ELSE
948: org_id=>null,
949: server_id=>null);
950:
951:
952: wf_engine.SetItemAttrText ( itemtype => itemtype,
953: itemkey => itemkey,
954: aname => 'ERROR_TIMEOUT',
955: avalue => i_time_out);
956: result:='COMPLETE';
1003:
1004: -- your run code goes here
1005: --get transaction_type,transaction_subtype,party_type from item_attributes
1006:
1007: l_transaction_type :=wf_engine.GetItemAttrText ( itemtype => itemtype,
1008: itemkey => itemkey,
1009: aname => 'ECX_TRANSACTION_TYPE');
1010:
1011: l_transaction_subtype :=wf_engine.GetItemAttrText ( itemtype => itemtype,
1007: l_transaction_type :=wf_engine.GetItemAttrText ( itemtype => itemtype,
1008: itemkey => itemkey,
1009: aname => 'ECX_TRANSACTION_TYPE');
1010:
1011: l_transaction_subtype :=wf_engine.GetItemAttrText ( itemtype => itemtype,
1012: itemkey => itemkey,
1013: aname => 'ECX_TRANSACTION_SUBTYPE');
1014: l_party_type := wf_engine.GetItemAttrText(
1015: itemtype => itemtype,
1010:
1011: l_transaction_subtype :=wf_engine.GetItemAttrText ( itemtype => itemtype,
1012: itemkey => itemkey,
1013: aname => 'ECX_TRANSACTION_SUBTYPE');
1014: l_party_type := wf_engine.GetItemAttrText(
1015: itemtype => itemtype,
1016: itemkey => itemkey,
1017: aname => 'ECX_PARTY_TYPE',
1018: ignore_notfound => true);
1016: itemkey => itemkey,
1017: aname => 'ECX_PARTY_TYPE',
1018: ignore_notfound => true);
1019:
1020: l_standard_code := wf_engine.GetItemAttrText ( itemtype => itemtype,
1021: itemkey => itemkey,
1022: aname => 'ECX_MESSAGE_STANDARD',
1023: ignore_notfound => true);
1024: l_standard_type := wf_engine.GetItemAttrText ( itemtype => itemtype,
1020: l_standard_code := wf_engine.GetItemAttrText ( itemtype => itemtype,
1021: itemkey => itemkey,
1022: aname => 'ECX_MESSAGE_STANDARD',
1023: ignore_notfound => true);
1024: l_standard_type := wf_engine.GetItemAttrText ( itemtype => itemtype,
1025: itemkey => itemkey,
1026: aname => 'ECX_MESSAGE_TYPE',
1027: ignore_notfound => true);
1028: l_party_site_id := wf_engine.GetItemAttrText(
1024: l_standard_type := wf_engine.GetItemAttrText ( itemtype => itemtype,
1025: itemkey => itemkey,
1026: aname => 'ECX_MESSAGE_TYPE',
1027: ignore_notfound => true);
1028: l_party_site_id := wf_engine.GetItemAttrText(
1029: itemtype => itemtype,
1030: itemkey => itemkey,
1031: aname => 'ECX_PARTY_SITE_ID');
1032:
1141:
1142: end if;
1143: end if;
1144:
1145: wf_engine.SetItemAttrText ( itemtype => itemtype,
1146: itemkey => itemkey,
1147: aname => 'ECX_TO_ROLE',
1148: avalue => rname);
1149: