Introduction

This blog post will teach you how to disguise the “Tax Number” field in SE16 and BP transactions using data from the “Tax Number Category” column of database DFKKBPTAXNUM.

Where “Tax Number Category” is “US01,” the “Tax Number” field of table DFKKBPTAXNUM in SE16 and BP transactions needs to be hidden. The “Tax Number” column will show as unmasked for other “Tax Number Categories.”

Users having the given role will be able to view the field value due to the use of a PFCG Role for the authorization check. Data will be safeguarded by masking, clearing, or disabling the field if a user does not have this role, indicating that they are not permitted.

Unauthorized users will see the following outcome:

ALV Grid Display, SE16

For SE16 ALV Grid Display in this scenario, masking is also supported in the Display, Detail, Double-Click, Print, and Download scenarios.

ALV List for SE16

Masking is also supported in Display, Detail, Double-Click, and Download scenario for SE16 ALV List in this scenario.

SE16 – Standard List

Masking is also supported in Display, Detail, and Double-Click scenario for SE16 Standard List in this scenario.

SE16N

Masking is also supported in Detail, Double-Click, Views-List Output, View-Excel In-place, and Download scenario for SE16N in this scenario.

BP – Identification tab – Tax Numbers section

What is Context based Masking?

Context (environment) attributes are those that have to do with time, place, or dynamic elements. Context-based masking refers to the process of hiding a field depending on a context attribute.

Masking the wages of employees who are German, for instance.

Prerequisite
“Protecting sensitive data on SAP GUI screens at the field level is possible with the help of “Field Masking for SAP GUI.” Field Masking for SAP GUI is a product that is supplied to the customer as an add-on (UIM 100). The customer system must have Add-on UIM 100 installed in order to implement role-based masking.

Requirement

For SE16 and BP transactions, context-based masking is necessary; the “Tax Number” field of table DFKKBPTAXNUM must be hidden when the “Tax Number Category” is “US01”. The “Tax Number” column will show as unmasked for other “Tax Number Categories.”

Maintain masking settings
Set the field’s technical information (table name–field name) for masking.

By hitting “F1” on the field, you can obtain the Technical Address of a GUI field.

Follow the given path:
SPRO -> SAP NetWeaver -> Field Masking for SAP GUI -> Masking Configuration->Maintain Masking Configuration

Follow below mentioned steps:

  • Click on “New Entries” button
  • Enter “Table Name” as “DFKKBPTAXNUM”
  • Enter “Field Name” as “TAXNUM”
  • Enter “PFCG Role Name” as “/UIM/PFCG_ROLE“. In this example, we have used a blank role “/UIM/PFCG_ROLE”. Customers can use any role as per their requirement.
  • Check “Masking Control” checkbox”
  • Click on “Save” button

Follow below mentioned steps:

  • Click on “New Entries” button
  • Enter “Table Name” as “DFKKBPTAXNUM”
  • Enter “Field Name” as “TAXNUMXL”
  • Enter “PFCG Role Name” as “/UIM/PFCG_ROLE“. In this example, we have used a blank role “/UIM/PFCG_ROLE”. Customers can use any role as per their requirement.
  • Check “Masking Control” checkbox”
  • Click on “Save” button

Mass Configuration
For the above entries, “Mass Configuration” report should be executed which is required to generate technical addresses.

Follow below mentioned steps:

  • Select the entry
  • Click on “Mass Configuration” button
  • Click on “Select All” button
  • Click on “Generate Customizing” button
  • Save the information

BAdI Implementation
Context-based masking can be achieved by implementing Masking BAdI /UIM/BD_MASKING

Create BAdI implementation for method PREPARE_MASK_DATA

Sample code is given below –

method /UIM/IF_UISECURITY~PREPARE_MASK_DATA.

DATA: lv_taxnum TYPE BPTAXNUM,
ls_dfkkbptaxnum TYPE dfkkbptaxnum.

“– Mask taxnumber in table DFKKBPTAXNUM output and BP transaction for tax category US1
CHECK cs_mask_data-tabname EQ ‘DFKKBPTAXNUM’ AND ( cs_mask_data-fldname EQ ‘TAXNUM’ OR cs_mask_data-
fldname EQ ‘TAXNUMXL’ ).
ASSIGN cs_mask_data-original_val->* TO FIELD-SYMBOL(<fs_taxnum>).
lv_taxnum = <fs_taxnum> .

SELECT SINGLE * FROM dfkkbptaxnum INTO ls_dfkkbptaxnum WHERE taxnum = lv_taxnum..
IF sy-subrc = 0 AND ls_dfkkbptaxnum-taxtype = ‘US1’.
ELSE.
cs_mask_data-masked_val = cs_mask_data-original_val.
ENDIF.

endmethod.

Conclusion
In this blog article, we learned how to use the “Tax Number Category” data from table DFKKBPTAXNUM in SE16 and BP transactions to create role-based masking for the “Tax Number” field.