I’m querying SAP using C# .NET Core, using SAPNWRFC for the first time, and I’m encountering issues with querying an RFC. Essentially, I’m calling an RFC with two parameters and retrieving the result in table T_ZSDS_IH08A, but I’m getting the following error:
SAP RFC Error: RFC_CONVERSION_FAILURE with message: T_ZSDS_IH08A of type RFCTYPE_TABLE cannot be converted to type RFC_STRUCTURE_HANDLE
Below is my code to access the RFC:
SapConfig sapConfig = new SapConfig();
string connectionString = sapConfig.SapconnectionString(ConfigurationManager.AppSettings["Ambiente"].ToString());
using var connection = new SapConnection(connectionString);
try
{
connection.Connect();
using var someFunction = connection.CreateFunction("ZRFC_IH08");
var result = someFunction.Invoke<SapFunctionResult>(new SapFuncionParameters
{
EquipmentNumber = "",
FunctionalLocation = "",
});
}
catch (Exception ex)
{
throw ex;
}
Below is my return class:
public class SapFunctionResult
{
[SapName("T_ZSDS_IH08A")]
public object table { get; set; }
}
Using SAP NCO in the .NET Framework, I used this line of code to receive the data from the table:
IRfcTable table = function.GetTable("T_ZSDS_IH08A");
My idea is to obtain the data from the table in result.table.
Gustavo Damasceno is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.