Skip to Content

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

Delete last row in 2007

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

Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question