Using the Logon Control to Connect to R/3 

Most controls deal directly with R/3 and therefore need a connection to the application server. To get a connection, you need to create a Logon object and call the NewConnection method on that object. The result of this call is the connection object. To log on to the R/3 System, you use the Logon control. The example code generates the window shown below:

‘ Create the Control.

Dim LogonControl As Object

set LogonControl = CreateObject ( " SAP.LogonControl.1 " )

‘ Create the connection.

Dim conn As Object

set conn = LogonControl.NewConnection

‘ Log on.

if conn.Logon (0, True) <> True then

MsgBox " Cannot log on! "

End If

 

You can set parameters for the logon process such as user name and password. See the <LOGON control SECTION> for details. Depending on the parameters you set in the Logon control, one or two dialog boxes are displayed that ask for the input needed to make the connection. One of these dialog boxes is: