on 04-13-2007 4:00 AM
I am trying to connect to SAP in silent mode with the following syntax
in VB.Net
oConnection = oFunction.Connection
oConnection.Client = "900"
oConnection.Language = "EN"
oConnection.TraceLevel = 6
oConnection.User = mUserId
oConnection.Password = mPassword
oConnection.System = mSystem
oConnection.ApplicationServer = mApplicationServer
oConnection.Logon(0, true)
However, the function return false, i.e. failed to connect.
But if I connect using oConnection.Logon(0, false), the logon dialog box with all information pre-set pop up, and when I pressed OK, the session is logged on.
I noticed that many developers met the same problem before, and I wonder if this is owing to the library that installed on my machine. As I have tried the javascript example provided in this SDN, but still got failed in logging on to SAP in silent mode.
Could someone please help?
Thanks a lot!
VB.Net is not the final language that I would like to use. Just to have some common language to discuss with, I used VB.Net as an example.
I cannot find the caption ocx installed on my machine, but I found another one with similar name
"wdtlogU.ocx", but I cannot register this one also.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have just tried your example code on my machine and everthing works fine here.
I just added the following bits
Dim oFunction As Object
Dim oConnection As Object
oFunction = CreateObject("SAP.Functions")
Then add the end of your example I used the following
If oConnection.logon(0, True) = False Then
MsgBox(oConnection.IsConnected)
Exit Sub
Else
MsgBox("Connected")
End If
However if you have tried using javascript with no success then check that the following OCX is registered
wdtlog.OCX (it should be in your SAPGUI directory)
run the following from a command prompt
regsvr32 (path and name to wdtlog.ocx)
eg.
regsvr32 "c:\program files\sap\frontend\sapgui\wdtlog.ocx"
You might also have an issue were it is registered more than once on your machine and that is a big hunt through the registry. However we have found that using late binding (as above) seems to work.
One other point though if you are using .NET to access SAP why not use the .NET connector?
Almost forgot you could test the return code as well to see if that pinpoints an error.
In the above example the return code will be in a message box if the connection fails.
Here is a list of the ones available
1 - Connected
2 - User clicked cancel on the log on box
4 - Connection parameter missing
8 - Connection error occured
Only number 4 seems to be the most helpful.
Nath
Message was edited by:
Nathan Jones
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.