Now that you are here reading this blog, we assume that you already know how to Create a Subscription-Enabled OData Service.
Before we take a deep dive into the exact steps of pushing Notifications, let’s get the basics right.
- To receive Notifications, one has to subscribe first.
- An application on the SAP backend must trigger the push. Gateway provides APIs to create this application easily.
- The notifications can be received by an online HTTP Destination/Server.
Creating a Notification Push Application
The whole procedure involves some development activities and some configurations.
Step 1 — Developing a Notification Push Application
- Create a program ZR_MGW_PUSHDEMO_TEST which will be using the Gateway APIs for pushing data. You can find the sample code here.
- Identify the triggering mechanism for this program. There can be multiple ways of doing this, e.g. BAdI Implementations, Scheduled Jobs, etc. For our Business scenario, we’ll identify a BAdI implementation which will trigger the Push Application. When someone tries to create a SAP User using the transaction SU01, the are some enhancement spots which are triggered. One of the BAdI definitions is ADDRESS_UPDATE, in which we will plug in the code to call the push application whenever a user is created. For this, the method IF_EX_ADDRESS_UPDATE~ADDRESS3_SAVED must be implemented. You can copy the code from here.
Step 2 : Configuring RFC Destinations for Pushing Notifications
Please note that these configurations have to be done just once for a system. So, the next time you write a Push application, these configurations are already in place.
- Configure bgRFC destinations for asynchronous processing of Notifications. These configurations steps have been mentioned in the documentation links : Maintaining Outbound bgRFC Queue from SAP Backend System to the Hub System and Maintaining Inbound bgRFC Queue on the Hub System. Please note that these settings must be done by the system administrator, as there are certain special authorizations required. For details refer to Configure the bgRFC Supervisor Destination.
- Maintain SAP NetWeaver Gateway Connections Settings in the IMG structure shown below. These fields must have the appropriate system details. For example, Destination system – DEV, Client – 100, RFC Destination – DEVCLNT100_BGRFC(This must be the same RFC destination that was created in the previous step)
- In the Gateway Hub system, go to transaction SM59 and create a RFC Destination of type “G“(HTTP Connection to External Server). Please note that an appropriate IP address must be used in this destination, which points to the same deliveryAddress which was used while creating the subscription. Also, make sure that the HTTP listener application is switched on and listening to the IP address. Once done, run a connection test which must be a success.
All Done!!! 🙂 Now you can test the Notification Push by trying to create a user from SU01.
In case everything is fine, you must receive a notification XML as shown below: