Saturday, October 25, 2008

If PR stuck in work flow then how to retry it

If PR stuck in work flow then how to retry it:

Save below script as name wfretry in C directory of your conmputer

rem HEADERrem $Header: wfretry.sql 110.0 97/07/22 16:34:45 appldev ship $rem NAMErem wfretry.sql - WorkFlow Handle error'ed activityrem USAGErem @wfretry rem DESCRIPTIONrem Displays a list of errored activityes for the indicated item.rem Type in the name of the activity, and command to skip, retry, or reset.
set verify off
define item_type='&1'define item_key='&2'
prompt Select from list of error activitiesselect pa.instance_label Label, ias.activity_result_code Resultfrom wf_item_activity_statuses ias, wf_process_activities pawhere ias.item_type = '&item_type'and ias.item_key = '&item_key'and ias.process_activity = pa.instance_idand ias.activity_status = 'ERROR';/accept activity prompt "Label: "
prompt SKIP, RETRY or RESET activity? accept comflag prompt "Command: "
prompt Result of activity if command is SKIPaccept result prompt "Result: "
begin Wf_Engine.HandleError('&item_type', '&item_key', '&activity', '&comflag', '&result');end;/set verify on


Now follow below steps

1. Run the script
@C:\wfretry;

2. Enter value for 1:
&WF_ITEM_TYPE= REQAPPRV

Enter value for 2:
&WF_ITEM_KEY= 112843-226248(will be different for different PR)
(Can get above value by running below script
select segment1,ORG_ID,WF_ITEM_TYPE,WF_ITEM_KEY,AUTHORIZATION_STATUS from po_requisition_headers_all where segment1= 84701)


3.Label: MAIN_REQAPPRV_PROCESS
SKIP, RETRY or RESET activity?
Command: RETRY
Result of activity if command is SKIP
Result:

PL/SQL procedure successfully completed
4. Commit;