I have an old program pushing some data from a Microsoft SQL server database to SAP. It uses Microsoft .NET Data Provider for mySAP Business Suite to connect to SAP and up to the moment it has worked perfectly.
Now, as a part of an improvement plan, I've been ask to migrate from Microsoft driver to the new SAP .Net Connector, version 3.0. Since I didn’t have any experience with either Microsoft connector neither with SAP connector, I started from the documentation. Even though I think I’ve done my homework I’m getting an error that I’m not able to solve or find any information about.
My main function:
log.Debug("Get the SAP destination")Dim destination AsRfcDestination=RfcDestinationManager.GetDestination("SAP") log.Debug("Fetch the function metadata")Dim rfcFunction AsIRfcFunction= destination.Repository.CreateFunction("Z_TEC_CAT") log.Debug("Set the import parameters")Dim am AsRfcStructureMetadata= destination.Repository.GetStructureMetadata("ZTEC_CAT")Dim exportTable AsIRfcTable= rfcFunction.GetTable("ZTEC_CAT")FillIrfTable(exportTable, invoices) log.Debug("Invoking the function Z_TEC_CAT") rfcFunction.Invoke(destination)
A helper to populate the table that I have to send to SAP HCM:
When the exportable variable is empty, I get a NO_DATA exception and everything is fine, but when the table has records, it throws:
Failed calling SAP FunctionModule Z_TEC_CAT
at SAP.Middleware.Connector.RfcConnection.ThrowRfcErrorMsg() at SAP.Middleware.Connector.RfcConnection.RfcReceive(RfcFunctionfunction) at SAP.Middleware.Connector.RfcFunction.RfcDeserialize(RfcConnection conn,IRfcIOStream stream) at SAP.Middleware.Connector.RfcFunction.RfcCallReceive(RfcConnection conn,IRfcIOStream stream, RFCID rid) at SAP.Middleware.Connector.RfcFunction.RfcCallReceive(RfcConnection conn) at SAP.Middleware.Connector.RfcFunction.Invoke(RfcDestination destination)
Does anyone know what can be happening? Any suggestion will be greatly appreciated.