Choose from list - data display with condition

I 've developed a form using screen painter, I ' ve attached a choose from list to fill GRPo Number.  In the choose from list the GRPo no. should not display again which once I have selected and saved. 
Let me have a good solution please and it would be appreciated.
Thanks & Regards,
Venkatesan G.

Hi suresh,
where did you put this code?....In the choose_from_list event handler?..I've tried a similar solution, before reading your post, but it doesn't work because if i dynamically set the condition for the choose from list i got an empty table.
i've tried to put my code when beforeaction=true and i have this kind of problem. The difference is that i need to set the filter starting with the value i've entered on the field connected to the choose from list. I put code here, so it's more clear
If (pVal.Before_Action = True) And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) Then
                    Dim oCFL As SAPbouiCOM.ChooseFromList
                    Dim oCons As SAPbouiCOM.Conditions
                    Dim oCon As SAPbouiCOM.Condition
                    Dim sItemCode As String
                    oEditText = oMatrix.Columns.Item("V_ItemCode").Cells.Item(pVal.Row).Specific
                    sItemCode = oEditText.Value.ToString
                    oCFL = oForm.ChooseFromLists.Item("CFL_Item")
                    oCons = oCFL.GetConditions()
                    oCon = oCons.Add()
                    oCon.Alias = "ItemCode"
                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_START
                    oCon.CondVal = sItemCode
                End If
My situation is that i type something in V_ItemCode column and after that i press the tab key to open the choose from list.
Would be ok if i get the SAP standard beahviour too, that doesn't open the choose from list, but fills the field with the first code starting with what you type.
Thanks in advance

