cancel
Showing results for 
Search instead for 
Did you mean: 

Object reference not set to an instance of the object

Former Member
0 Kudos

Hi

   When i install Add-on it gives message Object reference not set to an instance of the object . I am using Sap B1 2007 . PL10

I am following this tutorial

http://scn.sap.com/community/business-one-sdk/blog/2012/05/18/creating-and-registering-add-on-on-sap...

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sunny,

     It means you are using the object but you didn't declare it. Debug it line by line. Put some breakpoint in your source code.

Regards,

Former Member
0 Kudos

Hi Bryan

  Without creating Add_on if i test it it is working fine

Thanks

christophe_averous
Active Participant
0 Kudos

Hi Sunny,

This usually happen when:

1) You try to load a .xml or .srf file which is not located at the right place.

2) You use Di Api in your code and you are not connected to the Di Api.

But if your add-on works on debug I will suggest the first cause.

Regards

Christophe

Former Member
0 Kudos

Hi Christophe

    I don't have any srf file . Secondly this error comes when i go to Add-On Manager to Start this Add-On , then in the end it gives this error "Object reference not set to an instance of the Object" . It shows Status connected

Thanks

christophe_averous
Active Participant
0 Kudos

Hi Sunny,

Sounds that you are not connected to Di Api.

I give you what I use to connect to SAP in my add-on:

 

#Region "Initialisation"

    Public Sub New()
        MyBase.New()
        Try
            SetApplication()
        Catch ex As Exception

        End Try


    End Sub
    Private Sub SetApplication()
        Try
            Dim SBOUI As New SAPbouiCOM.SboGuiApi
            Dim sConnect As String = "0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056"
            If Environment.GetCommandLineArgs.Length > 1 Then
                SBOUI.Connect(Environment.GetCommandLineArgs.GetValue(1))
            Else
                SBOUI.Connect(sConnect)
            End If

            SBO = SBOUI.GetApplication
            Try
                oC = SBO.Company.GetDICompany
            Catch ex As Exception
                GC.Collect()
            End Try
            'Vérification de la connection
            If oC.Connected = True Then
                Message.Err_Me("Connexion UI/DI OK", SBO, BoStatusBarMessageType.smt_Success)

               else

               Message.Err_Me("Connexion UI/DI NOT OK", SBO, BoStatusBarMessageType.smt_Error)
            End If

        Catch ex As Exception
            Try
                Message.Err_Me("SetApplication-UI/DI", SBO, BoStatusBarMessageType.smt_Error, ex.Message)
            Catch ex1 As Exception

            End Try

        End Try

    End Sub

Regards

Christophe

Former Member
0 Kudos

Hi Sunny,

Did you create or wrote a QUERY that once the add-on starts it will automatically create a table(not the UDT) in the database?

Yan

Former Member
0 Kudos

Hi All

   No . Add-on gets connected & it shows all the fields that i created through Add-on . It adds record also.

Thanks