‎2007 Sep 11 8:12 AM
Hi guys,
need some help. i have a numeric field which gives some value say 101.000
i want to remove that '.000'. Is it possible . please reply urgently
‎2007 Sep 11 8:24 AM
Data : l_int_val type i.
move l_dec_val to l_int_val . "l_dec_val is ur variable that has the deimal val
this l_int_val will hold 101.
Else you can use CEIL and FLOOR to derive the upper and lower limits during rounding.
l_int_val = CEIL( l_dec_val )
l_int_val = FLOOR( l_dec_val ).
Hope it solves ur prob.
‎2007 Sep 11 8:25 AM
data type i.
move that variable to another variable of type i.
then again assign it to that perivious variable...
var1 = 101.00.
data : var2 type i.
var1 = var2.
var2 = var1.
reward if helpful.
Message was edited by:
Kaushik Datta
‎2007 Sep 11 8:26 AM
hi p347633,
do you want to remove (as you wrote in your question) or do you want to round up (as you wrote in the subject)?
For round up you can use the FM ROUND the following way:
DECIMALS : the number of decimals you want to have after rounding (of course can be zero as well, that is rounding to integer)
SIGN: the way to round: '+' always up, '-' always down, 'X' mathematical
the removing you can do with this FM as well, or you can use the bulit in function TRUNC.
hope this helps
ec
‎2007 Sep 11 8:28 AM
Declare one more character data type variable.Then pass the numeric field value to character data type variable while displaing the field value..It will avoid the "000"
‎2007 Sep 11 8:29 AM
Hi,
Check the following code:
DATA pack TYPE p VALUE '12543.000'
DECIMALS 3.
WRITE pack DECIMALS 2.
WRITE: / pack DECIMALS 0.
WRITE: / pack ROUND -2,
/ pack ROUND -1,
/ pack ROUND 1,
/ pack ROUND 2.
Regards,
Bhaskar
‎2007 Sep 11 8:32 AM
DATA pack TYPE p VALUE '12543.000' DECIMALS 3.
Data : pack1 type decimals 0.
move pack to pack1.
‎2007 Sep 11 8:36 AM
Hi,
hope this helps
REPORT ychatest2.
DATA : l_out TYPE p DECIMALS 3,
l_outc(10).
l_out = '123.000'.
l_outc = l_out.
CALL FUNCTION 'FTR_CORR_SWIFT_DELETE_ENDZERO'
CHANGING
c_value = l_outc.
TRANSLATE l_outc USING '. '.
WRITE : / l_outc.
‎2007 Sep 11 8:46 AM
hi,
data: var type float value '100.000'.
data zvar type p DECIMALS 0.
zvar = var.
write zvar.
<b>output is 100</b>
plz reward points if it helps
rgds