Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
masoud_aghadavoodijolfaei
Active Participant

As I started to implement the ABAP Channels with our colleagues I also have tried to implement different test applications and show cases to check and demonstrate the behavior of the ABAP Channels in different contexts. This comprises the usage in UI5/Fiori programming model, Web Dynpro, BSP, and WebGUI, as well as collaboration, "real-time", and throughput aspects. The result of these efforts was that some of those applications has been integrated as "simple" example application in  the ABAP Channels package "SAPC_EXAMPLES" to be able to use them as show case application for different occasions, e.g. TechEds and the like. Some of those examples are shown in the YouTube video "ABAP Channels - Real time eventing in ABAP".


 

In this blog we present some of the ABAP Channels show cases, which were delivered with SAP Netweaver ABAP 740 SP05 onward. The example applications are kept very simple and do not necessarily fulfill all the software requirement aspects for business applications. Thus these examples are not aimed and released for productive usage and we do not provide any support regarding any issues raised during execution in the applications! The goal of the provided example applications is to give an idea how the ABAP Channel technology, especially based on collaboration scenario, could be used to realize different use cases.

 

All these applications require an HTML5 based browser that supports WebSocket specification RFC 6455. A list of supported browsers are provided by http://caniuse.com/websockets. Furthermore it might be that some of the applications run only on certain browser types, e.g. only on Chrome.

 

Example Applications Since 740 SP05

Following example applications are available since 740 SP05:

 

  • Ping: a simple bi-direction push application. The application is running in browser and exchanges text messages between browser windows and ABAP reports.


 

Prerequisite: In the transaction SICF the following service paths has to be activated before:






    • /sap/bc/apc_test/ping: provides a web page for publishing and receiving of text messages.

    • /sap/bc/apc/sap/ping: provides ABAP Push Channel application for the WebSocket connection used to publish and receive text messages.




 

The following ABAP reports can be used to exchange messages between browser windows and ABAP reports:






    • RS_AMC_SEND_MESSAGE: the report (with its default parameter settings) sends messages to the browser window using AMC Channel.

    • RS_AMC_RECEIVE_MESSAGE: the report (with its default parameter settings) receives messages that have been sent either from the browser or the ABAP report. For message reception the ABAP report provides the following options:

      • Option "Wait Statement": receive messages via WAIT statement.

      • Option "List processing": receive messages via list processing.






 

The URL for the Ping application is http(s)://<host.domain>:<port>/sap/bc/apc_test/ping. Alternatively, the service path /sap/bc/apc_test/ping can be launched in the web browser via transaction SICF; see section "Execution of Services in SICF" blelow.


Figure 1 shows how a message published in a web browser is received in another web browser and SAP GUI session. Figure 2 shows how a message published in SAP GUI session is received in another SAP GUI session and web pages.


 


Figure 1: Sending messages from a browser (HTML5 UI) to other browsers or ABAP sessions.


 



Figure 2: Sending messages from an ABAP sessions to other browsers (HTML5 UI) and ABAP sessions.


 

  • Ping Pong: an interactive table tennis (pong) game.


 

Prerequisite: the application consist of the following elements:






    • Playing field: a playing field, which is executed as an HTML5 application in the browser. The URL for the playing field is http(s)://<host.domain>:<port>/sap/bc/apc_test/ping_pong/game. Alternatively, the service path /sap/bc/apc_test/ping_pong/game can be launched in the web browser via transaction SICF; see section "Execution of Services in SICF" blelow.




 






    • Players: players can either run in browser or in ABAP report.

      • Player running in browser: the URL for ping pong player is http(s)://<host.domain>:<port>/sap/bc/apc_test/ping_pong/player. In the browser page, you can choose the player, i.e, Player1 or Player 2.

      • Player running as ABAP report: the report RS_APC_PING_PONG provides a player screen when executing the report via transaction SA38 or SE38. The player can select to attend either as Player1 or as Player2.






 

Restrictions: This simple sample application allows one active match per system and client only.



Figure 3: Playing table tennis including playing field and player 1 in browser and player 2 in SAP GUI.


 


 


Example Applications Since 740 SP08


