SAP Workflow transaction SWEC to Trigger workflow on change document
Trigger workflow on change document using SWEC
This transaction allows you to trigger a workflow when change documents are created. These are entries written to tables for certain areas/tables by standard SAP transaction to record any changes made to the data.
Step 1 – Create new change document event
Execute transaction SWEC and press the ‘New Entries’ button.
Step 2 – Enter details
Enter required details including:
• Change document object – Name of change document you want to assign your workflow trigger too
• Object category – Type of object that gets triggered
• Object type – Name of business object to be used
• Event – Which event to call
Also select when you want the event to be triggered (create, change or delete) and press SAVE.
Step 3 – Select field workflow is to be triggered on
Now you need to double click on the ‘Field Restrictions’ option in the left tree menu
Now click New Entries and enter a table and field you want to check for. I.e. when this is the field is changed your workflow event will be triggered. You also need to enter an old and new value, so if you want to see when the field changes from one specific value to another i.e. MATKL changes from AA to BB enter these values here. Otherwise if you want to capture all changes enter * in both fields. Remember you can then set a restrict of when this should be triggered within the workflow you create.
Step 4 – Save
Now press save and back out until you return to initial screen. This is now setup and whenever that field is changed the event you have specified will be triggered so you can now go to SWDD and setup a workflow for this event.
The above example calls a standard event but in reality you would probably create a new event and call this. See transaction SWO1 for info on how to add a new event to an existing business object.