Delete overlapping requests DataStore Object using ABAP

Do you want to snapshot on a daily basis but only want to keep one request per calendar week? The attached ABAP makes this possible! You can use it the start routine of a transformation.

The logic uses the current calendar week (based on the system date) to retrieve a list of requests which are loaded in the same calendar week. This list is then sorted descending based on the loading date. Then one by one the loads are being removed from the DataStore Object (DSO), leaving only the current request active. When this load is executed on a daily basis only one request per calendar week will remain in the DSO.