Skip to Content
0

Choose From List is not being shown

May 04, 2017 at 07:37 PM

109

avatar image

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Danilo Kasparian May 04, 2017 at 07:54 PM
0

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Yes, it is. dt_SHORT_TEXT length: 15

0

Have a look on your form on SAP when you hover over your column if it shows on the status bar the binded properties.

0

Yes, it's showing UD_2 which is my UserDatasource. Do I need to treat events like ChooseFromListAfter?

0
Danilo Kasparian May 05, 2017 at 01:25 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

No worries. Those samples are very confusing and outdated. I found a simpler way to treat that but I'm still getting some errors. Check my last answer please.

0
Rudá Gonçalves May 05, 2017 at 02:55 PM
0

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;
	        }
        }

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Hi Rudá,

Use this:

IChooseFromListEvent oCFLEvento = (IChooseFromListEvent)(pVal);

Instead:

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

Hope it helps.

Kind Regards,

Diego Lother

0

Same error. SDK Help Center says:

To access this object, cast the ItemEvent object into this object.

Problem is that I can't use ItemEvent as an argument, it must be SBOItemEventArg

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

Hi Rudá,

Sorry, I didn't see the signature of your method I thought that you used the ItemEvent.

In this case, try this:

ISBOChooseFromListEventArg oCFLEvent = (ISBOChooseFromListEventArg)(pVal);

Hope it helps.

Kind Regards,

Diego Lother

1

Hi Diego,

Thanks for helping me. It's working now. There's a COMException being caught, should I worry about it?

0

Hi Rudá,

It's not common to caught this kind of exception. In what piece of code you received this exception?

Kind Regards,

Diego Lother

0
Danilo Kasparian May 05, 2017 at 03:07 PM
0

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

Try to use SAPbouiCOM.ItemEvent.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

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