Skip to Content

Updating Matrix On a System Form

Hello Everyone,

I am trying to update a matrix that exist in a SAP Business One system form. I open the form in SAP Business One Studio and than create project in Visual Studio 2010 to work on the system form. I followed the methods I saw in the forums but I get an error at the beginning. The error is "system nullreferenceexception object reference not set to an instance of an object" (first line of the try block). Also if I remove the exception handler, I get the error "Addon 90000002 failed with exception; Event type 6" in SAP B1. This is the first time I work on a system form therefore I assume that I am missing some technical requirements in the code or project settings. Also If I remove the first 2 lines of the try block code works fine.

Could you please help me with this issue

private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)

        {

            BubbleEvent = true;

            try

            {

                SAPbouiCOM.Form oForm = SBO_Application.Forms.Item(pVal.FormUID);

                SAPbouiCOM.Matrix oMatrix = oForm.Items.Item("35").Specific as SAPbouiCOM.Matrix;

              

                Application.SBO_Application.MessageBox("Hello o World");

            }

            catch (Exception e) {

                Application.SBO_Application.MessageBox(e.ToString() );

            }

        }

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 26, 2014 at 02:00 AM

    Hi Atilla,

    Can you try

                    SAPbouiCOM.Form oForm = Application.SBO_Application.Forms.Item(pVal.FormUID);

                    SAPbouiCOM.Matrix oMatrix = oForm.Items.Item("35").Specific as SAPbouiCOM.Matrix;

                 

                    Application.SBO_Application.MessageBox("Hello o World");

    Regards
    Edy

    Add comment
    10|10000 characters needed characters exceeded

    • Edy Simon Atilla Aykut Genç

      Hi Atilla,

      Your problem is you have declared SBO_Application twice.

      1. Once in your Application Class, which is the one you had initialized with the connection,

      2. The other one is in this EventHandling class. You do not need this one since it is not initialized.

      You have to always refer the SBO_Application declared in your Application class.

      Regards

      Edy