Triggering Notification to SAP Fiori
Introduction
Notifications are a great way to make users aware of the situation that require timely action or attention. This could be an information of an event/action which just occurred or could be a workflow task which requires immediate attention. One of the most awaited features of Fiori 2.0 is the Notification center. This was initially introduced as part of S4HANA 1610 release.
This document explains how to enable the Notification Center, explains some general principles, and shows how to configure Workflow Notifications to appear in the Notification Center – SAP Business Workflow being the first Notification Provider released with S/4HANA 1610.
Assumptions:
- We will assume that we are running S/4HANA 1610 with Fiori Frontend Server in Hub mode – which is the default recommendation for S/4HANA as explained in the SAP Enterprise Architecture Explorer > Landscape Deployment Options for Fiori Frontend Server > Landscape Scenario IV (FES and S/4HANA)
- We will assume that Fiori My Inbox is already activated including any Task-Specific extensions. Note: We need this because when we click on a notification we want it to take us to the matching task in Fiori My Inbox
Notification Concepts:
There are only a few concepts to be understood when activating notifications. These are:
- Notification Center – the area where notifications are shown in the Fiori Launchpad
- Notification Hub – It collects notifications that are to be shown in the Notification Center
- Notification Provider – It provides the content related to notification to the Notification Hub
To enable notifications, we need to:
- Enabling the Notification Center in the Fiori Launchpad
- Activation of the Notification Hub, i.e. the SAP Gateway Notification Channel
- Activation of the notifications from a Notification Provider
Prerequisites for Notification Center
The Notification Center is part of the Fiori Launchpad in Fiori 2.0.
This means you must have Fiori Launchpad that supports Fiori 2.0, such as Fiori Frontend Server 3.0. Note: Fiori Frontend Server 3.0 is required for S/4HANA 1610 and not available for S/4HANA 1511.
If you are using an on premise SAP Gateway, you must be on SAP Net Weaver version 7.51.
The SAP Gateway provides:
- Fiori Launchpad
- Notification Hub
You also need a Notification Provider. For example, the S/4HANA 1610 Core system acts as a Notification Provider, e.g. for SAP Business Workflow Notifications
Enabling the Notification Center in the Fiori Launchpad
The snippet that contains the parameters for Notifications looks like this.
“Notifications”: {
Fill the properties as
Enabled: true,
ServiceUrl:
WebsocketUrl:
}
Configuration for Notification Channel Hub
- The activities needs to be performed in transaction SPRO under SAP Customizing Implementation Guide-> SAP Net Weaver-> Notification Channel -> Notification Channel Hub.
In the IMG navigate to Configuration-> Connection Settings ->Manage SAP System Aliases and execute the activity.
If a LOCAL system alias with RFC destination set to NONE does not exist, then create a SAP system alias called LOCAL, and set RFC destination to NONE.
- Publish the Notification Channel OData service
In the IMG navigate to Configuration-> Connection Settings -> Publish the Notification OData Service and execute the activity.
If the Notification Channel service with ID /IWNGW/NOTIFICATION does not exist, publish it.
To publish the services, follow below steps:
- SelectPublish Services
- UnderSystem Alias enter LOCAL and choose Get Services
- Select the/IWNGW/NOTIFICATION service and choose Publish Services
Notification Provider Interface
Interface /IWNGW/IF_NOTIF_PROVIDER (Standard class) is the notification provider interface and it must be implemented before creating any notifications. Each provider has their own IDs, which is used for all interactions with the Notification Channel.
Methods:
- GET_NOTIFICATION_TYPE
This method returns metadata related to the notification type. Notification provider supports more than one notification types and also there can be multiple versions of a single notification type. The version needs to be a whole number. In case it is alphanumeric, the latest version is determined using SORT tab statement.
This TYPE_KEY we have to pass in our program as well, so that it can check for the respective type_key and trigger the particular notification.
- GET_NOTIFICATION_TYPE_TEXT
This method should return language dependent text related to the notification type, including text templates (e.g. “PR{PR_Number} send to buyer {Buyer}) and action texts (e.g. “Approve”).
- GET_NOTIFICATION_PARAMETERS
This method should return notification instance specific parameters (e.g. Buyer, Pr_Number). These parameters are combined with text templates (text message) to form the text of a notification.
- HANDLE_ACTION
End users can trigger actions, as defined in GET_NOTIFICATION_TYPE. The notification provider must handle those actions using this callback method.
Note: Register and activate the provider class under transaction SPRO.
Goto SAP Implementation Guide ->SAP Web Application Server ->Notification Channel->Notification Channel Provider Enablement -> Administration ->Notification Provider Settings – >Register Notification Settings
Activating the Provider class:
Goto SAP Implementation Guide ->SAP Web Application Server ->Notification Channel->Notification Channel Provider Enablement -> Administration ->Notification Provider Settings – >Activate Notification Settings
Fiori Screen with Notifications:
On clicking on the notification counts, you may see the whole notification message which is grouped by three categories: BY DATE, BY TYPE AND BY PRORITY
Template sensitive – By Date Template public – By Type Template Grouped – By Priority
Clearing Metadata Cache and Deleting Notifications:
During the period of provider class development there might be the scenario to get rid of some notifications which have been already there from a long time. For example: if you are adding a new functionality to a notification provider class which haven’t been there before. Then the existing notification won’t reflect this change nor will it be reflected on newly created notification. The notification channel has a caching mechanism for those kind of metadata.
- Transaction /IWNGW/H_CLEAR_NOTIFallows you to delete certain notifications by specifying a user name and a “Less than” created-at-date option. And as an additional option you can also use the Wipe Allfunction, which will wipe all notifications for all user and all metadata.
- Go to SPRO->SAP implementation guide->SAP web application server->Notification channel Hub->Administration->General settings->Clean up metadata and cache
References:
- https://help.sap.com/viewer/68bf513362174d54b58cddec28794093/7.51.1/en-US/d1fd9dcaaece44ceaa71967e91d3a51b.html
- https://blogs.sap.com/2017/02/13/leading-s4hana-ux-notification-center-part-1-activation/
- https://blogs.sap.com/2017/02/14/leading-s4hana-ux-notification-center-part-2-providing-notifications/
New NetWeaver Information at SAP.com
Very Helpfull