Skip to Content
Author's profile photo Former Member

Selective Deletion in Process Chain

Summary:

Before loading data to InfoCube or to Data Store Object, sometimes we need to delete data from that dataprovider for a particular selection i.e. using selective deletion and then load the data to InfoCube.

When it is required:

Sometimes before loading data to Infocube/DSO we need to delete data for that particular data range for what we are loading the data. To automate this selective deletion we need to use some variant in process chain to delete data selectively from data target. As there is no SAP given process type is available this has to be done through a different procedure.

Scenario:

Suppose we have a infocube where we need to recalculate some values everyday considering last three weeks. So Duirng everyday’s load there will be some data already present in the cube which need to be reloaded to recalculate the values. In such case we need to delete that particular data range else it will create data duplication in Infocube. In this case we need to delete last three weeks data before loading to Infocube.

How to Do:

  • We can achieve this by using “DELETE_FACTS” Transaction code.
  • Go to T-code DELETE_FACTS  and give InfoCube name. Select Generate selection program option and then execute.

Untitled1.png

  • It will generate the following G Program

Untitled1.png

  • Our target is to delete data for last three weeks. We can achieve this in two ways.

          1. Using variant

           2. Copying auto generated program into Z program and change inside the code

First Option: Using Variant

 

  • Take this G program and then go to SE38. Give program name and click on Variants
    option. Click on Display.

Untitled1.png

  • Give a Variant Techenical name and click on Create. It will go to Values Screen of the Variant.

Untitled1.png

  • Click on Attributes . Give description of the Variant.

Untitled1.png

  • Now find Calendar Day and select on Selection Variable field. Select Type of variable as “D”

Untitled1.png

  • Click on name of variable field and chose Variable which will give option of Current date – XXX, Current Date + YYY option. Enter 21 as XXX and 0 as YYY as we need to delete three weeks data (21 days)

Untitled1.png

  • Then save the variant and you will be able to see the variants with the caledar day values. It is reflecting last 21 days from current day.

Untitled1.png

  • Now add this G program with the created variant in the process chain to delete last three weeks data

Second Option: Changing inside ABAP Program

  • Go to SE38 and enter G program in the Program field. Clcik on Copy and copied this SAP generated program into a Custom Z program

Untitled1.png

  • Find 0CALDAY field in the newly copied Z program and change the code so that it takes last 21 days values from current date. Check if this field is Initial (not having any value)  and then Pass sy-datum in l_s_range-high and sy-datum – 21 in l_s_range-low field.

Untitled1.png

  • Now this new Z program need to be added in the process chain without variant to delete last three weeks data

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kamal Mehta
      Kamal Mehta

      Nice. Thanks for Sharing .

      Need to know do we have to schedule the deletion program or seleciton program as a step in process chain. Also this works both for DSO and Info cube right.

      Thanks

      Kamal

      Author's profile photo Former Member
      Former Member

      Yes Kamal. The Z program we are creating for selective deletion need to be added in process chain through ABAP variant.

      And it works same way for DSO as well as for Infocube. We have to just provide the infoprovider name in delete_facs tcode.

      Author's profile photo Former Member
      Former Member

      Very usefull post. Thanks a lot