Skip to Content
avatar image
Former Member

Fiori currecny formate based on SU01 decimal notation

Hi All,

I have some currency fields on XML/JS views currently I am applying below code

{parts: [
                               {path: 'CreditValue'},
                               {path: 'Currency'}  
                                       ],
                                     type: 'sap.ui.model.type.Currency',
                                     formatOptions: {
        showMeasure: false 
            }
        }

And in SU01 decimal notation is set as "1.234.567,89"

But on UI I can see value is with ',' separated

for ex : 300000000 is displaying like 300,000,000.00 but expected is "300.000.000,00"

Any clues are really helpful

Thanks

Rajesh

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 20, 2017 at 07:15 AM

    Hi,

    One way I found is to get the user notation format from the User Master and then accordingly in the controller try to set the format options of the control. If it is always the INR format then following are the possibilities:

    <mvc:View controllerName="mysap.ui5.demo.walk.controller.App" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
    xmlns="sap.m" xmlns:u="sap.ui.unified">
    <App>
    <pages>
    <Page title="{i18n>title}">
    <content>
    <!--<u:Currency value="2300.12" currency="INR" useSymbol="false" />-->
    <Text text="{ path: '/number', type: 'sap.ui.model.type.Currency', 
    formatOptions: { groupingSeparator: '.'
    , decimalSeparator: ','  } }"/>
    <!--<Text text="Hello World"/>-->
    </content>
    </Page>
    </pages>
    </App>
    </mvc:View>

    The other way is use the SAP.UI.UNIFIED reference. and mention the currency type.

    Probably you can end up creating your own formatter function.

    Thanks, Pavan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 20, 2017 at 01:36 PM

    Hi Pavan,

    Thanks for response, yes up to some extant your solutions worked for XML views.For my requirement I need the solution for JS as well.

    I am reading user notation from custom service and setting groupingSeparator and decimalSeparator.

    JS currency convertion

    var formatter = sap.ui.core.format.NumberFormat.getCurrencyInstance({showMeasure: false}, sap.ui.getCore().getConfiguration().getLocale());formatter.format(.Netwr);

    Thanks

    Rajesh

    Add comment
    10|10000 characters needed characters exceeded