cancel
Showing results for 
Search instead for 
Did you mean: 

Ctrl-Tab and ChooseFromList conditions

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

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?

Former Member
0 Kudos

Anybody got an idea?

Regards,

Simon

Former Member
0 Kudos

Hi Experts

Im having the same problem i want to filter the Bp master cfl  on journal entry when pressed ctrl + tab

im also getting the error as

Xml 'Conditions' parsing failed  [66000-116].  Invalid alias 'U_UserName' for table 'OACT'

Thanks

Shafi

Former Member
0 Kudos

Hi Experts

Can Any One Suggest me the solution for this

Thanks

Shafi

Former Member
0 Kudos

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

Former Member
0 Kudos

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

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

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