on 2018 Jun 12 3:26 PM
Hi,
There is an UDO I created that haves line items. Below is how the data looks in SAP
Below is how the data appearing in SQL
Based on the above query, I’m trying to update LindId 10 and 11. I know for the SDK when you update line items, you subtract by one. So, for this example in the SDK, the line items would be 9 and 10. When I try to update these two rows with these line numbers, I get Invalid row error. This issue started to happen after when I deleted row items. I’m trying to figure out why I’m facing this issue despite I see these line numbers in the database as for the screenshots I’m showing you above?
Edit:
Below is some of the code I'm using that handles the update
Dim oGeneralService As SAPbobsCOM.GeneralService
Dim oGeneralData As SAPbobsCOM.GeneralData
Dim oChildren As SAPbobsCOM.GeneralDataCollection
Dim oGeneralParams As SAPbobsCOM.GeneralDataParams
Dim sCmp As SAPbobsCOM.CompanyService
Dim rows As Integer = oMatrix.RowCount - 1
sCmp = oCompany.GetCompanyService
oGeneralService = sCmp.GetGeneralService("SPA")
oGeneralParams = oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)
oGeneralParams.SetProperty("DocEntry", "5")
oGeneralData = oGeneralService.GetByParams(oGeneralParams)
oChildren = oGeneralData.Child("SPA_L")
For row As Integer = 1 To rows
lineNum = CInt(oMatrix.Columns.Item("LineId").Cells.Item(row).Specific.Value()) - 1
docNum = CInt(oMatrix.Columns.Item("DocNum").Cells.Item(row).Specific.Value())
cardCode = oMatrix.Columns.Item("CardCode").Cells.Item(row).Specific.Value()
cardName = oMatrix.Columns.Item("CardName").Cells.Item(row).Specific.Value()
oChildren.Item(lineNum).SetProperty("U_DocNum", docNum)
oChildren.Item(lineNum).SetProperty("U_CardCode", cardCode)
oChildren.Item(lineNum).SetProperty("U_CardName", cardName)
Next
oGeneralService.Update(oGeneralData)
Request clarification before answering.
Hi,
As johan.hakkesteegt mentioned, you need to find out the Index, usually the VisOrder could be used for this, but in your case it is weird why it is the same as the LineNum.
Anyway, I didn`t understand why you are updating the UDO by code if you have the UDO Form, once the form is bind to the UDO, there is no need to write any code to update.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Danilo,
My Matrix gird is showing filtered results rather than all the line items. Example, let say my document had 6 line items but I only want to show 2 line items. Because the matrix gird is showing filter result, I was not sure the gird would know how to update the correct line items?
User | Count |
---|---|
99 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.