on 10-24-2008 8:50 AM
I have following code to connect from VBA to R3
If I use SilentLogon = True, It will be fail.
If I use SilentLogon = False, logon screen will popup, directly click logon will be fail too.
If I use SilentLogon = False, logon screen will popup and I select the existing system that I have, fill all the same information in this code and logon, the connection run successfully.
In this situation where I'm wrong ?
Can I debug to see which parameter I typed wrong ?
Thank you.
Halomoan
Sub connectR3()
Set LogonControl = CreateObject("SAP.LogonControl.1")
Set R3Connection = LogonControl.NewConnection
R3Connection.Client = "130"
R3Connection.ApplicationServer = "10.10.6.10"
R3Connection.Language = "EN"
R3Connection.User = "user1"
R3Connection.Password = "tiger"
R3Connection.System = "00"
SilentLogon = True
retcd = R3Connection.Logon(0, SilentLogon)
If retcd <> True Then
MsgBox "Logon Failed"
else
Msgbox "Logon Success"
R3Connection.Logoff
End if
End Sub
too much to think about, just use this:
Set FunctionCtrl = CreateObject("SAP.Functions")
Set SapConnection = FunctionCtrl.Connection
SapConnection.client = "<Client>"
SapConnection.user = "<logon user>"
SapConnection.password = "<Logon Password>"
SapConnection.language = "EN"
SapConnection.HostName = "<hostanme>"
SapConnection.SystemNumber = "<SySnr>"
If Not SapConnection.Logon(0, True) Then
msgbox ("not Connected")
else
msgbox ("connected")
End If
SapConnection.logoff
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.