Showing results for 
Search instead for 
Did you mean: 

How to read a value from SAP DBDataSource

Former Member
0 Kudos

I am trying to read row values from the sales order - items matrix

I tried this code

Dim dbdata As SAPbouiCOM.DBDataSource

dim strItemCode as string

dbdata = oform.DataSources.DBDataSources.Item("RDR1")

stritem = dbdata.getvalue("ItemCode",1)

but I am receiving in error -2010

Error Desc: Data soruce - Bad Data Source Offset

sincerely yours

Riade Asleh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Riade,

For system form's matrix, you can't use data source to get the value. You can use data source only for user's added matrix.

So, you may try the following code:

Dim oEdit As SAPbouiCOM.EditText

For i As Integer = 1 To oMatrix.RowCount

' Get itemcode from matrix

oEdit = oMatrix.Columns.Item(x).Cells.Item(i).Specific

itemCode = oEdit.Value


Notice that x is the column you want to access.



Former Member
0 Kudos

Dear Kit

Thank you

I was trying to read the matrix cell value through dbdatasource not through columns and cells

i beleive it's faster to read it through dbdatasource

Sincerely yours

Riade Asleh

Answers (1)

Answers (1)

Former Member
0 Kudos

Try this

stritem = dbdata.getvalue("ItemCode",0)


1. On system form add mode, you won't be able to get the value from dbdatasource even the matrix is filled.

2. On system form ok/update mode, the value you get from dbdatasource is old value, and not the one you changed in the matrix.