cancel
Showing results for 
Search instead for 
Did you mean: 

How to add data in database using user Table in sapb1 sdk

0 Kudos

I am trying to save data in database using user table but i am unable to catch fields for storing data.

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

I am Creating Form Without UDO and add() ,Update() data using userTable. and know i try to navigate data?

edy_simon
Active Contributor
0 Kudos

I see, master data type needs to be bound to UDO and add the values from General Data Service.

0 Kudos

Thanks Edy Simon .Yes i use this, Actually i found. it my table is master data type and solution is to create a table with SAPbobsCOM.BoUTBTableType.bott_NoObject.

edy_simon
Active Contributor
0 Kudos

Hi,

Quoted from SAP Business One Help File RefDI.chm

Private Sub Add_Data_Click()
    Dim oUserTable As SAPbobsCOM.UserTable
    Set oUserTable = oCompany.UserTables.Item(1)

    'Set default, mandatory fields
    oUserTable.Code = "A"
    oUserTable.Name = "Albert"
    'Set user field
    oUserTable.UserFields.Fields.Item("U_AlbUDF").Value = "1"

    oUserTable.Add

    If ret <> 0 Then
        oCompany.GetLastError ret, Str
        MsgBox Str
    Else
        MsgBox "Value to field: '" & oUserTable.UserFields.Fields.Item("U_AlbUDF").Name & "' was updated successfuly to "  & oUserTable.TableName & " Table"
    End If
End Sub

Regards
Edy