Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
AmitKrSingh
Advisor
Advisor
0 Kudos

Introduction


In this blog post, we will learn how to mask “Amount in Local Currency” field in BSAS table in transactions SE16FBL3N, and FBL5N.

In addition, we will also mask the Telephone Number information of Customer in FBL5N transaction.

PFCG Role will be used for the authorization check which will allow users with the specified role to view the field value. If a user does not have this role, it means the user is not authorized and data will be protected either through masking, clearing, or disabling the field.

The end result for unauthorized users will look like below:






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 Number, Bank Account Number, Amounts, Pricing information, Quantity 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
Amount in Local Currency



Telephone Number



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.
Amount in Document Currency


  • Click on “New Entries” button

  • Enter “Table Name” as “RFPOSXEXT

  • Enter “Field Number” as “DMSHB

  • Enter “Logical Attribute” as “LA_AMT_LOC_CURRENCY

  • Enter “Description” as “Amount in Local Currency

  • Click on “Save” button

  • Click on “Mass Configuration” button which is required to generate technical addresses for Module Pool Programs




For Telephone Number field in FBL5N transaction, you need to use Recording Tool feature to get the Technical Address as Technical Information on press of F1 key is not available here. Refer the Blog to know how to use Recording Tool.
Telephone Number


  • Click on “New Entries” button

  • Enter “Table Name” as “RFITEMAR

  • Enter “Field Number” as “ALVSTLI

  • Enter “Logical Attribute” as “LA_FBL5N

  • Enter “Description” as “Telephone Number

  • Click on “Save” button

  • Click on “Mass Configuration” button which is required to generate technical addresses for Module Pool Programs




Configure Derived Attribute


As Technical Address of all the fields displayed in Header section is same so we need to use Derived Attribute to only mask the Telephone Number.

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


Following code need to be implemented under this Derived Attribute -
method /UISM/IF_DERIVED_ATTR_VALUE~EXECUTE.
READ TABLE IT_NAME_VALUE_PAIR INTO DATA(ls_name_value_pair) WITH KEY SEM_ATTRIBUTE = 'LA_FBL5N'.
IF sy-subrc = 0.
IF LS_NAME_VALUE_PAIR-VALUE_INT CP '#+*(*)*'.
EV_OUTPUT = abap_true.
ELSE.
EV_OUTPUT = abap_false.
ENDIF.
ENDIF.
endmethod.

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.

Now, we need to implement a Policy and write some logic into the same to mask the field.



Write following logic into Policy



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:


  • Click on “New Entries” button

  • Enter “Sensitive Entity” as “LA_AMT_LOC_CURRENCY” and press “Enter” key. “Description” and “Application Module” will get populated in corresponding fields

  • Check “Enable Configuration” check-box

  • Select “Role Based Authorization” option

  • Enter “PFCG Role” as “/UISM/PFCG_ROLE“. In this example, we have used a blank role “/UISM/PFCG_ROLE”. Customers can use any role as per their requirement.

  • Enter “Field Level Action” as “MASK_FIELD

  • Click on “Save” button



Follow below mentioned steps:


  • Click on “New Entries” button

  • Enter “Sensitive Entity” as “LA_FBL5N” 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_FBL5N

  • Click on “Save” button




Conclusion


In this blog post, we have learnt how Role-based masking is achieved in transactions SE16FBL3N, and FBL5N for masking “Amount in Local Currency” field and "Telephone Number" field in FBL5N transaction.