Asynchronous MethodsClient applications support asynchronous method invocations. The main benefit of this is that your SAP client application remains responsive even when the RFC call is taking some time.
Many areas of the .NET framework support asynchronous programming. SAP .NET Connector classes are built in C# and take advantage of many .NET features including asynchronous method invocations. Asynchronous programming techniques are important with SAP RFC calls as some calls can take a long time to complete. During this time, a single threaded client application seems to be unresponsive as the main thread of execution is waiting for the SAP method call to complete. Many RFC calls happen very quickly and the user may not notice, others may take some time and the application appears to be unresponsive.
With .NET Connector, we can take advantage of many features of the Microsoft Common Language Runtime (CLR) including support for easy asynchronous programming. This powerful feature is not available on any other SAP connector at this time. In all other connectors, BAPI and RFC calls are synchronous calls.
The Asynchronous method calls use the standard .NET delegate callback mechanism. It provides the programmer with a familiar and powerful way of performing asynchronous calls in the SAP Client application.
When we use asynchronous methods from the .NET Connector wizard, the proxy contains two additional methods for each RFC: Begin<RFC Name> and End<RFC Name> and three additional variables to manage the asynchronous result.
When Begin<RFC Name> is called, CLR queues the request and returns immediately to the caller. The target method will be on thread from the thread pool. The original thread is free to continue executing in parallel to the target method. If a callback has been specified on Begin<RFC Name>, it will be called when the target method returns. In the callback, the End<RFC Name> method is used to obtain the return value and the in/out parameters. If the callback was not specified on Begin<RFC Name>, then End<RFC Name> can be used on the original thread that submitted a request.