开发者

Communication between SAP and C#

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 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 ret开发者_如何学Pythonrieve the data I want?


If the GetProducts function takes a parameter called for instance Category, you can set that before invoking the function:

IRfcFunction function = fRepository.CreateFunction("GetProducts");
function.SetValue("Category", "Shirts");
function.Invoke(destination);

Check out the A Spotlight on the New .NET Connector 3.0 blog entry for more details, links and examples.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