Skip to Content

Choose From List is not being shown

I have one Matrix with some cols and one of them is attached to a linked button and a ChooseFromList (OITM table). Problem is after I select an item, it's code is not being shown in the matrix. Am I doing something wrong?

choose.jpg (20.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • May 04, 2017 at 07:54 PM

    Does your column is binded to a datasource? If it is not, you should bind in order to show your CFL

    Add comment
    10|10000 characters needed characters exceeded

  • May 05, 2017 at 01:25 PM

    Sooorry, I thought you couldn`t open the CFL.

    Yes, you need to treat the ChooseFromListAfter event.

    There is a sample on SDK that should help you.

    C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\COM UI\CSharp\17.ChooseFromList

    Add comment
    10|10000 characters needed characters exceeded

  • May 05, 2017 at 02:55 PM

    Seems like I was not treating the ChooseFromListAfter event. I found a blog which was helpful:

    http://projectservercode.com/add-cfl-into-the-matrix-columns/

    Now I'm having the following error

    Cannot cast 'SAPbouiCOM.SBOItemEventArgClass' to 'SAPbouiCOM.ChooseFromListEvent'.

    My code is as follow:

            private void Matrix0_CFLA(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
            {
                try
    	        {
                    //It Contains information about the current choose from list event,
    		        SAPbouiCOM.ChooseFromListEvent oCflEvent = null;
    		 
    		        //Here pVal is an ItemEvent ,Thus we need to cast it as ChooseFromListEvent to access it as ChooseFromListEvent .
    		        oCflEvent = (SAPbouiCOM.ChooseFromListEvent)pVal; // HERE'S THE PROBLEM
    		        if (oCflEvent.SelectedObjects != null)
                        ((SAPbouiCOM.EditText)Matrix0.GetCellSpecific(pVal.ColUID, pVal.Row)).Value = oCflEvent.SelectedObjects.GetValue("ItemCode", 0).ToString();
    	        }
    	        catch(Exception ex)
    	        {
                    throw ex;
    	        }
            }
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • May 05, 2017 at 03:07 PM

    I believe the problem is the argument you are using "SAPbouiCOM.SBOItemEventArg pVal"

    Try to use SAPbouiCOM.ItemEvent.

    Add comment
    10|10000 characters needed characters exceeded

    • I can't use ItemEvent. This function only accepts SBOItemEventArg.

      this.Matrix0.ChooseFromListAfter += new SAPbouiCOM._IMatrixEvents_ChooseFromListAfterEventHandler(this.Matrix0_CFLA);