According to article Step by step tutorial to use SAP .NET Connector with VS 2008 [closed], I tried to connect and run a query. In VS Microsoft Visual Studio Professional 2022 it is not working.
Unable to start connection to SAP software with SAP .NET Connector.
Thank you for any help !
System.InvalidCastException
HResult=0x80004002
Nachricht = Das Objekt des Typs "SAP_Connect.ECCDestinationConfig" kann nicht in Typ "SAP.Middleware.Connector.IDestinationConfiguration" umgewandelt werden.
Code:
ECCDestinationConfig cfg = new ECCDestinationConfig();
RfcDestinationManager.RegisterDestinationConfiguration((IDestinationConfiguration)cfg);
RfcDestination dest = RfcDestinationManager.GetDestination("mySAPdestination");
RfcRepository repo = dest.Repository;
IRfcFunction testfn = repo.CreateFunction("BAPI_XBP_REPORT_SEARCH");
testfn.Invoke(dest);
var companyCodeList = testfn.GetTable("REPORTS");