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

Using CFL with a Matrix

Hi ,

I was trying to use CFL for Matrix but was not able to find how to link a Matrix in a User Defined Form to :

1. I need some examples/code which could help me in linking a Matrix item on a User Defined Form to a CFL (Choose From List)

2. I would also like to know if it is possible to use the Multiselection property of the CFL and choose more than one option from the Choos from List and then Map them to the Matrix.

Hopefully someone can help me out on this one.



Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 10:12 AM

    Hi Arshdeep,

    This is an example i'm use to link a CFL to a column of matrix :

    oColumn = oColumns.Add("V_10", SAPbouiCOM.BoFormItemTypes.it_EDIT);

    oColumn.TitleObject.Caption = "Nom";

    oColumn.Width = 60;

    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_NOM");

    oColumn.ChooseFromListUID = "CFL_2";

    oColumn.ChooseFromListAlias = "CardName";

    I define before the CFL "CFL_2".

    Hope i help you


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 11:27 AM


    It is certainly possible to pull multiple values from CFL and map it into matrix of user defined form. A lot of code on your part but am posting what was available with me. hope I have understood the scenario correct.

    'This will come with the initialization of form
     oMatrix = oform.Items.Item("mt").Specific
                oform.DataSources.UserDataSources.Add("Item", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)
                oMatrix.Columns.Item("V_1").DataBind.SetBound(True, "", "Item")
                oMatrix.Columns.Item("V_1").ChooseFromListUID = "MyCFL"
                oMatrix.Columns.Item("V_1").ChooseFromListAlias = "Itemcode"

    now, the AddChooseFromList() procedure. a CFL to pull item from OITM.

      Private Sub AddChooseFromList()
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                oform = sbo_Application.Forms.Item("cfl")
                oCFLs = oform.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = sbo_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCFLCreationParams.MultiSelection = True
                oCFLCreationParams.UniqueID = "MyCFL"
                oCFLCreationParams.ObjectType = "4"
                oCFL = oCFLs.Add(oCFLCreationParams)
                oCons = oCFL.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "sellitem"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "Y"
                oCFLCreationParams.UniqueID = "CFL2"
                oCFL = oCFLs.Add(oCFLCreationParams)
            End Try
        End Sub

    and the ChooseFromList event:

     If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                If pVal.FormUID = "cfl" And pVal.ItemUID = "mt" Then
                        Dim i As Integer
                        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)
                        If oCFLEvento.BeforeAction = False Then
                            Dim oDataTable As SAPbouiCOM.DataTable
                            oDataTable = oCFLEvento.SelectedObjects
                            If oDataTable Is Nothing Then
                                Exit Sub
                            End If
                            oMatrix = oform.Items.Item("mt").Specific
                            If pVal.ItemUID = "mt" And pVal.ColUID = "V_1" Then
                                For i = 0 To oDataTable.Rows.Count - 1
                                    oForm.DataSources.UserDataSources.Item("Item").ValueEx = oDataTable.GetValue(0, i)
                                    If Not i = oDataTable.Rows.Count - 1 Then
                                    End If
                            End If
                        End If
                    Catch ex As Exception
                    End Try
                End If
            End If

    hope it is what you want.


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:26 PM

    From System CFL you can receive just one value. For multiple selection of values you have to create user defined cfl.

    lg Mahendra

    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.