Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

As you may know, SAP Cloud 4 Customer offers a standard object called UISwitch to influence the standard field properties based on the user role.

How to use it?

Standard use

The UI Switch is an object that can be assigned to any business Role. Any standard screen extension is able to recognize if the user has some role associated with the UI Switch and based on this information, it can change the field properties as defined by the developer.

Step 1.

Create the UISwitch in the PDI

Step 2.

In any standard screen extension, you can modify field properties (via extensibility explorer) and make these properties dependant from the UI Switch

Non-standard use:

The limitation to this fact is that there is no standard way to use UI Switch (and so business role authorization) for your custom developments.

Here a simple trick to make it working for all the kinds of developments :smile:

Step 1.

Create the UI Switch as shown before

Step 2.

Add an indicator (or some other kind of field if you need) and an action to your custom BO

Step 3.

Implement the action as shown below (highlighted part). Note that Context.GetCurrentUserUISwitches() is a standard method always available in the ABSL library.

Step 4.

In your custom screen bind the favourited property of your fields to the (in this example) indicator field

Step 5.

In the initialization of your screen call the action that refresh the status of the indicator field, based on the user business role

Testing the UI Switch

Step 1.

Create a new business role and assign the UI Switch to it

Step 2.

Assign the Business Role to the user

Step 3.

Enjoy!

12 Comments
Labels in this area