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

Choose From List in Matrix

Dear Experts,

I have used the following code to select the Item from Choose From List. when i select the Item, i got the error message in the Line which i have marked as bold

the error is " Item - can't set the value on Item because item can't get the focus"

If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then

Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent

oCFLEvento = pVal

Dim sCFL_ID As String

Dim val1, val2 As String

sCFL_ID = oCFLEvento.ChooseFromListUID

oForm = SBO_Application.Forms.Item("purReq")

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

Dim oCFL As SAPbouiCOM.ChooseFromList

oCFL = oForm.ChooseFromLists.Item("CFL_2")

If oCFLEvento.BeforeAction = False Then

Dim oDataTable As SAPbouiCOM.DataTable

oDataTable = oCFLEvento.SelectedObjects

Try

val1 = oDataTable.GetValue(0, 0)

val2 = oDataTable.GetValue(1, 0)

r = oMatrix.RowCount

oMatrix.Columns.Item("itmcode").Cells.Item(r).Specific.Value = val1 oMatrix.Columns.Item("itmDesc").Cells.Item(r).Specific.Value = val2

oMatrix.Columns.Item("itmQty").Cells.Item(r).Specific.Active = True

oMatrix.AddRow()

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

End If

End If

Regards

Mathi

Edited by: Mathi Arasu on Jun 13, 2008 12:47 PM

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 13, 2008 at 11:26 AM

    Mathi arasu,

    before setting the values to the Matrix, add the rows

    '-------

    oMatrix.AddRow(r) ' r oMatrix.RowCount

    'Put ur code (which is in Bold) here

    '-----

    I think this will work now.

    Tamil

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Mathi Arasu.

      Use these peaces to have an idea. I think this note may be usefull for you.

      Best Regards,

      Sierdnas

      P.S.

      In AddRow your can decide in what cell you want to set focus.

      Public Sub Matrix_AddRow(oForm)
        ...
        ' Add new row code
        ...
        ' After adding the new row go to the desired or default cell...
        oColumn = oMatrix.Columns.Item("colCode")
        oCell = oColumn.Cells.Item(oMatrix.VisualRowCount)
        Try
          oCell.Click(SAPbouiCOM.BoCellClickType.ct_Regular)
        Catch ex As Exception
          ' log exception
        End Try
      ...
      End Sub
      

      And, after using Choose From List for Code/Name use the same code but column name change to "colQty"

      
      oColumn = oMatrix.Columns.Item("colQty")
      oCell = oColumn.Cells.Item(oMatrix.VisualRowCount)
      Try
        oCell.Click(SAPbouiCOM.BoCellClickType.ct_Regular)
      Catch ex As Exception
        ' log exception
      End Try
      
      

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.