cancel
Showing results for 
Search instead for 
Did you mean: 

Choose From List in Matrix

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Tamil,

thank u for ur reply

Already i added the row. from that row only i am pressing 'Tab' to display the Choose From List

Former Member
0 Kudos

Hi Mathi Arasu.

For solving your problem, you need:

- to see the Matrix object with the Columns.

- the Columns, have the Cells, what represents: EditText, Comboboxes, etc.



' Use oForm, iRow = pVal.Row for row number,  ItemCode Value, ItemName Value what you retrieve with ChooseFormList.

try
    Dim oMatrix As SAPbouiCOM.Matrix
    Dim oColumn As SAPbouiCOM.Column
    Dim oCell As SAPbouiCOM.Cell
    Dim oEdit As SAPbouiCOM.EditText

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

    oColumn = oMatrix.Columns.Item("colCode")
    oCell = oColumn.Cells.Item(iRow)
    oEdit = oCell.Specific
    Try
        ' Here set the ItemCode on column colCode
        oEdit.String = sCode
    Catch ex As Exception
    End Try

    oColumn = Nothing
    oCell = Nothing
    oEdit = Nothing

    oColumn = oMatrix.Columns.Item("colName")
    oCell = oColumn.Cells.Item(iRow)
    oEdit = oCell.Specific
    If oEdit.String <> sName Then
        ' Here set the ItemName on column colName
        oEdit.String = sName
    End If

    oColumn = Nothing
    oCell = Nothing
    oEdit = Nothing
    oMatrix = Nothing
catch ex As Exception
  ' log exception
end try

Bye

Former Member
0 Kudos

Dear Sierdna S

Thank yoou for ur Valid points

Its working. item is adding in the matrix row. but before add the item it is throwing same exception message. i have used it_LINK_BUTTON for itemcode Column.

i want to set the curser in itemcode cell by default. how to set the focus

after adding the itemcode & Description i want to set the focus in Qty column.

pls give a solution

Mathi

Former Member
0 Kudos

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

Answers (0)