CFL to UDO

Hi,
I am trying to assign the  UDO to CFL. While i am trying to assess the CFL It will throw Internal Error
oCFLCreationParams.MultiSelection = False
            oCFLCreationParams.ObjectType = "DSS_UDO1"
            oCFLCreationParams.UniqueID = "CFL6"
            oCFL = oCFLs.Add(oCFLCreationParams)
oEdit = objForm.Items.Item("4").Specific
            oEdit.ChooseFromListUID = "CFL6"
            oEdit.ChooseFromListAlias = "U_BPProjec"
i am using SAP 2007 A Patch 00.
if anyone having solutions pls let me know.
Thanks in advance
Senthil Kumar

Hi Senthil,
Did you define the finding items in the UDO.if you didnt, when you open the CFL
it will throws an error.
First Go to Update the UDO.
Give me reward points,
Regards,
G.Suresh

Similar Messages

  • Adding CFL for UDO generated form

    Hi I have created a form through Udo Form generator. i.e. UDO1(with Master Table=Users and master data rows table=OPDS)
    On other form made through screen painter, I want to add cfl for udo generated form(UDO1).
    Can anyone help me?

    You can set the CFL alias like this :
    oEditText.ChooseFromListAlias= "COLUMN_ID"
    I think this is how it's suppose to be - you set the CFL alias as the column id of the master data table ( whose values you want to be placed in the EditText) . The only problem is that it doesn't work - it  won't place the value automatically in the EditText.
    To make it work , you have to catch the CFL Event and put the value in the EditText manually. ( this is also covered in the CFL example in the sample files).

  • CFL for UDO problem

    Hi all,
    I have made one form for operation master.
    I try to use this UDO as a CFL in another form call router.
    I am trying to add CFL on the Matrix field in the Router form.
    CFL is added perfectly. But when I try to press the tab on the Field. I got the following error.
    Internal Error(-1003) occured Message [131-183]
    I have checked the User define table and UDO length is less than eight character.
    Kindly give me the solutions for the same.
    Regards,
    Gunjan Shukla.

    Hi,
    There are a couple of reason why you're getting that error, but the most probable is that the CFL conditions are not correctly defined OR the ChooseFromListAlias is pointing to a field that does not exist. (example: You have ChooseFromListAlias = "U_Code" when it should be ChooseFromListAlias = "Code", or vice-versa).
    Regards,
    Vítor Vieira

  • CFL in UDO problem!

    Hello every body
    i am newbie in SAP BUSINESS ONE and my question is simple: how can I add choose from list in text field to choose a business partner .I can't find a clear answer please helpppp.

    hi,
    To add choose from list to your form please review the following link :
    http://wiki.scn.sap.com/wiki/display/B1/SAP+BusineUsing+Choose+from+List
    After added the CFL to your form, do the following in item event:
    Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
                            Dim cfl As SAPbouiCOM.ChooseFromListEvent
                            Dim dt As SAPbouiCOM.DataTable
                            cfl = pVal
                            dt = cfl.SelectedObjects
                            If Not (dt Is Nothing) Then
                                   Try
                                        objform.DataSources.UserDataSources.Item("UD_2").ValueEx = dt.GetValue("CardName", 0)
                                    Catch ex As Exception
                                    End Try
                                    objform.DataSources.UserDataSources.Item("UD_1").ValueEx = dt.GetValue("CardCode", 0)
                             End If
    Note: If you are using user data source in alies, the above code should work.

  • How to popup form according to query by  CFL for user defined tables?

    Hi Experts!
    Please write a simple code for adding CFL in UDO and popup the window according to query. suppose i want to execute query
    "select code,name from [@WITM]". I want to add CFL in edittext which is on UDO. how can we add CFL in that Edittext by code.
    Thanking You
    vishwajit kumar

    Hi Vishwajit,
    Please response to your previous posting or close it first. Whatever the answer working or not, you need reply.
    Thanks,
    Gordon

  • CHOOSEFROMLIST FOR UDO

    Hello,
    please i wants to develop my own CFL for UDO,any suggestion or sample code to get it done.
    Thanks

    hi Ankit ,
    i have tried the choosefromlist sample but it gives me "Internal Error" when is mapped to my UDO ObjectType.
    sample code below
    Dim oCFLs As SAPbouiCOM.ChooseFromListCollectio
    oCFLs = oForm.ChooseFromLists
    Dim oCFL As SAPbouiCOM.ChooseFromList
    Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
    oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "ER_DED"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)
    binding it to my UserDefinedField below
    oEdit.ChooseFromListAlias = "U_szCode"

  • SAP B1 UDO: Bind CFL to the same form UDO

    Hi,
    I have created an UDO which is bound to a master data user defined table. Now, I have created a form for that master data, where in a matrix, I need to add some of the entries from the same master table, sort of like a tree structure. I have created a CFL which I have bounded to the object type of "MyUDO". The code on after choose from list is given below.
    try
                            Matrix oMatrix_upsell = (Matrix)form.Items.Item("mtx_upsell").Specific;
                            DBDataSource oDBDataSource = (DBDataSource)form.DataSources.DBDataSources.Item("@PRODUPSELLS");
                            DataTable oDataTable = null;
                            oDataTable = oCFLEvent.SelectedObjects;
                                if (form.Mode == BoFormMode.fm_ADD_MODE | form.Mode == BoFormMode.fm_OK_MODE | form.Mode == BoFormMode.fm_UPDATE_MODE)
                                    if (pVal.Row == oMatrix_upsell.RowCount)
                                        oDBDataSource.SetValue("LineId", oDBDataSource.Size - 1, null);
                                        oDBDataSource.SetValue("U_SKU", oDBDataSource.Size - 1, null);
                                        //oDBDataSource.SetValue("U_CatId", oDBDataSource.Size - 1, null);
                                        oDBDataSource.InsertRecord(oDBDataSource.Size - 1);
                                string Query = null;
                                Query = "select Name, U_Web_Id from [@WITM] where U_SKU =N'" + System.Convert.ToString(oDataTable.GetValue("U_SKU", 0)) + "'";
    Recordset RSet = (Recordset)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                                RSet.DoQuery(Query);
                                oDBDataSource.SetValue("U_SKU", pVal.Row - 1, System.Convert.ToString(oDataTable.GetValue("U_SKU", 0)));
                                oDBDataSource.SetValue("U_Name", pVal.Row - 1, RSet.Fields.Item("Name").Value.ToString().Trim());
                                oDBDataSource.SetValue("U_WebId", pVal.Row - 1, RSet.Fields.Item("U_Web_Id").Value.ToString().Trim());
                                oMatrix_upsell.LoadFromDataSource();
                                oDBDataSource = null;
                        catch (Exception ex)
                            B1Connections.theAppl.SetStatusBarMessage(ex.ToString(), BoMessageTime.bmt_Medium, true);
    The problem is that, when I select an item in the matrix, the data of the other fields in the form gets loaded for the selected object from the CFL. Is there a way to create a cfl and bind it to the same table on which the form is operating?

    Hi Philip,
    in SFP When you develop a form you have the interface mapped/assigned to it right.
    So here you have the source fields on the left hand side (the output parameters of your interface) and the form context on the right hand side.
    So lets say your interface gives you several data where employee list (EMP_LIST) is a internal table.
    so now if you drag and drop this EMP_LIST from left to right.
    when you do it again it will have the name EMP_LIST_1 and so on.
    Now if you go to layout tab you will see the form design area, here if you go to data view on the left hand side, you can see all the fields available for your form. since you have the EMP_LIST of 3 instances you will see all 3 of them.
    So now on the form as required have the 3 tables in different pages or so as you like, do the data binding to the 3 different data instances.
    since the actual actual source of the 3 lists is still the same the data presented in thhese tables is also same nothing different.
    you can have your script to individual tables for presentation nothing changes (all is well).
    Now when it comes to matter of support on your developments, when a new developer carries your work, he can see the context and understand that its the same. no need to investigate any scripts or such.
    Hope this makes you clear,
    Cheers,
    Sai

  • UDO + Matrix + CFL

    Hi,
    How can put to work together a matrix that links to an UDO that works with two user defined tables (a header and a detail), and a CFL two select values from the item table to put after in the matrix and update the UOD (and the table).
    In Screen Painter I put the references, in the matrix, to the detail user table. By code I put the CFL and all works fine. But when I put the values from the CFL in the row's matrix, seems that the matrix loose the original DataSource instead the DataSource from the CFL.
    Anybody knows how put to work this three objects together.
    Thanks in advance,
    Oscar S.M.

    Hi
    Seems that you have to control the values you are passing from and to the CFL.  You can do this by using the SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST event.  Also, try to evaluate the value of the cell on the lost_focus or validate event.
    Does the value has any special formatting (such as serial number or gl account number)?
    There's a sample on the SDK , C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\17.ChooseFromList that deals with assigning values to a control on the event!
    Hope it helps

  • UDO Form as CFL  in the same UDO Form

    Hi,
    I have created a user-defined form using UDO. In the same form I am using it as CFL  bound to a textbox.  I am unable to get the selected data in the textbox. I have written the CFL  event to capture the data in the textbox. Please let me know if its possible to use the same form(UDO) as CFL in the same form(UDO) or not ?  Any help is appreciated.
    Regards,
    Noor Hussain

    Hi Janos,
    I am able to create the CFL. But the selected value is not being copied to my textbox from the CFL. My code is as below.
    Private Sub AddCMSBPChooseFromList()
            'Choose From List Collection object to store the collection
            Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
            'Conditions object to set the conditons
            Dim oCons As SAPbouiCOM.Conditions
            'Condition object to set the conditons
            Dim oCon As SAPbouiCOM.Condition
            'Getting the Form Choose From Lists
            oCFLs = oForm.ChooseFromLists
            'Choose From List object to store the ChooseFromList
            Dim oCFL As SAPbouiCOM.ChooseFromList
            'ChooseFromListCreationParams to create the parameters for the CFL
            Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
            oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
            oCFLCreationParams.MultiSelection = False
            oCFLCreationParams.ObjectType = "IS_CMS_BP"
            oCFLCreationParams.UniqueID = "CFL_3"
            oCFL = oCFLs.Add(oCFLCreationParams)      
        End Sub
    oEdit = oForm.Items.Item("txtConsAcc").Specific
                oEdit.ChooseFromListUID = "CFL_4"
                oEdit.ChooseFromListAlias = "U_ConAcc"
    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                            Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                            oCFLEvento = pVal
                            Dim sCFL_ID As String
                            sCFL_ID = oCFLEvento.ChooseFromListUID
                            oForm = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)
                            Dim oCFL As SAPbouiCOM.ChooseFromList
                            oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                            If oCFLEvento.BeforeAction = False Then
                                Dim oDataTable As SAPbouiCOM.DataTable = oCFLEvento.SelectedObjects
                                Dim val As String
                                Try                              
                                    If pVal.ItemUID = "txtConsAcc" And oCFL.UniqueID = "CFL_4" Then
                                        With oForm.DataSources.DBDataSources.Item("@IS_CMS_BP") '@TABLE is the name of the DBDataSource the form's connect to
                                            .SetValue("U_ConAcc", .Offset, oDataTable.GetValue(0, 0)) 'U_txtGRNNo is the id of the field the EditText is connected to.
                                        End With
                                    End If                                                                               
    Catch ex As Exception
                                End Try
                            End If
                        End If
    Regards,
    Noor
    Edited by: noor_023 on Jun 17, 2010 10:59 AM
    Edited by: noor_023 on Jun 17, 2010 11:00 AM

  • How to call UDO from a CFL

    Guys need help on how to call a UDO from a CFL. I already successfully registered my UDO. Thanks

    Hi,
    I'm having an iternal error after I assigned the Unique ID of my UDO to the ObjectType of the CFL.
    Below is my code:
    Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
    Dim oCFL As SAPbouiCOM.ChooseFromList
    Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
    oCFLs = oForm.ChooseFromLists
    oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
    oCFLCreationParams.MultiSelection = False
    oCFLCreationParams.ObjectType = "BIN"
    oCFLCreationParams.UniqueID = "CFL1"
    oCFL = oCFLs.Add(oCFLCreationParams)
    Dim oColumns As SAPbouiCOM.GridColumns = dgItems.Columns
    oColumns.Item(0).Width = 100
    oColumns.Item(0).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
    Dim oText As SAPbouiCOM.EditTextColumn = oColumns.Item(0)
    oText.ChooseFromListUID = "CFL1"
    Thanks!

  • CFL Not working for one of my UDF

    Hi,
    I have created one UDT.
    I have created UDO for it. I also designed the screen in screen painter. In particular form i have created 3 CFL's. i have assigned to three of my UDF's. But only two or working. and another one is not working. I followed the same procedure for assigning the cfl to each field.
    Kindly help me in this situation.
    Thanks In Advance.

    sishir,
               Can u tell me the code then only i can able to give u the solution. How u define the CFL ???
    Regards,
    Anitha

  • Updating rows in a master-detail udo form

    Dear Sirs,
    I'm using a form connected to a UDO and I want to use standard services provided by SAP.
    In a column I have a CFL button, and if I set a new rows data with the following code in the et_CHOOSE_FROM_LIST event:
    oDetailDS.SetValue("U_ItemCode", pVal.Row - 1, code);  // code and name are variables containing values returned by the CFL
    oDetailDS.SetValue("U_ItemName", pVal.Row - 1, name);
    oMatrix.SetLineData(pVal.Row);
    this works fine until I add new rows in sequece, but if I attempt to modify an already inserted row, the sysstem gives the following error:
    "This entry already exist in the following tables "(@MY_UDO_ROWS) (ODBC -2035) [Message 131-183]
    Replacing the previous code with the following one:
    oDetailDS.Clear();
    oDetailDS.InsertRecord(0);
    oDetailDS.SetValue("U_ItemCode", 0, code);
    oDetailDS.SetValue("U_ItemName", 0, name);
    oMatrix.SetLineData(pVal.Row);
    oDetailDS.Clear();
    oMatrix.FlushToDataSource();
    the system let my update existing rows, but the both lineid and visorder fields are completely re-entered with new values and this make me loose all previous references and also change the order data are presente on the matrix.
    Can anyone help me to find the right way to insert neew rows and update existing ones?
    Thank you for the attention
    Massimo Landi

    Hi,
    Whenever you make changes to the existing record and want to update the record, you need to delete all the records from the child table pertaining to that entry. use the below code in BeforeAction=true.
    If pVal.BeforeAction = True Then
                        If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then
                            oForm = oSBOApplication.Forms.ActiveForm
                            If pVal.ItemUID = "1" And pVal.FormMode = 2 Then
                                oEdit = oForm.Items.Item("txtOpnCode").Specific 'you master document number/code
                                oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                oRecordSet.DoQuery("delete from [@MY_UDO_ROWS ] where [Code/DocNum]='" & oEdit.Value & "'")
                            End If
                        End If
                    End If
    Regards,
    Noor
    Edited by: noor_023 on May 10, 2010 4:41 PM
    Edited by: noor_023 on May 10, 2010 4:42 PM

  • Dynamic condition in UDO Matrix's Column

    Hi all,
    I have a user form with a matrix. The matrix's first column has a CFL linked to another UDO MasterData Code (lets call it UDOCode).
    And on this matrix, the same UDOCode cannot be chosen more then once.
    So, I've been trying to code a dynamic CFL that filters the UDOCode's already chosen in the Column.
    Based on this thread I've achived this code:
    Select Case pVal.ItemUID
                        Case "mtx_ACORDO" '// The Matrix
                            oConds = New SAPbouiCOM.Conditions
                            With oForm.DataSources.DBDataSources.Item("@ADAT_ACORDOS1") '// The Matrix's DBDataSource
                                If .Size = 1 Then
                                    oCond = oConds.Add
                                    oCond.Alias = "Code"
                                    oCond.Operation = BoConditionOperation.co_NOT_NULL
                                Else
                                    For i As Integer = 0 To .Size - 1
                                        oCond = oConds.Add()
                                        oCond.BracketOpenNum = 1
                                        oCond.Alias = "Code"
                                        oCond.Operation = BoConditionOperation.co_NOT_EQUAL
                                        oCond.CondVal = .GetValue("U_EspPrcCd", i)
                                        oCond.BracketCloseNum = 1
                                        If i > 0 And i < .Size - 1 Then
                                            oCond.Relationship = BoConditionRelationship.cr_OR
                                        End If
                                    Next
                                End If
                            End With
                    End Select
    If Not oConds Is Nothing Then oCFL.SetConditions(oConds)
    In the matrix's first row I have no problem. All the values are there. But on the second row, no values are display in the DataTable.
    If I change the conditions from .Size -1 to .Size - 2, I get the correct values on the first and second rows, but on the third, again, no values are being display in the DataTable...
    Can anyone help me?
    Regads,
    Vítor Vieira
    Edited by: Rui Pereira on Dec 23, 2008 4:17 PM

    Hi, Erwine Sukardy
    Maybe it will be helpful if you have a specific task.
    All of items on a Form have it's own DBDataSources.
    For example, to get a table name and field name, that are Datasources to the ItemCode field in a Matrix in a  Purchase Order document, you can use this code:
    SAPbouiCOM.Matrix        tblSNs;
    SAPbouiCOM.Column      oColumnItems;           
    tblSNs = (SAPbouiCOM.Matrix)oPurDNForm.Items.Item("38").Specific;
    oColumnItems = (SAPbouiCOM.Column)tblSNs.Columns.Item("1");
    string tableName = oColumnItems.DataBind.TableName;
    string fieldName = oColumnItems.DataBind.Alias;
    HTH!

  • Problem with ChooseFromList on UDO

    Hi, I have a UDO form that works well except for one small issue.  I have an EditText that is tied to a field in the UDO table for the B1 Item Code.  This field saves, loads and navigates fine, but when adding a new UDO record, I need to have the user pop up a ChooseFromList to see a list of the B1 items.  The only problem is that this edit text is already bound to the UDO table/field and therefore the Choosefrom list isn't able to automatically populate the edit text like it normally would when the field is bound to a user datasource. 
    What is the preferred way to have a UDO field bound to an edit text box on the UDO to also work with a ChoosefromList?
    I just wanted to ask before I spend time programming a work-around to code the choosefromlist value into the edit text myself.
    Thanks!

    Hi Curtis,
    Have you tried to create a CFL and asign it to your edit text (linked to a DB Datasource)? I have tried it and it works fine, it works for UDS and also for DBDS.
        'Add EditText to the form for User Object
        oItem = oForm.Items.Add("EdTxtUO", SAPbouiCOM.BoFormItemTypes.it_EDIT)
        oItem.Left = 105
        oItem.Top = 50
        oItem.Width = 100
        oEdit = oItem.Specific
        'Link DBDS to EditText
        'oEdit.DataBind.SetBound(True, "", "ET_UDS_UO")
        Dim etDDSuo As SAPbouiCOM.DBDataSource
        etDDSuo = oForm.DataSources.DBDataSources.Add("@T_MD")
        oEdit.DataBind.SetBound(True, "@T_MD", "Code")
        ' Add ChooseFromList for EditText to the form
         oCFLCPuo = SB1_App.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
        oCFLCPuo.ObjectType = "TT_MD"
        oCFLCPuo.UniqueID = "UserObjectCFL"
        oCFLuo = oForm.ChooseFromLists.Add(oCFLCPuo)
        'Link CFL to EditText
        oEdit.ChooseFromListUID = "UserObjectCFL"
        oEdit.ChooseFromListAlias = "Code"
    Regards
    Trinidad.

  • Matrix With UDO Datasource

    Hi,
    I have been through all the Matrix Samples and read many threads here but I just dont get a few things with the Matrix.
    I have created an add on that adds a new folder to the Business Partners Form,
    I can have built a matrix in this form and created bound columns bound to my UDO Table @xxxx
    I have an event that fires when a business partner is chosen and the folder is only shown when a Customer is selected.
    I can even get the matrix to fill with data related to the specific customer only when the customer is selected - using conditions on the DBDataSource.
    This is all great but the 2 problems I have are :
    I have created a button called Add Row that Adds a Row to Matrix - this button turns into an Update button when the row is added in the Matrix.
    Problem 1 : When the row is added in the Matrix it takes the data from the last row of the data and duplicates it in the new row - you can change this data of course however I would like a blank row inserted instead.
    Problem 2 : When I update I do a Matrix.FlushToDataSource - then I requery but it has not saved the new entry ?
    How do I get the new entry to save into the database.
    Any Help would be appreciated.
    Thanks

    Thanks - I sent the Screen shot - here is the event code
                If ((pVal.FormType = 134 And pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) And (pVal.Before_Action = True)) Then
                     oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
                    If ((pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD) And (pVal.Before_Action = True)) Then
                            oNewItem = oForm.Items.Add("BOMFolder", SAPbouiCOM.BoFormItemTypes.it_FOLDER)
                        oItem = oForm.Items.Item("9")
                        oNewItem.Top = oItem.Top
                        oNewItem.Height = oItem.Height
                        oNewItem.Width = oItem.Width
                        oNewItem.Left = oItem.Left + oItem.Width
                        oFolderItem = oNewItem.Specific
                        oFolderItem.Caption = "Lynxs BOM"
                        oFolderItem.GroupWith("9")
                        SetupBOMMatrix()
                        oForm.PaneLevel = 1
                    End If
                    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                        If pVal.ItemUID = "mat" Or pVal.ItemUID = "colitem" Then
                            Try
                                Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                                oCFLEvento = pVal
                                Dim sCFL_ID As String
                                sCFL_ID = oCFLEvento.ChooseFromListUID
                                Dim oForm1 As SAPbouiCOM.Form
                                oForm1 = SBO_Application.Forms.Item(FormUID)
                                Dim oCFL As SAPbouiCOM.ChooseFromList
                                oCFL = oForm1.ChooseFromLists.Item(sCFL_ID)
                                If oCFLEvento.BeforeAction = False Then
                                    Dim oDataTable As SAPbouiCOM.DataTable
                                    oDataTable = oCFLEvento.SelectedObjects
                                    Dim val As String
                                    Dim nam As String
                                    Try
                                        val = oDataTable.GetValue(0, 0)
                                        nam = oDataTable.GetValue(1, 0)
                                     Catch ex As Exception
                                        val = "none"
                                        nam = "none"
                                    End Try
                                     Try
                                        Call UpdateCells(oForm1, pVal.Row, val, nam)
                                    Catch
                                        MsgBox("Couldnt Set Data Tables")
                                    End Try
                                End If
                            Catch
                                MsgBox("Error in Item Event - CFL : " & Err.Description)
                            End Try
                        End If
                    End If
                     If pVal.ItemUID = "btnAddRow" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.Before_Action = True Then
                        ' SOMETHING IS AMISS HERE
                        Dim ob As SAPbouiCOM.Button = oForm.Items.Item("btnAddRow").Specific
                        Dim oe As SAPbouiCOM.EditText = oForm.Items.Item("5").Specific
                        oMatrix = oForm.Items.Item("mat").Specific
                        If MatrixMode = "Nothing" Then
                            oMatrix.AddRow()
                            Dim i As Integer
                            i = oMatrix.RowCount
                            Dim oc As SAPbouiCOM.Column
                            Dim ocell As SAPbouiCOM.Cell
                            Dim oed As SAPbouiCOM.EditText
                            oc = oMatrix.Columns.Item("colArea")
                            oed = oc.Cells.Item(i).Specific
                            oed.String = ""
                            oc = oMatrix.Columns.Item("colItem")
                            oed = oc.Cells.Item(i).Specific
                            oed.String = ""
                            oc = oMatrix.Columns.Item("colItemtxt")
                            oed = oc.Cells.Item(i).Specific
                            oed.String = ""
                            oc = oMatrix.Columns.Item("colFitted")
                            oed = oc.Cells.Item(i).Specific
                            oed.Value = 0
                            oc = oMatrix.Columns.Item("colCritica")
                            oed = oc.Cells.Item(i).Specific
                            oed.Value = 0
                            oc = oMatrix.Columns.Item("colSpares")
                            oed = oc.Cells.Item(i).Specific
                            oed.Value = 0
                            MatrixMode = "Add"
                            ob.Caption = "Update Row"
                        Else
                            oMatrix.FlushToDataSource()
                            Dim oConditions As SAPbouiCOM.Conditions
                            Dim ocondition As SAPbouiCOM.Condition
                            oConditions = New SAPbouiCOM.Conditions
                            ocondition = oConditions.Add
                            ocondition.BracketOpenNum = 1
                            ocondition.Alias = "U_CARDCODE"
                            ocondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                            ocondition.CondVal = oe.Value.ToString
                            ocondition.BracketCloseNum = 1
                            oDBDatasource.Query(oConditions)
                            oMatrix.LoadFromDataSource()
                            MatrixMode = "Nothing"
                            ob.Caption = "Add Row"
                        End If
                    End If
                    If pVal.ItemUID = "BOMFolder" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.Before_Action = True Then
                        '// when the new folder is clicked change the form's pane level
                        '// by doing so your items will apear on the new folder
                        '// assuming they were placed correctly and their pane level
                        '// was also set accordingly
                        oForm.PaneLevel = 11
                    End If
                End If

Maybe you are looking for