Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Mandatory Fields & Transaction Notifications

Hi,

I've been reading various other threads about stopping the Form ADD process if a field is empty on the form - hence making the user enter data.

I have read various examples none of which make sense to me, if anyon has any full subroutine examples I would appreciate it.

Going to search the rest of the forums........

Private Sub oApplication_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles oApp.FormDataEvent
        If BusinessObjectInfo.FormTypeEx = "149" And BusinessObjectInfo.BeforeAction = True And BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then
            Try
                Dim oform As SAPbouiCOM.Form
                oform = oApp.Forms.GetForm("149", 1)
              
                '***************************
                '
                'add code to make certain fields mandatory
                '
                '***************************
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End If

Former Member replied

Hi,

For that i use the Item Event. I check on the Button click if the fields required by me are empty or not.

Then i show the error msg, Check the following sample which i use...

Public Sub SBO_Appln_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean)

   If pVal.BeforeAction = True Then
       Select Case pVal.EventType
                   Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
                             If pVal.FormMode = 3 And pVal.ItemUID = "1" Then 'Add Mode
                            objMatrix = objForm.Items.Item("matIndent").Specific
                            If ValidateHeaderData(objForm) = False Then
                                objUtility.ShowErrorMessage("Please fill all the header details.")
                                BubbleEvent = False
                                Exit Sub
                            End If
End IF    
   End If

End Sub

And for the ValidateHeaderData the following is the code..

Public Function ValidateHeaderData(ByVal oForm As SAPbouiCOM.Form) As Boolean
        Dim strReqDate, strReqester, strApprover, strClosingDate As String
        objEdit = oForm.Items.Item("txtReqDate").Specific
        strReqDate = objEdit.String
        objEdit = oForm.Items.Item("txtDocClD").Specific
        strClosingDate = objEdit.String
        objEdit = oForm.Items.Item("txtReqUser").Specific
        strReqester = objEdit.String
        objEdit = oForm.Items.Item("txtAppro").Specific
        strApprover = objEdit.String

        If strReqDate = "" Or strClosingDate = "" Or strReqester = "" Or strApprover = "" Then
            Return False
        Else
            Return True
        End If

    End Function

Hope it helps u..

Vasu Natari.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question