cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Existing request in Cube of two years before data using ABAP

Former Member
0 Kudos

Hi,

I want to automize the process of deleting cube data which is Two years old in the process chain.

I know this could be done in process type of delete overlapping request . There we Should write ABAP code to acheive the same.

I have seen the editor screen but could do nothing as i am writing the code for the first time.

In the code i see the following:

{form compute_XX

tables l_t_request_to_delete structure rsreqdelstruc

using l_request like rsreqdone-rnr

changing p_subrc like sy-subrc.

*Insert Source Code to decide if requests should be deleted.

*All Requests in table l_t_request_to_delete will be deleted

*from Infocube XX.

*Add new requests if you want to delete more (from this cube).

*Remove requests you did not want to be deleted.

$$ begin of routine - insert your code only below this line -

loop at l_t_request_to_delete.

*....

endloop.

clear p_subrc.

ENDFORM.}

Any clue of how to procede?

Accepted Solutions (0)

Answers (3)

Answers (3)

sven_mader2
Active Contributor
0 Kudos

This coding can only delete some data, when the infocube isn't compressed.

=> Please compress old data

so, use "selective deletion" -> see the answer from Sudeep Paranjape

Sven

Former Member
0 Kudos

You will need code similar than bellow in the routine that you mentioned:

-


*Defined the ccupeaka data types as the timestamp calculation module

*requires this data types

DATA i_date LIKE ccupeaka-timestamp.

DATA i_request_date LIKE ccupeaka-timestamp.

DATA i_diff_sec TYPE i.

DATA i_diff_day TYPE i.

DATA i_request_tm LIKE rsreqdelstruc-timestamp.

*Define here the retention period in days

DATA c_retention_day TYPE i VALUE 70.

i_date+0(8) = sy-datum.

i_date+8(6) = '000000'.

LOOP AT l_t_request_to_delete.

i_request_tm = l_t_request_to_delete-timestamp.

i_request_date = i_request_tm.

CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'

EXPORTING

timestamp1 = i_date

timestamp2 = i_request_date

IMPORTING

difference = i_diff_sec.

*Get the day difference:

i_diff_day = i_diff_sec / 24 / 3600.

*Exclude all request that are within the retention

*time

IF i_diff_day LE c_retention_day.

DELETE l_t_request_to_delete.

ENDIF.

*....

ENDLOOP.

-


However, it is bad practice to keep a lot of request in a cube (e.g. all request of 12 month) without doing compression.

Normally you would use request compression (lets say for all requests older 7 days) to have best cube query performance. As after compression you can no longer do request deletion you would then use the selective deletion as descibed in the document in the post above to control the data volume in the cube.

Best regards,

Axel

Former Member
0 Kudos

Hi Simran

Check out document on below link, explains solution to your problem in detail.

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

Regards

Sudeep