With 740 SP08 we also have integrated the SAP message format "Push Channel Protocol" (PCP) in ABAP Push Channels and provided a JavaScript library as well as a UI5 library. PCP is WebSocket subprotocol (registered at IANA); it is the preferred protocol for SAP push applications. The JavaScript and UI5 libraries are especially designed for SAP HTML browser based UI technologies, i.e. UI5/Fiori, Web Dynpro, BSP/CRM UI, and WebGUI. The YouTube video "ABAP Channels - Real time eventing in ABAP" demonstrates these examples as well.

 

Following example applications are available since 740 SP08:

 

  • ABAP Online Community (AOC aka Palavar): the application provides simple instant messaging (similar to WhatsApp). This can be used not only for exchanging messages but also for sharing pictures and documents. The AOC exists in two different UI technologies, namely UI5/Fiori and Web Dynpro.


In AOC the interaction between users are controlled by the term "Room". Only users belonging to a "Room" can interact with each other. There exists two types of rooms, "Public Rooms" and "Own/Permitted Rooms". Whereas "Public Rooms" are accessible for any user, the access to the "Own/Permitted Rooms" is only permitted to the members of the room and controlled by access control lists. The access control list per room can be maintained manually by assigning valid users in the respective system and client. All room ids starting with the prefix "public" (case insensitive) belong to "Public Rooms" and hence are publicly accessible.


Important remarks: whereas the text messages are immediately published in the respective room and not persisted in the database table, shared documents, i.e. any uploaded picture or document, are persisted on database and a reference is pushed to the room members. Each uploaded document is checked via virus scanner (with virus scan profile /SIHTTP/HTTP_UPLOAD); an ABAP dump could arise if the virus scan check fails. Since there exist no "garbage collector" for the database table entries, this could lead to table space issues and also security issues (as the published documents may contain security relevant information). For cleaning up the affected table entries there exists the static method CL_ABAP_ONLINE_COMMUNITY_UTIL=>CLEANUP_SHARED_DOCUMENTS (or a customized copy of it), which could be used to cleanup the entries older than 1 hour. This could be scheduled as a periodic batch job.


 






    • UI5/Fiori version of AOC: the URL for this version of AOC application is http(s)://<host.domain>:<port>/sap/bc/ui5_ui5/sap/aoc/index.html. According to my present tests (at the time this blog has been written), this version works fine under Chrome and iPhone/iPad using mobile Safari. The upload function provided in the rooms does not work in IE and Firefox, but the messaging works fine. It is also nice to see how the exchange of messages and pictures works in a local network using mobile devices, e.g on iPhone try the voice recognition!

      • Features:

        • Entering/Leaving a room: As soon as a member enters a room or actively leaves the room, i.e. using "switch icon", the member list gets updated.

        • Members: room members can see the present activity status ("Online" or "typing") of all room members.








 

Prerequisite: in the transaction SICF following service paths has to be activated before:










        • /sap/bc/ui5_ui5/sap/aoc: provides the Fiori page for AOC application.

        • /sap/bc/apc/sap/abap_online_community: provides ABAP Push Channels application for the WebSocket connection used for message exchange.

        • /sap/bc/apc_test/abap_online_com: provides the HTTP service for exchanging documents.









Figure 4: AOC UI5/Fiori start page.


 



Figure 5: AOC UI5/Fiori room page.


 



    • Web Dynpro version of AOC: the URL for this version of AOC application is http(s)://<host.domain>:<port>/sap/bc/webdynpro/sap/abap_online_community. This version of the AOC provides instant messaging features similar to the UI5/Fiori version. The difference is the UI technology (Web Dynpro) and its session handling based on stateful HTTP communication (be aware of session timeouts !).




 

Prerequisite: in the transaction SICF following service paths has to be activated before:








      • /sap/bc/webdynpro/sap/abap_online_community: provides the Web Dynpro application.

      • /sap/bc/apc/sap/abap_online_community: provides ABAP Push Channels application for the WebSocket connection  for message exchange.

      • /sap/bc/apc_test/abap_online_com: provides the HTTP service for exchanging documents.







Figure 4: AOC Web Dynpro start page.



Figure 5: AOC Web Dynpro room page.


 


Sohbat based applications:

