Skip to Content
Technical Articles

Formatting amounts with Currency symbol – An ABAP Class solution

Formatting amounts is not only dependent on the currency, but is also dependent on the country. Here some examples:

Country Currency Example amount Symbol position (1) Space in between (2) Decimal sign (3) Number of decimals (4) Currency symbol (5)
USA Dollar $1,234.57 Left No Point 2 $
Germany Euro 1.234,57 € Right Yes Comma   2
Netherlands Euro € 1.234,57 Left Yes Comma 2
Belgium Euro €1 234,57 Left No Comma 2

There are 3 characteristics of an amount format which are country specific.

1. Symbol position. (In USA it is left, in Germany right.)
2. Space in between symbol and amount. (In USA no space, Netherlands one space.)
3. Decimal sign.

And 2 characteristics are currency specific

4. Number of decimals.
5. Currency symbol.

Characteristic 3 and 4 can be retrieved from SAP database tables.
3. Decimals sign: SAP field “Decimal Format” (T005X-XDEZP).
4. Number of decimals: SAP field “Number of decimal places”  (TCURX-CURRDEC).

So for characteristics 1, 2 and 5 we need an extra table.

Currency ABAP class

I created a class to format amounts based on the country and currency. The class name is ZCUR_CURRENCY_BO.

Get formatted amount in ABAP.

    "Get currency object
    DATA(lo_currency_bo) =
      zcur_currency_bo_ft=>get_factory( )->get_currency_bo(
        iv_country_key = <ls_currency>-country_key
        iv_currency_key = <ls_currency>-currency_key ).

    "Format amount
    DATA(lv_formatted_amount) = lo_currency_bo->format_amount( lv_amount ).

For example:

  • iv_country_key = ‘US’
  • iv_currency_key = ‘USD’
  • lv_formatted_amount = $1,234.57

How does it work?

In class ZCUR_CURRENCY_BO_DP in the CLASS_CONSTRUCTOR method the table GT_CURRENCY_LIST is filled with the characteristics 1, 2 and 5.

For example:

country_key ‘US’ currency_key ‘USD’ left_symbol |$| right_symbol || )
country_key ‘DE’ currency_key ‘EUR’ left_symbol || right_symbol | €| )


  • 1. Symbol position
    The symbol is placed in the field left_symbol or right_symbol.
  • 2. Space in between symbol and amount
    The space is placed with the left_symbol or right_symbol. See for example the German right_symbol = | €|.
  • 5. Currency symbol
    The currency symbol is placed in the field left_symbol or right_symbol.


  • Table GT_CURRENCY_LIST is not yet complete.
    You can extend it in your own system.
    Program ZCUR_CURRENCY_BO_LIST can be used to create a list of all currencies.
    The colum “L/R” = “Left or right symbol indicator” indicates whether a currency has a left or right symbol.
    If you have some updates for me with these currency symbols, than please send them to me via or via Github.
  • If a currency does not have a left_symbol or right_symbol, than the Currency ISO code will be placed to right of the amount with a space in between. For example for Egypt 1,234.57 EGP.
  • Always check with program ZCUR_CURRENCY_BO_LIST the currency you use.
    Don’t assume all symbols are correct. And test it wherever you use it.
    It is about money, so you should always be careful.

Using the framework

  1. Be sure you have program ZABAPGIT in your SAP system.
  2. Import the Github repository:
    … in your SAP system.
  3. Start program ZCUR_CURRENCY_BO_LIST to see the results.

Kind regards,

Alwin van de Put

You must be Logged on to comment or reply to a post.