As you know, nowadays most of the popular applications we are using are based on the real time notification as a main service. Real time update is the demand of the hour and every organization is moving in this direction to be ahead in the competition.
Real Time Notifications provide the end users and stake holders the latest up-to-date information about application data and state, without having the need to use the refresh button to get the updated data from the backend system.
In this article, we would learn how to create our first Real Time Client Server Communication using ABAP Push Channel (APC) and ABAP Messaging Channel (AMC). We would show you all the required components of this architecture and you can implement a working example using the step by step process.
[docxpresso file=”https://sapyard.com/wp-content/uploads/2019/01/Push-Notification-in-SAP.odt”]
We hope, you know how to create a simple OData Service and redefine the method USERSET_GET_ENTITYSET.
If you are new to OData, please take this Free End to End Video Training on SAP OData and Netweaver Gateway.
method USERSET_GET_ENTITYSET.
data ls_user type zuser.
data lt_user type TABLE OF zuser.
select * from ZUSER into CORRESPONDING FIELDS OF TABLE LT_USER.
MOVE-CORRESPONDING LT_USER TO ET_ENTITYSET.
endmethod.
Also Check – How to Create your First OData Service
Please find attached the SAPUI5 Application. You can upload it and play around with it.
If you do all the steps mentioned above, you should be successful in creating your first Push Notification using SAP ABAP. Just like the one we created below.
SAP is innovating fast and we have lots of areas to catch up. If you have done anything interesting, which you want to share, please email us at mail@sapyard.com.
If you have any issue developing this Push Notification, do write your queries in the comments section and we would try our best to answer.
We have a very active Telegram (App) SAP Technical Group with more than 3650+ SAP Technical Practitioners from 6 Continents of the SAP World. Please join it using below link.
Telegram SAP Technical Discuss Group. You need to install the Telegram App first on your mobile device. Once you have it on your mobile, you can join the group and also access it from the Web on your computer and laptop.
Authors: Fares Letaief & Ramzi Abdallah
Free SAP ABAP for HANA Training Tutorials Exercises:
- ABAP on SAP HANA. Part I. First Program in ABAP HANA
- ABAP on SAP HANA. Part II. ADT Eclipse and HANA Studio
- ABAP on SAP HANA. Part III. Debugging in ADT
- CDS Part 1. Core Data Services – Introduction
- CDS Part 2. Core Data Services – Deep Dive
- ABAP on SAP HANA. Part VI. New Age Open SQL ABAP 740
- ABAP on SAP HANA. Part VII. SQL Script and SAP HANA Stored Procedure
- ABAP on SAP HANA. Part VIII. ADBC – ABAP DataBase Connectivity
- ABAP on SAP HANA. Part IX. AMDP – ABAP Managed Database Procedure
- ABAP on SAP HANA. Part X. AMDP with SELECT OPTIONS
- ABAP on SAP HANA. Part XI. Are Native SQL and Open SQL Competitors?
- ABAP on SAP HANA. Part XII. Open SQL, CDS or AMDP, which Code to Data Technique to use?
- ABAP on SAP HANA. Part XIII. Sample Functional Specification of HANA Project
- ABAP on SAP HANA: Part XIV. HANA Ready, HANA-tization & HANA Plus
- CDS Part 3. Expose CDS Views as OData Service through Annotation
- ABAP on SAP HANA: Part XVI. HANAtization
- ABAP on SAP HANA: Part XVII. ATC – ABAP Test Cockpit Setup & Exemption Process
- SAP ABAP on HANA: Part XVIII. SALV IDA (Integrated Data Access)
- ABAP for SAP HANA. Part XIX. Sample Technical Specification of HANA Project
- ABAP for SAP HANA. Part XX. ALV Report On SAP HANA – Opportunities And Challenges
- 4 Useful Tips on ABAP and ABAP on HANA
- Associations in HANA – A Conceptual Approach
- CDS Part 5. ABAP CDS Views With Authorization
- ABAP for SAP HANA. Part XXII. How to Consume Native HANA Views Using ADBC?
- CDS Part 6. Basic Expressions & Operations Available for CDS View – I
- 115 ABAP for SAP HANA Interview Questions & Answers
- CDS Part 7. Basic Expressions & Operations Available for CDS View – II
- CDS Part 8. Usage of Built-In Functions in CDS – I
- CDS Part 9. Usage of Built-In Functions in CDS – II
- CDS Part 10. Usage of Built-In Functions in CDS – III











I implemented and the UI5 app is showing the records only after pushing refresh, I’m having trouble with the push. In your example you say to redefine the IF_APC_WSP_EXT_PCP~ON_MESSAGE method but I don’t see in the example what code it should it be refined to? I’m so close but yet so far away lol can you help point me in a direction to better trouble shoot.
It is useless if you don’t explain “WHY” “WHAT” before “HOW”. People are here to understand the concepts and real time examples in depth, not to copy paste the code.
Hi Ramzi,
Can we use ABAP push channel to send Notification to Middleware like Software AG.
If so how to establish communication between SAP and Middle ware
Regards
Deepthi
Hi Ramzi,
Thanks for your effort. Very useful tutorial.
I did all these steps but I get this error in my SAPUI5 application.
WebSocket connection to ‘wss://webidetesting****-fiori.dispatcher.int.sap.eu2.hana.ondemand.com/sap/bc/apc/sap/ztest_apc’ failed: Error during WebSocket handshake: Unexpected response code: 403
can you help me please it’s very urgent.
Best regards.
Hi Ramzi Abdallah,
Good explanation but can you please let me know in which case you have implemented it .because while creating sales order or any data related to business through frontend sapui5 with odata how could you add you notification packet between this.
Hi.
Excuse my English. I’m doing every single step, but if I dont have SAPUI5…I can connect any js script to this websocket? There is any kind of security?
Thanks.
SAPYard is known for explaining more on the “Why” part of the solution then “How” of it. Could you please explain the architecture and design of this also.
Nice tutorial.
Could you please extend it to cover a scenario when notification is sent from one SAP system to some other web service/API ?
I’m trying to test your code but I can’t connect to the WebSocket using cloud platform connector to our on-premise server. It gives me an error.
“failed: Error during WebSocket handshake: Unexpected response code: 404”
It appears that socketHostURI += “//” + hostLocation.host is not giving the correct URI on this configuration.
Any suggestions?
Thanks in advance and thank you for the article.
I think that the issue is maybe related to the “hostLocation” variable which is used as window.location. So try to change it to the URL of your on-premise server and check again.
Hello Marcelo . How did you resolve this error?
how user is determined ?? How to send notification to particular user ?? …is this will send notification to mobile also?
Chukran Abdallah for this tutorial, looking forward to read more 😉
It’s a very good explanation of push notification and how it works. Please keep posting.