Get Example source ABAP code based on a different SAP table
ABAP_APC - Creating a Detached Client This example demonstrates how a detached client is created for the WebSocket protocol.
ABAP_SOURCE_CODE DEMO CL_DEMO_APC_DETACHED_CLIENT
ABAP_DESCRIPTION This example demonstrates how an ABAP program can create a detached APC client for the WebSocket protocol.
The local class apc_handler, which implements the interface IF_APC_WSP_EVENT_HANDLER_PCP, is used as the handler class. The method on_open gets a connection handle for the connection. The other methods are not needed.
CL_APC_WSP_CLIENT_CONN_MANAGER is used to create a detached client object as an APC server for the current AS ABAP. It is possible to select which of the two ABAP push channels, DEMO_APC_PCP or DEMO_APC_PCP_STATEFUL, from the executable example AS ABAP as WebSocket Server is used. The server can also be instructed to send its messages using ABAP messaging channels. The method CONNECT_AND_DETACH is used to create a detached client for the ABAP push channel.
The connection handle obtained in the method on_open of the handler class can either be displayed or used immediately in the class to create an attached client for the detached client.
A connection handle in the output can be copied and used in the class of the executable attached client example.
If not, the method ATTACH of the class CL_APC_WSP_CLIENT_CONN_MANAGER is used to create an attached client object for the connection handle. Its message manager is then used to create a message in PCP format and send it. A breakpoint in the method ON_MESSAGE of the APC handler class CL_APC_WSP_EXT_DEMO_APC_PCP can be used to monitor the arrival and processing of the message. The reaction to custom messages is prevented here. If the message is sent using AMC, the response from the server is received by all associated AMC receivers. The attached client cannot itself wait for the response.