Field Level Masking: How to enable editing of a masked field in a new line Item created
In this blog post, I will show how in Supplier Governance App/Vendor Management App we can enable editing of a field, which is configured for masking, in a new line item created
A PFCG Role used for the authorization check will allow users to view & edit the value of the field. If a user does not have this role, an unauthorized user will see masked data and also not be able to edit value.
To make masked field editable of new line Item for unauthorized user.
The end result will look like below:
Lets start with the requirement:
- The field Tax Number is configured for masking to prevent unauthorized access of data.
- When an unauthorized user goes to add a new line Item under Tax Numbers the new Tax Number will appear as masked and disabled for editing which is the default feature of the Product.
- To make this field editable for new line item, we need to create implementation UI Masking Framework BAdI: /UIMWDA/BD_MASK_AUTHORIZATION to handle this specific requirement.
Before BAdI implementation The field TAX NUMBER is disabled for editing as highlighted below.
Now create an implementation of BAdI /UIMWDA/BD_MASK_AUTHORIZATION.
- Go to SE18 and enter the BAdI name /UIMWDA/BD_MASK_AUTHORIZATION, click on create implementation.
- In method EXECUTE_AUTHORIZATION, write the ABAP logic for Pseudo-code below
Read the Key field entry of the line item, which is Tax Number Category in our case, to identify that is it a new record or existing record then set the Authorization indicator flag to TRUE.
- Read TAX_NUM_CATEGORY from importing parameter IS_ROW_DATA of method
- If the TAX_NUM_CATEGORY is BLANK/empty (new record) then set the flag EV_AUTH_INDICATOR to TRUE.
This code will enable editing of masking configured fields for new line items and as soon as data is entered and saved, the column will get masked and disabled for editing to prevent unauthorized access of data.
After BAdI implementation : The field TAX NUMBER is enabled for editing
In this Blog post we learned how we can easily achieve the custom requirement of editing a masked field for a new line Item thru UI Masking BAdI.
Kindly let me know your questions, feedback or suggestions for the post.