cancel
Showing results for 
Search instead for 
Did you mean: 

SAP .NET Connector 2.0 and RFC callback

Former Member
0 Kudos

Hi,

can you explain to me, please, the way for create a simple example which calls a RFC function in SAP, with callback issue ? Does it work ?

Before, with .NET Connector 1.0 when i created a new proxy the wizard ask me if i wanted to generate asynchronous methods, and now in version 2.0 how can i do it ?

Thanks

Message was edited by: tafkap

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

In SAP, you will find an example function module names STFC_CONNECTION_BACK that was specially built for demonstrating RFC callback. During the execution of this function module, one or more calls to the function STFC_CONNECTION will be made back to the original RFC client by using the ABAP statements:

CALL FUNCTION "STFC_CONNECTION" DESTINATION "BACK"

...

The RFC client should be aware that the function might invoke callbacks and must implement the required callback functions.

Here is a step-by-step example of building a .NET RFC client that calls the above sample RFC function module with callback using .NET Connector 1.0.3 or 2.0:

1 Create a client proxy with the function STFC_CONNECTION_BACK selected as usual, say SAPProxy1

2 Create a server stub with the function STFC_CONNECTION

selected as usual, say SAPProxy2

3 Implement the server function STFC_CONNECTION:

protected override void Stfc_Connection(

string Requtext,out string Echotext,

out string Resptext)

{

Resptext = "This is function STFC_CONNECTION";

Echotext = Requtext;

Console.WriteLine("Callback get called");

}

4 Call the function module with callback

4.1 Create a SAPClient instance of class SAPProxy1

SAPProxy1 proxy = new SAPProxy1("....");

4.2 Create a SAPServer instance of class SAPProxy2 to be used as callback server

SAPProxy2 callbackServer = new SAPProxy2();

4.3 Set SAPClient's CallbackServer property to the SAPServer instance. This property is newly introduced in SAP .NET Connector 1.0.3 and 2.0

proxy.CallbackServer = callbackServer;

4.4 Call STFC_CONNECTION_BACK and specify the number of callbacks with the first parameter:

prxy.Stfc_Connection_Back("2",

"hello world",out echoText,

out countCallback,out respText);

During the call, the callback function STFC_CONNECTION will be get called twice.

Hope this helps,

Guangwei

Former Member
0 Kudos

Thanks very much for yours answers i'll try it.

reiner_hille-doering
Active Contributor
0 Kudos

You can have RFC callbacks even easier. Please see my WebLog at /people/reiner.hille-doering/blog/2004/09/30/how-to-use-sap-net-connector-callback-feature

Former Member
0 Kudos

Open the *.sapwsdl file in design mode, then right-click the design view and choose properties, to show the properties, if they are not already shown.

There you find the settings for proxy generation known from version 1.

Markus