繁体   English   中英

SAP .NET Connector 3.0,将数据推送到SAP时出错

[英]SAP .NET Connector 3.0, error pushing data to SAP

我有一个旧程序将一些数据从Microsoft SQL Server数据库推送到SAP。 它使用Microsoft .NET Data Provider for mySAP Business Suite连接到SAP,直到它完美运行。

现在,作为改进计划的一部分,我一直要求从Microsoft驱动程序迁移到新的SAP .Net Connector 3.0版。 由于我对使用SAP连接器的Microsoft连接器没有任何经验,我从文档开始。 即使我认为我已完成作业,但我收到的错误是我无法解决或找不到任何相关信息。

我的主要功能:

    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)


有谁知道会发生什么? 任何建议将不胜感激。

谢谢,

一月

经过一个星期的再次战斗,我发现了发生了什么,我认为发布它可能会帮助其他人不要花很多时间在它上面。

看起来SAP Connector在调用中插入了一个空格(Microsoft连接器没有),因此,SAP系统无法映射我发送给它的参数(exportTable)并失败。

另一端的SAP程序员修改了这个功能,所以现在它已经知道了空间,一切正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM