SAP Screen Personas
Create: Dominik Ofenloch Jul 20, 2015 14:15
Last Update: Tamas Hoznek Dec 10, 2019 02:22
Manipulation of flavor-role-assignments using BAdIs
SAP SCREEN PERSONAS KNOWLEDGE BASE - by Tamas Hoznek , Regina Sheynblat , Dominik Ofenloch
This article explains how can you manipulate the assignments of flavors assigned by role using SAP BAdIs. This enables developers to implement company-specific rules for flavor assignment and setting up default flavors.
- A flavor can be assigned to any user directly. For this you can use transaction /PERSONAS/FLAVORS. Using transaction /PERSONAS/USERS additionally enables administrators to set up the default flavor for any user.
- A flavor can be assigned to a group of users by role. For this you have to enable the chosen PFCG role for Personas using admin transaction /PERSONAS/ROLES. Afterwards you can use the same transaction to assign the flavor to the user group having the specified role. Additionally you can also set up the chosen flavor as default flavor for the users.
In some scenarios the role assignment doesn't fit to the requirements. For example you may want to set up different default flavors to your call center agents based on their default sales organization. To realize flavor assignments and default flavors on your own selection criteria, you can use BAdI /PERSONAS/INIT_ROLE_ASSIGNMENT.
- You can delete assigned flavors
- You can add any other flavor which is released for the same framework and application ID (transaction in case of framework "Dynpro").
- You can set up the default flavor
- Start the BAdI Builder (transaction SE19)
- Select "New BAdI" in group "Create implementation" and click on button "Create Impl."
- Follow through the next steps to define the BAdI enhancement.
- Now you're in screen "Enhancement Implementation". On this screen select tab "Enh. Implementation Elements" and double click on the Implementing Class in the "BAdI Implementations" tree.
- Double-click method /PERSONAS/IF_BADI_ROLE_ASSIGN~INIT_ROLE_ASSIGNMENTS in the right pane and start with the implementation of the BAdI.
- The BAdI interface offers the following parameters:
- IV_FRAMEWORK: Can be "01" for Dynpros or "02" for Web Dynpros. Please use the constants GC_FRAMEWORK_DYNPRO offered by interface /PERSONAS/IF_CONSTANTS
- IV_APP_ID: Transaction name (in case of framework Dynpro) or Web Dynpro application ID (in case of framework Web Dynpro)
- IT_FLAVORS_ASSIGNED_BY_ROLE: Returns the list of flavors assigned to the user based on the user's roles
- ET_DELETE_FLAVOR_ASSIGNMENTS: Enables you to delete flavors from the given list (IT_FLAVORS_ASSIGNED_BY_ROLE)
- ET_ADD_FLAVOR_ASSIGNMENTS: Enables you to add any other flavor to the user's flavor assignments
- EV_DEFAULT_FLAVOR_BY_ROLE: Enables you to set a new default flavor. This flavor must be already part of the list of IT_FLAVORS_ASSIGNED_BY_ROLE or it must be added to the exporting parameter ET_ADD_FLAVOR_ASSIGNMENTS first.
- Now you can start with your implementation of the BAdI. Let's look at a simple example:
- Finally, activate your implementing class and the BAdI. It is now ready to use.