cancel
Showing results for 
Search instead for 
Did you mean: 

how to delete records from a DSO ?

former_member182467
Participant
0 Kudos

Hi,

I have a requirement to delete all the records in a DSO where zfield = blank. Can I write this in the start routine or end routine ? Please suggest.

delete IT_DSOA where zfield is not initial. (IT_DSOA will be the internal active table of DSOA )Can anyone suggest the code to put it in the expert routine ?

I guess expert routine is executed after the transformation is complete and I assume it is the last step in the transformation. Correct ? Is that fine ?

Please suggest your views.

Cheers,

DR

Accepted Solutions (0)

Answers (2)

Answers (2)

pradeep_gupta
Active Participant
0 Kudos

Hi Daniel,

Its very simple, depends on your ZFIELD whether it is in your Source or in your Target.

If in Source, then write a 1 liner code in Start Routine,

Delete Source_package WHERE zfield IS INITIAL.

If ZFIELD is in the target, write an End routine:

Delete Result_package WHERE zfield IS INITIAL.

No need of Expert Routine.

CHeerz

Pradeep.

former_member182467
Participant
0 Kudos

Hi Pradeep,

Welcome back Thanks for the update Pradeep. Here is  my query.

I have a zfield where there are a lot of conditions and populates different values. but on 1 condition, it puts blank values....which is normal. Now I wanna delete all those blank records in that DSO.

So still i can go with this , Delete Result_package WHERE zfield IS INITIAL. No need to declare any internal table any structure anything. Jus 1 line in the end routine ?

my 2nd doubt, I want to update current day's date (sy-datum) in all the values of an the infocube. (without any condition) How can I do that ? Dont tell me zdate = sy-datum in the transformation ....that will be only for day's delta load . Am i right ? I dont want that, when ever the data gets loaded, it should update all the records in that zdate field in infocube with that day's system date. Is it possible in an infocube ? I know it can be done in a DSO, can we do it in an infocube ? Please sugest.

Hope i dint confuse you mate.

Cheers,

DR

pradeep_gupta
Active Participant
0 Kudos

1st Doubt - Yes just 1 line code. Writing that 1 line in your end routine would filter out all the records from the source where Zfield is blank, and update the rest in DSO.

pradeep_gupta
Active Participant
0 Kudos

2nd Doubt - As per me, not possible mate.

former_member182467
Participant
0 Kudos

Thanks a lot. Will test that tomorrow and reply you.

former_member182467
Participant
0 Kudos

OK. Any other thoughts to fix this ?

Cheers,

DR

former_member182467
Participant
0 Kudos

Pradeep,

How about a self loop on the infocube only wiht that date field in the self transformation 

I guess it wll fix it .yeah. Will update the thread tmrw with my trial.

Cheers,

DR

former_member209728
Active Participant
0 Kudos

Hi Daniel,

There is a special transaction for selectively deleting the contents of a DSO or a cube. The transaction is DELETE_FACTS. You can use the below link for your guidance.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/603a9558-0af1-2b10-86a3-c685c6007...

But i think instead of deleting the records from the DSO every time, you can stop such records from getting updated to the DSO in the first place. This can be achieved by deleting the records which satisfy the condition from the result_package in the End Routine.