Skip to Content
0
Jul 02, 2016 at 10:55 AM

Event execution increments every time the form is opened

66 Views

Hi everyone

Here is the Problem, I am using SAP B1 9.1 PL. 08

1) run the code

2) open form one time --> message displayed one time OK

3) close the form

4) open form second time --> message displayed one time OK

3) close the form

4) open form third time --> message displayed three times Problem

The number of messages displayed increments every time Form is opened and event viewer shows event triggered only once for the condition.

Here is the code. :

private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)

{

BubbleEvent = true;

if ((pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD) & (pVal.FormType == 150) & (pVal.BeforeAction == true))

try

{

oForm = Application.SBO_Application.Forms.Item(pVal.FormUID); // get active form initialized

Application.SBO_Application.MessageBox("hello : " + pVal.BeforeAction + " event" + pVal.EventType + " form type" + pVal.FormType + oForm.UniqueID.ToString() + " form mode " + pVal.FormMode, 1);

}

catch (Exception ex)

{

Application.SBO_Application.StatusBar.SetSystemMessage("Error : " + ex.ToString(), SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

}

}

Thanks in Advance