Skip to Content

Excel cannot connect to Server

Hi, Everybody

I have several thousand Journal Entries to post in SAP B1.

This is a one time job, so I don't want to spend too much time developing a complete add-on.

I got a quick and nice solution on the web:

e-tanit.blogspot.com/

http://e-tanit.blogspot.com/2012/07/journal-entries-in-sap-business-one.html?m=1

Journal entries in SAP Business one with Excel

The trick is to put the Journal Entries in 2 Excel worksheets: one for header, one for rows, and to use VBA and DI API to post the Journal Entries.

But I could not connect to the server. Here is my code in the VBA module:

Public Sub login()
    
    Set oCompany = New SAPbobsCOM.Company  'initialate DI company object
    oCompany.DbServerType = dst_MSSQL2008
    oCompany.Server = "KLSAP"
    oCompany.DbUserName = "sa"
    oCompany.DbPassword = "78910"
    oCompany.CompanyDB = "ABCDLTD"
    oCompany.UserName = "Manager"
    oCompany.Password = "ABCD"
      
     lRetCode = oCompany.Connect
     If lRetCode <> 0 Then
            sErrMsg = oCompany.GetLastErrorDescription
            MsgBox (sErrMsg)
      Else
            MsgBox ("Connected to: " & oCompany.CompanyName)
        End If
End Sub

It gives the following error message:

"Failed to connect to SBO Common"

Can anybody tell me what's wrong with the code?

Is there any connection detail I missed?

Thanks

Leon

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 31, 2017 at 01:11 PM

    Hi Leon,

    Check the following:

    1. Try to insert LicenseServer or SLDServer property in DI API code and check the connection again.

    2. Check whether the same VB code can be used in Visual Studio to make the company connection?

    Let us know the results!

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Leon,

      Check the MS Excel is 64-Bit or 32- Bit?

      If 64-Bit, probably you need to refer to 64-Bit DI API reference. Otherwise, tell us what is the error that you are having?

      Kind regards,

      ANKIT CHAUHAN

      SAP SME Support