Skip to Content
Product Information

UI Data Protection – Level based masking scenario in SE16 and MM03

Introduction

In this blog post, we will learn how to achieve level based masking in transactions SE16 and MM03 for masking “Material“, “Gross Weight”, and “Net Weight” fields in MARA table for materials of Material Group300“ and “LEGAL“.

Attribute based authorizations are dynamic determination mechanism which determines whether a user is authorized to access specific data sets which can be based on the context attributes of the user and data (for example, price of certain sensitive materials are masked).

Requirement

Material”, “Gross Weight”, and “Net Weight” fields in MARA table for Material Group “300” and “LEGAL” need to be masked for User “TESTUSER01” which is assigned with PFCG RoleLEVEL01” whereas for User “TESTUSER02” which is assigned with PFCG RoleLEVEL02”, the above mentioned fields need to be masked only for Material Group “LEGAL”. The above mentioned fields will also appear as masked in MM03 transaction code for materials of mentioned Material Groups accordingly.

The end result for TESTUSER01 which is assigned with PFCG RoleLEVEL01” will appear as:

SE16

MM03

The end result for TESTUSER02 which is assigned with PFCG RoleLEVEL02”will appear as:

SE16

MM03

The end result for TESTUSER03 which is assigned with PFCG RoleLEVEL03”will appear as:

SE16

MM03

Prerequisite

Product “UI data protection masking for SAP S/4HANA” is used in this scenario to protect sensitive data at field level and must be installed in the S/4HANA system.

The product is a cross-application product which can be used to mask/protect any field in SAP GUISAPUI5/SAP FioriCRM Web Client UI, and Web Dynpro ABAP.

Let’s begin

Configuration to achieve masking

Logical Attribute is a functional modelling of how any attribute such as Social Security NumberBank Account NumberAmountsPricing informationQuantity etc. should behave with masking.

Configure Logical Attribute

Follow the given path:

SPRO -> SAP NetWeaver -> UI Data Protection Masking for SAP S/4HANA -> Maintain Metadata Configuration -> Maintain Logical Attributes

Material Group

Material Number

Gross Weight

Net Weight

Configure Derived Attribute

Derived Attributes are user defined attributes which are populated at run time. The derivation of these attributes can be maintained in a class method. The name of the Class can be specified while maintaining a derived attribute in the IMG.

Follow the given path:

SPRO -> SAP NetWeaver -> UI Data Protection Masking for SAP S/4HANA -> Maintain Metadata Configuration -> Maintain Attributes and Ranges for Policy – Follow below mentioned steps:

Material Group
  • Click on “New Entries” button
  • Enter “Derived Field” as “DA_MATGROUP
  • Enter “Class Name” as “ZCL_MATGROUP
  • Select “Application Module” as “* Cross-Application
  • Enter “Description” as “Material Group
  • Click on “Save” button

Implementation of Derived Attribute for Material Group

