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.

Loop over table columns dynamically

In case of data cleanse activities there could be a necessity to loop over columns. Doing this dynamically will enable you to easily verify each column without writing to much ABAP code, as the code is valid for all columns.

Since everybody knows how to loop over rows but not over columns I began my quest of finding the most proper solution. I stumbled across this blog explaining me how to achieve this with just a couple lines of ABAP. The ABAP uses a standard SAP class cl_abap_typedescr to retrieve data.

Be sure to have a good look at this class since it has more nifty methods available which might get in handy during your developments in SAP BW.

Replace hexidemical values in SAP BW with ABAP

Sometime it happens that users accidentally enters a horizontal tab into a text field when creating order. These are translated into BW as hexadecimal. BW displays these values as a hash tag (#). When activating a DSO, SIDs cannot be generated for these hashes. It is therefore necessary to replace these hashes with a normal characters like a space. The ABAP code below can be used for this purpose.

REPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB in lv_string WITH space.

This code uses class CL_ABAP_CHAR_UTILITIES to get the hexadecimal representation for a horizontal tab. Also other hexadecimal representations are available in this class.

Class which can be used to replace hexadecimal value