Retracting Master Data and Transaction Data 
Retraction of master data and transaction data can be performed by the process type BAdI for MasterData and BAdI for transaction data, respectively, and each is called by a process chain.
You must specify the filter in the data package script to indicate to the system the BAdI implementation calls.
For master data, the BAdI is called only once since packaging is not supported.
For transaction data, the BAdI is called for each package during the transaction data load.
The BAdI implementation (syntax) is checked during validation. When validating a transformation file with a start_routine or end_routine, the system validates the results of these routines while the validation runs all code, except the commit (write). For the retractor BAdI, the system does not validate the syntax. You must validate the syntax of your BAdI implementation.
You define *start_routine and *end_routine in the transformation file.
Example
In the transformation file, the following code would exist:
*Option
*start_routine = <filtervalue_start>
*end_routine = <filtervalue_end>
For each data package, before transformation, the system executes the BAdI implementation for the start routine by the filter value = filtervalue_start.
For master data and transaction data, the start_routine BAdI is filled after the master data or transaction data has been read and made available.
For each data package, after transformation, the system executes the BAdI implementation for end_routine by the filter value = filtervalue_end.
When *start_routine is not empty, the value in <filtervalue_start> is used to find the BAdI implementation that is called before transformation. When *end_routine is not empty, the value in <filtervalue_end> is used to find the BAdI implementation that is called after transformation.
For master data and transaction data, the end_routine BAdI is called before the write (commit to NW). The value for <filtervalue_start> and <filtervalue_end> should be unique. When calling BAdI, this value is used to find the correct BAdI implementation. Although you can set the value for *start_routine and *end_routine to be the same, having different values may be more realistic. For masterdata, the BAdI is based on the table level since master data extraction and retraction do not support packaging of data. For transaction data, the BAdI is based on package level since packaging is supported.
Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or by its gross negligence.