Procedure
Write the logon procedure using the Logon( ) function. Define a connection object and establish a connection to the R/3 System.
Private Function Logon() As Boolean
'
'Logon with initial data
oConnection.Client = "000"
oConnection.User = "SAPUser"
oConnection.Language = "EN"
'
'Performing a remote logon to the R/3 System
If oConnection.Logon(0, False) <> True Then 'Logon with dialog
Set oConnection = Nothing
Logon = False
MsgBox "No access to R/3 System", vbOKOnly, APPID
End
Else
Logon = True
End If
End Function
Private Sub cmdLogon_Click()
If boolLogon = False Then
Logon 'connect to R/3
boolLogon = True
cmdLogon.Caption = "&Logoff 'Switch keys and menues
mnuLogon.Caption = "&Logoff"
txtFirstName.Visible = True
txtLastName.Visible = True
cmdList.Enabled = True
mnuEmployeeList.Enabled = True
Else
Logoff 'Disconnect from R/3
boolLogon = False
End If
End Sub
Private Sub mnuLogon_Click()
cmdLogon_Click
End Sub
How to Continue
Exercise 4: Call BAPI Method