我有一箇舊程序將一些數據從Microsoft SQL Server數據庫推送到SAP。它使用Microsoft .NET Data Provider for mySAP Business Suite連接到SAP,直到它完美運行。SAP .NET Connector 3.0,將數據推送到SAP時出錯
現在,作爲改進計劃的一部分,我一直要求從Microsoft驅動程序遷移到新的SAP .Net連接器3.0版。由於我沒有任何Microsoft Connector和SAP連接器的使用經驗,所以我從文檔開始。儘管我認爲我已經完成了作業,但是出現了一個我無法解決或找到任何信息的錯誤。
我的主要功能:
log.Debug("Get the SAP destination")
Dim destination As RfcDestination = RfcDestinationManager.GetDestination("SAP")
log.Debug("Fetch the function metadata")
Dim rfcFunction As IRfcFunction = destination.Repository.CreateFunction("Z_TEC_CAT")
log.Debug("Set the import parameters")
Dim am As RfcStructureMetadata = destination.Repository.GetStructureMetadata("ZTEC_CAT")
Dim exportTable As IRfcTable = rfcFunction.GetTable("ZTEC_CAT")
FillIrfTable(exportTable, invoices)
log.Debug("Invoking the function Z_TEC_CAT")
rfcFunction.Invoke(destination)
一個輔助填充,我要發送到SAP表:
Private Sub FillIrfTable(ByVal sapTable As IRfcTable, ByVal dt As DataTable)
log.Debug("Started FillIrfTable")
For Each row As DataRow In dt.Rows
sapTable.Append()
Dim index As Integer = 0
Do While (index < dt.Columns.Count)
Dim columName As String = dt.Columns.Item(index).ColumnName
Dim columnValue = row.Item(index)
sapTable.SetValue(columName, columnValue)
index = (index + 1)
Loop
Next
log.Debug("Completed FillIrfTable")
End Sub
當導出變量是空的,我得到一個NO_DATA異常並且一切正常,但是當表有記錄時,它會拋出:
Failed calling SAP Function Module Z_TEC_CAT
SAP.Middleware.Connector.RfcAbapException: BDC_OPEN_ERROR
at SAP.Middleware.Connector.RfcConnection.ThrowRfcErrorMsg()
at SAP.Middleware.Connector.RfcConnection.RfcReceive(RfcFunction function)
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)
有誰知道什麼能發生?任何建議將不勝感激。
謝謝
月