Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Revisit To error : An attempt was made to reference a token that does not exit

Hallo  Experts ,

I  encounter this error " An attempt was made to reference a token that does not exit"    every time  i run an addon i have  created . I have also looked  at  this link   Re: UI-Error: An attempt was made to reference a token that does not exit ?  and adopted  @Owen Slater Mar 11, 2007 9:20 PM  response   marked  as correct answer so i added the Thread.Sleep(10)    as shown in my code  but nothing  happens . Kindly help .

Public Sub SetApplication()

        '*******************************************************************

        '// Use an SboGuiApi object to establish connection

        '// with the SAP Business One application and return an

        '// initialized appliction object

        '*******************************************************************

        Dim SboGuiApi As New SAPbouiCOM.SboGuiApi

        Dim sConnectionString As String

        SboGuiApi = New SAPbouiCOM.SboGuiApi

        '// by following the steps specified above, the following

        '// statment should be suficient for either development or run mode

        sConnectionString = Environment.GetCommandLineArgs.GetValue(1)

        '// connect to a running SBO Application

        Try ' If there's no active application the connection will fail

            SboGuiApi.Connect(sConnectionString)

            'Suggestion  to given in  this link    

            Thread.Sleep(10)

        Catch ' Connection failed

            System.Windows.Forms.MessageBox.Show("No SAP Business One Application was found")

            End

        End Try

        '// get an initialized application object

        SBO_Application = SboGuiApi.GetApplication()

    End Sub

Former Member
Not what you were looking for? View more on this topic or Ask a question