cancel
Showing results for 
Search instead for 
Did you mean: 

Currency Value Conversion

Former Member
0 Kudos

Hello All,

We have created Fiori with the field Sales_Value, Please find the screenshot below

Displaying image.png

Here we have value  as for example 69473214.80 and we want to convert it into million format , please let us know how to convert the value into millions/ billion etc and if we have to write any code please be specific where to write in Web IDE.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Please refer link: https://sapui5.hana.ondemand.com/sdk/explored.html#/sample/sap.ui.core.sample.TypeCurrency/preview

Please check if Class sap.ui.model.type.Currency suits your requirement.

In WebIDe, You can bind as below in your view:

<Text text="{parts:[{path : 'BilledValue'}, {path : 'BilledCurrency'}], type:'sap.ui.model.type.Currency'}" maxLines="0" id="__text26"/>

Output:

You can also use/extend class sap.ui.core.format.NumberFormat.getCurrencyInstance and write your own formatter method.

Hope this help.

Thanks,

Vinod

Former Member
0 Kudos

Thank you for the quick response, Vinod.

I really appreciate your effort in sending that link but I want to shorten the whole value in million or billion format, for example : 67898982 thousand  - 67898.982M/67.898982 Bl. Please let me know if you have any solution for this query.

Former Member
0 Kudos

Hi,

Just add the formatOptions.

style parameter as short and decimal to control the precision (no. of decimal points) you need.

Ex:

<text="{parts:[{path : 'BilledValue'}, {path : 'BilledCurrency'}], type:'sap.ui.model.type.Currency', formatOptions: {style : 'short', decimals : 10}}" maxLines="0" id="__text26"/>

Output:

Does this help? If not you need to write your own formatter method.

Please look at the formatting options available for currency formatting:

https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.core.format.NumberFormat.html#.getCurrency...

The standard uses CLDR number pattern: Number Patterns - CLDR - Unicode Common Locale Data Repository

Thanks,

Vinod