Table Value from SAP Returns Nothing RRS feed

  • Question

  • Hi,

    Please help me with this.

    Here's my Code

     Public Shared Function GetIOData(IONumber As String)
            Dim result As New List(Of String)
            Dim RtrnVal As New PRItmDtls
            Dim strVal As String = ""
            Dim intSepartorPos As Integer = 0
            Dim strLgort As String = ""
            Dim strWerks As String = ""
            Dim rfcManager As Boolean = False
            Dim dtRow As DataRow
            Dim i As Integer = 0
            Dim notExist As Integer = 0
            Dim dtIOResult As DataTable
            Dim ds As New DataSet
            Dim IONum As String = ""
            Dim IOAmount As String = ""
            Dim IOBalance As String = ""
            Dim strMsg As String = ""
                Dim it_row As Sap.Middleware.Connector.IRfcStructure
                'rfcManager = True
                ConnSAp = RfcDestinationManager.GetDestination("NEPCLNT100")
                DTIONumber = New DataTable
                DTIONumber.Columns.Add("AUFNR", System.Type.GetType("System.String"))
                DTIONumber.Columns.Add("OBJNR", System.Type.GetType("System.String"))
                DTIONumber.Columns.Add("WTGES", System.Type.GetType("System.Double"))
                DTIONumber.Columns.Add("WTJHR", System.Type.GetType("System.Double"))
                DTIONumber.Columns.Add("RUNBAL", System.Type.GetType("System.Double"))
                dtIOResult = New DataTable
                dtIOResult.Columns.Add("IONumber", System.Type.GetType("System.String"))
                dtIOResult.Columns.Add("RunBal", System.Type.GetType("System.String"))
                dtIOResult.Columns.Add("IOamount", System.Type.GetType("System.String"))    'RN 201906.001 SDC 07.02.2019
                'rfcdtIONumber.SetValue("AUFNR", element(objCols(3)).ToString)
                rfcdtIONumber.SetValue("AUFNR", IONumber.ToString)
                SAPTRANS.SetValue("LT_AUFNR", rfcdtIONumber)
                SAPTRANS.SetValue("LT_ASSETS", rfcdtAsset)
                If Not rfcdtIONumber Is Nothing Then
                    rfcIOReturn = SAPTRANS.GetTable("LT_OBJNR") 'returns nothing
                    If rfcIOReturn.RowCount > 0 Then
                        dtRow = dtIOResult.NewRow
                        For Each it_row In rfcIOReturn
                            dtRow("IONumber") = it_row.GetValue("AUFNR")
                            dtRow("RunBal") = it_row.GetValue("RUNBAL")
                            dtRow("IOAmount") = it_row.GetValue("WTGES")    'RN 201906.001 SDC 07.02.2019
                            IONum = it_row.GetValue("AUFNR")
                            IOAmount = it_row.GetValue("WTGES")
                            IOBalance = it_row.GetValue("RUNBAL")
                    End If
                    RtrnVal.IONumber = IONum
                    RtrnVal.IOAmount = IOAmount
                    RtrnVal.RunBal = IOBalance
                    RtrnVal.ErrMsg = ""
                    RtrnVal.ErrMsg = "Failed connecting to SAP. Retrieving the IO data failed."
                End If
                RtrnVal.ErrMsg = strMsg
            Catch ex As Exception
                RtrnVal.ErrMsg = ex.Message
                rfcdtmattr = Nothing
                rfcmatdoc = Nothing
                rfcdtIONumber = Nothing
                rfcIOReturn = Nothing
                rfcdtAsset = Nothing
                rfcAssetReturn = Nothing
            End Try
            Return RtrnVal
        End Function

    • Moved by Alex-KSGZ Wednesday, August 7, 2019 6:54 AM
    Tuesday, July 2, 2019 5:33 AM

All replies

  • Hi,

    Is SAP a third-party dll?

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 3, 2019 2:05 AM