2

I have written some code for a program that is using the RFC .NET Connector to get the data from an SAP Server to my C# program. I have done some research what module you should use to get data from the server but I couldn't find out how to use the module.

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");
    }
}

In the SAP .NET Connector Programming Guide, it tells you can get access to the fields of a table with this code:

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

The problem is when I put that code into my program I get this error:

SAP.Middleware.Connector.RfcInvalidParameterException: "Element ADDRESSES of container metadata TABLE_ENTRIES_GET_VIA_RFC unknown"

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
brachi
  • 119
  • 1
  • 3
  • 16
  • The RFM TABLE_ENTRIES_GET_VIA_RFC also falls under these RFC_READ_TABLE variants which I mentioned in my answer here: https://stackoverflow.com/a/51464052/7337102 – Trixx Jul 22 '18 at 10:21
  • 1
    Possible duplicate of [Need Help at Getting data from SAP to C#](https://stackoverflow.com/questions/51382441/need-help-at-getting-data-from-sap-to-c-sharp) – Trixx Jul 22 '18 at 10:26

0 Answers0