WF Error Log Notification Report
Email should be sent to initiator and IT support team for all errors in SWIA.
SWIA can be used to list workitems in ERROR status, this report can be extracted manually as a ALV output.
To extract this report, one would need to access SWIA daily and pull this error log and notify relevant persons of the failed workflows.
Due to manual error where daily monitoring would not happen as expected, once the form is landing in ERROR status, it’s losing the visibility. We have the risk of over payments for the terminated employees as well.
This is the work around to automate the monitoring and sending of email to external mail ids.
1. Report RSWIWILS is the calling program for the SWIA output screen.
2. A custom report can be created as a copy of this standard report, daily job can be scheduled saving a variant with status ‘ERRORS’.
3. The selection screen can be updated to add new fields for email address input.
4. IT suport team email addresses can be passed from the selection screen.
5. Initiator email address can be extracted from the output of SWIA.
6. Initiator user id (IT0105 subtype 0001) can be extracted from column ‘Creator’.
7. To identify initiator, we can use the rows for which cells in column ‘Workflow’ are blank.
8. Initiator user id would be extracted as char 3 onwards of column ‘Creator’.
9. Through initiator user id, initiator email address can be extracted from IT0105 – subtypes 0001 & 0010.
10.Email address of initiators can be appended into the table holding selection screen input of email addresses.
11.Email generated can have a xls attachment of the required output format (either all fields or selected fields of SWIA output).
In this document, we create a report that has the same look and feel as SWIA, but this report will generate an email listing all the work items in status ‘ERROR’ and send the email to all recipients required.
To achieve this, we need to copy a standard SAP program and make some minor adjustments.
Step 1. Copy the SAP report
SE38: Copy program RSWIWILS to ZRSWIWILS.
Activate the program. Then, in the attributes, change the title of the program to ‘Workflow Error Log Notification Report’.
(If you see a message about “Different original and logon languages” then click on the “Change orig.language” button and continue to agree with whatever SAP asks until you get to the “ABAP: Program Attributes ZRSWIWILS Change” window, where you can change the Title.)
Step 2. Create a new report transaction
SE93: Create a ‘report transaction’ ZWF_ERROR_NOTIF and link it to program ZRSWIWILS.
Step 3. Edit the program
SE38: Make some code changes to ZRSWIWILS – see attached document.
(We add the additional logic at 2 places:
1. After the selection screen fields, we create a new input fields for email address
2. Instead of alv output creation, we add the logic to create the email and send as xls attachment)
Step 4. Activate the program
Step 5. Test the program
You can test it by running transaction ZWF_ERROR_NOTIF. The selection screen is the same as SWIA with the addition of the email address input:
The output will be an email generated with all the workitems in ERROR.
Step 6. Setup a job for the program.
SM37: Create a new job for daily run.
The workflows in ERROR will be automatically notified to the relevant persons, and manual monitoring is no longer required.
Thanks for sharing this document.
But a workflow administrator should be checking SWI2_DIAG anyway (hopefully on a daily basis), so why would you need this development?
What was the actual business case for this custom report..? I'm curious.
Due to manual error where daily monitoring would not happen as expected, once the form is landing in ERROR status, it's losing the visibility. We have the risk of over payments for the terminated employees as well.
To automate the monitoring and sending of email to external mail ids, this is the work around.
Meets my requirement perfectly. Any idea where I can find the attachment?