Skip to Content

SDK: How to get total rows for matrix


I’m currently using the SDK to read line items from SO. I add a button for an event I want to happen. Below is sample code. The problem I’m having when I call the RowCount method, it always gives me one even though the matrix haves more than one row. Do you know what I need to revise to have it return the correct number of rows?

            If pVal.FormType = "139" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.ItemUID = "btnPO" And pVal.BeforeAction = True Then
                    Dim oSOForm As SAPbouiCOM.Form
                    Dim oMatrix As SAPbouiCOM.Matrix
                    oSOForm = SBO_Application.Forms.Item(FormUID)
                    oMatrix = oSOForm.Items.Item(38).Specific
                    MsgBox("Total Rows:" + oMatrix.RowCount.ToString)

                Catch ex As Exception
                End Try
            End If



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 23, 2017 at 08:25 PM

    Hi William

    There is a small mistake in your code in this line:

    oMatrix = oSOForm.Items.Item(38).Specific

    The correct is:

    oMatrix = oSOForm.Items.Item("38").Specific

    When you work with the items of the form you can retrieve them by two ways, by index or by Uid. In your case 38 is the Uid of the control that you want, then you need provide it as string.

    Hope it clears.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded