Get Example source ABAP code based on a different SAP table
ABAP_AMC - Receiving Messages This example demonstrates how messages are received using AMC>.
ABAP_SOURCE_CODE DEMO CL_DEMO_RECEIVE_AMC
ABAP_DESCRIPTION The local class message_receiver> implements the interfaces IF_AMC_MESSAGE_RECEIVER_TEXT>>, IF_AMC_MESSAGE_RECEIVER_BINARY>>, and IF_AMC_MESSAGE_RECEIVER_PCP>>. AMC consumers (created using the factory method CREATE_MESSAGE_CONSUMER > of the system class CL_AMC_CHANNEL_MANAGER>>) are used to register instances of this local class for the messaging channels /demo_text>, /demo_binary>, and /demo_pcp> of the application DEMO_AMC> from the package SABAPDEMOS>. It is possible to select which messages are waited for. In accordance with this selection, the WAIT>> statement creates a wait state that lasts until all corresponding fields text_message>, binary_message>, and pcp_message> have been filled in the callback routines RECEIVE> triggered by messages. The wait time is limited to a definable number of seconds. The transaction SMAMC>> displays the registered AMC consumer during the wait time. The required messages can be sent by executing CL_DEMO_SEND_AMC>> (see the executable example Sending AMC Messages>) from any current AS ABAP user session. The content of the messages is displayed once they have been received. The executable example APC, WebSocket Communication> shows how the messaging channels are linked with ABAP push channels (APC) >. The class CL_DEMO_RECEIVE_AMC> also receives messages sent from Web pages connected to an APC like this. The ID of the receiver session is displayed in the input window of the class. If this ID is entered in the executable example for sending AMC messages>, point-to-point communication is used and only this receiver session is sent.