I want to save different SAP users to a database and check with a SAP login if the input was correct. For the login, I have to use the SAP.net Connector3.0.
Procedure: click button -> enter user1 -> SAP login -> if correct: save, else errormessage -> SAP logout -> click button again-> enter user2 -> Sap login ->...and so on
My code:
Private Sub ButtonSaveUser_Click(sender As Object, e As EventArgs) Handles ButtonSaveUser.Click
Try
Dim parms As New RfcConfigParameters
parms.Add(RfcConfigParameters.User, TextBoxUser.Text)
parms.Add(RfcConfigParameters.AppServerHost, TextBoxRouter.Text)
parms.Add(RfcConfigParameters.SystemNumber, TextBoxSystemnumber.Text)
parms.Add(RfcConfigParameters.SystemID, TextBoxSystem.Text)
parms.Add(RfcConfigParameters.Password, TextBoxPasswort.Text)
parms.Add(RfcConfigParameters.Client, TextBoxClient.Text)
parms.Add(RfcConfigParameters.Language, TextBoxLanguage.Text)
parms.Add(RfcConfigParameters.Name, "Connection Name")
Dim dest As RfcDestination = RfcDestinationManager.GetDestination(parms)
Dim repo As RfcRepository = dest.Repository
' in this space is the part where I save the user information. this works.
Catch ex As Exception
MsgBox("Logon failed. " + ex.Message)
End Try
End Sub
Question: What do I have to write at the end of my code to logout or disconnect? I thought that there might be something like a 'dest.disconnect' command, but i can't find such a command.
(My problem is, that I'm new at programming and don't know how to implement the missing parts.)
If anybody could post a vb code or give any other information, that would be awesome! Thanks :)