cancel
Showing results for 
Search instead for 
Did you mean: 

SBO 6.5 - AddOn - Change from one Data Base to another

Former Member
0 Kudos

Hi,

I have the following problem when I change to another Data Base that I have in the same server, without closing and opening again the SBO client, using an

AddOn.

The object used to change the Data Base for the refresh of the ADDON is “company”.

The system tells that the AddOn is now connected to the other Data Base but it doesn’t work.

This problem is regarding a company that has multi-companies that use the same AddOn, it doesn’t refresh it when I change from one Data Base to the other.

The Code use it is:

'//////////////////////////////
' Reconecta a la base de datos
'//////////////////////////////
Public Sub GEI_ReconnectToCompany()
Dim liSegs As Integer

Call DisconnectToCompany
Call Init_Connection(liSegs, "Principal")

End Sub

'//////////////////////////////
' Inicia la conexion a la base de datos
'//////////////////////////////
Private Sub Init_Connection(aiTimer As Integer, asTipoConnection As String)

Dim li_veces As Integer

If Not goCompany Is Nothing Then
If goCompany.Connected = True Then
'Call DisconnectToCompany
Exit Sub
'Else
'Call GEI_Espera(aiTimer)
End If
'Else
' Call GEI_Espera(aiTimer)
End If

Call SetApplication
If Not SetConnectionContext = 0 Then
goApp.MessageBox "Fallo de conexión a DI API"
End
End If

goApp.SetStatusBarMessage "Conectando DataInterfaces " + asTipoConnection + " ..."
li_veces = 1
Do While li_veces < 3
If ConnectToCompany = 0 Then
Exit Do
End If
'Call GEI_Espera(aiTimer)
li_veces = li_veces + 1
Loop

If li_veces >= 3 Then
goApp.MessageBox "Fallo de conexión a la base de datos"
End
End If

goApp.SetStatusBarMessage goApp.Company.UserName + ", Bienvenido a : " & goCompany.CompanyName

End Sub

Private Sub SetApplication()
Dim sConnectionString As String

Set goGuiApi = New SAPbouiCOM.SboGuiApi
sConnectionString = Command
goGuiApi.Connect sConnectionString
Set goApp = goGuiApi.GetApplication()

End Sub

Private Function SetConnectionContext() As Long
Dim sCookie As String
Dim sConnectionContext As String
Dim lRetCode As Long

Set goCompany = New sapbobscom.Company
sCookie = goCompany.GetContextCookie
sConnectionContext = goApp.Company.GetConnectionContext(sCookie)
SetConnectionContext = goCompany.SetSboLoginContext(sConnectionContext)
End Function

Private Function ConnectToCompany() As Long
ConnectToCompany = goCompany.Connect
End Function

Private Sub DisconnectToCompany()
goCompany.Disconnect
End Sub

-

-


I will like to know what I have to do to manage this.

Kind Regards,

Cristian Moreno

Accepted Solutions (1)

Accepted Solutions (1)

former_member185703
Active Contributor
0 Kudos

Hi,

You are on the right track and what you try to do is certainly supposed to work!

I think you should in addition to calling goCompany.Disconnect also set goCompany to nothing.

If this does not help, please create a message to SAP Support on SAP Service Marketplace.

I remember having maybe (I am really not sure) heard about some bug like this some months ago. If I am right, I would have been sure that this had been fixed in the meantime. (I guess you use the latest DI API version of 6.5, don't you?)

Please check which DI API patch you use...

Regards,

Frank

Answers (0)