Script to Clear Orders Stuck in Workflow @ Releasing

If you have some order lines in booked status and the ship line activity is in error instead of ‘Notified’ then use the following script (But check on Test Environment first). Pass the line_id for one of the line from problematic order and check if this will progress the line to ‘Awaiting Shipping’ and the work flow activity to Notified status.

set serveroutput on
Declare

l_line_id NUMBER := &line_id; /* Order Line Id*/
l_org_id NUMBER; /* Organization Id*/
l_count NUMBER;
l_activity_id NUMBER;
l_result VARCHAR2(30);

Begin

OE_Standard_WF.OEOL_SELECTOR
(p_itemtype => ‘OEOL’
,p_itemkey => to_char(l_line_id) /* Order Line Id*/
,p_actid => 12345
,p_funcmode => ‘SET_CTX’
,p_result => l_result
);

select activity_id
into l_activity_id
from wf_item_activity_statuses_v
where item_type = ‘OEOL’
and activity_name = ‘SHIP_LINE’
and item_key = to_char(l_line_id)
and activity_status_code = ‘ERROR’;

wf_item_activity_status.create_status(’OEOL’,to_char(l_line_id),l_activity_id,wf_engine.eng_notified,wf_engine.eng_null,SYSDATE,null);
commit;
End;
/

Leave a Reply