hello,
I'm creating various user defined tables and fields by code. The tables and most of the fields are created correctly, but I've problems with two of the fields.
The fields are:
U_Bono = sbocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
U_Bono.TableName = "PRESENCIA"
U_Bono.Name = "Bono"
U_Bono.Description = "Bono"
U_Bono.Type = SAPbobsCOM.BoFieldTypes.db_Numeric
U_Bono.Size = 8
U_Bono.EditSize = 8
x = U_Bono.Add()
If x = 0 Then
MessageBox.Show("Campo de usuario U_Bono creado")
Else
MessageBox.Show("ERROR. El campo de usuario U_Bono no se ha creado. Nº de error: " & x.ToString)
End If
sbocompany.GetLastError(x, errMsg)
If (0 <> x) Then
MsgBox("Found error, code=" + Str(x) + ",msg=" + errMsg)
End If
U_Hora = sbocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
U_Hora.TableName = "PRESENCIA"
U_Hora.Name = "Horas"
U_Hora.Description = "Horas"
U_Hora.Type = SAPbobsCOM.BoFieldTypes.db_Date
U_Hora.Size = 8
U_Hora.EditSize = 8
x = U_Hora.Add()
If x = 0 Then
MessageBox.Show("Campo de usuario U_Hora creado")
Else
MessageBox.Show("ERROR. El campo de usuario U_Hora no se ha creado. Nº de error: " & x.ToString)
End If
sbocompany.GetLastError(x, errMsg)
If (0 <> x) Then
MsgBox("Found error, code=" + Str(x) + ",msg=" + errMsg)
End If
And the error messages I get are the same for the two fields:
"Ref count for this object is higher then 0"
Another strange thing is that sometimes the field U_Hora is created and others isn't, of course without changing the code.
Thanks in advance