on 06-06-2008 6:29 AM
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
Hi,
you can't use the UserTable Object for Tables of type master_data or document_data.
UDOs can only be accessed via UIAPI.
the UserTable Object is for Tables of type no_object
lg David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
im geeting invalid field value in the line
Private Function AddBookToDatabase(ByVal Code As String, ByVal Name As String, ByVal Stock As String) As Boolean
' Dim oRecordSet As SAPbobsCOM.Recordset
Dim oUsrTbl As SAPbobsCOM.UserTable
'Dim oUsrTbl As SAPbobsCOM.Recordset
Dim sSQL As String
Dim Res As Integer
'Dim oUsrTbl As SAPbobsCOM.Items
' sSQL = "SELECT U_bookid,U_bookname FROM [@BK_DATA] WHERE U_bookid='" & Code & "'"
'oUsrTbl = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
'oUsrTbl = oCompany.UserTables.Item("BKD")
'Try
'oUsrTbl.DoQuery(sSQL)
'Catch ex As Exception
' MessageBox.Show(ex.Message)
'End Try
AddBookToDatabase = False
Try
oUsrTbl = oCompany.UserTables.Item("BK_DATA")
oUsrTbl.Code = CInt(Code)
oUsrTbl.Name = Name
oUsrTbl.UserFields.Fields.Item("Stock").Value = Stock----
(Error Line)
'oUsrTbl.UserFields.Fields.Item("U_SPACE").Value = Space()
Res = oUsrTbl.Add()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
AddBookToDatabase = False
'oUsrTbl.Code = CInt(Code)
'oUsrTbl.Name = Name
''oUsrTbl.UserFields.Fields.Item("U_").Value = Code
''oUsrTbl.UserFields.Fields.Item("U_NAME").Value = Name
'Res = oUsrTbl.Command.Execute()
If Res = 0 Then
AddBookToDatabase = True
Else
SBO_Application.MessageBox("Error, failed to add movie")
End If
End Function
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.