Procedure
Define function Logoff ( ) that you use to disconnect from R/3 and release the resources.
Private Sub Logoff( )
If Not (oConnection Is Nothing) Then
mnuExit_Click
End If
End Sub
End the application using menu mnuExit or pushbutton cmdExit.
Private Sub mnuExit_Click()
oConnection.Logoff
Set oConnection = Nothing
Set oBAPICtrl = Nothing
MsgBox "Program finished !", 16, APPID
End
End Sub
Private Sub cmdExit_Click()
mnuExit_Click
End Sub
Check Your Work
You created a simple Visual Basic project of type "Standard EXE" to call the BAPI in the R/3 system.
Use the newly created application to call the BAPI.
Example:

A list of employee data is displayed using the Table View Control. Any problems are specified in the return parameter.