cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic oCompany

Former Member
0 Kudos

Hello

I need help to do Dynamic oCompany, actually im connect with the information of only one company with this code.

    Public Sub ConnectCompany()


        oCompany = New SAPbobsCOM.Company()

        oCompany.Server = "SERVER_NAME"

        oCompany.DbUserName = "USER_DB"

        oCompany.DbPassword = "DB_PASSWORD"

        oCompany.CompanyDB = "NAME_OF_DB"

        oCompany.UserName = "USER"

        oCompany.Password = "PASSWORD"

        oCompany.LicenseServer = "localhost:30000"

        oCompany.UseTrusted = False

        oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2012

        oCompany.language = BoSuppLangs.ln_English

But i need connect to diferent company, for example my add-on have to run on different company

Accepted Solutions (0)

Answers (2)

Answers (2)

edy_simon
Active Contributor
0 Kudos

Hi,

If you need to connect to 2 company under the same server and the same version.

Public oCompany as SAPbobsCOM.Company

Public oCompany2 as SAPbobsCOM.Company

  Public Sub ConnectCompany()


        oCompany = New SAPbobsCOM.Company()

        oCompany.Server = "SERVER_NAME"

        oCompany.CompanyDB = "NAME_OF_DB"

        oCompany.UserName = "USER"

        oCompany.Password = "PASSWORD"

        oCompany.LicenseServer = "localhost:30000"

        oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2012

          oCompany.Connect

        oCompany2 = New SAPbobsCOM.Company()

        oCompany2.Server = "SERVER_NAME"

        oCompany2.CompanyDB = "NAME_OF_DB2"

        oCompany2.UserName = "USER2"

        oCompany2.Password = "PASSWORD2"

        oCompany2.LicenseServer = "localhost:30000"

        oCompany2.DbServerType = BoDataServerTypes.dst_MSSQL2012

          oCompany2.Connect

Regards

Edy

Former Member
0 Kudos

Hi Jesus,

There was a similar question last weekend about this, please see: http://scn.sap.com/thread/3763144

Issue is not to have the addon to connect (simultaneously or separately) on various servers, issue is that they have to be of the same DI version.

From your sample (too much data provided), you can make parameters from everything and to read them from a configuration file.

Regards,

Eric