Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to do addition of two columns cells in Matrix.

Hi All,

I tried following code on LostFocus event of Mtrix. I want to do addition of two columns cells of matrix and addtion display in third column. I tried the following code but in this I am getting the column value and when i enterd any value in columns cells it disappear when i move to next column cells.

Can anybody suggest me how to do it ?

Dim i As Integer

Dim v1, v2 As String

matrix.Columns.Item("V_4").DataBind.SetBound(True, "", "matrixds")

If pVal.ColUID = "V_4" Then

For i = 0 To matrix.RowCount - 1

v1 = matrix.Columns.Item("V_5").Cells.Item(i + 1).Specific.Value

v2 = matrix.Columns.Item("V_4").Cells.Item(i + 1).Specific.Value

Dim v3 As Integer = CInt(v1) + CInt(v2)

matrix.Columns.Item("V_3").Cells.Item(i + 1).Specific.Value = v3.ToString()


End If

Thanks and Regards,

Former Member
Former Member replied


Try this, in the below code i'm doing a similar operation, just change the operation...

Dim objEdit, objEdit2 As SAPbouiCOM.EditText
objEdit = objMatrix.Columns.Item("V_14").Cells.Item(pVal.Row).Specific
dblQty = objEdit.String
objEdit = objMatrix.Columns.Item("V_13").Cells.Item(pVal.Row).Specific
dblUnitPrice = objEdit.String
objEdit = objMatrix.Columns.Item("V_10").Cells.Item(pVal.Row).Specific
dblRowTot = dblQty * dblUnitPrice
objEdit.String = dblRowTot

the above code is executed in LOST FOCUS in the BeforeAction = False condition.

Hope it helps,

Vasu Natari.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question