Overeview
In a web front end a sales dealer is trying to work out Cost Price, Sell Price and Margin.
He enters a Cost Price of £1100 and a Sell Price of £1149.83 – and the margin is calculated as 4.3333333333...%.
The Cost Price and the Margin are saved to SAP (and the sell price is from then on calculated based on these two).
The Problem
In CRM the Margin can only be stored up to 3 decimal places (as it is a percentage and in the pricing conditions table percentages are stored by first multiplying them by 10 - for 4.3333333 becomes 43.3333... - and then storing them to 2 decimal places - 43.33).
This means that in some scenarios when the Dealer comes back to see his Sell Price (for example he comes back to the numbers above), and finds that the margin has been rounded, so the calculation returns this:
Sell Price = Cost Price/(1-(Margin/100))
Sell Price = 1100/(1-0.04333) <- note 3dp margin value
Sell Price = 1149.821777
ROUNDED (to sell price) = £1149.82 (1p out!)
So he sees a sell price that is 1p less that what he entered initially.
Solution
My solution to this issue was to save the Margin to 5 decimal places – which would increase the accuracy of the calculation, and mean that the sell price would always* be accurate.
* - I did extensive tests and proved that almost all of the time 5 decimal places would be enough for the Sell Price to be calculated accurately.
However
When I try to save 5dp to SAP for a margin% (pricing condition) it rounds up to 3dp and saves that (as eplained above).
Does anyone know of any why in which I could change the condition so it would accept 5 decimal places?
If I multiplied the Margin% (eg 4.33333) by 1000 (4333.33) this would work, but because the value is a % pricing condition I don’t know how this would affect calculations on it. Where would I store the 1000, so that subsequent calculations using the margin knew how to interpret it?
I have seen that column KPEIN in the pricing condition table stores values which are multiplied by (for example when the condition is in GBP), but it seems that for percentages this column is always set to 0 (and cannot be changed).
Please, any advice you might have on this would be really greatly appreciated - and point awarded for helpful advice!
Thank you,
Lindsay