142: l_start_wf_process VARCHAR2(1);
143: l_return_status VARCHAR2(1);
144:
145: l_customer_name VARCHAR2(50);
146: l_aname_num wf_engine.nametabtyp;
147: l_avalue_num wf_engine.numtabtyp;
148: l_aname_text wf_engine.nametabtyp;
149: l_avalue_text wf_engine.texttabtyp;
150:
143: l_return_status VARCHAR2(1);
144:
145: l_customer_name VARCHAR2(50);
146: l_aname_num wf_engine.nametabtyp;
147: l_avalue_num wf_engine.numtabtyp;
148: l_aname_text wf_engine.nametabtyp;
149: l_avalue_text wf_engine.texttabtyp;
150:
151: l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'START_WF_PROCESS';
144:
145: l_customer_name VARCHAR2(50);
146: l_aname_num wf_engine.nametabtyp;
147: l_avalue_num wf_engine.numtabtyp;
148: l_aname_text wf_engine.nametabtyp;
149: l_avalue_text wf_engine.texttabtyp;
150:
151: l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'START_WF_PROCESS';
152: l_debug_on BOOLEAN;
145: l_customer_name VARCHAR2(50);
146: l_aname_num wf_engine.nametabtyp;
147: l_avalue_num wf_engine.numtabtyp;
148: l_aname_text wf_engine.nametabtyp;
149: l_avalue_text wf_engine.texttabtyp;
150:
151: l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'START_WF_PROCESS';
152: l_debug_on BOOLEAN;
153:
271: ELSE
272: l_itemtype:='WSHTRIP';
273: END IF;
274:
275: WF_ENGINE.Createprocess(itemtype => l_itemtype,
276: itemkey => l_itemkey,
277: process => l_process_name);
278:
279: l_aname_num(1) := 'USER_ID';
282: l_avalue_num(2) := FND_GLOBAL.RESP_APPL_ID;
283: l_aname_num(3) := 'RESPONSIBILITY_ID';
284: l_avalue_num(3) := FND_GLOBAL.RESP_ID;
285:
286: WF_ENGINE.SetItemAttrNumberArray(
287: itemtype => l_itemtype,
288: itemkey => l_itemkey,
289: aname => l_aname_num,
290: avalue => l_avalue_num);
310: l_avalue_text(5) := FND_GLOBAL.USER_NAME;
311: l_aname_text(6) := 'CUSTOMER_NAME';
312: l_avalue_text(6) := l_customer_name;
313:
314: WF_ENGINE.SetItemAttrTextArray(
315: itemtype => l_itemtype,
316: itemkey => l_itemkey,
317: aname => l_aname_text,
318: avalue => l_avalue_text);
318: avalue => l_avalue_text);
319:
320: ELSIF(p_entity_type = 'TRIP') THEN
321:
322: WF_ENGINE.SetItemAttrText(
323: itemtype => l_itemtype,
324: itemkey => l_itemkey,
325: aname => 'TRIP_ID',
326: avalue => to_char(p_entity_id));
325: aname => 'TRIP_ID',
326: avalue => to_char(p_entity_id));
327: END IF;
328:
329: WF_ENGINE.Startprocess(itemtype => l_itemtype,
330: itemkey => l_itemkey);
331:
332: IF (p_entity_type = 'DELIVERY') THEN
333: UPDATE WSH_NEW_DELIVERIES
417:
418: l_scpod_wf_process_exists VARCHAR2(1);
419: l_return_status VARCHAR2(1);
420:
421: l_aname_num wf_engine.nametabtyp;
422: l_avalue_num wf_engine.numtabtyp;
423: l_aname_text wf_engine.nametabtyp;
424: l_avalue_text wf_engine.texttabtyp;
425:
418: l_scpod_wf_process_exists VARCHAR2(1);
419: l_return_status VARCHAR2(1);
420:
421: l_aname_num wf_engine.nametabtyp;
422: l_avalue_num wf_engine.numtabtyp;
423: l_aname_text wf_engine.nametabtyp;
424: l_avalue_text wf_engine.texttabtyp;
425:
426: l_override_wf VARCHAR2(1);
419: l_return_status VARCHAR2(1);
420:
421: l_aname_num wf_engine.nametabtyp;
422: l_avalue_num wf_engine.numtabtyp;
423: l_aname_text wf_engine.nametabtyp;
424: l_avalue_text wf_engine.texttabtyp;
425:
426: l_override_wf VARCHAR2(1);
427: l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'START_SCPOD_C_PROCESS';
420:
421: l_aname_num wf_engine.nametabtyp;
422: l_avalue_num wf_engine.numtabtyp;
423: l_aname_text wf_engine.nametabtyp;
424: l_avalue_text wf_engine.texttabtyp;
425:
426: l_override_wf VARCHAR2(1);
427: l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'START_SCPOD_C_PROCESS';
428: l_debug_on BOOLEAN;
561: END IF;
562: RETURN;
563: END IF;
564:
565: WF_ENGINE.CreateProcess(itemtype => 'WSHDEL',
566: itemkey => p_entity_id,
567: process => l_custom_process_name);
568:
569: l_aname_num(1) := 'USER_ID';
572: l_avalue_num(2) := FND_GLOBAL.RESP_APPL_ID;
573: l_aname_num(3) := 'RESPONSIBILITY_ID';
574: l_avalue_num(3) := FND_GLOBAL.RESP_ID;
575:
576: WF_ENGINE.SetItemAttrNumberArray(
577: itemtype => l_itemtype,
578: itemkey => l_itemkey,
579: aname => l_aname_num,
580: avalue => l_avalue_num);
598: l_avalue_text(5) := FND_GLOBAL.USER_NAME;
599: l_aname_text(6) := 'CUSTOMER_NAME';
600: l_avalue_text(6) := l_customer_name;
601:
602: WF_ENGINE.SetItemAttrTextArray(
603: itemtype => l_itemtype,
604: itemkey => l_itemkey,
605: aname => l_aname_text,
606: avalue => l_avalue_text);
603: itemtype => l_itemtype,
604: itemkey => l_itemkey,
605: aname => l_aname_text,
606: avalue => l_avalue_text);
607: WF_ENGINE.StartProcess(itemtype => 'WSHDEL',
608: itemkey => p_entity_id);
609: -- Add attributes
610: UPDATE WSH_NEW_DELIVERIES
611: SET delivery_scpod_wf_process=l_custom_process_name
1581: IF l_debug_on THEN
1582: WSH_DEBUG_SV.log(l_module_name,'P_ENTITY_IDS(I)',p_entity_ids(i));
1583: END IF;
1584: --
1585: WF_ENGINE.ItemStatus(itemtype => l_itemtype,
1586: itemkey => p_entity_ids(I),
1587: status => l_wf_status,
1588: result => l_result);
1589:
1587: status => l_wf_status,
1588: result => l_result);
1589:
1590: IF (l_wf_status <> 'COMPLETE') THEN
1591: WF_ENGINE.AbortProcess(itemtype => l_itemtype,
1592: itemkey => p_entity_ids(i)); -- ,l_wf_end_result);
1593: IF (p_action = 'PURGE') THEN
1594: WF_PURGE.Items(itemtype => l_itemtype,
1595: itemkey => p_entity_ids(i),
1933:
1934: END GET_WF_NAME;
1935:
1936: --========================================================================================
1937: -- FUNCTION : WF_ENGINE_EVENT
1938: -- This function will derive the workflow process name for the trip/delivery
1939: -- and pass the event to those processes which are waiting to receive the
1940: -- corresponding event by calling WF API wf_engine.event.
1941: --
1936: --========================================================================================
1937: -- FUNCTION : WF_ENGINE_EVENT
1938: -- This function will derive the workflow process name for the trip/delivery
1939: -- and pass the event to those processes which are waiting to receive the
1940: -- corresponding event by calling WF API wf_engine.event.
1941: --
1942: -- The return status could be SUCCESS/ERROR
1943: -- This API must be called only from wsh_wf_std.instance_default_rule
1944: -- SCOPE : PRIVATE
1954: --
1955: -- This function is introduced as part of bugfix 8706771 and this is replacement
1956: -- for function wsh_wf_std.instance_default_rule
1957: --========================================================================================
1958: FUNCTION WF_ENGINE_EVENT (p_subscription_guid in raw,
1959: p_event in out nocopy WF_EVENT_T) return
1960: VARCHAR2 is
1961: l_eventname VARCHAR2(240);
1962: l_wf_pr_name VARCHAR2(30);
1968: e_event_error EXCEPTION;
1969:
1970:
1971: l_debug_on BOOLEAN;
1972: l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'WF_ENGINE_EVENT';
1973:
1974: BEGIN
1975:
1976: --Get the EventName and EventKey from p_event to local variable
1997:
1998: -- Out Agent/To Agent/Priority/Workflow Type/Workflow Process
1999: -- We dont have any of the above specified in our business event subscriptions which are responsible for triggering the shipping workflow.
2000: -- Due to this we are not doing anything w.r.t input parameter p_subscription_guid and it disappears in this function without doing any processing.
2001: -- If in future we specify any value for these fileds.Then we need to add code here so that those things will be communicated/Set before calling wf_engine.event.
2002: -- Need to refer API WF_RULE.INSTANCE_DEFAULT_RULE for the code to be added.
2003:
2004: IF (l_entityid is not NULL) THEN --{ If l_entityid is not null
2005: p_event.SetEventKey(l_entityid);
2021: IF l_debug_on THEN
2022: WSH_DEBUG_SV.log(l_module_name,'DELIVERY: l_wf_pr_name',l_wf_pr_name);
2023: END IF;
2024:
2025: --Call wf_engine.event only if any process is associated to the entity
2026: IF l_wf_pr_name IS NOT NULL THEN
2027: --{
2028: IF l_debug_on THEN
2029: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WF_ENGINE.EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2025: --Call wf_engine.event only if any process is associated to the entity
2026: IF l_wf_pr_name IS NOT NULL THEN
2027: --{
2028: IF l_debug_on THEN
2029: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WF_ENGINE.EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2030: END IF;
2031:
2032: WF_ENGINE.EVENT(itemtype => 'WSHDEL',
2033: itemkey => l_entityid,
2028: IF l_debug_on THEN
2029: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WF_ENGINE.EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2030: END IF;
2031:
2032: WF_ENGINE.EVENT(itemtype => 'WSHDEL',
2033: itemkey => l_entityid,
2034: process_name => l_wf_pr_name,
2035: event_message => p_event);
2036: ELSE
2045: END IF;
2046:
2047: IF l_wf_pr_name IS NOT NULL THEN
2048: IF l_debug_on THEN
2049: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WF_ENGINE.EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2050: END IF;
2051:
2052: WF_ENGINE.EVENT(itemtype => 'WSHDEL',
2053: itemkey => l_entityid,
2048: IF l_debug_on THEN
2049: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WF_ENGINE.EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2050: END IF;
2051:
2052: WF_ENGINE.EVENT(itemtype => 'WSHDEL',
2053: itemkey => l_entityid,
2054: process_name => l_wf_pr_name,
2055: event_message => p_event);
2056: END IF;
2070: END IF;
2071:
2072: IF l_wf_pr_name IS NOT NULL THEN
2073: IF l_debug_on THEN
2074: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WF_ENGINE.EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2075: END IF;
2076:
2077: wf_engine.Event(itemtype => 'WSHTRIP',
2078: itemkey => l_entityid,
2073: IF l_debug_on THEN
2074: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WF_ENGINE.EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2075: END IF;
2076:
2077: wf_engine.Event(itemtype => 'WSHTRIP',
2078: itemkey => l_entityid,
2079: process_name => l_wf_pr_name,
2080: event_message => p_event);
2081: END IF;
2111: RETURN 'SUCCESS';
2112:
2113: EXCEPTION
2114: WHEN e_entityid_notfound THEN
2115: WF_CORE.CONTEXT('WSH_WF_STD', 'WF_ENGINE_EVENT',p_event.getEventName( ), p_subscription_guid);
2116: WF_EVENT.setErrorInfo(p_event, 'ERROR');
2117:
2118: IF l_debug_on THEN
2119: WSH_DEBUG_SV.logmsg(l_module_name,'Associated Entity Id not found. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_EXCEP_LEVEL);
2122:
2123: RETURN 'ERROR';
2124:
2125: WHEN e_event_error THEN
2126: WF_CORE.CONTEXT('WSH_WF_STD', 'WF_ENGINE_EVENT',p_event.getEventName( ), p_subscription_guid);
2127: WF_EVENT.setErrorInfo(p_event, 'ERROR');
2128:
2129: IF l_debug_on THEN
2130: WSH_DEBUG_SV.logmsg(l_module_name,'Some Entities had errors while raising events. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_EXCEP_LEVEL);
2133:
2134: RETURN 'ERROR';
2135:
2136: WHEN others THEN
2137: WF_CORE.CONTEXT('WSH_WF_STD', 'WF_ENGINE_EVENT',p_event.getEventName( ), p_subscription_guid);
2138: WF_EVENT.setErrorInfo(p_event, 'ERROR');
2139:
2140: IF l_debug_on THEN
2141: WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
2142: WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
2143: END IF;
2144:
2145: RETURN 'ERROR';
2146: END WF_ENGINE_EVENT;
2147:
2148: ---------------------------------------------------------------------------------------
2149: FUNCTION Instance_Default_Rule (p_subscription_guid in raw,
2150: p_event in out nocopy WF_EVENT_T) return
2199:
2200: BEGIN
2201: -- De-supporting the usage of this API code logic due to bug 8706771.
2202: -- Removing all the code inside the begin block and commenting almost all local variables in the declaration part.
2203: -- From now on this API will just redirect the call to the newly created API WSH_WF_STD.WF_ENGINE_EVENT.
2204: -- This API is not removed since the subscription of business event has this one specified.SO instead of making changes there,
2205: -- we are still keeping the skeleton of this API as it is,but redirecting the code logic to new API.
2206: -- For more details refer bug 8706771.
2207:
2215: END IF;
2216: --
2217: IF l_debug_on THEN
2218: WSH_DEBUG_SV.push(l_module_name);
2219: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_WF_STD.WF_ENGINE_EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2220: END IF;
2221:
2222: l_return_status := WF_ENGINE_EVENT( p_subscription_guid => p_subscription_guid,
2223: p_event => p_event);
2218: WSH_DEBUG_SV.push(l_module_name);
2219: WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_WF_STD.WF_ENGINE_EVENT', WSH_DEBUG_SV.C_PROC_LEVEL);
2220: END IF;
2221:
2222: l_return_status := WF_ENGINE_EVENT( p_subscription_guid => p_subscription_guid,
2223: p_event => p_event);
2224: IF l_debug_on THEN
2225: WSH_DEBUG_SV.log(l_module_name,'l_return_status',l_return_status);
2226: WSH_DEBUG_SV.pop(l_module_name);
2448: p_organization_id => l_org_id,
2449: x_return_status => l_wf_rs);
2450: END IF;--Check for old and new Carrier_id values.
2451:
2452: WF_ENGINE.SetItemAttrNumber(itemtype => 'WSHDEL',
2453: itemkey => p_delivery_id,
2454: aname => 'CARRIER_ID',
2455: avalue => p_new_carrier_id);
2456:
2457: OPEN c_get_carrier_name(p_carrier_id => p_new_carrier_id);
2458: FETCH c_get_carrier_name INTO l_carrier_name;
2459: CLOSE c_get_carrier_name;
2460:
2461: WF_ENGINE.SetItemAttrText(itemtype => 'WSHDEL',
2462: itemkey => p_delivery_id,
2463: aname => 'CARRIER_NAME',
2464: avalue => l_carrier_name);
2465: