Skip to Content
Technical Articles
Author's profile photo Priyanka Sadana

Consumption of Notifications on SAP Fiori Launchpad from SAP Gateway Notification Channel

In this blog we will learn the following

  • Usage of Notifications
  • How to provide Notification from Notification Provider to Notification Hub
  • How to configure Notifications to appear in Notification Center
  • How SAP Fiori Launchpad can consume notifications from the SAP Gateway Notification channel.

Introduction

Notifications are an effective way to make users aware if a situation requires timely action or attention.

This could be a situation that requires an action like accepting or rejecting a scenario on high priority or it could be a task triggered by a workflow or it could be a medium priority information like informing about planned downtime.

How it works?

Users can access the notification by pressing on the bell icon in the shell bar at the top right of the screen. The area where notifications are shown in the Fiori Launchpad is Notification Center.

Notification Provider provides the notification content to the Notification Hub. Notification Hub collects and keeps the notifications to be shown in Notification Center.

The Notification list appears once the user clicks on the bell icon. The list displays various types of notifications, which can differ in terms of appearance, content and functionality.

By Date: Order By the timestamp, most recent appears on top.

By Type: Order By the type, this shows grouped notifications. This makes it easier for the user to handle a high volume of notifications. The user can act on all the notifications in a group at once.

The priority of the group is decided by the highest priority of notifications present in the group.

The timestamp of the group is based on the most recent notification in the group.

By Priority: Order By the priority, highest priority appears on top.

Pre-requisites

You would require S/4 HANA 1610 or above Fiori Frontend server in hub mode or S/4 HANA 1709 or above with Fiori Frontend server in embedded mode.

The Notification Center is part of Fiori Launchpad in Fiori 2.0 which means you must have Fiori Launchpad that supports Fiori 2.0.

SAP Net Weaver 7.51 version or above is required in case you are using on premise SAP Gateway.

Configurations

 

Notification Channel Hub Configuration

Go to SAP Reference IMG in the SAP Implementation Guide (IMG) in transaction SPRO under SAP Customizing Implementation Guide > SAP NetWeaver > Notification Channel

Go to Notification Channel Hub > Configuration > Connection Settings > Manage SAP System Aliases and execute this activity

Create an SAP system alias called LOCAL and set RFC destination to NONE

The notification provider needs to register its system alias with the notification hub, so that when a user selects a notification in the Notification Center knows which system to call.

Note:

  • For Embedded deployment, we need one system alias called LOCAL.
  • For Hub deployment, we need two system aliases, one is LOCAL and the other one is pointing to the backend system.

Publish the Notification OData service

Go to Notification Channel Hub > Configuration > Connection Settings > Publish the Notification Services and execute this activity

Publish the Notification channel service with ID /IWNGW/NOTIFICATION.

Choose Publish Service Groups.

Under System Alias enter LOCAL and choose /IWNGW/NOTIFICATION in Service Group ID.

Choose Get Service Groups,

Select the /IWNGW/NOTIFICATION Group ID and choose Publish Service Groups.

Click on save.

Test the newly created OData service

/IWNGW/NOTIFICATION_SRV

  • Open Service Groups folder
  • Open “/IWNGW/NOTIFICATION” folder
  • Open “LOCAL” folder
  • Open “Available Services”
  • Select OData Service /IWNGW/NOTIFICATION_SRV
  • Click “Service Test” button to test the service

Execute

Notification Channel Provider Enablement Configuration

We will do this configuration once we create a provider class.

Conceptual Understanding & Implementation

Standard interface /IWNGW/IF_NOTIF_PROVIDER or /IWNGW/IF_NOTIF_PROVIDER_EXT (extended with email functionality) must be implemented to generate notification. Create a provider class and implement methods of this interface. Each Notification Provider has its own id. This id is used for all the interactions within the Notification channel.

Each notification is assigned a type which is called as Notification Type. For example, Downtime could be a Notification Type and all the notifications with same notification type comes under one umbrella.

Methods to be implemented:

GET_NOTIFICATION_TYPE

