Skip to Content

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

disable particular row in a grid

I displayed the table in a grid, and I want to disable the row if the field "Status" is equal to 1, how to do it?

Ken

Former Member
Former Member replied

Hi

You can do it using workaround ....:)

In ItemEvent handler add your check for KEY_DOWN event...

Public Sub ManageItemEvent( _
      ByVal FormUID As String, _
      ByRef pVal As SAPbouiCOM.ItemEvent, _
      ByRef BubbleEvent As Boolean _
)
  Dim oForm As SAPbouiCOM.Form
  Try
      oForm = SBO_Application.Forms.Item(FormUID)
  Catch ex As Exception
      oForm = Nothing
  End Try

  If Not oForm Is Nothing Then
    Select Case oForm.TypeEx
      Case "YOUR_FORM_TYPEEX"

	Select Case pVal.EventType

	  Case SAPbouiCOM.BoEventTypes.et_KEY_DOWN
	    If pVal.BeforeAction Then
		Select Case pVal.ItemUID
		    Case "mtx00" ' PLACE HERE MATRIX ITEM UID
			If pVal.ColUID.Equals("COLUMN_1_UID") _
			Or pVal.ColUID.Equals("COLUMN_2_UID") _
			Or pVal.ColUID.Equals("COLUMN_3_UID") _
			... all matrix columns uids what user can modify if your condition is True
			Then
			    BubbleEvent = Matrix_CheckIfTheUserCanModifyThisRow( _
					oForm, _
					pVal.InnerEvent, _
					pVal.ColUID, _
					pVal.Row, _
					pVal.CharPressed)
			End If
		End Select
	    End If
...
End Sub


Private Function Matrix_CheckIfTheUserCanModifyThisRow( _
    ByRef oForm As SAPbouiCOM.Form, _
    ByVal bInnerEvent As Boolean, _
    ByVal sColumnUID As String, _
    ByVal iRow As Integer, _
    ByVal iCharPressed As Integer, _
    ByVal sUserTable As String _
) As Boolean

    Dim b As Boolean = True

    Dim oMatrix As SAPbouiCOM.Matrix
    Dim oCheckBox As SAPbouiCOM.CheckBox

    Dim sCode As String = ""
    Try
	If Not iCharPressed = 9 Then
	    oMatrix = oForm.Items.Item("mtx00").Specific
	    If oMatrix Is Nothing Then Throw New Exception("ERROR!")
	    oCheckBox = oMatrix.Columns.Item("e1Code").Cells.Item(iRow).Specific
	    '... check if value true/false...
	    b = oCheckBox.Checked
	End If
    Catch ex As Exception
      b = False
    Finally
      oEdit = Nothing
      oMatrix = Nothing
    End Try
    Return b
End Function

Regards

Sierdna S.

Edited by: Sierdna S on Oct 9, 2008 2:58 PM

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question