ISSUE: The usage of DOT/COMMA as decimal separator (radix point) is different in different geographies. We faced issues where user cannot fill a decimal numeric field due to the IE /portal language setting defined for the user. For most users in SAP NetWeaver Portal, the user profile was not updated with preferred language,and the browser settings determined the preferred language when user logged in to the application. for e.g., a user with Polish language setting in browser trying to use DOT as decimal separator got below error for format as inPolish comma is considered as decimal formatter.
SAP WAS Dot/Comma is determined by the local settings of the application language. The determination is based on the following order of preference:
SOLUTION: The solution was implemented by making code changes to determine user locale and convert the number based on locale.
Below is the sample code snippet used:
Convert the numeric value to string first:
String ValToConvert = String.valueOf(numeric field);
Create a method for checking Locale and pass this string as a parameter:
public java.lang.String mLocaleBasedFormatNumber( java.lang.String ValToConvert ) {
//@@begin mLocaleBasedFormatNumber()
String ConvertedVal = null;
try
{
java.util.Locale sessionLocale = WDClientUser.getCurrentUser().getLocale();
if(null == sessionLocale){
sessionLocale = WDResourceHandler.getCurrentSessionLocale();
}
NumberFormat formatter = NumberFormat.getNumberInstance(sessionLocale);
if(null != ValToConvert && !"".equalsIgnoreCase(ValToConvert.trim()))
{
Number number = formatter.parse(ValToConvert);
ConvertedVal = number.toString();
}
}
catch (Exception e) {
wdComponentAPI.getMessageManager().reportException(e.getMessage());
}
return ConvertedVal;
//@@end
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |