SAP AMC SEND ABEXA



Get Example source ABAP code based on a different SAP table
  


VX_EXA_ONLY

ABAP_AMC - Sending Messages
This example demonstrates how messages are sent using AMC.

ABAP_SOURCE_CODE
DEMO CL_DEMO_SEND_AMC

ABAP_DESCRIPTION
The factory method CREATE_MESSAGE_PRODUCER of the system class CL_AMC_CHANNEL_MANAGER is used to create sender objects for the messaging channels /demo_text, /demo_binary, and /demo_pcp of the application DEMO_AMC from the package SABAPDEMOS and to perform a casting for these objects to the appropriate interfaces.
X can be passed to the optional parameter I_SUPPRESS_ECHO to define that the messages sent using a sender object are not sent to the current ABAP session. The effect of this is shown in the executable example Suppressing Standalone Messages.
The SEND methods of the interfaces are used to send a text string, JSON data as a byte string and two name/value pairs, as well as a body in SAP's own Push Channel Protocol (PCP) using the messaging channels. The data of the PCP message is passed to an object of the class CL_AC_MESSAGE_TYPE_PCP and serialized there.
The executable example Receiving AMC Messages demonstrates how these messages can be received in ABAP programs. The executable example APC, WebSocket Communication shows how the messaging channels are linked with ABAP Push Channels (APC) and that the messages sent using CL_DEMO_SEND_AMC are received by Web pages connected to an APC like this.
The ID of a receiver session can be entered in the input window of the class, as shown in the executable example for receiving AMC messages. If an ID of this type is entered, the class attempts to send the messages synchronously to this receiver session only.