cancel
Showing results for 
Search instead for 
Did you mean: 

disable particular row in a grid

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Nussi
Active Contributor
0 Kudos

Hi,

disabling rows is not possible.

you can only disable columns but NOT a single row.

you can try to catch the got_focus event to block rows/cell that should be disabled.

and you can use a picture column to show that the column is locked (maybe a red picture)

lg David