The technical standard for push channel driven web applications is defined with the Web Socket API specified by the W3C and WHATWG. Based on this SAP introduced with NetWeaver 740 (SAP_BASIS SP 8) the ABAP Push Channel framework to establish a bidirectional communication between client and server.
With SAP NetWeaver 750 (SAP_UI SP 5) we present an integration of the Floorplan Manager with the ABAP Push Channel (APC) and ABAP Message Channel (AMC) technology:
Based on the ABAP Push Channel for FPM Events the application developer can trigger FPM Events from any server in the system environment. By doing this various use cases can be addressed, such as data feeds, collaborative editing, remote control, chat communication etc. Some of them may occur in the context of the Internet of Things.
Once the connection between AMC and FPM runtime is established, the FPM application can receive FPM events that have been send by the FPM Message Channel API.
Binding to AMC
The binding to AMC is based on two parameters: Semantic ID and Scope.
The Semantic ID is case sensitive and has a size of 60 characters (at maximum).
The Scope defines who can receive a message sent by FPM Message Channel API. There are three values: S, C or U:
- S (System): All user sessions receive messages
- C (Client): All user sessions with the same client receive messages
- U (User): Only user sessions with the same user name and the same client receive messages
A binding to AMC can be either defined statically (during the design time) or dynamically (during the runtime).
Static binding is done in the configuration editor (FLUID) on floorplan configuration level. To define a binding to AMC, open the General Settings panel and choose the function Floorplan Settings > ABAP Message Channel Bindings. A dialog window appears on which you can add the binding by entering a Semantic ID, Scope and Description (see Figure 1).
Figure 1: Adding static AMC bindings in FLUID
Besides a static binding to AMC you have the possibility to add, remove and check bindings dynamically by using the methods BIND, UNBIND,UNBIND_ALL and IS_BOUND of interface IF_FPM_BINDING_MANAGER. During the FPM runtime an instance on this interface is exposed via attribute IF_FPM~MO_BINDING_MANAGER.
Sending FPM Events via Message Channel API
For a given Semantic ID and Scope you can send FPM events (objects of type CL_FPM_EVENT) using static method SEND_EVENT of class CL_FPM_CHANNEL_MANAGER.
Regarding FPM event parameters, mind that data references will not be considered when broadcasting the event. In addition there is an upper boundary of 32 kilobyte for the data volume to be sent.
In case of technical problems during the connection set-up between browser and ABAP Push Channel or during the binding between ABAP Push Channel and ABAP Message Channel, the application layer is informed about the situation with FPM Event FPM_AMC_ERROR (Constant CL_FPM_EVENT=>GC_EVENT_AMC_ERROR).
Then the application layer can obtain an error log with method GET_LOG of interface IF_FPM_BINDING_MANAGER. The error log is based on error codes, which are defined as constants in interface IF_FPM_BINDING_MANAGER, for instance: BROWSER_NOT_COMPATIBLE, BINDING_FAILED and CONNECTION_CLOSED. On basis of this the application can follow up with application specific error handling, e.g. inform the user with a message, trigger technical workarounds etc.
There is a small demo application FPM_TEST_APC_OVP (see the Figure 2) where you can quickly check the solution. Before verify that ICF Service FPM_APC has been activated in transaction SICF. This application shows share prices of some companies in a List UIBB ATS and share price deltas (in time) in a Chart UIBB.
If you run the ABAP report FPM_APC_TEST (see Figure 3) in parallel, you can trigger an update of the web application data on basis of the FPM Message Channel API, ABAP Message Channel, APAB Push Channel + WebSocket technology.
Figure 2: Demo application FPM_TEST_APC_OVP showing share prices that are being updated by the FPM Message Channel API
Figure 3: Demo Report FPM_APC_TEST that triggers the event FPM_REFRESH for semantic id OBJECT_1
Have fun when trying this 🙂