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

Ctrl-Tab and ChooseFromList conditions

Hello Experts,

I am trying to add conditions on the alternate ChooseFromList (When you press CTRL-TAB) of the Journal Entry Matrix (Form 390, Item 76).

I have no problem setting condition on the GL CFL, but I also need to put some condition on the Business Partners CFL.

I tried to set the condition after the Ctrl-Tab is pressed by handling the KeyDownEvent + modifier = CTRL but I always get an error about applying an invalid condition on the GL table (OACT)

        [B1Listener(BoEventTypes.et_KEY_DOWN, false)]
        public virtual void OnAfterItemPressed(ItemEvent pVal) {
            bool ActionSuccess = pVal.ActionSuccess;
            Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            Item item = form.Items.Item("76");
            Matrix matrix = ((Matrix)(item.Specific));

            Console.WriteLine(pVal.Modifiers.ToString());
            if (pVal.Modifiers == BoModifiersEnum.mt_CTRL)
            {
               SetBPFilterCFLMatrix(ref form, UIDMatrixGL, "1", UIDComboSeriesGL);
            }

        }



        public static void SetBPFilterCFLMatrix(ref Form form, string UIDMatrix, string ColumnIDCFL, string UIDSeries)
        {
            // Apply BP Filter on the CardCode ChooseFromList
            SAPbouiCOM.Conditions oCons = null;
            SAPbouiCOM.Condition oCon = null;
            SAPbouiCOM.ComboBox CboSeries = null;
            
            SAPbouiCOM.ChooseFromList oCFL = null;
            string QryGroup = string.Empty;


            // Get CFL from matrix 1st column
            SAPbouiCOM.Matrix myGrid = (SAPbouiCOM.Matrix)form.Items.Item(UIDMatrix).Specific;

            oCFL = form.ChooseFromLists.Item(myGrid.Columns.Item(ColumnIDCFL).ChooseFromListUID);


            CboSeries = (SAPbouiCOM.ComboBox)form.Items.Item(UIDSeries).Specific;


            oCons = (SAPbouiCOM.Conditions)B1Connections.theAppl.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_Conditions);


            QryGroup = Conso.GetQryGroup(CboSeries.Selected.Value, true);

            oCon = oCons.Add();
            oCon.Alias = QryGroup;
            oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
            oCon.CondVal = "Y";

            // Apply conditions to Choose From List
            oCFL.SetConditions(oCons);

        }


Does anybody have an idea on how to do this?

Regards,

Simon

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Posted on Dec 10, 2008 at 03:27 AM

    Hello Simon,

    You may listen to et_CHOOSE_FROM_LIST ItemEvent (BeforeAction=True) instead of Tab Key down event. You also can refer to EventLoger in B1DE, figuring out the sequence of different events. if it doesn't work, please specify the exact error.

    by the way, You need to make sure it is right alias.

    oCon.Alias = QryGroup;

    Regards, yatsea

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 10, 2008 at 04:10 AM

    Hello Yatsea,

    Thank you for your quick reply.

    I used the event logger before posting this message and the only difference I can find between a call to the CFL with "TAB" vs "CTRL-TAB" is the Modifier on the et_KEY_DOWN event juste before the et_CHOOSEFROMLIST event.

    TAB event logger screenshot

    [http://img247.imageshack.us/img247/8468/tabsq0.gif]

    CTRL-TAB event logger screenshot

    [http://img247.imageshack.us/img247/3426/ctrltabqj2.gif]

    My error message is :

    Matrix_390_38.OnAfterItemPressed raised XML 'Conditions' parsing failed [66000-116] Invalid Alias 'QryGroup1' for table 'OACT'.

    [http://img367.imageshack.us/img367/1152/err1pa4.gif]

    If y put my method call in the CFL Event (where usually my method to set conditions on GL Account is called succesfully) i get a similar message : Matrix_390_38.OnBeforeChooseFromList raised XML 'Conditions' parsing failed [66000-116] Invalid Alias 'QryGroup1' for table 'OACT'.

    [http://img367.imageshack.us/img367/9113/err2nj9.gif]

    The table it should filter on is OCRD for BP any QryGroup1 (value of QryGroup variable) is a column of OCRD.

    Any suggestions?

    Regards,

    Simon

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Simon,

      When CFL swith to BP, you need to set ObjName of CFL from OACT to OCRD. Try this:

      oCFL = form.ChooseFromLists.Item(myGrid.Columns.Item(ColumnIDCFL).ChooseFromListUID);
      oCFL.ObjName = "OCRD";

      Also When CFL switchs to G/L, you need set ObjName of CFL as OACT.

      Regards, Yatsea

  • author's profile photo Former Member
    Former Member
    Posted on Dec 17, 2008 at 12:12 AM

    Hello Yatsea,

    Sorry for the late reply.

    There is no "ObjName" property for the SAPbouiCOM.ChooseFromList. There is a ObjectType property but it is Read Only. The "ObjectName" property is in the DI API. I had a look into the DI object ChooseFromList and I don't think this could help me with this problem.

    I also looked in the Form.ChooseFromLists collection, and there is no CFL defined for Business Partners (Object type = 2)

    Did anybody tried to filter a "secondary" CFL accessible by ctrl-tab?

    Any help would be appreciated!

    Thank you.

    Simon

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2009 at 08:41 PM

    Anybody got an idea?

    Regards,

    Simon

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 25, 2012 at 07:06 PM

    Hi Simon,

    In your OnAfterItemPressed event you call the subroutine like this: SetBPFilterCFLMatrix(ref form, UIDMatrixGL, "1", UIDComboSeriesGL);

    The 3rd parameter is UIDComboSeriesGL. You use it to retrieve the CFL object for the column in the grid. You're trying to get the combo box for the BP, but the name "UIDComboSeriesGL" that is being passed doesn't sound like it would contain the the correct column ID. Could this be your problem?

    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.