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:
This is complete RFC code:
Thanks for your help.
Brian
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