0
Completed

Communication between SAP and C#

Elena kretova 3 months ago • updated by Adam van Vliet (Product Manager) 3 months ago 1

I'm just a beginner and I'm trying to understand the communication between SAP and for example a C# application using the SAP-connector. I've searched numerous sites, but I really can't find an answer to my question! I hope someone here can help me.

I have a function in SAP for example getProducts(String = " "). This function works perfectly in SAP, it is not written by me and I don't have access to it so I can't give you any code (I'm sorry). I have to communicate with SAP HCM using a C# application.

What I want to do is give SAP a parameter, for example "Shirts". And SAP will give back all the shirts. I can't do this with Function.GetValue() (or at least I think I can't) because GetValue only expects integers. But if I enter GetValue(0), it gives me all the products (which is normal) and not just the shirts.

This is the code I use to get the data:

IRfcFunction function = fRepository.CreateFunction("GetProducts");
function.Invoke(destination);
String products = function.GetValue(0).ToString();
result = Functions.Instance.GetData(result);

Is there a way to give a string parameter (instead of an integer, in this case 0) to the SAP-function and retrieve the data I want?

Answer

Answer
Completed

Hi Elena,

I'm not too sure. The way we call into SAP is via .NET proxy's generated by Visual Studio 2008 - from the SAP wsdl. It gives us a nice set of strongly typed objects that correctly match the function definition.

Thanks.

Answer
Completed

Hi Elena,

I'm not too sure. The way we call into SAP is via .NET proxy's generated by Visual Studio 2008 - from the SAP wsdl. It gives us a nice set of strongly typed objects that correctly match the function definition.

Thanks.