cancel
Showing results for 
Search instead for 
Did you mean: 

altering browsing and searching behaviour

Former Member
0 Kudos

Hello everyone,

a customer of ours has requested that one of their users should only be able to see the activities that are assigned to himself.

In other words: I have to alter browsing and searching behaviour for this user in the activities window.

Now my first attempt looked promising:

I tried to alter the ObjectKey in the Application.SBO_Application.FormDataEvent on ActionSuccess = False And BeforeAction = True,

however, the BusinessObjectInfo.ObjectKey is a read only property!

Would anyone know a way around this or maybe have some other ideas as to how to implement this altered behaviour?

Kind regards,

Pieterjan

Accepted Solutions (1)

Accepted Solutions (1)

maik_delly
Active Contributor
0 Kudos

Hi Pieterjan,

afaik there is no "easy" way to manipulate browser or any setting. What you can do (and I successfully checked ) is the following. When Form is loaded add a new datatable with your activities and an index pointer. This datatable will be your browser. Now you have to catch all relevant menu events and change pointer, cancel standard brwosing, put form in search mode and search for the activity pointed in your datatable. This sound more complicated than it is :


//Catch Form Load

static void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)

{

    BubbleEvent = true;

    if (!pVal.BeforeAction && pVal.FormTypeEx == "651" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD)

    {

        SAPbouiCOM.Form oForm = SBO_Application.Forms.Item(FormUID);

        oForm.DataSources.UserDataSources.Add("actRow", SAPbouiCOM.BoDataType.dt_SHORT_NUMBER);

        oForm.DataSources.UserDataSources.Item("actRow").Value = "0";

        oForm.DataSources.DataTables.Add("myAct");

        oForm.DataSources.DataTables.Item("myAct").ExecuteQuery("Select ClgCode from OCLG Where AttendUser  =  " + SBO_Company.UserSignature);//get only my activities

    }

}


static void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)

{

    BubbleEvent = true;

    SAPbouiCOM.Form oForm = null;

    try

    {

        oForm = SBO_Application.Forms.ActiveForm;

    }

    catch

    {

        return;//if no active Form available

      

    }

    if (oForm.TypeEx == "651" && pVal.BeforeAction)

    {

        int newVal = 0;

        switch (pVal.MenuUID)

        {

            case "1288"://next

                BubbleEvent = false;

                newVal = Convert.ToInt32(oForm.DataSources.UserDataSources.Item("actRow").Value) +1;

                if (newVal > oForm.DataSources.DataTables.Item("myAct").Rows.Count - 1)

                    newVal = 0;

                break;

            case "1289"://previous

                BubbleEvent = false;

                 newVal = Convert.ToInt32(oForm.DataSources.UserDataSources.Item("actRow").Value) -1;

                 if (newVal < 0)

                     newVal = oForm.DataSources.DataTables.Item("myAct").Rows.Count - 1;

                break;

            case "1290"://first

                BubbleEvent = false;

                newVal = 0;

                break;

            case "1291"://last

                BubbleEvent = false;

                newVal = oForm.DataSources.DataTables.Item("myAct").Rows.Count-1;

                break;

        }

        if (BubbleEvent == false)

        {

            try

            {

                oForm.Freeze(true);

                oForm.Mode = SAPbouiCOM.BoFormMode.fm_FIND_MODE;

                ((SAPbouiCOM.EditText)oForm.Items.Item("5").Specific).Value = oForm.DataSources.DataTables.Item("myAct").GetValue("ClgCode", newVal).ToString();

                oForm.DataSources.UserDataSources.Item("actRow").Value = newVal.ToString();

                oForm.Items.Item("1").Click();

            }

            catch (Exception ex)

            {

                SBO_Application.SetStatusBarMessage(ex.Message);

            }

            finally

            {

                oForm.Freeze(false);

            }

          

        }

    }

}

regards,

Maik

Former Member
0 Kudos

Yours is closest to what I did

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks guys,

I've found a way in the meantime

I've succesfully implemented new browsing behaviour by 'catching' the browser menu item events, not letting them bubble through and then doing my own actions on the form :

I get the 'next item' through some extra logic, then go into search mode, fill in that item and click on OK programatically.

A bit shaky and still needs some work but for now it seems to be holding up.

Former Member
0 Kudos

Hi Pieterjan,

I'm seeing lately the question... So answering after all the others.

Like Pedro said, this is a common unanswered question... For which I had to dig a bit, a long time ago, but things have, saddly, not changed. The easiest solution I had found, was to manipulate the CFL form by changing its Conditions object and for the regular form to check the "legacy" of data in the FORM_LOAD before event, and if not corresponding to the criteria, sending a "Move Next" on the menu.

In my case, it was to prevent a commercial to see documents from other commercials

I certainly still have somewhere this code if needed...

Regards,

Eric

Former Member
0 Kudos

Thanks Eric.

This is also an approach I tried but since there might be huge 'gaps' between the activitity documents of this person it wasn't all too practical.

I can imagine it working fine in many cases, however.

Thanks for the advice!

pedro_magueija
Active Contributor
0 Kudos

Hi Pieterjan,

This is an often requested functionality, that is difficult to implement.

One possible alternative would be to block navigation entirely on the activity and create a form with your own grid that displays the activities of the user with linked buttons to them.

Good luck.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn