cancel
Showing results for 
Search instead for 
Did you mean: 

Validation in the matrix........

Former Member
0 Kudos

Hi Experts,

I have a doubt regarding validation in the matrix....this is my coding for validating the column if the code is NULL.


Private Function ValidateTM(ByRef oForm As Form,
 ByRef BubbleEvent As Boolean) As Boolean
Try
  Dim oMatrix As Matrix
  Dim oCode As EditText
  Dim oName As EditText
  Dim iCnt As Integer

 oMatrix = oForm.Items.Item("3").Specific
 For iCnt = 1 To oMatrix.RowCount - 1
 oCode = oMatrix.Columns.Item("Code").Cells.Item(iCnt).Specific
oName = oMatrix.Columns.Item("Name").Cells.Item(iCnt).Specific
                If oCode.Value = "" Then
                    oCode.Active = True
 objSBO_Application_Mas.MessageBox("Row : " & iCnt.ToString & " Code is missing")
  oMatrix.Columns.Item("Code").Cells.Item(iCnt).Click
(BoCellClickType.ct_Regular)
                  Return False
                End If
                If oName.Value = "" Then
                    oName.Active = True
                    
objSBO_Application_Mas.MessageBox("Row : " & iCnt.ToString & " Name is missing")
      oMatrix.Columns.Item("Name").Cells.Item(iCnt).Click
(BoCellClickType.ct_Regular)
                
                    Return False
                End If
            Next
            Return True
        Catch ex As Exception
            objSBO_Application_Mas.MessageBox(ex.ToString)
            Return False
        End Try
    End Function

In this coding all the validations works fine even in the

specific row when the column value is null it's pop

ups a message box that the field is NULL....

now my problem is suppose if *in the

CODE column the value is null,so when

i close(cancel) my form it shouldn't get

canceled...definitely the use should enter

some value......for this i think we have to

use BUBBLE EVENT=FALSE....but i

don't know where to use this bubble

event....* can anybody help me...

regards,

shangai.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi...

matrix load (values) u have to give

BubbleEvent = False

end of load

BubbleEvent = True

ur using validate event...

u have to give

pVal.InnerEvent = False

Regards..

Billa 2007

Former Member
0 Kudos

hi billa,

this is my coding....whether i have to use ur coding in Item Event or menu event....

Item Event



Private Sub objSBO_Application_Mas_ItemEvent(ByVal FormUID As String, 
ByRef pVal As SAPbouiCOM.ItemEvent, 
ByRef BubbleEvent As Boolean) Handles objSBO_Application_Mas.ItemEvent
        Try
            If pVal.Before_Action = True And pVal.EventType = BoEventTypes.et_CLICK And pVal.ItemUID = "1" Then
                If pVal.FormTypeEx = "TM" Then
                    Dim oForm As Form
                    oForm = objSBO_Application_Mas.Forms.ActiveForm
                    BubbleEvent = ValidateTM(oForm)
                End If
           End if
End sub

Menu Event


Private Sub objSBO_Application_Mas_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, 
ByRef BubbleEvent As Boolean) Handles objSBO_Application_Mas.MenuEvent
        If pVal.BeforeAction = False Then
            Try
                If pVal.MenuUID = "JB1" Then
                    Try
                     objSBO_Application_Mas.ActivateMenuItem(sTM)
                    Catch ex As Exception

                   End Try
                End If
        End If
End Sub

In this '2' Load Events where i have to set the bubble event

Regards,

shangai

Former Member
0 Kudos

hi..

use item event for exmp

BubbleEvent=false

oMatrixk = oform.Items.Item("Matrix - ID").Specific (matrix top)

ur code....

(or)

click event cancel button clik

oform.close()

Regards..

Billa 2007

Former Member
0 Kudos

Hi billa,

i think you have not understood my problem???? in ur coding for cancel button click you have given

coding as oform.close() .....i don't want to close the

form....i want to validate even on CANCEL button

click(that null value shouldn't be there..)

regards,

shangai.

Former Member
0 Kudos

Shangai,

Before validating on Cancel button check for the Form Mode i guess u need to check for the validation only if its in Add or Update Mode..

Vasu Natari.

Former Member
0 Kudos

hi vasu & billa 2007,

Thanks,i solved my problem....in the update mode itself i have written

specific coding....so by that i didn't need anything to

validate in the click event of CANCEL event....

regards,

shangai.

Former Member
0 Kudos

Sorry if its not clear,

I did'nt see ur code properly, as ur using a boolean function i guess u can leave the boolean variable part,

I guess u need not use the blnValueCheck variable as it dosent have any use now as ur using a Boolean function.

Hope i'm clear now..??

Vasu Natari.

Former Member
0 Kudos

Sure i'll help u.

In the Item event, in the Click of the Cancel button we write the code, it could be as follows,

Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
If Pval.ItemUID = "2" and Pval.BeforeAction = True
If blnValueCheck = False 'This is a global boolean variable which will be made false if the value in the col is nul.
BubbleEvent = False
MsgBox("Value cannot be empty")
End If
End If

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

hi vasu,


If pVal.Before_Action = True And pVal.EventType = BoEventTypes.et_CLICK And pVal.ItemUID = "2" Then
                If pVal.FormTypeEx = "TRADE" Then
                    Dim oForm As Form
                    oForm = objSBO_Application_Mas.Forms.ActiveForm
                   BubbleEvent = ValidateTM(oForm)
                    If BubbleEvent = False Then
                        MsgBox("Value cannot be empty")
                    End If
                End If
            End If

For validating TM i have written above coding,it works fine....r else any other process is there????

regards,

shangai.

Former Member
0 Kudos

HI,

I guess its fine... as long as it works without any issues...:)

Vasu Natari.

Former Member
0 Kudos

hi vasu,

can u give detailed coding of what you have posted above......my coding isn't working fine......i am

unable to understand what is

If blnValueCheck = False for blnValueCheck it will

check any value & gives the output as false???

Regards,

shangai.