cancel
Showing results for 
Search instead for 
Did you mean: 

ChooseFromList in a Matrix

Former Member
0 Kudos

Hi

I'am using a ChooseFromList in a Matrix column bound to the column segment_0 of the table OACT -

and I don't know how to show the account selected.

The next code always returns the segment_0 of the selected account

in the first row of the matrix because i'am using 0 (zero) as record number

in the setvalue property of the datasource:

oForm.DataSources.DBDataSources.Item("OACT").SetValue _

("Segment_0", <b>0</b>, DTable.GetValue("Segment_0", 0))

If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST And _
  Not pVal.BeforeAction Then
   oForm = CSBOApp.Forms.Item(pVal.FormUID)
   oCflEv = pVal
   CflUID = oCflEv.ChooseFromListUID
   oCFList = oForm.ChooseFromLists.Item(CflUID)
   DTable = oCflEv.SelectedObjects
   If DTable.Rows.Count > 0 Then
      oMatrix = oForm.Items.Item("REG_GrdReg").Specific
      oMatrix.FlushToDataSource()
      oForm.DataSources.DBDataSources.Item("OACT"). _
        SetValue("Segment_0", 0, DTable.GetValue("Segment_0", 0))
      oMatrix.LoadFromDataSource()
   End If
endif

How I can obtain the row number of the actual row?

or is there any other way to do this??

Thaks

Jesica

Accepted Solutions (1)

Accepted Solutions (1)

former_member184566
Active Contributor
0 Kudos

Hi Jessica,

I use the following code

Public Sub GetValuesFromChooseFromList(ByVal FormUID As String, ByVal SBO_Application As SAPbouiCOM.Application, ByVal pval As SAPbouiCOM.ItemEvent)

Try

Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent

oCFLEvento = pval

Dim sCFL_ID As String

sCFL_ID = oCFLEvento.ChooseFromListUID

Dim oForm As SAPbouiCOM.Form

oForm = SBO_Application.Forms.Item(FormUID)

Dim oCFL As SAPbouiCOM.ChooseFromList

oCFL = oForm.ChooseFromLists.Item(sCFL_ID)

Dim oDataTable As SAPbouiCOM.DataTable

oDataTable = oCFLEvento.SelectedObjects

Dim ProfitCenter As String = Nothing

Try

ProfitCenter = CStr(oDataTable.GetValue(0, 0))

Catch ex As Exception

End Try

If ProfitCenter <> Nothing Then

Dim oMatrix As SAPbouiCOM.Matrix = SBO_Application.Forms.Item(FormUID).Items.Item("13").Specific

Dim oEdit As SAPbouiCOM.EditText = oMatrix.Columns.Item("U_OcrCode").Cells.Item(Row).Specific

oEdit.Value = ProfitCenter

oForm.Update()

oMatrix.Columns.Item("U_OcrCode").Cells.Item(Row).Click(SAPbouiCOM.BoCellClickType.ct_Regular)

End If

Catch ex As Exception

Log.WriteToFileLog("GetValuesFromChooseFromList", "Y", ex.Message)

End Try

End Sub

Row is a global variable that represents the row where i place the value from choose from list. Its set by the event that triggers the above procedure.

Hope it helps

Answers (0)