Procedure
Program the logon procedure and connect to the R/3 system using the Function Control.
Private Sub cmdLogon_Click()
'
'Set connection object (Property of FunctionCtrl)
'
Set sapConnection = FunctionCtrl.Connection
'
'Logon with initial values
'
sapConnection.Client = "000"
sapConnection.User = "SAPUser"
sapConnection.Language = "DE"
If boolLogon = False Then
If sapConnection.Logon(0, False) <> True Then 'logon with dialog
Set sapConnection = Nothing
boolLogon = False
MsgBox "No connection to R/3 !"
Exit Sub
Else
boolLogon = True
cmdLogon.Caption = "SAP &Logoff"
cmdFunction.Enabled = True
cmdSysInfo.Enabled = True
End If
Else
sapConnection.Logoff 'Disconnect from R/3
MsgBox "Disconnect from R/3 !"
boolLogon = False
cmdLogon.Caption = "SAP &Logon"
cmdFunction.Enabled = False
cmdSysInfo.Enabled = False
End If
End Sub
Also implement the system info:
Private Sub cmdSysInfo_Click()
sapConnection.SystemInformation
End Sub
How to Continue
Exercise 4: Call Function Module