Similar Messages

  • Associating a Custome ResultSet with a Choose From List

    Hi Experts,
    I have to Link the Chose from List with a UDO for accessing the records from the Parent Table /Child Table
    How to crack this problem?
    Also I have to associate the Results of a custom query in a choose from list so that when I press TAB over a Text Box I get a Choose From List which displays the Results and I could select one of those rows.
    Plz Hint me for this Problem

    When you create CFL, just set your UDO type with oCFLCreationParams.ObjectType = "My_UDO", the collumn to be displayed in CFL has been determined by Find Service in your UDO definition.
    As per custom query, actually you can set the condition to do so. Direct customed SQL is not supported in CFL. You may refer to the SDK sample for further info after you install SDK component:
    <<C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\17.ChooseFromList>>
    Private Sub AddChooseFromList()
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                ' Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = False
                'Just Set your UDO type.
                oCFLCreationParams.ObjectType = "My_UDO"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)
                ' Adding Conditions to CFL1
                oCons = oCFL.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
            End Try
        End Sub
    Kind Regards

  • Delete/Edit/Update CFL Conditions - Choose From List

    Hi All,
    I have a Choose From List of which the conditions are set depending on a ComboBox.Selected.Value
    oCon.CondVal = comboboxBranch.Selected.Value
    So the Conditions are set when the "OnAfterComboSelect" event is trigered.           
    How do I reset the Condition when the user "RESELECTS" another ValidValue on that ComboBox???
    At the moment, on the Reselection on the Combobox, the CFL is returning EMPTY.....

    Hi Michael,
    Thanks for the speedy reply.  Its workin.
    Here's my code for the adding/editing of the Conditions from within the an Event Handler if any1 needs it.
    In the OnAfterFormLoad Event Handler:
    Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
    Dim oCFL As SAPbouiCOM.ChooseFromList
    Dim oCons As SAPbouiCOM.Conditions
    Dim oCon As SAPbouiCOM.Condition
    Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
    ' Adding CFL3 for Line GL Account Name.
    oCFLCreationParams.MultiSelection = False
    oCFLCreationParams.ObjectType = "1"
    oCFLCreationParams.UniqueID = "CFL3"
    oCFL = oCFLs.Add(oCFLCreationParams)
    In the 1st TabOrder Item's OnGotFocus Event Handler:
    oColumn = oColumns.Item("AcctCode")
    oColumn.ChooseFromListUID = "CFL3"
    oColumn.ChooseFromListAlias = "FormatCode"
    In the OnAfterComboSelect Event Handler:
    oCFLs = form.ChooseFromLists
    oCFL = oCFLs.Item("CFL3")
    oCons = oCFL.GetConditions()
    If oCons.Count = 0 Then
                    oCon = oCons.Add()
                    oCon.BracketOpenNum = 2
                    oCon.Alias = "GroupMask"
                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                    oCon.CondVal = "7"
                    oCon.BracketCloseNum = 1
                    oCon.Relationship = BoConditionRelationship.cr_AND
                    oCon = oCons.Add()
                    oCon.BracketOpenNum = 1
                    oCon.Alias = "Postable"
                    oCon.Operation = BoConditionOperation.co_EQUAL
                    oCon.CondVal = "Y"
                    oCon.BracketCloseNum = 1
                    oCon.Relationship = BoConditionRelationship.cr_AND
                    oCon = oCons.Add()
                    oCon.BracketOpenNum = 1
                    oCon.Alias = "Segment_1"
                    oCon.Operation = BoConditionOperation.co_EQUAL
                    oCon.CondVal = comboboxBranch.Selected.Value
                    oCon.BracketCloseNum = 2
                    oCon = oCons.Item(2)
                    oCon.CondVal = comboboxBranch.Selected.Value
    End If

  • Choose From List Cancel Button Throws Exception

    Hi all,
    When I click the "Cancel" Button on my CFL, I get an error....
    EXCEPTION: Matrix__EBS_FRM_CRDCLM__64.OnAfterChooseFromList raised
    No matching records found (ODBC -2028)
    Any ideas???

    in your choose from list  event add this  condition
    If Not pval.SelectedObjects Is Nothing Then
    'write your code in this if condition
    end if
    hope it will help u.

  • Choose From List From a UDT in SAP Business One 2005 A

    Hi All
    How to develop a Choose From List from a <b>User Defined Table</b> (not from System Tables) in SAP Business One 2005 A.
    I need the Choose From List should display the records stored in the UDT.
    Any Idea ?
    Thanks in Advance.

    Hi Asutosh,
    You can add a CFL to a User Defined Object, not a simple User Defined Table.
    In order to do it you only have to set the object type of the CFL to the code of your UDO.
    Here you have a simple:
    oCFLCPuo = SB1_App.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
    oCFLCPuo.ObjectType = "MY_UDO_CODE"
    oCFLCPuo.UniqueID = "UserObjectCFL"
    oCFLuo = oForm.ChooseFromLists.Add(oCFLCPuo)
    Hope it helps

  • Business Partner Choose from lists

    It would be good if the choose from lists would display only active Business Partners (and Items) by default, and have a check box to display inactive as well?
    This would be very useful for customers who have been using the system for some time and have many inactive customers, suppliers, leads and items, and employees!
    In general, only active ones should be chosen by the majority of users, and this would reduce the size of the lists to be displayed.

    Closed so I can open another thread

  • Change data in existing "Choose from list" matrix

      in UI GUI->order form . When add a new order, hit "TAB" to select BP from existing list. I want to use my own sql to populate the BP list (currently the GUI defaults to return all customers).
    Is there a way? I mean if I just want to change data in the matrix and let B1 continue to make the "Choose from list" form (form "10001") with my own new customer list.  Set BubbleEvent = true will just re-read all cards after I query my result.
      any help is appriciated!

    I came across the same issue with the Items Choose from List on the Sales Order screen. It is possible to load your own Choose from List form and populate the matrix using recordset objects and userdatasources. The same logic could be applied to the BP Choose from List form. The following code displays the user form and matrix items - separate code is needed to handle the selection process on this form. There maybe a faster way of acheiving this using UDTs etc but it seems to work ok.
    'When user presses Tab key in Item No. column.
    If pVal.EventType = et_KEY_DOWN Then
    If pVal.ItemUID = "38" And pVal.ColUID = "1" And _
    pVal.Before_Action = True And pVal.CharPressed = vbKeyTab Then
    'Load new Choose from List form.
    'This is actually an exported and edited version of the SBO form.
    'Populate matrix with items returned from SQL query.
    'Use recordset, arrays, userdatasources.
    Set oRecordSet = oCmp.GetBusinessObject(BoRecordset)
    sSql = "Select OITM.ItemCode, OITM.ItemName, OITM.OnHand FROM OITM " & _
        "Where Upper(Left(OITM.ItemCode,2)) = 'B1'"
    oRecordSet.DoQuery sSql
    nRows = oRecordSet.RecordCount
    If nRows <> 0 Then
    'Array declarations.
    Dim ItemCode(), ItemName(), OnHand()
    ReDim ItemCode(nRows - 1)
    ReDim ItemName(nRows - 1)
    ReDim OnHand(nRows - 1)
    'Add userdatasources to form.
    oForm.DataSources.UserDataSources.Add "ItemCode", dt_LONG_TEXT, 20
    oForm.DataSources.UserDataSources.Add "ItemName", dt_LONG_TEXT, 100
    oForm.DataSources.UserDataSources.Add "OnHand", dt_LONG_NUMBER
    i = 0
    'Populate arrays from recordset.
    Do While oRecordSet.EOF <> True
        ItemCode(i) = oRecordSet.Fields.Item(0).Value
        ItemName(i) = oRecordSet.Fields.Item(1).Value
        OnHand(i) = oRecordSet.Fields.Item(2).Value
        i = i + 1
    'Bind data fields to form items.
    Set oMatrix = oForm.Items.Item("7").Specific
    Set oColumn = oMatrix.Columns.Item("ItemCode")
    oColumn.DataBind.SetBound True, "", "ItemCode"
    Set oMatrix = oForm.Items.Item("7").Specific
    Set oColumn = oMatrix.Columns.Item("ItemName")
    oColumn.DataBind.SetBound True, "", "ItemName"
    Set oMatrix = oForm.Items.Item("7").Specific
    Set oColumn = oMatrix.Columns.Item("OnHand")
    oColumn.DataBind.SetBound True, "", "OnHand"
    'Get data from datasources.
    Dim oUItemCode As SAPbouiCOM.UserDataSource
    Dim oUItemName As SAPbouiCOM.UserDataSource
    Dim oUOnHand As SAPbouiCOM.UserDataSource
    Set oUItemCode = oForm.DataSources.UserDataSources.Item("ItemCode")
    Set oUItemName = oForm.DataSources.UserDataSources.Item("ItemName")
    Set oUOnHand = oForm.DataSources.UserDataSources.Item("OnHand")
    'For each returned record in recordset then
    'add row to matrix and populate it from
    For i = 1 To nRows
        oUItemCode.Value = ItemCode(i - 1)
        oUItemName.Value = ItemName(i - 1)
        oUOnHand.Value = OnHand(i - 1)
    Next i
    End If
    'Show form. This also sets focus to edittext field.
    oForm.Visible = True
    'Don't display standard SBO item list form.
    BubbleEvent = False
    End If
    End If

  • Multiple Values For one Condition in Choose From List

    I have used one Business Partner Choose From List in my form but i want to give condition in that choose from list on GroupCode .But the condition will have multiple values like 100,102,104 then how i will write the code to incorporate multiple values for one single condition.

    Check this thread
    How to set a Multiple condition in a single CFL
    Hope that helps,
    Vasu Natari.

  • Choose From List Condition

    Dear Experts,
    i want to select Items in Sales Quotation Screen  which is from Particular Group, I'm using following code
    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST And pVal.BeforeAction = True Then
                If pVal.FormTye = "149" And pVal.ItemUID = "38" And (pVal.ColUID = "1" Or pVal.ColUID = "3") Then
                        oForm = SBO_Application.Forms.ActiveForm
                        Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent = pVal
                        Dim sCFL_ID As String = oCFLEvento.ChooseFromListUID
                        Dim oCFL As SAPbouiCOM.ChooseFromList = Nothing
                        oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                        oCons = Nothing
                        oCon = Nothing
                        oCons = oCFL.GetConditions()
                        oCon = oCons.Add()
                        oCon.Alias = "ItmsGrpCod"
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                        oCon.CondVal = "100"
                    Catch ex As Exception
                    End Try
                End If
            End If
    First time  Its working fine. but i'm selecting the next time in next row or same row its not showing any item. it opens only empty Choose from list. what is the prblm

    The problem is that when this event is called again, the Conditions object still has the conditions from the last call :
    oConditions = oCFL.GetConditions();  // this has all the previous set conditions
    So the conditions set before are also taken into consideration. What you need to do is :
    oConditions = oCFL.GetConditions();
    This way the Conditions object will be empty. There is no method to remove a Condition from a Conditions collection, so you have to make it null.

  • Get cardname along with cardcode usuing Choose From List Button

    I am using Choose From List button in my form. If I click the button then I can see the matrix containing business partners list and if I choose any business partner from that list then I can see the business partners id or cardcode from ocrd table in the corresponding textbox.
    But I want the business partner's name or cardname also should come simultaneously in the next textbox of my form. Can some one provide me any code help for this process.

    Hi Sudesha,
    You can get the CardName with the following code:
    sCardCode = oDataTable.GetValue(0, 0)
    sCardName = oDataTable.GetValue(1, 0)
    Hope it helps,

  • Removing Duplicates from a choose from list

    Hi All,
    I have a choose from list of obj 73 )Catalog Numbers (Table OSCN)
    I also added conditions in the CFL that it only shows the Substitute for the CardType = 'S' (Supllier) Business Partners.
    But I want to remove all the duplicate Substitutes from the CFL so that only distinct Catalog Numbers shows in the CFL.
            //  Adding 2 CFL, one for the button and one for the edit text.
                    oCFLCreationParams.MultiSelection = false;
                    oCFLCreationParams.ObjectType = "73";
                    oCFLCreationParams.UniqueID = "CFL1";
                    oCFL = oCFLs.Add(oCFLCreationParams);
                    //Adding Conditions to CFL1
                    oCons = oCFL.GetConditions();
                    oCon = oCons.Add();
                    oCon.Alias = "Substitute";
                    SAPbobsCOM.Recordset oSuppliers = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    oSuppliers.DoQuery("Select Distinct t1.Substitute From OSCN t1 Join OCRD t2 on t1.CardCode = t2.CardCode Where t2.CardType = 'S' Group By t1.Substitute");
                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                    while (!oSuppliers.EoF)
                        oCon.CondVal = oSuppliers.Fields.Item(0).Value.ToString();
                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR;
                        oCon = oCons.Add();
                        oCon.Alias = "Substitute";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
    Please advise....
    Kind Regards,
    Brenden Draper

    Hi Brenden,
    what you are trying to archieve won't work. Simply because CFL is getting all row data from  OSCN and ItemCode or CardCode can differ for a specific substitute.
    For example.
    Would be 2 resultlines both with sub1 as substitute.
    SQL equivalent :
    Select Distinct t0.* from oscn t0 inner join OCRD t1 on t0.CardCode = t1.CardCode where t1.CardType = 'S'
    My advise would be to open a simple form with a grid and datatable bound.
    Some lines of coding and you get all you need.

  • Problem in Choose from list.

    As I tried CFL for a user defined form, when I select an item from CFL and it is displaying in the relevant field.  And when I save the data it is perfectly saving with the message of "Operation has been completed successfully".  But the data is not saving in the field in which is the CFL is activating. 
    It would be appreciated, if any one can give the solution please.
    The steps I' ve followed as,
    1.  In the screen painter I' ve added the choose from list thru' the collection folder.
    2.  Then the choose from list id is attached and give the allias in the item's specific property.
    3. Then I' ve written code in the load form function as follows.
                Oform.DataSources.UserDataSources.Add("EditDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)
                txtaccode.DataBind.SetBound(True, "", "EditDS")
    4. In the item event
            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
                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
                    Dim val As String
                    Dim val1 As String
                    Dim val2 As String
                    Dim val3 As String
                            val = oDataTable.GetValue(0, 0)
                            val1 = oDataTable.GetValue(1, 0)
                            If (pVal.ItemUID = "txtaccode") Then
                                oForm.DataSources.UserDataSources.Item("EditDS").ValueEx = val
                                txtaccode.Value = val
                                oForm.DataSources.UserDataSources.Item("EditDS1").ValueEx = val1
                            End If
                        Catch ex As Exception
                            Exit Sub 'For Exception raised for Cancel Button
                        End Try
                    Catch ex As Exception
                    End Try
                End If
            End If
        End Sub

    Checks if  the property TableName in the field is pointed to the table to store de data.
    Go to  Example: How to binding CFL  to a UDO in a customized System Form. and rate it

  • UDO-Choose From List

    I would appreciate if someone could tell me how to associate an UDO to a choose from list.
    I have looked over the SDK example, but this is for standar SAP objects and I need to associate the choose from list to a customer object. 
    Best regards

    The choose from list (CFL) can be triggered from your edittext - there is some sample code in the DI API help file that shows this.  Have a look for 'Adding a choose from list object' in the help file.  Remember that where they set ObjectType="2", you should use the name of your UDO.
    As can also be seen in the help file, CFL objects allow you to add conditions to determine what rows are displayed.  In the example it shows selecting only where CardType = 'C'.  The columns displayed can be tailored by the user at runtime, where they can select from any columns that are on your main UDO table.
    There are a few limitations.  At present CFL's do not allow you to directly specify a SQL query.  Only data from the single table related to the 'ObjectType' is displayed.  If you want a more complex query that displays data from multiple tables when you press tab, a formatted search may be more powerful.  If you search the forums you should find one of my previous posts (probably about a year ago) where I showed how to link a formatted search to the tab keypress and have it behave in a very similar manner to a CFL.

  • Edit and text and choose from list

    I am trying to create a form that resemle to the purchase order form.
    In the purchase order form when we select the card code from the choose from list
    the system fill all the fileds like the name docnum .. with relevant information.
    i tried to do that by using the vent et_evaluate of the edit text bind with the Card code in my form.
    The problem is that when i clik on the choose from list button the event is lanched  and then the value of the card code is "" so i can't crate my queries to get the infomation like suplier name and ..
    does any body have an answer?
    This my code:
    switch (pVal.ItemUID)
                                                case "3":
                                                            string NumFournisseur =
                                                                ((EditText) _Form.Items.Item("3").Specific).Value;
                                                            ArrayList DFournisseur =
                                                                new DB.PurchaseRequest(_SboCompany).
                                                            EditText Textvar;
                                                            // remplir nom fournisseur et nom contact
                                                            Textvar = (EditText) _Form.Items.Item("2").Specific;
                                                            Textvar.String = DFournisseur[0].ToString();
                                                            Textvar = (EditText) _Form.Items.Item("4").Specific;
                                                            Textvar.String = DFournisseur[1].ToString();
                                                            // remplir les dates comptable , de livraiosn et du document
                                                            Textvar = (EditText) _Form.Items.Item("17").Specific;
                                                            Textvar.String = DateTime.Today.ToString();
                                                            Textvar = (EditText) _Form.Items.Item("19").Specific;
                                                            Textvar.String = DateTime.Today.ToString();
                                                            Textvar = (EditText) _Form.Items.Item("21").Specific;
                                                            Textvar.String = DateTime.Today.ToString();
                                                            // remplir devise partenaire et numéro document
                                                            ((EditText) _Form.Items.Item("59").Specific).String =
                                                                new DB.PurchaseRequest(_SboCompany).GetCurrencyCode(
                                                            _Form.Items.Item("59").Visible = true;
                                                            _Form.Items.Item("59").Enabled = false;
                                                            ((ComboBox) _Form.Items.Item("10").Specific).Select(
                                                            ((EditText) _Form.Items.Item("11").Specific).String =
                                                                new DB.PurchaseRequest(_SboCompany).GetLastDocNum().
                                                            ((EditText) _Form.Items.Item("12").Specific).String = "0";
                                                        catch (Exception e)
                                        catch (Exception ex)

    Hey Achref,
    You can use the event and code like this:
    string vendCode = string.Empty;
    SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent) pVal;
    string sCFL_ID = oCFLEvento.ChooseFromListUID;
    SAPbouiCOM.ChooseFromList oCFL = oVendorSourcingForm.ChooseFromLists.Item(sCFL_ID);
    SAPbouiCOM.DataTable oDataTable =  oCFLEvento.SelectedObjects;
    if (oDataTable != null)
         //get selected value from datatable
         if (oDataTable.Rows.Count > 0)vendCode = oDataTable.GetValue(0, 0).ToString();
    Also check out 17.ChooseFromList in the samples that you can download.
    Hope that helps

  • Choose From List used in UDO (B1 2004)

    in the presentation "Creating a UDO of document type.pps" (slide 53+55) provided with the SDK 2004 they use the Choose From List to select business partners and/or items in their UDO form when adding a new document. Does anyone know, how this has to be done? The sample, from the presentation is not provided in the sample codes.
    Do I have to use an implementation DLL for my UDO to use this functionality?
    My problem is, that it takes too long (about 5 times longer than with the system CFL) to get all items in my custom defined matrix.

    Hi Markus,
    You cannot use the built-in CFL in version 2004. It is only exposed from version 2005. The only suggestion is to look at optimizing your matrix. All CFLs in the system uses DB Datasources which makes populating the grid faster than using User data sources.
    Hope it helps,

Maybe you are looking for