Hi All,
I have a macro which works fine when I run it from my local computer. Unfortunately, it fails to connect to SAP when I try to run it from SAP as a citrix application.
What I mean by "Citrix application" is that I open SAP from the Citrix website. Next, I upload the Excel file with macro to SAP. Lastly, I open and run the macro from SAP. This has always worked for VBA/SAP Script macro's.
Any ideas?
Code:
Function Logon_SAP()
Dim wsS As Worksheet
Set wsS = ThisWorkbook.Worksheets("Settings")
Set oSAP = CreateObject("SAP.Functions")
With oSAP.Connection
.system = wsS.Cells(3, 6)
.client = wsS.Cells(3, 1)
.user = wsS.Cells(3, 2)
.Password = wsS.Cells(3, 3)
.Language = wsS.Cells(3, 4)
.hostname = wsS.Cells(3, 5)
.systemnumber = wsS.Cells(3, 7)
If .Logon(1, True) = False Then
MsgBox "Could not connect to SAP using provided details", vbCritical, "BAPI connection error"
End
Else
MsgBox ("Connection OK.")
End If
End With
End Function