‎2009 Aug 06 7:22 AM
Dear All,
Any Idea to remove the decimals value from the text ? my parameter declare as Character type.
eg : i want from 10000.000 become 10000
thanks
‎2009 Aug 06 7:25 AM
data:val1 type p decimals 3 value '10000.000'.
data:val2(15) type c.
write val1 to val2 DECIMALS 0.
write val2.
‎2009 Aug 06 7:25 AM
data:val1 type p decimals 3 value '10000.000'.
data:val2(15) type c.
write val1 to val2 DECIMALS 0.
write val2.
‎2009 Aug 06 7:27 AM
you either use round or ceil or floor functions...
or copy that var into a var of type int.
it'll get rounded off though.
Rehards,
Sumit Nene.
‎2009 Aug 06 7:28 AM
Hi,
It's very simple Just Use Split syntax.
DATA : X(10) TYPE C VALUE '1000.00',
Y (7) TYPE C ,
Z(5) TYPE C.
Ex.
SPLIT X AT '.' INTO: Y Z.
Salil ....
‎2009 Aug 06 7:28 AM
Check this code.
DATA amt(8) TYPE p DECIMALS 3 VALUE '10000.000'.
DATA int_amt TYPE i.
data c_amt(10) type c.
int_amt = amt.
c_amt = int_amt.
WRITE : 'Integer' , int_amt, 25 'Char', c_amt.
KR,
Advait
‎2009 Aug 06 7:35 AM
Hi ,
use FM.
ROUND
E.g.
DATA : lv_amt1 TYPE p DECIMALS 4,
lv_amt2 TYPE p DECIMALS 0,
lv_places TYPE i VALUE '0'.
CALL FUNCTION 'ROUND'
EXPORTING
decimals = lv_places
input = lv_amt1 "gs_flatfile-item_cost
sign = 'X'
IMPORTING
output = lv_amt2
EXCEPTIONS
input_invalid = 1
overflow = 2
type_invalid = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Vijay
‎2009 Aug 06 7:36 AM
Dear All,
Any Idea to remove the decimals value from the text ? my parameter declare as Character type.
eg : i want from 10000.000 become 10000
thanks
hi,
for this we can use two method one is,
data : value type p decimals 0.
value = '10000.000'.
write : / value.
Output is = 10000
Second method,
data : value type i.
value = '10000.000'.
write : / value.
Output is = 10000
-
If u use packed decimals
data : value type p decimals 1.
value = '10000.000'.
write : / value.
Output is = 10000.0