cancel
Showing results for 
Search instead for 
Did you mean: 

This Entry Already Exist in Table

Former Member
0 Kudos

Hi,

I created Add-on Form Using Screen Painter.document type is Master. while Adding Values suddenly i got Error This Entry Already Exist in "My user table Name".Eventhough that entry doesnt exist in my Table. i saw lot of Threads regarding this issue.

but still didnt get any clear suggestion.. i restored my Numbering Files also in utilities. i was not able to move For further Functionalities because of this issue....

Any Suggestion...

Thanks in Advance

Ganesh K

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi..

After matrix use this code

oForm.DataSources.DBDataSources.Item(1).Clear()

example...

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

oMatrix = oitem.Specific

oForm.DataSources.DBDataSources.Item(1).Clear()

Regards..

Billa 2007

Former Member
0 Kudos

go to document numbering in business one.

select your udo

close the old range

create a new range and assign it as default.

Former Member
0 Kudos

Hi John,

thank you. i will try that...

Regards,

Ganesh k

Former Member
0 Kudos

Hi John,

as i mentioned my documnet type is Master(UDT -Master).. so my UDO wont exist in Document Numbering.. what to do if Master type?

kindly let me know if any mistakes in my side...

Regards,

Ganesh K

Former Member
0 Kudos

Hi,

Ganesh, this is a common problem with UDO, to overcome this u in the update mode u need to delete all the records in the line table so that the update will go on smoothly.

The following is the code which i follow to avoide this.

In the item event in the before action part i execute the following code

If pVal.FormMode = 2 And pVal.ItemUID = "1" Then 'In UPDATE Mode
                        strDocNum = objForm.Items.Item("txtCode").Specific.String
                        objMatrix = objForm.Items.Item("matMand").Specific
                        objForm.Freeze(True)
                        UpdateMatrixRowsDel(objForm)
                        objMatrix.FlushToDataSource()
                        For Count = 1 To objMatrix.RowCount
                            'oDataSrc.SetValue("LineId", Count - 1, oDataSrc.GetValue("DocEntry", Count - 1))
                        Next
                        objMatrix.LoadFromDataSource()
                        objForm.Freeze(False)
End If

And now for UpdateMatrixRowsDel this is the code..

Private Sub UpdateMatrixRowsDel(ByVal objForm As SAPbouiCOM.Form)
        Dim oUserTable As SAPbobsCOM.UserTable = Nothing
        Try
            oDataSrc = objForm.DataSources.DBDataSources.Item("@EMR_MAND_DET")
            oDataSrc.Clear()
            oDataSrc.Query()

            objMatrix = objForm.Items.Item("matMand").Specific
            objMatrix.FlushToDataSource()
            oUserTable = objSBOAPI.oCompany.UserTables.Item("EMR_MAND_DET")
            Dim strDocEntry As String = ""
            If objMatrix.RowCount > 0 Then
                '  MsgBox(objMatrix.RowCount)
                If oDataSrc.GetValue("U_ItemUID", objMatrix.RowCount - 1) = "" Then
                    If blnMenuDel = True Then
                        objMatrix.DeleteRow(objMatrix.RowCount - 1)
                    Else
                        objMatrix.DeleteRow(objMatrix.RowCount)
                    End If
                    blnMenuDel = False
                    objMatrix.FlushToDataSource()
                End If
                Dim i As Integer
                i = 1
                For Count = 0 To oDataSrc.Size - 1
                    If oUserTable.GetByKey(oDataSrc.GetValue("Code", Count)) Then
                        strDocEntry = oDataSrc.GetValue("Code", Count)
                    End If
                Next
                oDataSrc.Query()
                oDataSrc.Clear()
            End If
            strSQL = "Delete FROM [@EMR_MAND_DET] WHERE Code = '" & strDocEntry & "'"
            objRecSet = objSBOAPI.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            objRecSet.DoQuery(strSQL)
            blnFrmUpdate = True
            'objMatrix.AddRow()
        Catch ex As Exception
            Throw ex
        Finally
            System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserTable)
            oUserTable = Nothing
            GC.WaitForPendingFinalizers()
            GC.Collect()
        End Try
    End Sub

Hope this helpz u solve it..

Vasu Natari.

Former Member
0 Kudos

Hi Vasu Natari,

Thanks For your reply.. while installing my Add-on in client machine we created UDT,UDF,UDO newly.. now its working Fine... hope that Error wont occur.. i will have your code For future Enhancements in my Add-ons..

Thanks And Regards,

Ganesh K

Former Member
0 Kudos

Hi Ganesh,

Gud go see that its solved... Guess u forgot to gimme some points...

Vasu Natari.

Former Member
0 Kudos

create a new document range and set it as the default for the udo

Former Member
0 Kudos

Hi John,

i cant get you clearly.. could you please explain in detail..

Regards,

Ganesh K