Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
reiner_hille-doering
Active Contributor
0 Kudos

This weblog show how you can use a so called RFC callback with SAP .NET Connector 2.0 using some desgin time features.


Of cause you can do everything also programmatically.
Note that the design time features don't work with Beta version of NCo 2.0.



1. Create a C# or Visual Basic Windows Forms application.


2. Add a new SAP Connector Proxy called "Client.sapwsdl".


3. In Server explorer go navigate to or add a SAP server. The described functions should be contained in each.


4. Add a function filter for "STFC*".


5. Drag the function "STFC_CONNECTION_BACK" to "Client.sapwsdl" designer. You can also drag other STFC functions.


6. Add another new SAP Connector Proxy called "CallbackServer.sapwsdl".


7. Click on the background of "CallbackServer.sapwsdl" designer, go to property window and change "ProxyType" to "Server".


8. Drag "STFC_CONNECTION" to "CallbackServer.sapwsdl" designer.


9. Delete "CallbackServerImpl.cs / .vb" in Solution explorer, right-click "CallbackServer.sapwsdl" and select "Run Custom Tool". This is to update CallbackServerImpl.cs".


10. Open CallbackServerImpl in Code view and delete the sample Main function (this is not needed in VB).


11. Fill the implementation of "Stfc_Connection", e.g. like this:
Echotext = Requtext;

Resptext = "Hello from Callback";


12. Compile, then open Form1 windows forms designer and drag a "Client" and a "CallbackServer" instance from the "SAP Proxy" toolbox.


13. From the Server Explorer drag your SAP server icon to create a destination to it.


14. Select the "client1" object and set the property "Connection" to the dragged destination and the property "CallbackServer" to the "callbackServer1" instance.


15. Add a button with handler like this:

string resultText, echoText, noBack;

client1.Stfc_Connection_Back("1", "Hi", out echoText, out noBack, out resultText);


16. Run in debugger and see how callbackServer1's "Stfc_Connection" method is called inside the client call.