on 2022 Jun 21 7:55 AM
I am using SAP B1 9.2 PL:08. I have developed Validation add-on which gets disconnected after some time. I can not predict the condition when it gets disconnected . I have used these codes for connecting UI API and DI API. Please see the below code and tell me if there is some problem in my code.
'First I connect UI API.
Public Sub SetApplication()
Dim SboGuiApi As SAPbouiCOM.SboGuiApi
Dim sConnectionString As String
Try
SboGuiApi = New SAPbouiCOM.SboGuiApi
sConnectionString = Environment.GetCommandLineArgs.GetValue(1)
SboGuiApi.Connect(sConnectionString)
SBO_Application = SboGuiApi.GetApplication()
Catch ex As Exception
WriteLog(SBO_Application.Company.ServerDate & ":" & SBO_Application.Company.ServerTime & ":" & "SetApplication()=" & ex.Message & vbNewLine & "Line=" & ex.StackTrace)
End Try
End Sub
'Then I connect DI API.
Public Sub ConnectToCompany()
Dim objProcess As Process
Try
objCompany = New SAPbobsCOM.Company
objCompany = SBO_Application.Company.GetDICompany
If objCompany.GetLastErrorDescription.Length > 0 Then
SBO_Application.MessageBox(objCompany.GetLastErrorDescription)
End If
Catch ex As Exception
WriteLog(SBO_Application.Company.ServerDate & ":" & SBO_Application.Company.ServerTime & ":" & "ConnectToCompany()=" & ex.Message & vbNewLine & "Line=" & ex.StackTrace)
End Try
End Sub
User | Count |
---|---|
94 | |
9 | |
8 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.