Today in this blog post, we will have a deep dive to understand how system uses email templates and how email is triggered by flexible workflow. There are many beautiful blog post available today on email template on flexible workflow, but the information on how system uses these template to trigger email is missing. So, we will discuss the same in this blog post.
Knowledge of Flexible workflow and email template in Flexible Workflow is required. We won’t be discussing how flexible workflow works and how email template can be maintained to trigger email for flexible workflow. There are already so many beautiful blog post are available. Some of the links are given below. If you have not gone through the concept of flexible workflow and email template, then it is recommended to have a look into below links first then continuing this blog post
- SAP Flexible Workflow Custom Scenario development with My Inbox Integration
- Flexible workflow for purchase order
- Flexible Workflow in SAP S/4HANA Sales Scenarios
- The email template for Flexible Workflow is maintained using Fiori App “Maintain Email Template”.
- The name of the email template should follow the below naming convension
- YY1_<Scenario_ID>_CRT_<StepID> / YY1_<Scenario_ID>_CRT_ALL: Email template to be used when workitem is created
- YY1_<Scenario_ID>_COMPLETE_POSITIVE: Email template to be used when workflow is approved (Point to note: It will be triggered when the workflow is approved, and not the workitem)
- YY1_<Scenario_ID>_COMPLETE_NEGATIVE: Email template to be used when workflow is rejected(Point to note: It will be triggered when the workflow is rejected)
|SMTG_TMPL_HDR||Email Template Header|
|SMTG_TMPL_HDR_T||Email Template Name and Description|
(Email template defined in Maintain Email Template Fiori App)
(Email template stored in Table)
Point to note: We can see the table is a cross client table, so no need to transport the email template across client.
Now that email template has been maintained using the Fiori apps, various event like work item creation, workflow approval and rejection, system check for the respective template associated with the workflow and creates an entry in the table “SWW_WIREGISTER” on the respective event(WI Creation, Approval and rejection) if email template is maintain for those events.
Let’s have a look into table entry to have an idea how it’s looks.
(Registration of a Work Item)
We can notice