SAP workflow monitoring made easy
SAP workflow monitoring made easy
Cause
We have lots of transaction like PO, PR, Contract, Invoice Etc that gets locked as some user is locking the Transaction and in the same time WF-BATCH is trying to Release or update Transaction.
Standard Solution
•Run everyday SWI2_DIAG and find the workflow in error and restart them from the same transaction Code or SWPR.
Disadvantage of Standard Solution
•Business stops unless the Workflow Administrator process error workflow.
•We waste a lot of time doing this manual task which can be done automatically by a custom solution
•Document which has already been released workflow do not have any insight to stop it
Custom Solution
•Build a Custom Program that runs probably 2 times a day that picks up the workflow that are in error due to locking and restart them.
•Use the Condition Tab for Complete workitem and check whether the Business document has already been released and if so just put a Process control step to Complete or Cancel the Workflow.
Advantages of Custom solution
•Workflow Administrator do not have to restart workflow in error. Less work and less time.
•Business do not have to wait for Workflow Administrator to restart workflow to resume the business process
•Workflow status will be revised as we only need to check the true error Workflow.
Sample code
data:it_wi type standard table of swwwihead,
wa_wi type swwwihead.
select * into table it_wi from swwwihead
where wi_rh_task = ‘TS90400182’
and wi_stat = ‘ERROR’
and WI_CD eq sy-datum.
loop at it_wi into wa_wi.
CALL FUNCTION ‘SWW_WI_ADMIN_ERROR_RESTART’
EXPORTING
WI_ID = wa_wi-top_wi_id
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
endloop.
The standard solution is actually to define it as a temporary error. Then the WF system error monitoring job will attempt restarts without the need for a custom report.
Yup as long as the Termorary error is defined in standard Method
What about the Codition step which helped me a lot. Do standard SAP support those which are in error regardless of what error it is.
Hi Arghadip,
The idea and intent is good
I would prefer to use temporary exception workflow handling for temporary error.
Regards,
Gaurang
Thanks for posting this Arghadip but I'm afraid you are reinventing the wheel here. As noted above, there is already a standard SAP 'restart' job that runs every 20 minutes. Sure, it only handles temporary exceptions, but your custom workflows should be built to throw temporary exceptions when there is locking.
Also, if you are going to do this, you should be using WAPIs in your code to select and restart workitems.
I'm not sure what you mean about using the Condition step? Can you please explain?
thanks
Paul
Imagine there was an error in workflow for some reason but the document is completed or released which is not caught in workflow if the workflow goes into error then the condition tab in a activity step which went into error will take care of that situation. Here is an example. Imagine you have an invoice that requires GR and you send to someone for processing. Now that Invoice is sitting in this users inbox and now someone comes and does the GR. If we have a Condition in Complete execution in the Codition tab of aGR activity step then this will automatically disappear from GR users inbox and do the Invoice Posting. This is one of the feature I did in the new AP workflow which is as good as VIm solution 🙂