cancel
Showing results for 
Search instead for 
Did you mean: 

Calling .net function from SAP.

Former Member
0 Kudos

Hi,

I am using SAP .NET connector to call BAPIs required for my .NET application. However, I need to initiate a method in .NET from SAP side, using a return interface. I have read other threads on this forum, but i have had no luck so far. Can you help me out on this? Does my SAP server and .NET server have to be in the same domain to do so? what are the other requirements for that?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Basically I am a .NET programmer, but this DB multi-connect feature of ABAP sounds good. That way, no calls to RFC server are required. Can I get some more information and/or links on this DB multi-connect feature of ABAP. And will I be able to update data in MSSQL server databse from within my ABAP program?

reiner_hille-doering
Active Contributor
0 Kudos

> Basically I am a .NET programmer, but this DB

> multi-connect feature of ABAP sounds good. That way,

> no calls to RFC server are required. Can I get some

> more information and/or links on this DB

> multi-connect feature of ABAP. And will I be able to

Best you ask in the ABAP forum.

> update data in MSSQL server databse from within my

> ABAP program?

Yes.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you for your prompt reply, but I wasnt really talking about callbacks. Let me reframe my question and make it detailed.

I am working for a project where we are required to communicate with an SAP application server which is located at client end. Now, whenevr a particular table in SAP gets updated, the changes have to be reflected in the .NET application and hence our SQL server database as well. To do so, we have decided to go ahead with Change document approach. Please suggest a better solution if there is any.

Assuming that we are going ahead with the Change document approach, some program from SAP side should be able to call a function in my .NET project and send the necessary data to it. Eventually, this .NET function would push across that data in SQL server database.

Can I have a detailed procedure to do so? To do so, do the servers have to be in the same domain/LAN network? Because in this case, both the servers are located in different countries altogether.

I understand that I'll have to create a TCP/IP destination on SAP side with a program Id and pass command line parameters from my .NET program for it to register itself on SAP server. But I am not sure of the entire procedure.

In the process of writing .NET program, do I have to write some special code in my method, or do I have to use the readymade method provided by my proxy class? How does this entire thing work exactly?

Awaiting your reply and thank you in advance.

reiner_hille-doering
Active Contributor
0 Kudos

You proposal should work, it is called "RFC Server". You need one or more function interfaces (this is a function module, where the ABAP implementation can be empty). You create a .NET Server stub from this. You will you .NET code that handles the function's behavior in the *Impl.cs/vb. RFC Servers don't require in the same Windows Domain as the ABAP server, because the authenticaion is typically done via Username/Password or SNC.

You find samples of RFC servers with the NCo installation package (installed to c:\Program Files\SAP .NET Connector 2.0\Samples).

An alternative is not using .NET Connector at all, but instead write some ABAP code and use ABAP's "Multi DB Connect" feature, that allows to talk to addinal databases directly from ABAP.

reiner_hille-doering
Active Contributor
0 Kudos

It sounds if you want to use RFC callbacks.

For this, the function/BAPI that you call from .NET contains a call back to .NET using a pseudo ABAP destination "BACK". It's easy to use from .NET side: Create a second proxy and change it's ProxyType to "Server" (click on background of the designer and look in properties window). Populate this designer with the function/functions that are called back.

In the client proxy pass an instance of you server proxy to property "CallbackServer".

My WebLog /people/reiner.hille-doering/blog/2004/09/30/how-to-use-sap-net-connector-callback-feature describes and example.