Showing results for 
Search instead for 
Did you mean: 

Selective Delection in DSO by date

0 Kudos

I need making a selective deletion

in a DSO where only should remain data of the last 5 days.

What is the best to make this deletion?


Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos


Best suggestion is automate the process by writing ABAP and including it in a Process Chain OR Routines based on sy-date - 5.

They may help you!



Active Participant
0 Kudos

Hi Rogerio,

Adlins third link ( is a great solution.

Read it first to get an understanding of the type of approach to the solution.

Below is a variation of the above solution that is more optimised for performance and written in sequence of the build activities you will need to do.

A ‘5 day old’ requirement is fundamentally driven by the needs of the down stream data targets. It is not in any way related to the fundamental design of the DataProviders and their DataSets supplying the data to the DataStore.

With this insight you can safely proceed to apply your logic to the DataStore with special consideration to the down stream DataTargets. A few points to note:

  • The DataProvider(s) that supply the data to the DataStore need to pass all their new records in, exactly as they currently are. No change required. Their DTPs will still have all your current selection filters but will not have anything to do with the ‘5 day old’ requirement;
  • This means the DataTargets activation process is generating true delta records into its change log table. Excellent.

Now we add a circular load on the DataStore itself and apply the ‘5 day old’ requirement here. Create an InfoSource that contains only the following InfoObjects:

  • All the InfoObjects that define the semantic key of the DataStore.
  • The 0RECORDMODE characteristic.

Now create two transformations. One from the DataTarget to the InfoSource and the second from the InfoSource back to the same original DataTarget. Map all InfoObjects as straight through for the transformations.

Create a DTP that is a FULL load. We want to process all records in the active table of the DataStore every time this DTP is executed.

Add a start routine to the first transformation, the one from the DataTarget to the InfoSource. This start routine will be looping through all records and will have access to all InfoObjects of the DataStore. Within the loop that processes the current DataPacket in the start routine we can now assess the date of each record and determine if it should be deleted (older than 5 days) or kept (5 days old or younger).

The action to be done is determined by the value assigned to the 0RECORDMODE characteristic.

<source_fields>-recordmode = ‘D’. “This record will be deleted from the DataTarget.

<source_fields>-recordmode = ‘ ’. “This record will be kept in the DataTarget.

Note: The kept record is assigned a “SPACE”, ASCII 32 (#20 hex), “Blank” character value, not an empty string. A “ “ character value is used to identify what is known as an “After-Image” record.

Once your have processed all the records in the DataPacket you can apply a second piece of code to optimise the load time by only allowing the records to be deleted to be loaded back into the DataTarget.

delete source_package where recordmode = ‘ ’.

Each time you execute and activate the full circular load on the DataStore you will remove records from the active table and also capture a 100% accurate delta load generated into that DataStores change log table for all the dependant down stream DataTargets to get their data from this DataProvider.

You will need to add this circular load into your process chain. It should be done after all DataProviders have been loaded and activated into this DataTarget and before any of the down stream DataTargets are loaded.

Result: The ‘5 day old’ requirement has been implement on the DataStore, optimised for delta loading into down stream cubes and easily integrated into the nightly load window.

Hope this helps.

Kind regards,


Answers (5)

Answers (5)

0 Kudos
Former Member
0 Kudos

Hi Rogerio Vaz de Souza,

    Please note that when u try to do selective deletion, only the fields present in the DSO will present for the selection option.

So you can check if there is any field present in your DSO that have the sy-datum maintained in it.So you can use the same for your selective deletion purpose.

Or else one more option is to write a small ABAP program to delete the data that are older than 5 days and embed the same in your process chain after/before loading.



Former Member
0 Kudos

Refer to the Link Once to get the understanding of this concept of deletion from DSO .

Then you can decide whether to do it based on ABAP program Placing in the process chain (kind of automation)

or Write code the end routine and clear the records .

Active Contributor
0 Kudos

Try this wonderful document:

Former Member
0 Kudos

Not a big fan of automated deletion and digging thru the system for a missing record. Not sure what your actual requirement is and data volumes are, why not do a selective load for previous 5 days based on the date - a simple routine in selection filter should do the trick.