hi,
i created one sample application in SAP B1 SDK. I created one form using Screen Painter which consist of Book ID(Text field), Book Name(Text field) and a Add Command(Button). I created the database of type Document object. I created two fields in the usertable "BK_DATA" of type document object. I created userdefined-object "BKD" for the table BK_DATA. When i click Add button the event is triggering but it not accepting the usertable what i created when i checked in the debug mode. The code what i have written is
Private Function AddBookToDatabase(ByVal Code As String, ByVal Name As String) As Boolean
Dim Res As Integer
Dim oUsrTbl As SAPbobsCOM.Documents
oUsrTbl = oCompany.UserTables.Item("BK_DATA")
AddBookToDatabase = False
'oUsrTbl.Code = CInt(Code)
'oUsrTbl.Name = Name
oUsrTbl.UserFields.Fields.Item("U_ID").Value = Code
oUsrTbl.UserFields.Fields.Item("U_NAME").Value = Name
Res = oUsrTbl.Add()
If Res = 0 Then
AddBookToDatabase = True
Else
SBO_Application.MessageBox("Error, failed to add movie")
End If
End Function