cancel
Showing results for 
Search instead for 
Did you mean: 

Copy data from cube A to cube B via fox formula

Former Member
0 Kudos

Hi!

I need to write a fox formula copying data from cube A (actuals) to cube B (plan, realtime).

Speciality why standard copy function is not working in this case:

I may have combinations of characteristics in my cube B, which do not exist in cube A, and I want to keep them after copy. The standard copy function is multiplying each line in cube B with -1 before it copies the lines of cube A to cube B. Lines which do not exist in cube A will be lost.

So my copy function should work as follows:

  1. For each line in cube B, check if it also exists in cube A
    1. If it exists in cube A, multiply it by -1
    2. If it does not exist in cube A, do nothing
  2. Copy data from cube A to cube B

As a result, cube B should look like cube A for all records that exist in cube A PLUS all records in cube B which do not exist in cube A.

Any idea how this can be done using a fox formula?

Thanks in advance

Marco

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

First Its important to check at what granularity you are changing data.Please ensure when you are copying only Characteristic which will change mark it in fields to be changed.Check using standard function.

Secondly You can achieve the same functionality through FOX by restricting cube B in filter and read Cube A in reference,Compare using IF statement Subset if matches in both A and B then update Keyfigure value.

Third You can also achieve this by writing custom planning function where Cube B data can be read in C_TH_DATA and update C_TH_DATA only based on I_TH_Reference data.

Hope it helps.

Former Member
0 Kudos

Hi Indu,

thx for your reply.

Do you have any example ABAP or useful documentation using reference data in FOX or custom planning function? I never worked with reference data before.

Thx in advance

Marco

Former Member
0 Kudos

Hi Marco,

You can refer to below links for FOX code and standard examples for your reference:

BI-IP Fox formula issue | SCN

http://help.sap.com/saphelp_nw70ehp2/helpdata/en/47/90d158d4944befe10000000a42189d/content.htm

If you still face any issues feel free to ask.

Thanks

Answers (1)

Answers (1)

cornelia_lezoch
Active Contributor
0 Kudos

Hi Marco,

never do the "multiply with -1" in your formulas. This is something that seems to happen to you, but it does not.

The aggregation behaviour of the cube does a calculation of a delta record - having a new value of 0 and a data record of maybe 4 it calculates 4 (old record) + (aggregation) -4 (delta record) = 0 (new value).

in a fox you always calculate the new value - the delta will automatically be calculated by the cube.

now in your case you need something like:

if {KF, CubeA} <> 0.

{KF, Cube B} = {KF, CubeA}.

endif.

to make this work, cube A must be included in the filter of your function.

regards

Cornelia