使用TABLE_ENTRIES_GET_VIA_RFC将数据从SAP获取到C#

时间:2018-07-18 07:17:20

标签: c# .net sap sap-connector saprfc

我已经为使用RFC .NET连接器将数据从SAP Server获取到我的C#程序的程序编写了一些代码。我已经做过一些研究,应该使用哪个模块从服务器获取数据,但是我找不到如何使用该模块的方法。

RFCConnector.cs:

class RFCConnector
{
    RfcDestination dest = RfcDestinationManager.GetDestination("SAPServer");

    public void Ping()
    {
        dest.Ping();
        Console.WriteLine("Ping erfolgreich.");
    }

    public void GetData(string module)
    {
        IRfcFunction function = dest.Repository.CreateFunction(module);
        Console.WriteLine("Verbindung erfolgreich aufgebaut zu Module: " + module);
    }
}

Program.cs:

class Program
{
    static void Main(string[] args)
    {
        RFCConnector connector = new RFCConnector();

        connector.Ping();

        connector.GetData("TABLE_ENTRIES_GET_VIA_RFC");
    }
}

SAP .NET Conenctor Programming Guide中,它告诉您可以使用以下代码访问表的字段:

IRfcTable addresses = function["ADDRESSES"].GetTable();
Console.WriteLine("STREET");
for (int index = 0; index < addresses.RowCount; ++index)
{
    Console.WriteLine(addresses[index]["STREET"].GetString());
}

问题是,当我将该代码放入程序时,出现此错误:

  

SAP.Middleware.Connector.RfcInvalidParameterException:“容器元数据TABLE_ENTRIES_GET_VIA_RFC的元素地址未知”

0 个答案:

没有答案
相关问题