Skip to Content
Jul 10, 2010 at 02:02 PM

Delete Row In Matrix


Hello All,

I have a UDO and a form for it. The UDO has a child table, which is binded to a matrix in the form. Everything works well except Delete Row in the matrix.

If I don't do anything when Delete Row menu is clicked, the row is deleted. But as soon as Update button is clicked, a new empty row gets added to the matrix and the underlying table.

The same happens even if I catch the delete row event, do the delete myself and then set the bubbleevent to false.

Is this the default behaviour. What is the workaround to avoid this addition of new empty row.

Following is the code I am using for deleting the row. I've used various combinations of this code to the same affect.

        Dim oMatrix As SAPbouiCOM.Matrix
        Dim RowIndex As Integer

            If oForm.Mode <> SAPbouiCOM.BoFormMode.fm_FIND_MODE Then
                oMatrix = oForm.Items.Item("AC_MX01").Specific
                RowIndex = oMatrix.GetNextSelectedRow

                If RowIndex <= 0 Then
                    Exit Sub
                End If

                oForm.DataSources.DBDataSources.Item("@AC_SMP1").RemoveRecord(RowIndex - 1)

                Exit Sub
            End If