Skip to Content
0
Sep 27, 2010 at 07:40 AM

Key Figure calculation with Abap is not working correctly - Overlooping

15 Views

Hi,

I wrote a logic to calculate the ratio of key figure but it is not working correctly

For example I have a requirement to split 1 Product into Several new Products and also the Net Amount will be splitted to these several new products as well. The total Amount of the new product will be equivalent to the Net Amount.

So far my Logic is splitting the product to several new products but the amount is incorrect as the calculation is over looping.

Sample

A PRODUCT has Net Amount 1000. And this product needs to be splitted into 3 new products. Each of this new product is assigned a ratio of 0.3, 0.2 and 0.7 respectively. total sum of the ratio is 1.

PRODUCT1 0.3 = 1000 * 0.3 = 300

PRODUCT2 0.2 = 1000 * 0.2 = 200

PRODUCT3 0.7 = 1000 * 0.7 = 700

The total amount of this new products is 1000.

Now my logic is working this way.

PRODUCT1 0.3 = 1000 * 0.3 = 300

PRODUCT2 0.2 = 1000 * 0.2 * 0.3 = 60

PRODUCT3 0.7 = 1000 * 0.2 * 0.3 * 0.7 = 42

Only the PRODUCT1 is working correctly and there is overlooping for the remaining products

Logic used

thanks

Edited by: Bhat Vaidya on Sep 27, 2010 9:40 AM