SAP Fiori globalization实现原理之Number显示的格式原理

简介: SAP Fiori globalization实现原理之Number显示的格式原理

You might observe the same number value but displayed with different format if you log on the same system with different user.


image.png


The user with Decimal Notation setting ” ” will see the format “1.880,00” and setting “Y” will see “1 880,00”. What has happened under the hood?

image.png



If you monitor the network tab in Chrome development tool when Fiori launchpad is initialized for the very beginning, you can find the http request below:


image.png


The response contains the Defaults user setting stored in ABAP backend. The attribute “numberFormat” is related to the number format being displayed.


image.png


In Configuration.js, the corresponding enumeration variable is defined for each type of number format.

image.png



The main logic for number format is implemented in file NumberFormat.js. As the variable name has already given a good hint, the integer part and fraction part of 1880.00 are parsed and stored into the two variables separately.


image.png


The logic of the following code:


(1) Since a number is displayed as several groups and each group consists of THREE digits, so in code 627, the position of group is calculated by MOD operation against 3.


(2) For user setting “Y”, the group separator character is ” ” and decimal separator is “,” , stored in corresponding attribute in variable oOptions.


image.png


(3) You can debug the NumberFormat.format in the run time to have a better understanding on the logic above. Suppose you do not the exact location of NumberFormat.js, just switch to debug mode, open Chrome development tool and go to Sources tab,

image.png



press Ctrl+O and type “NumberF” and then there is auto-complete function which lists all potential results.


image.png


Click the second one ( ) and you will navigate to NumberFormat.js. Hover the mouse and you can see its absolute path in tooltip.

Now you can set breakpoint and debug.

For more tips about Chrome development tool used in my daily work, please refer to this blog.

Enjoy debugging!


相关文章
|
1月前
|
数据库 API
启用SAP Fiori之前的一些注意事项
启用SAP Fiori之前的一些注意事项
13 0
|
3月前
|
IDE JavaScript 开发工具
什么是 SAP Fiori tools 的 environment check 功能
什么是 SAP Fiori tools 的 environment check 功能
30 0
|
2月前
SAP UI5 Link 控件的使用方法介绍 - 后续学习 Fiori Elements Smart Link 的基础试读版
SAP UI5 Link 控件的使用方法介绍 - 后续学习 Fiori Elements Smart Link 的基础试读版
16 0
|
2月前
|
UED
什么是 SAP Fiori 的 Technical Catalog 和 Business Catalog
什么是 SAP Fiori 的 Technical Catalog 和 Business Catalog
38 0
|
2月前
|
前端开发 UED
SAP Fiori 到底指什么
SAP Fiori 到底指什么
49 0
|
2月前
|
XML 前端开发 JavaScript
SAP Fiori Launchpad Custom Fields tile 里的 ABAP 语法高亮显示
SAP Fiori Launchpad Custom Fields tile 里的 ABAP 语法高亮显示
16 0
|
3月前
|
XML JavaScript 数据格式
SAP UI5 XML Preprocessor 的工作原理和 instructions 指令详解
SAP UI5 XML Preprocessor 的工作原理和 instructions 指令详解
29 0
|
3月前
|
XML 存储 JavaScript
关于 SAP Fiori Elements List Report 里的 TableCell.fragment.xml 头部声明
关于 SAP Fiori Elements List Report 里的 TableCell.fragment.xml 头部声明
24 0
|
3月前
SAP Fiori Elements 应用里图片字段(Image)的显示原理介绍试读版
SAP Fiori Elements 应用里图片字段(Image)的显示原理介绍试读版
17 0
|
6月前
|
算法
Leetcode 313. Super Ugly Number
题目翻译成中文是『超级丑数』,啥叫丑数?丑数就是素因子只有2,3,5的数,7 14 21不是丑数,因为他们都有7这个素数。 这里的超级丑数只是对丑数的一个扩展,超级丑数的素因子不再仅限于2 3 5,而是由题目给定一个素数数组。与朴素丑数算法相比,只是将素因子变了而已,解法还是和朴素丑数一致的。
65 1