Skip to Content
avatar image
Former Member

Removing decimal points from a currency value

Dear experts,

I have a variable of type HSLXX12. I need to round and remove the decimal points in the value. I could round the value using the ROUND function as following.

result = ROUND( val = input dec = 0 )

Then I used TRUNC to remove decimals. But it is not working. How can I remove the decimals?

If the value is 173645.00 I want to display it as 173645

Is it possible to do this, without changing the data type? Please help.

Thanks in advance.


Add comment
10|10000 characters needed characters exceeded

  • Hello Manori,

    The solution;

    DATA:  lv_decimal TYPE p DECIMALS 2,
           lv_string  TYPE string.
    lv_decimal = '22.00'.
    lv_string = ROUND( val = lv_decimal dec = 0 ).
  • Get RSS Feed

2 Answers

  • Oct 18, 2016 at 06:09 AM

    This value is a Currency field, so its display is controled by the currency code, so answer could be 'no' you cannot. You should so change to some other type or use a currency without decimal positions (browse table TCURX) There are some tricks but they depend on where you want to display the amount: dynpro field, alv, sap script, smartforms, adobe, etc.


    Add comment
    10|10000 characters needed characters exceeded

  • Oct 18, 2016 at 06:55 AM

    Why don't you use String in Smart form.You can do the below task in Smartform coding part else in driver program.
    DATA:net TYPE ekpo-netpr VALUE '2500.00',
    c1 TYPE string.

    c1 = trunc( NET ).
    "MOVE net TO c1.

    Add comment
    10|10000 characters needed characters exceeded