如何在SAP B1矩阵中进行多选?

时间:2018-02-02 14:19:31

标签: sdk sap

我创建了在SAP B1中有矩阵的UDO,我在第一列中使用UDV(查询的UDV,选择所有项目代码)以选择所有项目代码,因此在UDO的矩阵中无法选择从列表中选择多个项目,除了逐个选择

如何从列表中选择UDO矩阵中的多个项目?

我尝试使用以下代码,但有一个问题

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
    If pVal.BeforeAction AndAlso pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD AndAlso pVal.FormTypeEx = "UDO_FT_RLPY" Then
        Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(FormUID)
        Dim oMatrix As SAPbouiCOM.Matrix
        oMatrix = oForm.Items.Item("C_0_1").Specific 'ISSUE IS HERE, to this line (C_0_1 is the Unique ID of first column of matrix, I do know well if it is that I have to use there because it brings error)
        If pVal.Modifiers = SAPbouiCOM.BoModifiersEnum.mt_SHIFT Then
            Dim lastRowSelected As Integer = oMatrix.Rows.SelectedRows.Item(oMatrix.Rows.SelectedRows.Count - 1, SAPbouiCOM.BoOrderType.ot_RowOrder)
            If lastRowSelected < pVal.Row Then
                For i As Integer = pVal.Row To lastRowSelected + 1
                    oMatrix.Rows.SelectedRows.Add(i)
                Next
            End If
        End If
    End If 
End Sub

我试图在SDK示例中查看矩阵的所有示例,但是没有可以解决我的问题的示例,即使在门户网站中也没有人解决了这个问题

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

你可以使用for循环,在添加一行后使用AddRow方法,依此类推..

来自SDK帮助

Public Sub AddRow( _
   Optional ByVal RowCount As Long = 1, _
   Optional ByVal Position As Long = -1 _
)