on 09-15-2008 12:00 PM
Hi all .
I want to ask ; how to format decimal values. sample ;
value
40.45235435345
I want to show
40.45
how am ı doing this. I use this code :
but result is = 40.45235435345 .
[SMARTFORM|http://www.irfanmatak.com/projects/smartform.jpg]
Regards
İrfan.
Hi irfan,
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;
&itab-netpr(C.2)&
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.
Regards
Karthik D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks everybody I fix problem ,
DATA: GV_DEC TYPE P DECIMALS 2.
CLEAR: GV_NETWR.
GV_NETWR = LS_VBRP-KZWI5 / LS_VBRP-FKIMG.
GV_DEC = GV_NETWR.
GV_NETWR = GV_DEC.
casting and decimal 2 show in varible.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
write like this
&v_var(C.2)&
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
IRFAN , u can use CEIL(WF_VALUE) or FLOOR(WF_VALUE) operators.
BR
Lavanya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.