cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping an event

Former Member
0 Kudos
112

Hello,

I would like to stop processing events if some condition occurs.

I have matrix object and I would like to not update the db if this matrix contains data that is not valid upon pressing update button.

Currently I put my validation logic in OnFormDataUpdateBefore. If it returns error I set bubble event to false so it stops further processing (specifically it won't fire OnFormDataUpdateAfter where I presume data is persisted into db)

The problem is that with bubble event set to false I got some "internal error occured" error.

What happened?

Thanks in advance

Kamil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Kamil,

Or try with the Item Press event and check if u are getting the same error?

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

Thanks Vasu.

I could put it OnItemPressed event but it won't stop FormDataEvent from being fired. My goal here is to not updating db with invalid data. I could also change the data in code so it will become valid but I don't want to do that. I want the user to make necessary changes.

Or maybe there another way to achieve what I want? Again top priority for me is to not updating DB with invalid (from bussiness logic) data when user presses update button.

Thanks

Kamil

Former Member
0 Kudos

Kamil,

Did u try the following..? just some sample code sippet.

Itemevent()  ' In before action = true
   DatavalidationinMatrix()
If not datavalidated
    Bubbleevent = false
End if

Hope it helps,

Vasu Natari.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

i think form data add/update event is the right thing to handle this. you can try like below

If pVal.FormTypeEx = "140" And pVal.BeforeAction = True Then

If pVal.ItemUID = "1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then

If validate(pval) Then

BubbleEvent = True

Else

BubbleEvent = False

End If

end if

end if

Private Function validate(ByVal pval As SAPbouiCOM.ItemEvent) As Boolean

'insert your code here

return true

Former Member
0 Kudos

Thanks Vasu and Manmath.

Putting my validation logic inside ItemPressed event seems to work.

Does anyone know why putting it into FormData event results in "internal error ocurred"?

Thanks again.