This Space has blogs on various topics in the field of SAP. These blogs point out solutions to various technical and functional issues that consultants face during implementation or support of SAP Projects. Readers/followers are welcome to contribute to this space by emailing your content at bohra.mohammadi@gmail.com. You will be rewarded according to the topic/number of words/complexity of the topic/issue which are you addressing in your blog.
Wednesday, April 29
Locales, languages, date and time formats in Web Dynpro
Symptom
A wrong language or locale is used after you logged on to the system ?
Calendar dates are formatted in an unintended way ?
Language change in the portal (through portal personalization) does not get immediately reflected in the Web Dynpro iViews ?
Calendar dates are formatted in an unintended way ?
Language change in the portal (through portal personalization) does not get immediately reflected in the Web Dynpro iViews ?
Other Terms
Web Dynpro Java, Enterprise Portal, locale, date format, time format
Reason and Prerequisites
You are using applications that have a SAP Web Dynpro Java user interface, running standalone or in the SAP Enterprise Portal.
Solution
Determination of languages and locales
Languages and locales are found stepping through several hierarchies based on the server layers involved. If you want to find out where this algorithm fails in your case, e.g. due to misconfiguration, you have to carefully check each step.
As there might be differences from release to release we recommend to double check with the NetWeaver Developer Workplace documentation, to visit sdn.sap.com or to consult a book like "Web Dynpro for Java" (SAP PRESS).
- 1. Determination of the locale in SAP Portal
If the Portal succeeds to determine a locale and successfully hands it over in the URL to Web Dynpro, this locale might become effective. The first locale determined by the following sequence will be forwarded to Web Dynpro.
- a) Component locale: The locale of the component is specified by the following two properties and enables you to force a component to use one specific locale. This could be used for administration components.
ForcedRequestCountry
- b) Portal mandatory locale: This is defined in the prtDefault.properties and forces a portal installation to use one and only one locale. Administrators setting up a portal environment use this locale.
request.mandatorycountry
- c) User locale: This is the locale attached to the profile of the user who logged in to the system. This is the most popular way to set language and locale.
- d) Request locale: The request locale is defined by the browser. This is used, for example, for anonymous user or users that do not have locales defined in their profiles.
- e) Portal default locale: This locale is defined in the prtDefault.properties by the following two properties.
request.defaultcountry
- f) System default locale: The Java default locale defined by the system, either by the operating system or by the JVM on the server.
- 2. Determination of the locale in SAP Web Dynpro Java
- a) SAP Portal hands over a locale to Web Dynpro via an URL parameter sap-locale .
- b) The user locale is checked. This is the locale attached to the profile of the user who logged in to the system.
- c) The Accept-language in the HTTP header of the request, defined in the browser, is checked.
- d) The default sap.Locale in the application properties of the Web Dynpro application is investigated.
- e) The sap.systemLocale in the Propertysheet default of the Web Dynpro runtime is evaluated.
- f) The system default locale, either defined by the operating system or by the JVM on the server, is evaluated.
- 3. Determination of language resources
- a) The system searches for property resource bundles for the language defined in the SAP Web Dynpro Java session locale in a file like
- b) The default locale of the JVM on the server is evaluated and the related resource file
- c) Last the system tries to use the default resource bundle named
- d) If this fails too, e.g. because the default resource bundle is not available, a java.util.MissingResourceException is thrown.
Troubleshooting
- 4. Check the current session locale
It can be checked in the Web Dynpro Content Administrator:
- a) Enter the Web Dynpro Content Administrator, e.g. via the start page of the SAP J2EE Engine -> Web Dynpro -> WD Content Administrator.
- b) Display the attributes for any application.
- c) Choose the tab "Language Resources" in the content area on the right.
- d) Watch for the session locale displayed in the content area in the upper part ("Current locale"):
If it is something like "en_AU" it contains both language and country information, if it is e.g. "en" only, the country information is missing and the default formatting related to this language for e.g. calendar dates is used. For "en" this is USA English MM/DD/YYYY.
- 5. Check the available language resource bundles
They can be checked in the Web Dynpro Content Administrator:
- a) Enter the Web Dynpro Content Administrator.
- b) Display the attributes for the application you want to check.
- c) Choose the tab "Language Resources" in the content area on the right.
- d) Select the desired language in the drop down menu "Select Language".
- e) Watch for error messages like "No resource bundles found " at the bottom of the content area.
If the language resource bundle for the language chosen is available, the texts contained are shown in the table next to the drop down menu.
Mind that the resource bundles are stored on the appliocation servers locally and that they have to be checked for all application servers.
- 6. Different languages on different application servers
Please check these prerequisites on all apllication servers.
- 7. Enable session trace
- a) NW 04s & later versions
- b) NW 04 versions
- 8. Users from R/3 & Date Formatting
The settings in the user management in R/3 are:
- a) call transaction SU01 in R/3 ABAP system
- b) press tab "Address"
- c) look at box "Person"
- d) maintain "Language" field (technical "LANGUP_ISO")
- e) press small button "+ more fields" on right
- f) maintain "Format country" field (technical "NAMCOUNTRY")
For further reference on localization of Java applications see ISO 639 Language Codes, ISO 3166 Region Codes and SUN SDN "Internationalization: Understanding Locale in the Java Platform".
- 9. Change of locale in Web Dynpro iView
After detecting the locale, this locale is assigned to the login session and all Web Dynpro applications and all Web Dynpro iViews started in the same login session. The reason why it has to be this way is that Web Dynpro uses backend connection caches which are associated to the login session and they are locale sensitve.
If the locale for the Web Dynpro iView is changed in the portal (through portal personalization), this is not reflected in the running login session. The user needs to logoff and login again, in order to see the locale change in the Web Dynpro iView.
As Web Dynpro uses one locale per login session, it is not possible to run multiple iViews with different locale settings.
Known Limitations
- 10. Calendar date formatting for Singapore
This is a feature of the SUN Java JVM. It is not possible, by means of SAP NetWeaver, to change this behaviour.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
You are welcome to express your views here...