cancel
Showing results for 
Search instead for 
Did you mean: 

Troble when connecting to Company using DI

Former Member
0 Kudos

Hi All

I have trouble when try to connect to SAP B1 (in the server) via DI using my application (vb.net) from client PC. It keeps returning error message : Can not connect to Company

But it didn;t happen if I try to connect to SAP B1 (in the same server and same company) via DI from my pc (debugging using VB.net).

Can anybody help me to solve this problem?

Thanks Before

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Dear Herfin Jodana,

Could you put your connection code for investigation if the issue can not solve?

Best Regards

Jane Jing

SAP Business One Forums team

Former Member
0 Kudos

Thx for your reply,

@Eddy

My application is not an SAP add on. It just need to throw data (creating journal, AP, Credit Memo) to SAP database using DI.

So I don;t think i need add on identifier, or do i ? please advise me

@Jane

This is my connection code:


 Public Function up_SAP_Connect() As String
        'Connect
        Dim lRetCode, lErrCode As Long
        Dim sErrMsg As String = ""

        oCompany = New SAPbobsCOM.Company
        oCompany.Server = gs_SAPServer
        oCompany.CompanyDB = gs_SAPDatabase
        oCompany.UserName = gs_SAPDI_User
        oCompany.Password = gs_SAPDI_Pass
        oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005
        oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English


        oCompany.UseTrusted = False

        oCompany.DbPassword = gs_SAPPass 'gs_SAPUser
        oCompany.DbUserName = gs_SAPUser 'gs_SAPPass

        lRetCode = oCompany.Connect()

        'Check Return Code
        If lRetCode <> 0 Then
            oCompany.GetLastError(lErrCode, sErrMsg)
            If sErrMsg <> "" Then
                Return "SAP Connect Failed : " & sErrMsg
            Else
                Return ""
            End If
        End If
        Return ""
    End Function

Edited by: Rui Pereira on Dec 23, 2008 2:42 PM

Eneveux
Product and Topic Expert
Product and Topic Expert
0 Kudos

Herfin,

The issue I think that you are running into is you are using the Development Addon Identifier string in your compiled code. While this will work for running your addon in Debug mode .. it will not work for compiled (exe) code. You either need a valid add-on identifier string in your compiled code or you need to run your add-on in Compatibility Mode.

Please see the SAP Business One SDK Help Documentation and specifically the Packaging and Deployment section of the Help.

Eddy