Search code examples
roundingcurrencyabap

How to round a sum for the swiss currency (francs)


here in switzerland our currency is francs and the smallest coin is 5 centimes which is 0.05 francs. what is the best way to round amounts to be payable with our money using the programming language ABAP in a SAP R/3 system?

examples:

" 4.48 should round to 4.50
" 2746.24 should round to 2746.25

Solution

  • it looks like there IS a standard module:

    DATA: result TYPE dec11_4.
    
    CALL FUNCTION 'FIMA_NUMERICAL_VALUE_ROUND'    
      EXPORTING
        i_rtype     = space
        i_runit     = '0.05'
        i_value     = '4.48'
      IMPORTING
        e_value_rnd = result.
    

    i_rtype controls whether it is rounded up (+), down (-) or commercial (space).