Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

ABAP Channels Examples

$
0
0

**** ACCIDENTALLY PUBLISHED -  STILL IN DRAFT MODE - UNDER CONSTRUCTION ****

As I started to implement the ABAP Channels with our colleagues I also have tried to implement different test applications and at the end show cases to check and demonstrate the behavior of the ABAP Channels in different contexts, e.g. in UI5/Fiori programming model, in Web Dynpro/BSP and WebGUI, collaboration and "real-time" and throughput aspects, etc.  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 occations, e.g. TechEds and the like, and only for internal use ! tSome 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 a an idea how the ABAP Channel technology especially based on collaboration scenario could be used to realize different collaborative applications.

 

All these applications require HTML5 based browser which 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 runs only on certain browser types, e.g. only on Chrome.


Following example applications are available since 740 SP05:


  • Ping a simple "Chat" application : The application is running in browser and exchanges text messages between browser windows and ABAP reports.

 

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

    • /sap/bc/apc_test/ping: provide HTML5 page for publishing and receiving of text messages.
    • /sap/bc/apc/sap/ping: provides ABAP Push Channel application for the WebSocket connection used publishing and receiving of text messages.

 

The following ABAP reports can be used to exchange messages to between HTML pages and ABAP reports:

    • RS_AMC_SEND_MESSAGE: The report (based onits default parameter settings) sends messages to the browser window.
    • RS_AMC_RECEIVE_MESSAGE: The report (based on its default parameter settings) receives messages that have been sent from either the browse window or from the ABAP report. In the ABAP report receives messages via following options:
      • Option "Wait Statement": Receive messages via 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?sap-client=<client>.

 

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


ping_browser_e.PNG

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


ping_report_e.png

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

 

  • Ping Pong as interactive table tennis (pong) game.


Prerequisite: The application consist of the following elements:

    • Game table: A game table, which is executed as an HTML5 application in the browser.The URL for the table tennis table is http(s)://<host.domain>:<port>/sap/bc/apc_test/ping_pong/game?sap-client =<client>.


Alternatively, the application of the transaction SICF for the service path /sap/bc/apc_test/ping using the context menu function (right mouse button) "Service Test". Coming to Please Note that in the case u.U. the default browser is used to Auzsführung the URL, which already does not WebSocket-support. Make sure that the URL is carried out in a suitable Brwoser type, such as Chrome, Firefox or IE10. Players can either browser or ABAP report use.


    • 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?sap-client=<client>. In the browser page, the selection of the player, such as Player1 or player 2, can be taken.
      • 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: Can only be used for a active game pr client.

ping_pong_e.PNG

Figure 3: Playing table tennis including playing field and running player 1 in browser and player 2 in SAPGUI as an ABAP report.



Following example applications are available since 740 SP08: With SP08 we have also integrated the SAP message format "Push Channel Protocol" in ABAP Push Channel and also provded JavScript library especially for the consumption in the 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" demonstrate these examples as well..


  • ABAP Online Community (AOC aka Palavar) (available since 740 SP08): The application provide a simple collaboration environment, which can be used not only for exchanging of messages but also of pictures and documents. The AOC exists in two different UI technologies, i.e. based on 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 and this after entering the room they are allowed to. There exists two types of rooms, i.e. "Public Rooms" and "Own/Permitted Rooms".  Whereas "Public Rooms" are accessible for any user the access to the own/permitted rooms are only accessible by the members of the room and controlled by a access control list. The access control list per room can be maintained manually. All room ids starting with the prefix "public" (case insensitive) are declared as public rooms and hence publicly accessible. Access to all other own/permitted rooms are controlled by access control lists by assigning valid users in that  system and client.

 

 

Important remark: Whereas the text messages are immediately published in the respective room and not persisted in the database table will all shared documents, i.e. any uploaded picture or document, is checked via virus scanner (with virus scan profile /SIHTTP/HTTP_UPLOAD) and if the check is successful is the document persisted on a dedicated table and additionally published in the room. An ABAP dump  could ariase If the virus scan check fails.

