‎2007 Jun 21 1:46 PM
HI All ,
Could anyone please let me know how to remove trailing zero from my output or hw to decl data type of variable l_div ...so that zero wont come to output.
REPORT Y_REPORT2 .
data : l_string1(10) type n,
l_div type float.
l_string1 = 220.
l_div = l_string1 / 100 .
write l_div.
Output : 2.200000000000000E+00
Desired output : 2.2
Thanks in advance
‎2007 Jun 21 1:52 PM
why dont u try it with packed data type and give the number of decimals required.
‎2007 Jun 21 1:49 PM
Hello,
Do like this.
DATA : L_STRING1(10) TYPE N,
L_DIV TYPE P DECIMALS 2. " check here
L_STRING1 = 220.
L_DIV = L_STRING1 / 100 .
WRITE L_DIV.
Vasanth
‎2007 Jun 21 1:52 PM
why dont u try it with packed data type and give the number of decimals required.
‎2007 Jun 21 1:57 PM
Hi ,
Could you please explain me more abourt that .
Thanks in advacnce
‎2007 Jun 21 2:01 PM
put it as
data : i_div type p decimals 2(or whatever u desire).
Message was edited by:
sheldon barretto
‎2007 Jun 21 2:02 PM
Hi Sharma,
data : l_string1(10) type n,
<b>l_div type p decimals 1.</b>
l_string1 = 220.
l_div = l_string1 / 100 .
write l_div.
Regards
Aneesh.
‎2007 Jun 21 2:09 PM
Hi All ,
That is working fine now ,Could you please let me know also
l_string1 = 220 instead of this If I will pass 220.00
like this l_string1 = 220.00
Then what data type I have to defined for l_string1 ?
Thanks for your time & effort..
‎2007 Jun 21 2:13 PM
Hi Sharma,
data : l_string1 type p,
l_div type p decimals 1.
l_string1 = '220.00' .
l_div = l_string1 / 100 .
write l_div.Thanks
Aneesh.
‎2007 Jun 21 2:54 PM
Hi All ,
Thanks for your help .
Points rewarded ...
Regards
Rahul
‎2007 Jun 21 1:54 PM
‎2007 Jun 21 2:03 PM
If you look at the help on WRITE :
WRITE l_div EXPONENT 0 DECIMALS 2.
Will show as 2.20