SAP Anmeldung via VBA nicht mehr möglich
22.06.2015 14:51:50
Flo
wir nutzen folgendes vereinfachtes VBA Script um mittels Excel auf SAP zu connecten:
Private Sub Main()
Dim LogonControl As SAPLogonCtrl.SAPLogonControl
Dim R3Connection As SAPLogonCtrl.Connection
Dim retcd As Boolean
Set LogonControl = CreateObject("SAP.LogonControl.1")
Set R3Connection = LogonControl.NewConnection
R3Connection.Client = "600"
R3Connection.ApplicationServer = "DEV1"
R3Connection.Language = "EN"
R3Connection.User = "DsA"
R3Connection.Password = "123"
R3Connection.System = "E01"
R3Connection.SystemNumber = "01"
R3Connection.UseSAPLogonIni = True
retcd = R3Connection.Logon(0, True)
If retcd True Then
MsgBox "Logon failed"
Else
MsgBox "ok"
R3Connection.logoff
End If
End Sub
Seitdem wir nun auf den SAP GUI 740 gewechselt haben ist eine Anmeldung nicht mehr möglich. Dies ist aber nur im unsichtbaren Modus der Fall. Ändern wir den Code wie folgt ab (Anmeldung mit sichtbaren Dialogfenster) ist eine Anmeldung weiterhin möglich:Private Sub Main()
Dim LogonControl As SAPLogonCtrl.SAPLogonControl
Dim R3Connection As SAPLogonCtrl.Connection
Dim retcd As Boolean
Set LogonControl = CreateObject("SAP.LogonControl.1")
Set R3Connection = LogonControl.NewConnection
R3Connection.Client = "600"
R3Connection.ApplicationServer = "DEV1"
R3Connection.Language = "EN"
R3Connection.User = "DsA"
R3Connection.Password = "123"
R3Connection.System = "E01"
R3Connection.SystemNumber = "01"
R3Connection.UseSAPLogonIni = True
retcd = R3Connection.Logon(0, False)
If retcd True Then
MsgBox "Logon failed"
Else
MsgBox "ok"
R3Connection.logoff
End If
End Sub
Kann hier jemand helfen?Danke schon mal für eure Hilfe! :)
Grüße
Flo