cancel
Showing results for 
Search instead for 
Did you mean: 

multi selection in grid

Former Member
0 Kudos

Hello freind

i have one form which have one GRID and MATRIX now i want when i selct entry from grid one by one it add in matrix sequntially.i create one code but it add only one entry in matrix and when i select other entry i get overlap on previous entry.so if yu have solution pls give me for sample code

this is my code

If (pVal.Before_Action = False) Then

If pVal.ItemUID = "1000002" Then

oForm = objMain.objApplication.Forms.Item(FormUID)

Dim Tid, Tname As String

Dim oedit As SAPbouiCOM.EditText

Dim i, j As Integer

objGrid = oForm.Items.Item("1000002").Specific

i = objGrid.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_SelectionOrder)

oMatrix = oForm.Items.Item("1000012").Specific

' oMatrix.Clear()

oMatrix.FlushToDataSource()

oDBs_Detail1 = oForm.DataSources.DBDataSources.Add("@UPDATE5")

Try

Dim y As String

For k As Integer = 1 To oMatrix.RowCount

Tid = objGrid.DataTable.GetValue("Test", i)

Tname = objGrid.DataTable.GetValue("Name", i)

'oMatrix.AddRow()

y = oMatrix.Columns.Item("V_1").Cells.Item(k).Specific.value

If y = "" Then

oMatrix.FlushToDataSource()

oDBs_Detail1.Offset = k - 1

oDBs_Detail1.SetValue("LineId", oDBs_Detail1.Offset, i)

oDBs_Detail1.SetValue("U_TId", oDBs_Detail1.Offset, Tid)

oDBs_Detail1.SetValue("U_TName", oDBs_Detail1.Offset, Tname)

oMatrix.SetLineData(k)

oMatrix.FlushToDataSource()

Exit For

Else

oMatrix = oForm.Items.Item("1000012").Specific

oDBDataSource = oForm.DataSources.DBDataSources.Item("@UPDATE5")

oMatrix.AddRow(1)

Dim otext2 As EditText

Dim rc8 As Integer = oMatrix.VisualRowCount

otext2 = oMatrix.Columns.Item("V_-1").Cells.Item(rc8).Specific

otext2.Value = rc8

End If

Next

Catch ex As Exception

objMain.objApplication.MessageBox(ex.Message)

End Try

End If

End If

Accepted Solutions (1)

Accepted Solutions (1)

former_member689126
Active Contributor
0 Kudos

Hi

Try this code

If (pVal.Before_Action = False) Then
                    If pVal.ItemUID = "1000002" Then
                        oForm = objMain.objApplication.Forms.Item(FormUID)
                        Dim Tid, Tname As String
                        Dim oedit As SAPbouiCOM.EditText
                        Dim i, j As Integer
                        Dim offset As Integer

                        objGrid = oForm.Items.Item("1000002").Specific
                        i = objGrid.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_SelectionOrder)
                        oMatrix = oForm.Items.Item("1000012").Specific
                        ' oMatrix.Clear()


                        oDBs_Detail1 = oForm.DataSources.DBDataSources.Add("@UPDATE5")
                        oDBs_Detail1.Clear()
                        oMatrix.FlushToDataSource()

                        Try
                            With oDBs_Detail1

                                offset = .Size
                                .InsertRecord(offset - 1)
                                .SetValue("LineId", offset - 1, i)
                                .SetValue("U_TId", offset - 1, objGrid.DataTable.GetValue("Test", i).Trim)
                                .SetValue("U_TId", offset - 1, objGrid.DataTable.GetValue("Name", i).Trim)

                            End With

                            oMatrix.LoadFromDataSource()
                            oDBs_Detail1.Clear()

                        Catch ex As Exception
                            objMain.objApplication.MessageBox(ex.Message)
                        End Try
                    End If
                End If

Regards

Arun

Answers (0)