Skip to Content

The ABAP Channels infrastructure offers best support for native event-driven interactive and collaborative scenarios in ABAP and is generally available with ABAP 7.40 Support Package 5 (SP05). The ABAP 7.40 Support Package 8 (SP08) contains various enhancements including API refactoring to support WebSocket subprotocols.and message exchange with SAP Push Channel Protocol (PCP).

 

Take your time to watch these YouTube video tutorials to learn how to implement and use ABAP Channels.

 

See also the blog ABAP Channels Examples.

 

How to implement ABAP Push Channel (APC)
ABAP Push Channel enables bi-directional communication via WebSockets in ABAP. This video gives you step-by-step introduction on how to implement and use ABAP Push Channel.

 

 

 

How to implement ABAP Messaging Channel (AMC)
ABAP Messaging Channel enables event-driven communication based on publish/subscribe mechanism for message exchange between different ABAP sessions which can reside on different ABAP Servers. Any ABAP session can subscribe to channels and any ABAP session can publish messages to channels. This video gives you step-by-step introduction on how to implement and use ABAP Messaging Channel.

 

 

How to implement collaboration using ABAP Push Channel (APC) and ABAP Messaging Channel (AMC)

 

The collaboration scenario provides the possibility on the basis of publish/subscribe mechanism of ABAP Messaging Channels and WebSocket implementation of ABAP Push Channel to exchange messages between different WebSocket Clients. This video gives you step-by-step introduction on how to implement collaboration scenario using ABAP Messaging Channel and ABAP Push Channel.

 

To report this post you need to login first.

16 Comments

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

  1. Florian Henninger

    Hi Olga,

    nice blog as usual. Can you release something about the dynpro push channels? I read somewhen a bit about it, but I’m not sure if the APC/AMC is the same?

    Can I look forward to something other?

    Thank you

    ~Florian

    (0) 
    1. Olga Dolinskaja Post author

      Hi Florian,

      you can use AMC for message exchange between ABAP sessions, which can even belong to different ABAP application servers. The example of AMC communication between two dynpro applications is explained in the “How to implement ABAP Messaging Channel (AMC)” video here and in Masoud’s blog http://scn.sap.com/community/abap/connectivity/blog/2014/03/26/abap-channels-part-2-publish-subscribe-messaging-using-abap-messaging-channels

      Best Regards,

      Olga.

      (0) 
  2. Thomas Porcham

    Hello Olga,

    thank you very much for these interesting tutorials.

    Can’t wait to try out this functions.

    Our Development System is on 7.4 SP 6.

    Do you think it will be possible to create the echo example with this version?

    Thanks,

    Thomas

    (0) 
    1. Masoud Aghadavoodi Jolfaei

      Hi Thomas,

      in releases < 7.40 SP8 the Push Channel Protocol (PCP) handling can be done in application which is per default available with releases >= 740 SP08. The PCP type is per default a text based message type (very similar to HTTP message format without the request/response line
      part). In ABAP the PCP is realized via class CL_AC_MESSAGE_TYPE_PCP and the respecting interface IF_AC_MESSAGE_TYPE_PCP. In UI5/Fiori the PCP library is provided as sap.ui.core.ws.SAPPcpWebsocket and the messages transferred to an APC application can be deserialized to an PCP object via following line of codes included in ON_MESSAGE method:

      TRY.

           DATA(lo_pcp) = CL_AC_MESSAGE_TYPE_PCP=>DESERIALIZE(´i_message->get_text( ) ).
         CATCH  cx_ac_message_type_pcp_error INTO DATA(lx_pcp_error).

           ” apply error handling

          CATCH cx_apc_error INTO DATA(lx_apc_error).

           “apply error handling

      ENDTRY.

      Furthermore to create a PCP message in an 740 SP05-S=7 release you will use following code
      snippet, e.g. in ON_MESSAGE:

        TRY.
            DATA(lo_message_mgr) = i_message->get_context( )->get_message_manager( ).
            DATA(lo_message) = lo_message_mgr->create_message( ).
            ” transfer of a message via PCP

            DATA(lo_pcp) = cl_ac_message_type_pcp=>create( ).

            lo_pcp->set_text( “some text” ).

            lo_pcp->set_field( i_name = “myname” i_value = “myvalue” ).
            lo_message->set_text( lo_pcp->serialize( ) ).
            lo_message_mgr->send( lo_message ).
          CATCH  cx_ac_message_type_pcp_error INTO DATA(lx_pcp_error).

           “apply error handling
          CATCH cx_apc_error INTO DATA(lx_apc_error).

           “apply error handling
        ENDTRY.

      Cheers,

      Masoud

      (0) 
  3. Nitesh Jain

    Hi Olga/Masoud,

    I have a normal ABAP dynpro which has an ALV grid which needs to be refreshed based on some event.

    Using AMC and APC i have got the message in the module pool program but tried to find a way as to how do i refresh the ALV grid table data.

    Any ideas? I hope this is possible with normal ABAP dynpro screens.

    regards

    Nitesh

    (0) 
  4. Mathias Bischoff

    Hello Olga,

    Which package version is needed to use the Websocket Client Class: CL_APC_WS_CLIENT

    Support Package 5 or Support Package 8.

    Are there examples existing. I want to write a Socket IO Client Lib.


    Best regards


    Mathias

    (0) 
    1. Masoud Aghadavoodi Jolfaei

      Hi Matthias,

      the WebSocket client, i.e. APC client, is not released in NW ABAP 740 SPx and is only available as prototype ! The  general  availability is with NW ABAP 750.

      Best regards,

      Masoud

      (0) 
  5. Iegor Titov

    Hi all,

    Thank you for guides. Could you please clarify is there any way to process AMC messages in async mode (run if_amc_message_receiver~receive asynchronously)?

    Thank you.

    (0) 
    1. Olga Dolinskaja Post author

      Hi Iegor,

      you can start e.g. an asynchronous RFC (aRFC) in your main program and in this aRFC implement subscription to the AMC to get AMC messages there. As soon as an AMC message is received in this aRFC, it will return to the main program via callback. Just take a look at the Masoud’s reply in the “Comments” section of the blog “Say Goodbye to Polling: Real-time eventing in ABAP with ABAP Channels”. There you will find an example report with explanation how to implement it.


      Best Regards,

      Olga.

      (0) 
      1. Iegor Titov

        Hi Olga,

        thank you for the reply. I have considered such approach, but messages still will be processed successively, the only difference is the main thread is not blocked. So the total processing time will be the same. Apparently it is impossible to build something like rest-service using channels, am I right?

        (0) 
        1. Olga Dolinskaja Post author

          Hi Jegor,

          yes, ABAP Messaging Channel (AMC) is not like a REST-based services infrastructure. AMC is based on the publish-subsribe mechanism and acts as a broker between ABAP sessions to exchange messages.

          Regards,

          Olga.

          (0) 

Leave a Reply