I have written pricing routines quite some times and have been able to deliver things which were simpler of-course with quite ease.
In my current assignment I faced an issue which was quite similar to my knowledge but I was unable to re-collect the solution or even the root cause for the same.
The pricing routine written to calculate the rebate value with respect to some quantity base calculation with lot of if and but’s not giving appropriate output.
Well, to my surprise when I do it outside the routine passing the same parameters it does not seems to work.
Closer analysis dictates SAP has not yet made the “Fixed Point Arithmetic” flag for the main program and is still using a very old methodology to convert values in appropriate decimals.
If outside the program I set the flag in the attributes of the program and run it, it works just as I want it to.
Key Issue :
Don’t want to take the key “Fixed Point Arithmetic” flag for the main program
1. Don’t want to modify the main program
2. In doing so may be… just may be I could affect a lot of things which could result in a bigger disaster.
Solution and Learnings :
Well, I have learned if I want to d write routines in my future projects:
I will create a new Function Group / Class and “Fixed Point Arithmetic” flag for the main program
Create Function modules / methods with passing values as parameters and returning parameters with the value needed.
Embed all calculations inside this FM to have appropriate calculations.