Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jan 28, 2005 at 03:21 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.