SAP RFC not working on Windows 10 / Excel 2016

bconforto

New Member
Joined
Nov 17, 2016
Messages
30
Hello,
I developed below script in Windows 7 and Office 2010.
It is a simple RFC to connect to SAP. This is been used by many users.
Now IT is upgrading to Windows 10 / Office 2016 and same script fails in connection.
Any idea how to solve it?

The problem is in below line:

Code:
If Functions.Connection.logon(0, True) <> True Then
Exit Sub
End If
This is complete RFC code:

Code:
'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.AppendRow
    tblOptions(1, "TEXT") = "VBELV EQ '" & returnorder & "' and VBTYP_N EQ 'I' "
    tblOptions.AppendRow


    tblFields.AppendRow
    tblFields(1, "FIELDNAME") = "VBELN"


    If RfcCallTransaction.Call = True Then
        If tblData.RowCount > 0 Then
            For intRow = 1 To tblData.RowCount
            replorder = tblData(intRow, "WA")
            Next
        Else
        'MsgBox "No records returned"
        Application.StatusBar = "Waiting: " & a


        End If
    Else
    MsgBox "Error"
    End If
Functions.Connection.Logoff
Thanks for your help.
Brian
 

RickXL

MrExcel MVP
Joined
Sep 9, 2013
Messages
4,314
Hi,

Not sure but I could make a guess.

Assuming the only thing that has changed is the OS and Office versions, I would guess that the SAP Functions libraries have not been installed. If that were the case, I would expect this line to fail:
Code:
Set Functions = CreateObject("SAP.Functions")
You should be able to check whether SAP.Functions exist by searching for SAP.Functions in the windows registry using REGEDIT. That location will have one of those long, unique keys used by Windows - a GUID. Inside there, there should be a link to an InProcServer which is the .dll, or similar, that contains the functions.

Alternatively, they have installed that but the names have now changed of some of the internal functions.

Sorry I can't be more helpful.

(PS. I got the PM, by the way!)


Regards,
 

bconforto

New Member
Joined
Nov 17, 2016
Messages
30
Thanks Rick, I only took a quick look now and may be we have something good.
I will check it tomorrow if this is not so complicated.

Regards,
Brian
 

RickXL

MrExcel MVP
Joined
Sep 9, 2013
Messages
4,314
No problem. It does look as if their are issues so I hope you can fix it.


Regards,
 

Forum statistics

Threads
1,077,951
Messages
5,337,381
Members
399,144
Latest member
Lauren Ward

Some videos you may like

This Week's Hot Topics

Top