The aim of the Sohbat framework (Sohbat means in Persian/Farsi language "speak/conversation") was to establish a "simple rapid prototyping framework" for implementation of ABAP Channels show cases. It provides simple APIs based on database CRUD (Create/Read/Update/Delete) and publish-subscribe pattern.

 

Following examples are based on the Sohbat framework:

 

  • Sohbat Slider: demonstrates the "real-time" power of ABAP Channels (by the way my favorite show case). The abstract idea is to provide a test application that takes use of Fiori and SapPcpWebSocket libraries to visualize a simple business object (a database table) consisting of the attributes "First Name", "LastName", and "Performance". Furthermore, the UI model and view should automatically be updated when any changes on the business object (database table) takes place in the backend system. In short, the goal is to eliminate the refresh button in the UI! The replacement of the refresh button depends on the UX expectation. In this example we use two patterns, namely notification bar and auto refresh.


 

The URL for the Sohbat Slider application is http(s)://<host.domain>:<port>/sap/bc/bsp/sap/sohbat_slider/index.html. Alternatively, the service path /sap/bc/bsp/sap/sohbat_slider can be launched in the web browser via transaction SICF; see section "Execution of Services in SICF" blelow.


 

Prerequisite: in the transaction SICF the following service paths has to be activated before:






    • /sap/bc/bsp/sap/sohbat_slider: provides the Fiori UI application.

    • /sap/bc/apc/sap/sohbat: provides the ABAP Push Channels application for the WebSocket connection. It uses the PCP subprotocol for exchanging the CRUD-like messages.




 


Figure 6: Sohbat Slider page.


 




  • Sohbat Video: is a prototype application for sharing videos (actually picture sequences) between users. It demonstrates how fast the ABAP engine can handle a large number PCP messages with encapsulated binary data. The web client is based on SapPcpWebSocket in UI5. My observation was that with increasing number of web clients the bottleneck was the rendering engine of underlying browsers and not the ABAP engine (just check the transaction SM50 during the video transfer!).


 

The URL for the Sohbat Slider application is http(s)://<host.domain>:<port>/sap/bc/bsp/sap/sohbat_video/index.html. Alternatively, the service path /sap/bc/bsp/sap/sohbat_video can be launched in the web browser via transaction SICF; see section "Execution of Services in SICF" blelow. After launching the application you have to accept the access permission to your webcam. The popup which requires the permission in Firefox has the following shape:


 


Figure 7: Popup screen for requesting access permission to connected Webcam device


 




  • Prerequisite: The Fiori page takes use of the getUserMedia API, i.e. "Capturing Audio and Video in HTML5". The list of supported browsers, e.g. Chrome and Firefox, can be checked under http://caniuse.com/#search=getusermedia. Furthermore in order to publish video, the PC/notebook has to have a functional webcam. For receiving and viewing the videos no webcam is needed and usually any browser, e.g. the one in your mobile device, can be used.


 

In the transaction SICF following service paths has to be activated before:






    • /sap/bc/bsp/sap/sohbat_video: provides the Fiori UI application.

    • /sap/bc/apc/sap/sohbat: provides the ABAP Push Channels application for the WebSocket PCP-based connection and message exchange.




 


Figure 8: Sohbat Video page (video snapshot taken in our office in Walldorf).


 


Execution of Services in SICF


In general, a service URL, e.g., /sap/bc/apc_test/ping, can also be executed via transaction SICF of the corresponding application server. To do this choose the service path, e.g., /sap/bc/apc_test/ping, in the transaction SICF and choose the context menu function (right mouse button) "Service Test". Please note that in this case the default browser is used for the execution of the URL, which might not support WebSockets. Make sure that the URL is carried out in a suitable browser, such as Chrome.


 


Conclusion and outlook


The examples demonstrates the amazing potential of the ABAP Channels infrastructure for high-responsive and real-time UI applications. New use cases can be realized, which would not be possible using polling. The capability of the infrastructure of handling a high message throughput and the positive experience with this technology in different projects motivated us to go beyond. In NetWeaver 7.50 the ABAP Channels has been extended to support plain TCP/IP socket protocols, which are needed to directly connect industrial devices (e.g., Programmable Logic Controllers) to ABAP business applications. This builds the basis for our Industry 4.0 (Industrial Internet of Things) infrastructure in ABAP.


 


 



12 Comments