This method is used to return the metadata of the notification type. There can be n number of notification types.

GET_NOTIFICATION_TYPE_TEXT

This method is used to return language-based text for each notification type.

        et_type_text = VALUE #( ( name = /iwngw/if_notif_provider_ext=>gc_template_names-description
                                  value = 'Execution of transfer document {tdoc_no} was finished' )
                                ( name = /iwngw/if_notif_provider_ext=>gc_template_names-subtitle
                                  value = 'Transfer was executed finished, click to check the detail - {count}' )
                                ( name = /iwngw/if_notif_provider_ext=>gc_template_names-template_grouped
                                  value = 'TDoc execution was finished' )
                                ( name = /iwngw/if_notif_provider_ext=>gc_template_names-template_public
                                  value = 'TDoc execution was finished' )
                                ( name = /iwngw/if_notif_provider_ext=>gc_template_names-template_sensitive
                                  value = 'Execution of transfer document {tdoc_no} was finished with error' ) ).

In this method itself you can define the text to be displayed as the Group heading in the By Type view.

Subtitle can be used to define the subtitle of the notification.

GET_NOTIFICATION_PARAMETERS

This method is used to return the dynamically filled parameters for each notification instance which can be combined with text in GET_NOTIFICATION_TYPE_TEXT method. For example, in the above code you can find two parameters {tdoc_no} and {count}.

These parameters are passed from CREATE_NOTIFICATION method which you will learn later in this blog.

HANDLE_ACTION

This method is used to trigger actions.

Let’s do Notification Channel Provider Enablement Configuration

Go to SAP Implementation Guide > Guide > SAP NetWeaver > Notification Channel > Notification Channel Provider Enablement > Administration > Notification Provider Settings > Register Notification Providers

 

Register the Notification provider class and enter a Notification ID which will be used to refer the Notification that will be generated via this provider class

Activate the Notification Provider

Go to SAP Implementation Guide > Guide > SAP NetWeaver > Notification Channel > Notification Channel Provider Enablement > Administration > Notification Provider Settings > Manage Notification Providers

Class /IWNGW/CL_NOTIFICATION_API is the Notification provider path to the Notification Gateway.

Method CREATE_NOTIFICATIONS from this class should be called with parameter Notification Provider ID, this ID would help to determine the Provider Class that corresponds to this ID which was maintained in SPRO configuration while registering the provider class. This would further call the methods of the provider class.

/iwngw/cl_notification_api=>create_notifications(
          EXPORTING
            iv_provider_id  = lc_provider_id
            it_notification = VALUE #( ( id = lv_id
                                       type_key = ls_entities-Title
                                       type_version = '01'
                                       priority = ls_entities-Priority
                                       recipients = lt_receipents
                                       parameters = VALUE #(   language = sy-langu
                                                              ( parameters = VALUE #( ( name = 'tdoc_no' value = ls_entities-Notification type = ls_entities-Title is_sensitive = abap_false ) ) )
                                                            )
                                        ) ) ).

In the above method, lc_provider_id is the ID that you registered while enabling Notification Channel Provider.

Summarizing the flow:

Enable Notification Center in the Fiori Launchpad

Manage System Alias

Publish the OData service group /IWNGW/NOTIFICATION

Create a class using interface /IWNGW/IF_NOTIF_PROVIDER_EXT and implement its methods as per the requirement.

Register this class and create a notification provider ID that corresponds to this class.

Call method CREATE_NOTIFICATIONS of class /IWNGW/CL_NOTIFICATION_API with the registered Notification Provider ID.

 

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Santiago Garcia
      Santiago Garcia

      Very nice! Thanks for sharing!

      Author's profile photo Cheating Raider
      Cheating Raider

      Great article. Very well explained. Thanks for the share. dqfansurvey

      Author's profile photo Gurpreet Singh Jaspal
      Gurpreet Singh Jaspal

      This is exactly what i was looking for... very well explained and thanks for sharing it.

      Author's profile photo Akop Elbakyan
      Akop Elbakyan

      Thank you for this post, Priyanka. It helped me to answer my customer question.