Skip to Content
Product Information
Author's profile photo Uday Kamte

Data privacy deletion context in custom extensions using SAP Cloud Application Studio (PDI) and SAP Business ByDesign

Data Privacy

Data privacy and protection is an important topic especially when it comes to custom extensions you might develop with SAP Cloud Application Studio (PDI). The intent of this blog is to make customers and partners aware of the reuse library functions available in cloud application studio that can be used to identify the document deletion and business partner deletion runs.

Those of you would like to get an overview of this topic and what it means for ByDesign customers can refer to this comprehensive blog post written by my colleague Jan. For the details about what these entities mean and how they can be scoped in the system you can refer to this blog post.

Add-on scripts

The add-on scripts are developed to enrich the data and react to the events associated with the custom business objects or standard business object extensions. These add-on scripts can cover a wide range of spectrum; from straight forward ones that enriches extension fields to fairly complicated solutions that have intensive logic.


The details of the SAP help document for Actions, Events and Validations can be found here.

Document Deletion

When a business object instance is deleted the events listed above along with OnSave validation are triggered and the ABSL script in them is executed. During the normal course of instance deletion executing these scripts is logical and unavoidable.

However, once the document chain reaches its end of retention, all the documents (business object instances) that are part of this chain are deleted. During the course of this deletion executing the script in the events AfterModify, BeforeSave, AfterLoading and OnDelete and OnSave validations could be avoided.

Document deletion run can involve large volume of data – in case of one of the ByDesign customer the deletion run had more than 200 thousand records in it! As you can imagine, execution of add-on scripts for these records takes inordinate amount of time – when, in fact, the logic in these scripts isn’t relevant due to the document’s end of retention and hence the scripts’ executions in this case should be avoided.

Identifying the Deletion Context

The following code snippet explains how an ABSL script can be enhanced to check if it being executed during the course of deletion run – both Business Partner Deletion and Document deletion – and how its execution can be avoided.


	Add your SAP Business ByDesign scripting language implementation for:
		Business Object: xxx
		Node: xxx
		Event: AfterModify 
	  - To access the elements of the business object node, 
	    use path expressions, for example, this.<element name>. 
	  - To use code completion, press CTRL+J. 
	  - This script file is mass-enabled, i.e. the keyword "this" 
	    refers to a collection of node instances.
	  - The solution uses this script if:
		- the value of any field in the node in which this script is contained is modified.
		- the node itself is modified by another business object within the same solution.

import ABSL;

var delBP = DeletionContext.IsBupaDeletion(); // Business Partner Deletion

var delDoc = DeletionContext.IsDocDeletion(); // Document Deletion

if (delBP || delDoc)


The link to SAP help document for these reuse libraries can be found here.

Importance of Adoption

My advice to the customers and partners would be to follow this approach, not just for the Root/Header node but also for scripts belonging to the child nodes as well. As a deletion run can end up having huge number of records, not doing so will have a detrimental impact on the performance and execution of the run.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.