Skip to Content

SAP RFC not working on Windows 10 / Excel 2016


I have below script to run RFC between SAP / Excel.

This has been working without problems for some time already. I developed it in Windows 7 (64 bit) and Office 2010 (32 bit), using SAP GUI 7.40 SP7. I am running it everyday in this laptop.

Now IT started upgrading all laptops to Windows 10 (64 bit) and Office 2016 (32 bit), using SAP GUI 7.40 SP13. With new laptops script is not working.

Script now exits in this line:

If Functions.Connection.logon(0, True) <> True Then
Exit Sub
End If

This is the complete Script:

'RFC to get Replacement order
Dim Functions As Object
Dim RfcCallTransaction As Object
Dim Messages As Object
Dim BdcTable As Object
Dim tblOptions
Dim tblData
Dim tblFields
Dim strExport1
Dim strExport2
Dim intRow As Integer
Dim conn As Object
Dim sap As Object
sorg = Sheets("Sheet1").Cells(2, 1).Value
StartTime = Timer
user = Sheet3.Cells(1, 2)
pass = Sheet3.Cells(2, 2)
syst = Sheet3.Cells(3, 2)
Set Functions = CreateObject("SAP.Functions")
Functions.Connection.System = syst
Functions.Connection.client = "010"
Functions.Connection.user = user
Functions.Connection.Password = pass
Functions.Connection.Language = "EN"
If Functions.Connection.logon(0, True) <> True Then
Exit Sub
End If
Set RfcCallTransaction = Functions.Add("RFC_READ_TABLE")
Set strExport1 = RfcCallTransaction.exports("QUERY_TABLE")
Set strExport2 = RfcCallTransaction.exports("DELIMITER")
Set tblOptions = RfcCallTransaction.Tables("OPTIONS")
Set tblData = RfcCallTransaction.Tables("DATA")
Set tblFields = RfcCallTransaction.Tables("FIELDS")
    strExport1.Value = "VBFA"
    strExport2.Value = ";"
    tblOptions(1, "TEXT") = "VBELV EQ '" & returnorder & "' and VBTYP_N EQ 'I' "
    tblFields(1, "FIELDNAME") = "VBELN"
    If RfcCallTransaction.Call = True Then
        If tblData.RowCount > 0 Then
            For intRow = 1 To tblData.RowCount
            replorder = tblData(intRow, "WA")
        'MsgBox "No records returned"
        Application.StatusBar = "Waiting: " & a
        End If
    MsgBox "Error"
    End If

Any idea where is the problem and how to solve it?



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers