how to format decimals in variable
Hi all .
I want to ask ; how to format decimal values. sample ;
I want to show
how am ı doing this. I use this code :
but result is = 40.45235435345 .
Karthik Dharmarajan replied
Try like this;
data amount type p DECIMALS 5 VALUE '12.45678'. data amount1(10) type C. write amount to amount1 DECIMALS 2.
Now amount1 will contain 12.46, you can control the number of decimals using the decimals option in write statement.
If you are doing this in smartforms, no need for coding just use like this;
Here C will condense the leading spaces and .2 will restrict the value to print with 2 decimals. Give this a try and let me know if it works.