Skip to Content
0
Nov 08, 2018 at 12:00 PM

RFC_READ_TABLE In Visual Basic

797 Views Last edit Nov 11, 2018 at 06:53 AM 3 rev

Hi experts, I was trying to use the RFC_READ_TABLE more than once but I couldn't

I have this code:

Set Functions = CreateObject("SAP.Functions") Functions.Connection.System = "Tenaris - TEST" 'Ambiente en SAP

Functions.Connection.client = xxxx

Functions.Connection.user = xxxx

Functions.Connection.Password = xxxx

Functions.Connection.Language = xxxx

Set RfcCallTransaction = Functions.Add("RFC_READ_TABLE")

Set strExport1 = RfcCallTransaction.exports("QUERY_TABLE")

Set strExport2 = RfcCallTransaction.exports("DELIMITER")

Set strExport3 = RfcCallTransaction.exports("NO_DATA")

Set strExport4 = RfcCallTransaction.exports("ROWSKIPS")

Set strExport5 = RfcCallTransaction.exports("ROWCOUNT")

Set tblOptions = RfcCallTransaction.Tables("OPTIONS")

Set tblFields = RfcCallTransaction.Tables("FIELDS")

Set tblData = RfcCallTransaction.Tables("DATA")

strExport1.Value = xxxx

strExport2.Value = xxxx

strExport3.Value = xxxx

strExport4.Value = xxxx

strExport5.Value = xxxx

tblOptions.AppendRow

tblOptions(1, "TEXT") = xxxx

tblFields.AppendRow

tblFields(1, "FIELDNAME") = xxx

If RfcCallTransaction.Call = True Then

If tblData.ROWCOUNT > 0 Then

Dim DatTxt, OutputTxt As String

For intRow = 1 To tblData.ROWCOUNT

VG = tblData(intRow, "WA")

Next

Else

MsgBox "No records returned"

End If

Else MsgBox "Error en la Query"

End If

I need to made more than one query but without logoff, do you know if there's some how to do it?