For the given case, we are masking Material Number (MARE-MATNR), Gross Weight (MARA-BRGEW), and Net Weight (MARA-NTGEW) fields in transaction MM03 and SE16. The context for our rule (i.e. Material Group (MARA-MATKL) is available as context in table MARA in SE11/SE16/SE16N transactions but the same is not available in transaction MM03 (as in case of Module Pool programs, Context of only sub-screen fields are available), Hence, there is a need to create a Derived Attribute for Material Group for Material Master (MM02/MM03) cases.

Steps to implement Class for Derived Attribute:

  • Execute transaction SE24
  • Create Derived Attribute Class mentioned in the configuration (i.e. ZCL_MATGROUP)
  • Implement the Interface: /UISM/IF_DERIVED_ATTR_VALUE in the Class

  • Sample implementation of Method: /UISM/IF_DERIVED_ATTR_VALUE~EXECUTE

Maintain Technical Address

In this step, we will associate the Technical Address of the fields to be masked with the Logical Attributes.

You can get the Technical Address of a GUI field by pressing “F1” on the field.

Follow the given path:

SPRO -> SAP NetWeaver -> UI Data Protection Masking for SAP S/4HANA -> Maintain Metadata Configuration -> Maintain Technical Address

Follow below mentioned steps:

Under “GUI Table Field Mapping”, maintain technical address for following fields.

Material Group
  • Click on “New Entries” button
  • Enter “Table Name” as “MARA
  • Enter “Field Number” as “MATKL
  • Enter “Logical Attribute” as “LA_MATGROUP
  • Enter “Description” as “Material Group
  • Click on “Save” button
  • Click on “Mass Configuration” button which is required to generate technical addresses for Module Pool Programs

Material Number
  • Click on “New Entries” button
  • Enter “Table Name” as “MARA
  • Enter “Field Number” as “MATNR
  • Enter “Logical Attribute” as “LA_MATERIAL
  • Enter “Description” as “Material Number
  • Click on “Save” button
  • Click on “Mass Configuration” button which is required to generate technical addresses for Module Pool Programs

Gross Weight
  • Click on “New Entries” button
  • Enter “Table Name” as “MARA
  • Enter “Field Number” as “BRGEW
  • Enter “Logical Attribute” as “LA_BRWEIGHT
  • Enter “Description” as “Material Gross Weight
  • Click on “Save” button
  • Click on “Mass Configuration” button which is required to generate technical addresses for Module Pool Programs

Net Weight
  • Click on “New Entries” button
  • Enter “Table Name” as “MARA
  • Enter “Field Number” as “NTGEW
  • Enter “Logical Attribute” as “LA_NTWEIGHT
  • Enter “Description” as “Material Net Weight
  • Click on “Save” button
  • Click on “Mass Configuration” button which is required to generate technical addresses for Module Pool Programs

Policy Configuration

Policy is a combination of rules and actions which are defined in one or more blocks. The actions are executed on a sensitive entity (field to be protected) which has to be assigned to a Policy. The conditions are based on contextual attributes which help derive the context.

Context Attributes are logical attributes which are used in designing the rules of a policy. They are mapped to fields which are used to derive the context under which an action is to be executed on a sensitive entity.

Sensitive Entities are logical attributes which are sensitive and need to be protected from unauthorized access.

Follow the given path:

SPRO -> SAP NetWeaver -> UI Data Protection Masking for SAP S/4HANA -> Data Protection Configuration -> Maintain Policy Details for Attribute based Authorizations – Follow below mentioned steps:

  • Click on “New Entries” button
  • Enter “Policy Name” as “POL_LEVEL_MASK
  • Select “Type” as “Field Level Masking
  • Select “Application Module” as “* Cross-Application
  • Enter “Description” as “Mask Based on Levels
  • Click on “Save” button

Write following logic into Policy
Note:
PFCG Role “LEVEL01” must be created and assigned to the User “TESTUSER01”
PFCG Role “LEVEL02” must be created and assigned to the User “TESTUSER02”
PFCG Role “LEVEL03” must be created and assigned to the User “TESTUSER03

Maintain Field Level Security and Masking Configuration

Here, we will define how masking will behave with the logical attribute that we created in above step.

Follow the given path:

SPRO -> SAP NetWeaver -> UI Data Protection Masking for SAP S/4HANA -> Data Protection Configuration -> Maintain Field Level Security and Masking Configuration

Follow below mentioned steps:
Material Number
  • Click on “New Entries” button
  • Enter “Sensitive Entity” as “LA_MATERIAL” and press “Enter” key. “Description” and “Application Module” will get populated in corresponding fields
  • Check “Enable Configuration” check-box
  • Select “Attribute Based Authorization” option
  • Enter “Policy Name” as “POL_LEVEL_MASK
  • Click on “Save” button

Gross Weight
  • Click on “New Entries” button
  • Enter “Sensitive Entity” as “LA_BRWEIGHT” and press “Enter” key. “Description” and “Application Module” will get populated in corresponding fields
  • Check “Enable Configuration” check-box
  • Select “Attribute Based Authorization” option
  • Enter “Policy Name” as “POL_LEVEL_MASK
  • Click on “Save” button

Net Weight
  • Click on “New Entries” button
  • Enter “Sensitive Entity” as “LA_NTWEIGHT” and press “Enter” key. “Description” and “Application Module” will get populated in corresponding fields
  • Check “Enable Configuration” check-box
  • Select “Attribute Based Authorization” option
  • Enter “Policy Name” as “POL_SENSITIVE_MAT
  • Click on “Save” button

Conclusion

In this blog post, we have learnt how Level-based masking is achieved in transactions SE16 and MM03 for masking “Material“, “Gross Weight”, and “Net Weight” fields for materials of Material Group300” and “LEGAL“.

2 Comments
You must be Logged on to comment or reply to a post.
    • Hi Arunava,

       

      Thanks for your appreciation…!!!

       

      Please refer my following blog post in order to get a fair understanding about Policy Builder –

      https://blogs.sap.com/2020/02/24/attribute-based-access-control-abac-how-policies-are-being-created-and-evaluated/
      
      Thanks,
      Amit Kumar Singh