Skip to Content
0
Sep 23, 2018 at 09:12 PM

Differentiating add and update item event

328 Views Last edit Sep 24, 2018 at 08:40 AM 2 rev

While developing an addon i need to differentiate between form add and update mode

here is my code for add option -

private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
    {
        BubbleEvent = true;
        if (((pVal.ItemUID == "1") & (pVal.EventType == SAPbouiCOM.BoEventTyes.et_ITEM_PRESSED) & (pVal.Before_Action == false)))
        {
            if(oForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE)
            {
             // code for adding values
             }
         }

and here is my code for update -

 if (((pVal.ItemUID == "1") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) & (pVal.ActionSuccess == true)))
        {
            if ((oForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE))
            {
               //   code for update
            }
        }
   }

while add block is working fine and update block isn't.

The control doesn't enter the below mention update block.

 if ((oForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE))
            {
               //   code for update
            }  

If i remove the above block ( boformmode=update mode ) and directly write my update code under actionsucces = true, i am able to update my field values, but it contradicts with the find button.

I am using a single button with id = 1;

how should i manage my requirement ?? Any valuable inputs ?? please suggest !!

Thank You

Ranu Vijay