cancel
Showing results for 
Search instead for 
Did you mean: 

Stop execution of item master

Former Member
0 Kudos

I want to make some fields mandatory in item master.

For this I am tracking the click event when the user clicks

on Update or Save button.I have displayed message

but I can not stop the execution of item master.

I want to stop its execution once the message

is displayed.After my message the item is getting updated

and message is displayed as

"Operation completed successfully"

I am using following code-


Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
        Dim btnSave As SAPbouiCOM.Button
        Dim txtUserText As SAPbouiCOM.EditText

        If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.Action_Success = True And pVal.FormType = "150" And pVal.ItemUID = "1" Then
            objForm = SBO_Application.Forms.GetFormByTypeAndCount(150, 1)
            btnSave = objForm.Items.Item("1").Specific
            If btnSave.Caption = "Update" Then
                txtUserText = objForm.Items.Item("79").Specific
                If txtUserText.Value = "" Then
                    SBO_Application.StatusBar.SetText("Please enter User Text ", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                End If
            End If
        End If
    End Sub

Accepted Solutions (1)

Accepted Solutions (1)

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

Actually you don't need check the mandotary field and stop the execution in Update, the validation for mandotary field has better be done in event et_Validate.

'et_Validate handler of mandotary filed
If mandor_field= "" Then
     MessageBox("Enter the text for**")
     'Set the bubble event as false, thus the end user can leave the focus of the mandotary field
     BubbleEvent = False
End If

Kind Regards

-Yatsea

Answers (1)

Answers (1)

Former Member
0 Kudos

When you cannot save the item, set bubbleevent to false in your code or use transaction notification for this.

Former Member
0 Kudos

Peter,

I tried bubble event but it did not worked. I tried

objCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)

but it did not worked.

Former Member
0 Kudos

try the condition as

If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.Before = True And pVal.FormType = "150" And pVal.ItemUID = "1" Then

I never used this type of actions in sbo (im using trsancation notfication), but I saw here in conference few threads that with adding or updating isnt the itemevent the right choice. Try the changed condition or search in history (how to prevent add)

Former Member
0 Kudos

Peter ,

I managed to stop the execution of item master using messagebox as,

SBO_Application.MessageBox("Please enter User Text ")

But if I could show it in status bar then I could follow the syntax followed by SAP.