Skip to Content
author's profile photo Former Member
Former Member

ChooseFromList in a Matrix

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2006 at 02:42 PM

    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 😊

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.