‎2007 Dec 20 7:49 AM
Hi All
i had a quantity feild gamng and it contains three decimals
like this 1000.000
now i want to remove the decimal part of that value and it should be stored as 1000.
can any body hlp me how to do that..
thanks in advance
‎2007 Dec 20 7:58 AM
Hi,
try with below code,
data:
l_value type i,
l_val1 type p decimals 3 value '1000.000'.
l_value = abs( l_val1 ).
write:/ l_value.
Reward if useful.
Regards,
Sreeram.
‎2007 Dec 20 7:51 AM
Hi,
Decalre the quantity field as character field.
Regards,
Nagaraj
‎2007 Dec 20 7:54 AM
Hi,
Do like this
Data: Var type i.
Move GAMNG value to Var, Now Var will have only 1000.
Regards.
Satish
‎2007 Dec 20 7:56 AM
‎2007 Dec 20 7:58 AM
Hi,
try with below code,
data:
l_value type i,
l_val1 type p decimals 3 value '1000.000'.
l_value = abs( l_val1 ).
write:/ l_value.
Reward if useful.
Regards,
Sreeram.
‎2007 Dec 20 8:03 AM
i tried abs( i_val1) but that is not working. i think we dont have any such keyword in ABAP
‎2007 Dec 20 8:04 AM
‎2007 Dec 20 7:58 AM
Hi,
Try the below logic.
1.Assign qty value to numeric.
2.Numeric to char.
3.delete the leading zeros.
DATA: l_f_qty type gamng,
l_f_char type char10,
l_f_num(10) type n.
l_f_qty = '1000.000'.
l_f_num = l_f_qty.
l_f_char = l_f_num.
shift l_f_char left deleting leading '0'.
write: / l_f_char.
Or
l_f_qty = '1000.500'.
l_f_char = TRUNC (l_f_qty)
write: / l_f_char.
Hope this helps u.
Edited by: Ramesh Hirial on Dec 20, 2007 5:00 PM
‎2007 Dec 20 8:05 AM
HI
First get the Value into character field .
Then Use Split Command ..
l_charfield = 1000.00
SPLIT l_charfield AT '.' INTO l_field1 L_field2 .
L_field1 will contain 1000 .Use l_field1 as per your reqmt .
Hope this Helps.
Praveen
‎2007 Dec 20 8:25 AM
Hi,
If you are using ABS(), it will not truncate the decimal values, it will round the value.
Ex: ABS ( 1000.500) : Result : 1001
TRUNC( 1000.500) : Result : 1000
Decide based on ur requirement.