Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
simon_hoeg
Product and Topic Expert
Product and Topic Expert


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

 



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.



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 :smile:


11 Comments
Uli_42
Participant
0 Kudos
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
simon_hoeg
Product and Topic Expert
Product and Topic Expert
0 Kudos
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
edemey
Explorer
0 Kudos
Hi Simon,

I tried to use the message channel for a FPM application which includes a POWL. I registered the message channel in the POWL Feeder method IF_POWL_FEEDER~GET_ACTIONS which is called only once the POWL is called.

I trigger a message from a test report. Unfortunately the FPM event does not reach any of the POWL feeder methods. Neither IF_POWL_FEEDER~HANDLE_ACTION or IF_POWL_FEEDER~GET_OBJECTS.

Is this concept not supported for the FPM POWL.

Thank you, Eddy

 
simon_hoeg
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello Eddy,

sorry for the late reply. The SCN notification engine does not really work 🙂

As long as you run in an FPM application the feature is supported definitely!

You have to start debugging in the Browser -> Developer Tool (F12) to check if the webSocket connection could be established successfully.

Best regards,

Simon
former_member185171
Participant
0 Kudos
Hi,

I' trying to get this working, but there one thing I don't get.

Where do you maintain the 'semantic id' of an ABAP messaging channel.

I miss something...

Thanks for an answer.

Kris
simon_hoeg
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Kris,

the Semantic IDs can be either maintained dynamically (-> ABAP interface IF_FPM_BINDING_MANAGER) or statically (-> configuration editor FLUID).

There are several possibilities to enter FLUID, for instance, if you provide the SET/GET Parameter FPM_CONFIG_EXPERT with value X (-> transaction SU3), then you will find function Configure Page in the top right corner of your FPM application.

After launching FLUID there is a function ABAP Message Channel Bindings in the toolbar of the panel General Settings.

Best regards,

Simon
former_member185171
Participant
0 Kudos
Thanks a lot for the fast respons.

I found where I have to put the ID in the FPM configuration.

In your test-application the semantic id is 'OBJECT_1', but how do I connect it to an AMC? I don't see where I make the link between 'OBJECT_1' and (e.g.) my AMC 'ZZ_KCL_TEST'.

Thanks a lot.

Kris
simon_hoeg
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Kris,

when you maintain a static AMC binding in FLUID, then the FPM runtime will automatically connect with the semantic ID ( + Scope) to the AMC, given that the AMC and APC environment is up and running ...

Then, by using the above semantic ID and Scope, you can use the static method SEND of ABAP Class CL_FPM_CHANNEL_MANAGER to send FPM events directly to your currently bound FPM application.

A basic example can be found in FPM application FPM_TEST_APC_OVP.

Best regards,

Simon
former_member185171
Participant
0 Kudos
Sorry for continuing asking questions.

That far I am... but when I create an AMC / APC I see "Applications", "Channels", ... But I do not find the semantic Id for the channel.

I found where to put it in the Floorplan, but I do not know "what" I have to put in it. I don't find the samantic Id of my channel.

Thanks for you patience.

Kris
simon_hoeg
Product and Topic Expert
Product and Topic Expert
Hello Kris,

I think it is easier then you think 🙂 The sender and receiver have to communicate with the same Semantic ID and Scope.

The Semantic ID is something that you define for your own application and use case. Many of our use cases just use a GUID here. I think this can be recommended for the scopes S (system) and C (client).

Internally the Semantic ID will be part of the AMC_CHANNEL_EXTENSION_ID, this DDIC data element can be found in many APIs.

Best regards,

Simon

 

 
former_member185171
Participant
0 Kudos
Hey Simon,

now I see. You always use the same Channel in an FPM: FPM_AMC.

I think I'm started now.

Thanks a lot.

Kris