cancel
Showing results for 
Search instead for 
Did you mean: 

Delete last row in 2007

Former Member
0 Kudos

Hi, we are migrating from 2005A PL39 to 2007A PL30 and i find an old problem that was resolved in 2005A, when i delete the last and unique row of a matrix in a UDO form it doesn´t modified database and the row persits.

Does any one have the same problem?

Thanks,

Daniel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks Mohama for your answer, I tried your sample but i doesn´t work for me in version 2007 (in version 2005 runs well).

Former Member
0 Kudos

Hi Daniel,

I'm working with B1 2007A, and I remove a row with this function


Private Sub DeleteLine(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application, _
            ByRef pVal As SAPbouiCOM.MenuEvent)

        oForm = oApplication.Forms.ActiveForm

        Try
            oForm.Freeze(True)

            If oForm.Mode <> BoFormMode.fm_FIND_MODE Then
                Dim oMatrix As SAPbouiCOM.Matrix = oForm.Items.Item("mtx_NP").Specific
                Dim LineDeleted As Boolean = False

                With oForm.DataSources.DBDataSources.Item("@ADAT_NP1")

                    For i As Integer = 1 To .Size - 1
                        If oMatrix.Columns.Item("V_LineId").Cells.Item(i).Specific.Value <> i Then

                            If LineDeleted = True Then 
                                If oForm.Mode = BoFormMode.fm_ADD_MODE Then .SetValue("LineID", i - 1, CStr(i))

                            Else 
                                .RemoveRecord(i - 1)
                                If oForm.Mode = BoFormMode.fm_ADD_MODE Then .SetValue("LineID", i - 1, CStr(i))
                                LineDeleted = True
                            End If
                        End If
                    Next
                End With

                oMatrix.LoadFromDataSource()
            End If

        Catch ex As Exception
            oApplication.MessageBox("DeleteLine(): " & ex.Message)
        Finally
            oForm.Freeze(False)
        End Try

Hope it helps,

Vítor Vieira

Answers (1)

Answers (1)

Former Member
0 Kudos

hi..

try this one

If (pVal.MenuUID = "OnlyOnRC") And (pVal.BeforeAction = False) Then

Try

Dim oMenuItem As SAPbouiCOM.MenuItem

Dim oMenus As SAPbouiCOM.Menus

Dim omat As SAPbouiCOM.Matrix

Dim GCols As SAPbouiCOM.Columns

Dim i As Integer

oitem = OForm.Items.Item("38")

omat = oitem.Specific

GCols = omat.Columns

omat = OForm.Items.Item(selItem).Specific

For i = 1 To omat.RowCount

If omat.IsRowSelected(i) = True Then

omat.DeleteRow(i)

Exit For

End If

Next

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

End If

regards...

Mohana