Application Development 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: 

Key Figure calculation with Abap is not working correctly - Overlooping

bhat_vaidya2
Active Participant
0 Kudos

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

1 REPLY 1

bhat_vaidya2
Active Participant
0 Kudos

Moved it to a different forum.

thanks