Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
kenichi_unnai
Advisor
Advisor

Hi everyone,


 


Attention please...


 


Push Notifications. It's everywhere in our daily mobile apps. If the pushed information is relevant and interesting, it provides up-to-date relevant information to users, encouraging engagement, sparking recognition and increasing involvement. The messages are simple, uncomplicated. They contain only the essential information, making them user friendly and effective.


 


No doubt it applies to the case of SAP's mobile portfolio - The ability of "Business Events to Push Notifications" is one of the major value proposition.


 


The question is how to implement it with minimum effort and time, as the push implementation is all about connecting dots. You need to go through all the creation of apps and server config, and making sure if each dot is connected properly. The goal of these H2G series is to cover all the practical aspects so that many of the readers can implement it without spending hours (or days) of try & error.



 


Applicable Releases


 


SAP HANA Cloud Platform Mobile Services (HCPms)


SAP Gateway SP4+


 

 

How It Works


 


Let's have a look at how it works from the end user perspective. Assuming all the configs are properly done and the device is happily on-boarded to HCPms.


 


As you see in the diagram, it is the very typical landscape - the HCPms and Push Providers are located in the internet while all the SAP specific systems are protected by the firewall.




1. The device registers with Push Provider. Each Push Provider shall provide the notification token.

 



2. The device tells HCPms the notification token, which was provided by each Push Provider. HCPms adds and stores the token in the existing user on-boarding information. Now HCPms knows how to talk to each Push Provider when it needs to send the message to your device.



3. The device "subscribes" to business event. Technically it subscribes the OData collection with which you want to get notified when Create/Update/Delete occurs. The subscription itself is also done via OData. Once the subscription step is done, the ERP Backend keeps track of which application connection ID (of HCPms) subscribes which OData collections.



4. Now the time to push. If any of the business event happens (most likely the OData collections subscribed has changed), the ABAP code looks up the table so that it prepares which subscribers the push is relevant for, and it triggers the notification via SAP Gateway Hub to HCPms by HTTP POST. As SAP Gateway knows the firewall proxy config, it doesn't use the HANA Cloud Connector during this step. The message goes through Push Providers via HCPms.



That's all. It's that simple and powerful - but the question is how exactly we implement all the things. In the next section, we'll go through in details.

 

 

Steps to Implement


 


Let's implement from a scratch. How do we create each dot and wire them all? The first step is -


 


1. Implement your mobile app so it will work with Push Providers. This requires each platform specific SDK/documentation and Push Provider setup. Each Push Provider offers fairly matured documentation and sample codes. Not to mention, iOS is for APNS, Android for CGM, and Windows Mobile for WNS. These are all generic (3rd party) push implementation.




> Implementation Details

 

2. Once your platform specific push implementation is done correctly, time to get in the HCPms specific part. Configure the app setting on HCPms so that it will work with Push Provider for each mobile application (identified by the app ID) with HCPms.



> Implementation Details

 

3. Add small code in your app so that the app can add push registration information (or token) to HCPms. Technically it is the code to add your push token to the existing user on-boarding info in HCPms. By using this token, HCPms can relate the application connection id to the platform specific push receiver identifier. Once it is done, you can test the push message via HCPms to see if the message correctly reaches to your device.



> Implementation Details

 

> Test the landscape

 

4. Time to work on SAP components, which sit behind the firewall. Deploy and configure HANA Cloud Connector so that HCPms can talk to SAP Gateway Hub system over the firewall.



> Implementation Details

 

5. Working with SAP Gateway Hub. Major to-do thing here is to configure the bgRFC (Background RFC) to create a queue for push messages. If you don't need ERP backend access, you can implement OData services in the Hub system. The OData service must be implemented as "subscribable".



> Implementation Details

 

> Run the Test Report

 

> Tips & Tricks - Implementing Subscribable OData services & Notification API in ABAP

 

6. If you need ERP backend access for push content (such as SAP Business Workflow), wire the SAP Gateway Hub and its ERP backend. The configuration of bgRFC is required here too for queuing the push messages. Write some ABAP code to trigger the push.



> Implementation Details

 

> Tips & Tricks - Implementing Subscribable OData services & Notification API in ABAP

 

 

 

That wraps up the implementation, entire landscape is ready to subscribe & notify. Hope this H2G helps you to take a full advantage of push notifications with SAP Mobility Platform.

 

 

- Happy Notifications!!!


 

 

 

 

 

 

 

 

6 Comments