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
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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,
 
Upvote 0
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
 
Upvote 0
No problem. It does look as if their are issues so I hope you can fix it.


Regards,
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top