Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

clear existing data in bpc cube using badi

UmaArjunan
Active Participant
0 Likes
960

Dear Experts,

I am a BI - ABAP consultant.

I have implemented UJ_CUSTOM_LOGIC badi for one BPC requirement.

In that BADI, using the master data dimension , i m populating some calculated records to the BPC Model ( cube ) . My BPC consultant came up with some requirement to clear the unwanted records in the cube for which i m loading the data for a particular accounts.

Before loading or at the time of adding new records to the BPC cube. i have to clear those existing records in the BPC cube using ABAP coding.

I tried to fetch the records for  the accounts and cleared the signed data and posted along with my calculated records. 

I used the code like this.

<lt_ct_data> contains calculated records.

<lt_clear_data> contains records to be cleared. for some specific accounts in the BPC cube.

loop at <lt_clear_data> assigning <lw_clear_data>.

assign component 'SIGNEDDATA' of structure <lw_clear_data> to <lv_clear_sign>.

<lv_clear_sign> = 0.

collect <lw_clear_data> to <lt_ct_data>.

endloop.

clear ct_data.

refresh ct_data.

ct_data = <lt_ct_data>

When i run it, the summation of all records is equal to zero. I expect the only the selected account numbers to get zero. I don't know how BPC reacts when i clear the signed data. Please help with some suggestions to overcome this issue.

i also tried using CLEANUP method , but the result is all same i.e summation of all records is equal to zero. How better we can handle this situation.

Thanks,

ABAP Dev

Dear Experts,

I am a BI - ABAP consultant.

I have implemented UJ_CUSTOM_LOGIC badi for one BPC requirement.

In that BADI, using the master data dimension , i m populating some calculated records to the BPC Model ( cube ) . My BPC consultant came up with some requirement to clear the unwanted records in the cube for which i m loading the data for a particular accounts.

Before loading or at the time of adding new records to the BPC cube. i have to clear those existing records in the BPC cube using ABAP coding.

I tried to fetch the records for  the accounts and cleared the signed data and posted along with my calculated records. 

I used the code like this.

<lt_ct_data> contains calculated records.

<lt_clear_data> contains records to be cleared. for some specific accounts in the BPC cube.

loop at <lt_clear_data> assigning <lw_clear_data>.

assign component 'SIGNEDDATA' of structure <lw_clear_data> to <lv_clear_sign>.

<lv_clear_sign> = 0.

collect <lw_clear_data> to <lt_ct_data>.

endloop.

clear ct_data.

refresh ct_data.

ct_data = <lt_ct_data>

When i run it, the summation of all records is equal to zero. I expect the only the selected account numbers to get zero. I don't know how BPC reacts when i clear the signed data. Please help with some suggestions to overcome this issue.

i also tried using CLEANUP method , but the result is all same i.e summation of all records is equal to zero. How better we can handle this situation.

Thanks,

ABAP Dev

4 REPLIES 4
Read only

naga_arjun2
Explorer
0 Likes
688

Hi,

Create one more BADI for Clearing the particular records . It should be called from same scripting logic,

We need to call this BADI 1 st and calculation BADI.

Read only

Former Member
0 Likes
688

Hi,

did you find any solution for this? I am trying exactly the same to delete records before updating from custom logic BAdI.

Thanks,

Tim

Read only

0 Likes
688

Hi,

Your coding seems correct better check the <lt_ct_data> and <lt_clear_data> before the loop in debug mode whether it has the correct record in it.

Tim,

You can't delete the record using badi but we can zero it out. If you want to delete the record from cube you have to zero it out the record and then you have to run the light optimize package.

But there is a way to do it. You can zero it out the unwanted record first and then write back the records manually  to cube and then you can trigger the package inside the BAdI itself using run_package method. Please let me know if you get any other good idea to achieve it.

Hope it helps!

Thanks,

Suresh

Read only

0 Likes
688

Thanks Suresh. I will go with this approach.