Welcome to the UNIFY Solutions UserEcho forum!

This general forum is for general feedback.

Communication between SAP and C#

Elena kretova 6 years ago updated by Adam van Vliet 6 years 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");
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?

Adam van Vliet 6 years ago

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.