Skip to Content
0

How is currency formatted in the sap.m.ObjectNumber API

Jan 27, 2017 at 03:37 PM

467

avatar image

We use the sap.m.ObjectNumber to display the number formatted based on the currency key as shown below. I have issues with formatting of the USD vs EUR. The decimal and thousand separator shows the same as shown below. For EUR, I except ',' as decimal seperator and '.' as thousand separator. For USD, I except the opposite. My understanding is that it is formatted based on the regional settings of your computer. However, when I tried to change it , it does not reflect in the UI. Anybody ,please explain how is this thing working.

<ObjectNumber class="sapUiSmallMarginBottom" binding="{/ProductCollection/0}"
number="{ parts:[{path:'Price'},{path:'CurrencyCode'}], type: 'sap.ui.model.type.Currency', formatOptions: {showMeasure: false} }"
unit="{CurrencyCode}" numberUnit="{CurrencyCode}"/>
currency.png (10.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Veeraraghavan Narasimhan
Jan 27, 2017 at 07:41 PM
0

Hello Nirmal,

There are mutiple ways to handle this . One of the ways is

<ObjectNumber binding="{/}" number="{ parts:[{path:'Price'},{path:'CurrencyCode'}], type: 'sap.ui.model.type.Currency', formatOptions: {showMeasure: false,decimalSeparator : ',', groupingSeparator : '.'} }" unit="{CurrencyCode}" numberUnit="{CurrencyCode}" />

There are other ways as mentioned here

https://help.sap.com/saphelp_uiaddon10/helpdata/en/91/f2f2866f4d1014b6dd926db0e91070/content.htm

Thanks and Regards,

Veera

Show 3 Share
10 |10000 characters needed characters left characters exceeded

I don't think it will help any.

0

Hello,

Do you find any specific reason why it wont work. I found it working Sample Code . Basically there are many ways to override the locale . I checked the internal formatting functions in SAPUI5 and prepared the above code snippet.

Thanks and Regards,

Veera

0
Veeraraghavan Narasimhan

your code works, but you are doing hardcoding and won't satisfy his expectation.

he expects "," as decimal point for EURO and "." for USD. he wants this to happen automatically.

0