Skip to Content

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

SBO Item Events Problem/Solution

Hi people. Well I have been doing Add Ons only for the past 2 weeks now but I have got up and running pretty fast. However I was running into a bit of problems with cathing Item Events from SBO cos I would add my items to an existing form without any trouble but then the changes just would not stick cos on testing i open the form and the items are there on form load but then close and open the form and the items are no longer there and events were just not being caught. The solutions was that i was catching my events wrong e.g:

        If (<i>pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD</i>) Then
            If pVal.FormType = 150 Then
                oForm = SBO_Application.Forms.GetForm(pVal.FormType, pVal.FormTypeCount)
                '//Add my items
                'add caption
                oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_STATIC)
                oItem.Top = 67
                oItem.Left = 275
                lblBranch = oItem.Specific
                lblBranch.Caption = "Caption"
           End If
      End If

The solution came in just adding this:

        If (<i>pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And Not pVal.Before_Action</i>) Then
            If pVal.FormType = 150 Then
                oForm = SBO_Application.Forms.GetForm(pVal.FormType, pVal.FormTypeCount)
                '//Add my items
                oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_STATIC)
                oItem.Top = 67
                oItem.Left = 275
                lblBranch = oItem.Specific
                lblBranch.Caption = "Caption"
           End If
      End If

Well hope it helps someone!

Former Member
replied

I would do a bit different if I was you...

oForm = SBO_Application.Forms.GetForm(pVal.FormType, pVal.FormTypeCount)

works better with (Using other events)

oForm = SBO_Application.Forms.Item(FormUID);

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question