on 07-01-2005 12:47 PM
hi!
i need to update an user table that is of type document.
that table is also used as the client table in an udo.
i have tried the following code, but that of course doesn't work as the table is not a plain table but is of document type:
Dim objUserTable As SAPbobsCOM.UserTable
Set objUserTable = objCom.UserTables.Item("MP_TABLE_LINE")
If objUserTable.GetByKey(objMatrix.Columns.Item("U_MP_BEnt").Cells.Item(lngRow).Specific.Value) Then
objUserTable.UserFields.Fields.Item("U_Qty").Value = _
objUserTable.UserFields.Fields.Item("U_Qty").Value - dblDiff
If Not objUserTable.Update() <> 0 Then
Call objApp.SetStatusBarMessage(objCom.GetLastErrorDescription())
Call objApp.MessageBox(objCom.GetLastErrorDescription())
Else
objMatrix.Columns.Item("U_MP_BQty").Cells.Item(lngRow).Specific.String = _
objMatrix.Columns.Item("11").Cells.Item(lngRow).Specific.String
End If
End If
Set objUserTable = Nothing
then i tried to use a dbdatasource which i would expect to work:
Dim objDataSource As DBDataSource
Set objDataSource = objForm.DataSources.DBDataSources.Item("@MP_TABLE_LINE")
Dim objConditions As New SAPbouiCOM.Conditions
Dim objCond As SAPbouiCOM.Condition
<just setting up conditions here>
Call objDataSource.Query(objConditions)
Call objDataSource.SetValue("U_Qty", 0, objDataSource.GetValue("U_Qty", 0) - dblDiff)
but this only results in an error code "-7006", message:
"Item - The item is not a user defined item"
how can the update be done?
regards,
thomas
Hi ,
Realy Sorry for that.
objUserTable.GetByKey(objMatrix.Columns.Item("U_MP_BEnt").Cells.Item(lngRow).Specific.Value
to get a perticular record from the UserTable u have to provide "Code" field in place of "U_MP_BEnt"
the GetBykey() works on Code field which is uniques to the record
Thanks
Ankush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How this will work for u
i tried this code and it work for update the data.
in place of code pls provide DocEntry
Private Sub UpdateData()
Dim oUserTable As SAPbobsCOM.UserTable
oUserTable = oCompany.UserTables.Item("tbltest")
If oUserTable.GetByKey("2") = True Then
oUserTable.UserFields.Fields.Item("U_Test1").Value = "Test1"
oUserTable.UserFields.Fields.Item("U_Test2").Value = "Test2"
If oUserTable.Update() <> 0 Then
MsgBox(oCompany.GetLastErrorDescription())
End If
End If
End Sub
Thanks,
Ankush
thanks for your answer.
but as i wrote i need to update an user table that is of type 'document'.
and to make it even more complicated (and i forgot to mention it before) i want to update the client (slave) table (which means <u>the document's lines</u>).
and those tables have composite primary keys.
Hi Thomas,
U are using UserTabel Obejct , just try to Use UserTabelMD object
i am sending to how to create the User Table,
Hope it will help to
oUTb = mobjCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
If Not oUTb.GetByKey("SPH_FORMS") Then
oUTb.TableName = "SPH_FORMS"
oUTb.TableDescription = "Activity Forms"
oUTb.TableType = SAPbobsCOM.BoUTBTableType.bott_MasterData
If oUTb.Add <> 0 Then
mobjCompany.GetLastError(lRet, sErrMsg)
Else
oUTb = Nothing
end if
be carefull before using MD object , bcoz at a time only one MD object should be in memory else it will give to Error
Thanks
Ankush Vachher
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
U are using UserTabel Obejct , just try to Use UserTabelMD object
i am sending to how to create the User Table,
Hope it will help to
oUTb = mobjCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
If Not oUTb.GetByKey("SPH_FORMS") Then
oUTb.TableName = "SPH_FORMS"
oUTb.TableDescription = "Activity Forms"
oUTb.TableType = SAPbobsCOM.BoUTBTableType.bott_MasterData
If oUTb.Add <> 0 Then
mobjCompany.GetLastError(lRet, sErrMsg)
Else
oUTb = Nothing
end if
be carefull before using MD object , bcoz at a time only one MD object should be in memory else it will give to Error
Thanks
Ankush Vachher
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
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.