cancel
Showing results for 
Search instead for 
Did you mean: 

Load event gets executed many times why??

Former Member
0 Kudos
71

I was trying to fill a value in a text box in Packing screen on its page load .I used the following code

   if (((pVal.FormType == 60017 & pVal.EventType== SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD) & (pVal.Before_Action == true)))

            {        

             SapApp.MessageBox("Event Started", 1, "ok", "", "");

             oForm = SapApp.Forms.GetForm("60017", 1);

              //some code

             }

But the alert box gets displayed a multiple number of times.Why is it so?? Is there any better way to handle a form on load or is the  event (.et_FORM_DATA_LOAD) i have specified here is wrong??

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

You said that you are trying to send the message on the form load (which happens when it first is displayed when you take the option off the menu) but your code is  testing Form_Data_Load.  This event triggers whenever you navigate between existing records in the DB, using the next, previous, first  & last buttons.  Is this the behavior  that you are experiencing?

Former Member
0 Kudos

Hi,

When you execute: IF (pVal.FormType == 60017), that means your current form is 60017. You don't need to get the same form again.

Thanks,

Gordon

Former Member
0 Kudos

Hi, you can try this.

Select Case pVal.Action_Success

     Case True

          Select case pVal.FormType

                    Case 60017

                         Select case pVal.EventType

                              Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD

                                   Select case pVal.BeforeAction

                                        Case True

                                        'SOME CODE

                                   End Select

                         End Select

        End Select

End Select