转 Starting Workflow from Messages
Trigger Workflow from Messages
By Suresh Kumar Parvathaneni from Link
This document details about the procedure in triggering the workflows from a message (For e.g., error or warning message).
For our demo purpose, let us consider the transaction ME21 (Create Purchase Order). Without entering any values on the screen, press ENTER. You would get the error message “Enter Purchasing Org.” (as shown below)
Now double-click on the message, to get the long text and the message details.
Now click on the technical information.
The above screenshot provides us with the message details (Message Class: ME) and Message Number 083.
Now we need to create a workflow which needs to be triggered from this message.
Go to transaction SWUY. Following wizard appears.
Click on “Continue”.
Enter the message details, as obtained earlier. Click on “Continue”.
Click on “Complete” again. Pop-up screen regarding the package (Development class) appears. Assign the package, you would like to have. Press ENTER. You would be automatically navigated to the “Workflow Template” screen shown below:
Enter the Work item text and click on “Workflow Builder”. We are now in the “Workflow Builder” screen.
For our demo purpose, let’s create a simple email step in our workflow definition. (To know about how to include an email step in the Workflow definition, click here)
Activate the Workflow definition.
Testing the application
Go to transaction ME21.
Without entering any values, press ENTER. The error message “Enter Purchasing Org.” appears. Double-click on the message and the long text appears. See the screenshot below.
As highlighted in the screenshot above, the button “Workflow” is now enabled (before attaching a workflow definition to this message, this button was disabled”. Click on the button “Workflow”. The workflow definition created earlier, in this case WS99900061, is now triggered. See the screenshot below.