Monday 24 January 2022

How to Set Up the Email Notification for Flexible Workflow in SAP S/4HANA Cloud

Background

SAP has provided a Standard Solution to notify the users about new work items generated by flexible workflow and displayed in the ‘My Inbox’ app.

Introduction

The default notification in SAP S/4HANA Cloud is through alerts that are displayed in the SAP Fiori Launchpad, but it is also possible to configure the system to notify users via email about new work items in their inbox.

Moreover, it is possible to configure the system to send notification for approval or rejection of requests.

In this blog the steps to set up the email notification for the Release of credit memo request will be shown.

Pre-requisites

◉ The Flexible workflow has been already configured (not covered in this blog)

◉ Sender email address must be setup in the system.

How to set up the email notification

For the setup of the email notification and customising of the email workflow messages, we will use the “Maintain Email Templates” app:

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig. 1 Maintain Email Template

From the pre-delivered tab, search for the ‘SWF_CRT_NOTIFIY_RECIPIENTS’ email template (Fig. 2):

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig.2 Pre-delivered email templates

Create a copy of the template following the pattern specified in the standard email description <YY1>_<Scenario_id>_CRT_ALL or <YY1>_<Scenario_id>_CRT_<ACTIVITY_NODEID>.

For the notification about the approval or rejection we will use the pre-delivered template SWF_WORKFLOW_COMPLETE_NOTIFY with the following pattern:

◉ <YY1>_<Scenario_id>_COMPLETE_POSITIVE
◉ <YY1>_<Scenario_id>_COMPLETE_NEGATIVE

The scenario ID is the WS number linked to the flexible workflow. It can be found in the app “Manage Workflow Scenario”(Fig.3):

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig. 3 Workflow scenario ID for Credit Memo Requests

This info is provided also by the standard cds view I_WorkflowScenarioDefText:

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig.4 Scenario ID

Alternatively, we can access to the ‘Support Information” option of a selected work item in the ‘My Inbox” app:

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills

Examples:

◉ For the overall release of regular purchase requisitions, the scenario ID is 02000458 and the activity node ID is 19, so we will use YY1_02000458_CRT_19.

◉ For the item-level release of regular purchase requisitions, the scenario ID is 02000471 and the activity node ID is 20, so we will use YY1_02000471_CRT_20.

◉ For the Credit Memo the scenario ID is 02000029, so we will use YY1_02000029_CRT_ALL.
 
The copy of the email template for the Credit Memo Request will look like the following (Fig.5).

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig.5 Credit Memo Request email template

The following are the available fields that can be used to pass the values in the email subject and body:

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills

We can customise the email subject and the body. In our case, we also added the URL to navigate to the work item. The receiver will click on the link that will open the related work item directly in the ‘My Inbox’ app (Fig. 6 ):

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig. 6 Custom email template body

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig. 7 Email sent with the link to work item

Configure the default system email address


As prerequisite to be able to send email notifications, the sender email address must be setup in the system.

Via Manager your Solution -> Application Platform and Infrastructure -> Output Management -> System Administration -> Define Default Email Sender Address

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig. 8 Define Default Email Sender Address via Manager Solution

In CBC, go to “Define Default Email Sender Address’:

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills

SAP S/4HANA Cloud, SAP ABAP Career, SAP ABAP Tutorial and Materials, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Skills
Fig. 8 Define Default Email Sender Address via CBC

No comments:

Post a Comment