Saturday, September 24, 2022

DELETE_FACTS t-code to delete from BW InfoProvider

Normally in case a deletion of data is to be performed it is possibel to be done via RSA1 t-code or in case of BW/4 in its web environment (SAP BW∕4HANA Cockpit). If this task is supposed to be automated, it is possible to leverage deletion process in process chains. However, there is also a dedicated t-code for deleting of data from the fact table of BW’s InfoProviders. It is called DELETE_FACTS t-code. It is associated with ABAP program RSDRD_DELETE_FACTS. The program/t-code is also available in BW/4 based BW systems.

On its input screen, there is one mandatory parameter – Data Target that the BW InfoProvider on top the deletion is performed. Following that input field there are three radio buttons. Each of them controls mode of the program.

In case it is set to “Direct Deletion” the program asks for deletion criteria and deletion itself is performed as a next. The deletion criteria is just a filter that is setup by a user and is used for deletion. Only data that are returned by the filter criteria are deleted.

Next radio button is called “Generate Selection Program”. It generates either GP program for the InfoProv deletion. The generated program contains selection screen that serves as deletion criteria. User can input the filter in here. Once the deletion criteria are provided the deletion can be performed.

Finally, there is third radio button called “Generate Deletion Program”. The report is generated on the fly and the deletion criteria are static only available when the GP is generated. Thus no usage of ABAP program variants in this case.

Instead the GP program a real program name can be given in another option field of the selection screen – called “Name of report”.

The deletion itself is performed in a very interesting way. BW system copies the data are not supposed to be deleted (selection criteria reversed) to temporary DB table. The temp table is a copy of real InoProvider DB table. Next is that the system deletes the original (infoprov) table completely. Not just the data in the table but whole table is dropped. Finally, as a last step the system renames the temp table to original table. Reason why it is doing like that is a performance. You can read more details about this approach in a SAP Note listed below.

More information:

2918552 - [BW Central KBA] Selective Deletion

No comments: