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

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).

 

FLUID_AMC_Binding.png

Figure 1: Adding static AMC bindings in FLUID

 

Dynamic Binding

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.

 

Error Handling

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.

 

Demo Application

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.

FPM_APC_DemoAppl.PNG

Figure 2: Demo application FPM_TEST_APC_OVP showing share prices that are being updated by the FPM Message Channel API

 

FPM_APC_DemoReport.PNG

Figure 3: Demo Report FPM_APC_TEST that triggers the event FPM_REFRESH for semantic id OBJECT_1

 

Have fun when trying this 🙂

To report this post you need to login first.

2 Comments

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

  1. Ulrich Becker

    Hy Simon,

    taht sounds great. I hope it makes it easy to transform an apc-event to an “ordinary” event ..
    can you please figure out how the most important parts  opening the channel in the Client and reacting on the event is realized

    I do not see this in the outlined text ( and do not have access to such a new system to take a look. Also i gues it is  covered deeply inside the FPM Framework )

    I guess the framework does the opening to a  APC ( – please figure out which and how/when it si activated and how it is filtering the relevant messages ..) .
    Does it only open/register to the channel if an AMC binding exist or does it do that always?

    What is happening with userinput that will collide with an icoming message-> Event ?
    And how can i filter the events on Client side to prevent triggering irrelevant roundtrips to the backend?

    I am asking  mainly because  i have made a solution that is far to complicated (  based on a html island added to the fpm as freestyle component  with a very basic Java script  that does handle the Websocket-Part  including filtering the relevant messages  ).
    With the inegration, i hope, i can remove that and just use the new feature.

    Next Question: Will there be or is there something  that can be used in Webdynpro to use Sockets more comfortably without FPM and  without writing own Java Script ?

    Thanks a lot,

    Uli

    (0) 
    1. Simon Hoeg Post author

      Hi Ulrich,

      the FPM applications connects to APC only, if there is any dynamic or static binding available.

      The above described solution is tightly integrated into the FPM framework, this should help you to focus on the business use case, rahter than solving technical connection issues.

      Filtering is currently done on server side, i.e. via Semantic ID and Scope. Each of the use cases has its own set-up here, and (in theory) there is no upper limit for the amount of bound Sematic IDs.

      For the moment, collisions between user input and pushed events must be handled in the Feeder Class. But we think about improvements on client side regarding this.

      Thanks for your detailed feedback 🙂

      Regards,
      Simon

      (0) 

Leave a Reply