‎2010 Feb 15 9:29 AM
Hi all,
please help me in the issue . i am calculating the contion value in one of the rouitne value xkomv-kbetr(11 dec 2) is rounded off to 2 due to which i am getting difference in final value . i want it rounded off to 3 decimals how can i acheive it.
THanks in advance,
‎2010 Feb 15 10:39 AM
Hi,
For that it's better to use any z data element. You can use your own with 3 decimals.
Thanks
‎2010 Feb 15 9:38 AM
What is the formula you are using & what is the definition of he variables used?
If it is a custom code you can change the output variable to
TYPE p DECIMALS 3BR,
Suhas
‎2010 Feb 15 9:43 AM
output varaible is xkomv-kbetr which is standard and its length is 11 with 2 decimals.
‎2010 Feb 15 9:48 AM
Hello Eric,
Are you doing the calculation in some custom report or in some enhancement ?
BR,
Suhas
‎2010 Feb 15 9:53 AM
Please note that Std SAP accepts only 2 decimals. In case you are calculating values in a routine or user exit, the total calues mught not match.
‎2010 Feb 15 10:04 AM
Hi,
I am using routine to get the value and passing it to xkomv-kbetr(11 length 2 deci) so how do i roundoff it to 3 decimals
‎2010 Feb 15 10:43 AM
Hello,
Can you be more specific in explaining your requirement ?
Anyways if you can change the export param( TYPE xkomv-kbetr), i don't think you have much option here.
BR,
Suhas
‎2010 Feb 15 10:39 AM
Hi,
For that it's better to use any z data element. You can use your own with 3 decimals.
Thanks
‎2010 Feb 15 12:21 PM
Hi
Your target field should have 3 decimals to get the accurate value.
Regards
Gaurav
‎2010 Feb 15 10:56 PM
From your post, I'm assuming that you don't need the result as 3 decimal places but just the intermediate calculations.
For example, when creating a percentage, you can use either of the following formulas:
a = ( b / c ) * 100.
a = ( b * 100 ) / c.
Assuming a, b and c are all two decimal place variables.
The first example will have rounding issues.
The second example will give the desired results.
So in your results, you can either use local variables to do calculations or perhaps arrange the formula (as shown in the example) so significant digits aren't truncated.
‎2010 Feb 18 4:54 AM