cancel
Showing results for 
Search instead for 
Did you mean: 

Create a DefaultSet to Show only MyInstances

JOSC_ITLAB
Participant

Hi expersts,

is there a guide or correct explanation on how to create a DefaultSet for the OWL which will select only the instances which are created by myself?

I know that standard screens preovide it and i tried to look up some mechanics with field transformations etc but I did not behind how it's working.

It is a high prio topic for me so a fast solution would be awesome.

This is the field where the creation user is safed. Field Type: EmployeeID

Kind Regards,

Johannes

Accepted Solutions (1)

Accepted Solutions (1)

former_member200567
Active Contributor
0 Kudos

Hi Johannes,

Here is a nice document.

Instance Based Access Control

Best Regards,

Fred

JOSC_ITLAB
Participant
0 Kudos

Hi Fred,

I pretty much understand what the blog is doing but my requirement looks a little bit different and i am currently not able to manage it.

This is my OWL, now I want to have a filter for "My Votings" which filters the field "Anzeigefeld Mitarbeiter".

The code for "BevoreSafe" of the Object looks like this.

if(accountteamtable.GetFirst().IsSet())
            {
                foreach(var responsible in accountteamtable)
                {
                    var salesorganization = responsible.SalesOrganisationV1.CurrentNameAndAddress;

                    if(responsible.PartyRoleCode == "***" && salesorganization.Name =="***")
                    {
                        var employee = BusinessObject::Employee.Retrieve(responsible.EmployeeUUID);
                        this.ToActualModifyer =  employee;
                        this.For_Access_Control = employee;
                        this.Consistent = "3";
                        this.CV_EDITOR_MA.content = this.For_Access_Control.IdentificationEmployeeID.EmployeeID.content;
                    }
                    else
                    {
                        this.Consistent = "2";
                    }
                    
                }
            }

I bound the OWL query to the created overview query from the blog. The RBAM datas are also correct but i still see all created objects. My goal is, that only the user with the ID 2163 can see the Instances with "Anzeigefeld Mitarbeiter" - ID 2163. The Datatype of "Anzeigefeld Mitarbeiter" is EmployeeID. On "All Votings", of course all votings should be visible. Could you help me to achieve this?

Kind Regards,

Johannes

JOSC_ITLAB
Participant
0 Kudos

Hi again,

i have to ask if my approach is right. Do I just have to add an DefaultSet which asks for the Consitence Code 3?

If it's just that, then im really thankful for showing me this blog.

Kind Regards,

Johannes

JOSC_ITLAB
Participant
0 Kudos

Hi Fred,

after testing I came to the conclusion that this is not what i needed.

I dont want restrictions for my Instances yet I need filter for "Anzeigefeld Mitarbeiter" which filters out all Instances with the same ID as the current logged in User.

I hope this helps to understand my needs.

Could you give further advises ?

Kind Regards,

Johannes

former_member200567
Active Contributor

Hi Johannes,

Your requirement is much more simple.

Just add your user UUID to your business object definition.

e.g

element VotingID: ID;

element Anzeigefeld Mitarbeiter: EmployeeID;

element UserUUID: UUID;

In before-safe event, assign the UserUUID with the login user.

this.UserUUID = Context.GetCurrentIdentityUUID(); // this is a system reuse function

In the OWL, create a search parameter for UserUUID and bind the search parameter with a field transformation to get the current user UUID.

Check here about Field Transformation.

Best Regards,

Fred

JOSC_ITLAB
Participant

Hi Fred,

thank you a lot 🙂

I made it even easier through the guide. I created my own reuse library which returns the current user employee ID and used it on the UI as field tranfsormation as searchparameter for my defaultset (I couldnt find the right reuse library from sap standard and I am to lazy to look up every library).

It finally works! Thanks 🙂

Kind Regards,

Johannes

Answers (0)