Skip to Content

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

    1. Create a program ZR_MGW_PUSHDEMO_TEST which will be using the Gateway APIs for pushing data. You can find the sample code here.Program.JPG
    2. 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. Capture.JPG

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.

    1. 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.
    2. Maintain SAP NetWeaver Gateway Connections Settings in the IMG structure shown below.Capture.JPGCapture.JPG  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)
    3. 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.Capture.JPGCapture.JPG

          All Done!!! ๐Ÿ™‚ Now you can test the Notification Push by trying to create a user from SU01.

            Capture.JPG

          In case everything is fine, you must receive a notification XML as shown below:

                XML Notif.jpg

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     Related Information

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     Create a Subscription-Enabled OData Service

To report this post you need to login first.

46 Comments

You must be Logged on to comment or reply to a post.

  1. Carlos Roggan

    Thanks again, Anirvan, for the continuation for the topic, which I find very helpful and interesting as well.

    Hope there will be many more blogs coming from your side in future ๐Ÿ™‚

    Cheers,

    Carlos

    (0) 
  2. Former Member

    Hi,

    I am not able to establish ‘HTTP Connection to External Server’.

    I used my system IP address for Target host field.

    Can you suggest what i ‘d have missed, if any?

    Regards,

    Rajender

    (0) 
    1. Former Member Post author

      Hi Rajender,

      You have to provide your system IP address and the port number(e.g. 8000) in the respective fields while creating the RFC destination of type ‘G’.

      Also, before testing the connection, you have to make sure that the TCP monitor application(HTTP listener) is switched on and it must be listening to the appropriate port of your machine. If it is not switched on, you will get an error ICM_HTTP_CONNECTION_FAILED while trying to test the connectivity.

      Just in case you don’t have any HTTP listener application in your system, you will have to download one from the internet.

      Thanks,

      Anirvan.

      (0) 
      1. Former Member

        Hi Anirvan,

        Thank you very much for your helpful suggestions. i have successfully built the HTTP connection to external server for which i had to provide proxy details with system IP address and port number.

        Thanks & Regards

        Rajender Yadav

        (0) 
              1. Aakash Raj

                Hi Ramana,

                You need to create a simple service proxy and set the port, IP is automatically taken as local host. Please check its documentation available in the same link.

                Best regards,

                Aakash

                (0) 
                1. Former Member

                  Hi,

                  I am using membrane to test the notification. anyhow RFC type ‘G’ (HTTP Connection to External Serv) is giving error while testing thru SM59..

                  ERROR –  ICM_HTTP_CONNECTION_REFUSED

                  I have created RFC – with my system ID address and port # 8000.

                  Following error in SMICM:

                  *** WARNING => Connect to <desktop IP Address>:8000 failed: NIECONN_REFUSED(-10) {00058d0f} [icxxconn.c 2156]

                  I have created proxy – for local host and port 8000.

                  Please assist..

                  Regards,

                  Rajesh

                  (0) 
                  1. Syam Babu

                    Hi Rajesh,

                    I am also facing the simliar issue when i am using membrane..If you know the solution can you please post here.

                    Thanks,

                    Syam

                    (0) 
  3. Former Member

    Hi Anirvan,

    great job on this, I am debugging the ZR_MGW_PUSHDEMO_TEST program and it seems that I have no entires in the table /iwbep/d_mgw_sub.

    What step did I miss to put them into the table? Is it entered through SPRO?

    thanks

    Keith

    (0) 
      1. Former Member

        Hi Anirvan,

        You know what that appears to be the issue… I am working through some authorzation issues at the moment but once those are resolved I should be good to go.

        thanks for your help.

        Keith

        (0) 
  4. Former Member

    Hi Anivan \ Aakash,

    In the program ZR_MGW_PUSHDEMO_TEST when it calls “call_remote_destination” since my rfc is setup for an http connrection rfc destination type = ‘G’ the destination gets set to ‘IWBEP_ODATA_OD_PUSH’ when a call getrs made to

    lo_destination = cl_bgrfc_destination_outbound=>create( lv_destination ).

    an exeception is thrown of ‘CX_BGRFC_INVALID_DESTINATION’

    I can run the http connection successfully from SM59, however it appears it does work with the IWBEP_ODATA_OD_PUSH?

    thanks

    (0) 
    1. Former Member

      Hello Keith,

      Please note that the RFC connection type must be ‘3’ on the backend system. In the step 2 of the blog, the RFC destination DEVCLNT100_BGRFC is in the backend and it is of type 3. This RFC destination has to be configured to connect to the Gateway Hub system and should be able to run bgRFC units. Please go through the configurations mentioned in step 1.

      If the RFC connection in the backend system is of type ‘G’, it tries to connect to a cloud-based Gateway Hub which is not the case in this blog.

      The RFC destination TEST_CONNECTION is in the Gateway Hub system from where it is pushed to the delivery address. This RFC destination must be of type ‘G’ as it connects to external HTTP applications.

      Hope this helps.

      Regards,

      Anirvan.

      (0) 
      1. Former Member

        Arivan,

        Thanks for the reply, we werwe able to correct the issue. The was with ‘IWBEP_ODATA_OD_PUSH’ not being setup correctly.

        This is all working now, thanks for posting this.

        (0) 
        1. Former Member

          Thanks Aakash/Keith,

          I am able to proceed further , but with similar issue Keith is facing

          lo_destination = cl_bgrfc_destination_outbound=>create( lv_destination ).

          an exeception is thrown of ‘CX_BGRFC_INVALID_DESTINATION’ for IWBEP_ODATA_OD_PUSH

          Keith,

          Can you please let me know what was the issue and how did you get through it?

          Thanks inadvance

          Sandeep


          (0) 
        2. Former Member

          Hello Keith,

          Can you please help me how did you get the issue related to IWBEP_ODATA_OD_PUSH resolve as we are also facing the same issue of

          CX_BGRFC_INVALID_DESTINATION

          thanks in advance for your help.

          Sandeep

          (0) 
            1. Former Member

              Thanks Keith,

              when we do connection test on the G type RFC, it comes back with 405 method not allowed.

              while i request BASIS to check the GW_RFC, we are trying to push some workflow notifications to mobile and is there anything else i need to care for?

              I will keep you posted once BASIS corrects the RFC .

              Any thoughts from your side would be of great help

              Thanks for your help

              Sandeep

              (0) 
  5. Syam Babu

    Hi Anirvan,

    Well written both Subscription and Notification Blog.

    I have one query,If our system landscape is Hub deployment it’s ok to create bgrfc and external rfc but if the landscape will be embedded deployment ,Can you please explain what are the steps need to do in embedded deployment.

    Thanks,

    Syam

    (0) 
  6. Ekansh Saxena

    Hi,

    Thanks for the blog.

    I have implemented the same and in my case the subscriber is a SICF service. For a single subscriber, it is working fine. When I added another subscriber(other SICF service), instead of pushing the notification to both the subscribers, the notifications is being pushed to only first subscriber but twice. Can you please help.

    And how this RFC destination TEST_CONNECTION is linked to the gateway service or config? Since in my case, there are 2 diff. RFC destinations(pointing to 2 different subscribers) but as told above, the notification is being pushed to only 1st destination twice.

    You can also find detailed version of this problem here.

    (0) 
      1. Former Member

        Hello, I tried with this HTTPTrace, but it never shows up any trace, can you help me how to get trace? I am posting my notification on delivery address like http://xyz.com:8080, what should be values for ListenPort,TunnelHost,TunnelPort? or any other way to get trace?

        (0) 
      1. Former Member

        Hi Ekansh,

        This header can be used to send any type of additional information related to the payload which cannot be sent through the Entity structure.

        Regards,

        Anirvan.

        (0) 
          1. Former Member

            Ekansh,

            Let’s consider a case similar to the above screenshot you posted. Let’s say, a new characteristic is added to a material in the backend ECC system. There might be a requirement to notify all the subscribers of this change. Hence, a notification is triggered from Gateway.

            Now, if there is a requirement to send email to additional external users to notify about this change, there are two ways of doing that. Either you maintain these external email IDs in the backend so that you trigger emails right away from the ECC system, OR you can send these email IDs through the JSON header(with the notification) so that the consumer takes care of sending these emails. As the number of email IDs can vary, its a greater effort to maintain it in the entity structure and pass it on in the payload. Again, that’s purely a design decision.

            Hope this answers your query.

            Regards,

            Anirvan.

            (0) 
  7. Former Member

    Hi all,

    I am working on an similar requirement of push notification. Just wanted to know how to receive notifications on mobile devices. In the example you used http listener. Are there any similar mechanism for receiving notifications on the mobile devices as well ?

    (0) 
    1. Former Member

      Hi Varun,

      You need to use a Mobility platform like SMP to be able to do that. SMP will receive the notification and route it to the subscriber(mobile device).

      Regards,

      Anirvan.

      (0) 
  8. Prabaharan Asokan

    Hi Anirvan,

    Thanks for giving us such a good blog. Wisely done. Couple of queries.

    1.If we want to push notifications to mobile devices ,is it possible to this service.

    2.when the user using the application is not online then will the notification sent automatically to the mobile device once they turn online ? Or this notification is missed.

    3.What is the underlying technology that is pushing messages from server to client ?

    Regards

    Prabaharan Asokan

    (0) 
  9. Olga Esipova

    Hi Anirvan,

    Thanks for such a valuable information. My question is. Is it possible to listen those notifications from our regular SAP UI5 application. I know that WEB sockets can be used for that but I am interested if it would be possible with OData push notification.
    Do you have any examples related to consumption of such notification from SAPUI5?

    Thanks in advance,

    Olga

    (0) 
    1. Karsten Schaser

      Hi all,

      I am also interested in a way how this kind of notifications can be consumed using a SAPUI5 application. Would be great, if anyone could give some hints…

      Thanks an best regards,

      Karsten

      (0) 
  10. Former Member

    Hi All,

    I am getting an error saying ‘No RFC destination found’. Not sure where I am missing.

    In my system, GW is installed in my ECC system it self.

    I mentioned my Service and collection details correctly.

    I configured my bGRFC destination correctly and mentioned in the settings.

    BgRFC config is also good.

    But I am getting error and my service is not shown in SBGRFCMON.

    Pls help.

    Thanks

    seenu

    (0) 
  11. Former Member

    Is it possible to send Notifications with a whole Entityset (means multiple records) as payload ?
    In the endpoint method I used an internal table as data parameter, but only one record is transfered.

    Thanks in advance
    marko

    (0) 

Leave a Reply