Since there exist no "garbage collector" for the affected and "expired" database table entries this could lead to table space issues and also security issues if the persisted documents contain security relevant information. For cleaning up the affected table there exists the static method CL_ABAP_ONLINE_COMMUNITY_UTIL=>CLEANUP_SHARED_DOCUMENTS which (or a customized copy of it) could be used, e.g. as a batch report, to cleanup the entries older than 1 hours !


    • 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 time of writing this blog, 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 in a local network and using mobile devices, e.g on IPhone, the exchange of messages and pictures work !
      • Features:
        • Members: as soon as you enter a room you see the active members in the room and their status "Online" or "typing".
        • Entering/Leaving a room: As sson as a member enters a room or leave actively the room, i.e. using "switch icon", the member list get updated.

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

          • /sap/bc/ui5_ui5/sap/aoc: provide the Fiori page for AOC application.
          • /sap/bc/apc/sap/abap_online_community: provides ABAP Push Channel application for the WebSocket connection used for exchanging and of meessages.
          • /sap/bc/apc_test/abap_online_com: provide the HTTP service for exchanging of documents.

aoc_ui5_1_e.PNG

Figure 4: AOC UI5/Fiori start page.



aoc_ui5_2.PNG

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 provide similar collaboration feature like the UI5/Fiori version with the difference that the UI technology and its handling based on stateful HTTP communication (be aware of session timeout !).

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

      • /sap/bc/webdynpro/sap/abap_online_community: provide the Web Dynpro application for AOC application.
      • /sap/bc/apc/sap/abap_online_community: provides ABAP Push Channel application for the WebSocket connection  for exchanging of messages.
      • /sap/bc/apc_test/abap_online_com: provide the HTTP service for exchanging of documents.

aoc_webdynpro_1_e.PNG

Figure 4: AOC Web Dynpro start page.

 

aoc_webdynpro_2_n.PNG

Figure 5: AOC Web Dynpro room page.


Sohbat  "simple rapid prototyping framework for internal use" (means in Persian/Farsi language "speak/conversation") based applications: The aim of the Sohbat framework was to have a simple APIs based on database CRUD including pub-sub pattern under the usage of ABAP Channels. Following examples are based on the Sohbat framework.


  • Sohbat Slider (by the way my favorite show case) demonstrates the "real-time" power of ABAP Channels. The abstract idea is to provide a test application which take use of Fiori SapPcpWebSocket library to present (as master detail) a simple business object (a database table) consisting of the attributed "First Name", "LastName" "Performance". Furthermore the UI model and view should automatically be updated when any changes on the business object (database table) in backed system takes place. In short. Goal is to eliminate of the refresh button in the UI technologies ! The refresh button should be only  be provided (enabled) as fallback technology, when the WebSocket connection for whatever reason get interrupted or cannot be established. The replacement of refresh button depends on the UX expectation. In this example we use both pattern, i.e. notification bar on auto refresh. In order to

 


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

    • /sap/bc/ui5_ui5/sap/sohbat_slider/index.html or /sap/bc/bsp/sap/sohbat_slider/index.html : provide the Fiori UI application
    • /sap/bc/apc/sap/sohbat: provides the ABAP Push Channel application for the WebSocket PCP-based connection for exchanging of CRUD-like messages.

 

sohbat_slider_e.png

Figure 6: Sohbat Slider page.


  • Sohbat Video demonstrates the prototypical usage of WebSocket PCP to share videos (actually picture sequences) between users. The abstract idea is to get an  impresion how fast a large number of streamed data encapsulated in PCP messages (based on SapPcpWebSocket  in UI5 and PCP library in ABAP) can be handled by the ABAP engine.


The URL for this Sohbat Video application is http(s)://<host.domain>:<port>sap/bc/ui5_ui5/sap/sohbat_slider/index.html and after launching the application you have to accept the access to the WebCam device. The poup which requires the permission in Firefox has the following shape:


palaver_video_firefox_popup_e.png

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


  • Prerequisite: The Fiori page take use of the getUserMedia API, i.e. "Capturing Audio and Video in HTML5", supported browsers, e.g. Chrome and Firefox, can with http://caniuse.com/#search=getusermedia. Furthermore in order to publish video the PC/notebook has to have a function-able WebCam device. For receiving and viewing the videos neither a WebCam and usually any browser, e.g. in you mobile device like mobile Safari, can be used.


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


    • /sap/bc/bsp/sap/sohbat_video/index.html: provide the Fiori UI application
    • /sap/bc/apc/sap/sohbat: provides the ABAP Push Channel application for the WebSocket PCP-based connection and exchanging messages.

 

sohbat_video_e.PNG

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



Viewing all articles
Browse latest Browse all 2548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>