cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 HANA XSA Thousand Separator on the whole application from Odata

anandmuthu
Participant
0 Kudos

Hi Experts,

I have a SAPUI5 application that display table data which is retrieved from Odata (xsodata) in the backend. The table is generated and bind dynamically using template xml. For Odata, the metadata for some of the columns are decimals and I want to apply thousand separator based on the browser language settings. This can be done using formatter options but this has to be specifically coded in for each individual data column. How can default the whole application to apply the Number format / Float Format on all edm.Decimal fields from odata automatically ?

Hope can shed some light into the matter or suggestions.

Updated : This is with SAPUI5 on top of HANA XSA On Premise. There is no netweaver gateway / ABAP stack involved.

Thanks.

Anand Muthu

0 Kudos

Hi Anand,

We can make the default decimal notation for in Gateway server in user profile (SU01) or else user the SMART Field. In Metadata you need to add the unit for amount field . Below are the sample Metadata and refrence link

<Property Name="Price" Type="Edm.Decimal" Nullable="true" sap:unit="CurrencyCode" sap:label="Price" sap:creatable="false" sap:updatable="true" sap:sortable="false" Precision="13" Scale="5"/> <Property Name="CurrencyCode" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Currency" sap:creatable="false" sap:semantics="currency-code" sap:updatable="true" sap:sortable="false" />

https://sapui5.hana.ondemand.com/#/entity/sap.ui.comp.smartfield.SmartField/sample/sap.ui.comp.sampl...

MathiasUhlmann
Advisor
Advisor
0 Kudos

Hi Anand,

in templating you can use sap.ui.model.odata.AnnotationHelper.format so that bindings use the types according to the metadata. See also https://sapui5.hana.ondemand.com/#/entity/sap.ui.core.mvc.XMLView.

Another option could be the usage of Smart Controls that also evaluate metadata and use the respective types or formatters.

sap.ui.core.format.NumberFormat and types using this formatter like sap.ui.model.odata.type.Decimal will use the browser locale for formatting. By default thousand separator's are switched on through format option groupingEnabled, see also sap.ui.core.format.NumberFormat.sap.ui.core.format.NumberFormat.getFloatInstance.

Best regards
Mathias.

Accepted Solutions (0)

Answers (0)