Webdynpro Java supports SAP Blue Crystal Theme with sap-theme parameter
This blog describes how Web Dynpro Java framework supports new theming infrastructure and provide the possibility of defining sap_bluecrystal themes for all Web Dynpro java applications to have Fiori-like appearance. sap_bluecrystal theme will work only when the applications are rendered in Standard Mode and with sap-theme parameter.
This feature is available from NW730 SP16, NW731 SP 18, NW740 SP13 and NW750 SP4 onward.
The following document describes in detail how to define sap-theme parameter and to configure sap_bluecrystal theme for Web Dynpro java applications.
One must have knowledge about Setting Theme for Webdynpro Java application.
Running as a Standalone Application
If the Web Dynpro application runs as a standalone application (i.e. not inside the SAP Portal), or if the Web Dynpro runtime is configured to use the Web Dynpro theme in every case, there are two options to define the theme used by a Web Dynpro application.
You can define the default theme (i.e. the theme used by all applications running on this system) or you can define an application-specific theme.
Defining the Default Theme
Usually to define a default Web Dynpro theme, the sap.theme.default property was set in the following format: http://<host>:<port>/<path to the theme>/<theme name>.
For example: http://localhost:50000/irj/portalapps/com.sap.portal.themes.lafservice /themes/portal/sap_chrome.
Please refer Configuring the Web Dynpro Runtime Environment that describes how to configure Web Dynpro Java runtime Properties.
To set sap_bluecrystal or any theme from new theme infrastructure , as the default Web Dynpro theme, following properties has to be set in NWA.
- themeParameter = sap-theme
- themeID = provide the theme to be used. Eg: sap_bluecrystal
- themeLocation = Specify the location of a theme if the theme is not in the default location for the technology.
The following screen shot shows the new Web Dynpro java properties added in NWA for configuring sap_bluecrystal theme as Web Dynpro java default theme.
- If you want to use the theme that is set for the property sap.theme.default as a Web Dynpro defined theme, then you have to set the parameter themeParameter = sap-cssurl for NW versions NW730 SP16, NW731 SP 18, NW740 SP13, NW750 SP4 and above. sap_bluecrystal theme will not work in this case.
- For backward compatibility Web Dynpro java supports sap-cssurl parameter. But, to use sap_bluecrystal, sap-theme parameter has to be configured. The sap-theme parameter take higher precedence over sap-cssurl.
Defining an Application-Specific Theme
Earlier to specify application specific theme, URL parameter sap-cssurl was used to define the theme. This theme was overriding any default settings.
To specify sap_bluecrystal theme as application specific theme, sap-theme parameter has to be used as the URL parameter.
The validation is not case sensitive!
<theme-id> = [A-Za-z_][A-Za-z0-9_]*
<theme-uri> = <theme-id>(@<theme-root>)?(\?.*)?
Theme Id is the theme to be used by the application. Must start with A-Z, a-z or “_”. For subsequent characters also digits (0-9) are allowed.
Eg: sap_bluecrystal, sap_corbu, sap_tradeshow_plus
Location of a theme must be specified if the theme is not in the default location for the technology (Optional)
Theme-uri can be
Relative URLs for themes located on the local server start with “/”
Absolute and relative URLs can end with or without a trailing “/”
@ Separator between <theme-id> and <theme-root>(theme location)
| RESERVED (should not be used as part of the themeroot URL)
> RESERVED (should not be used as part of the themeroot URL)
? Append additional parameters which are for technology specific evaluation (not used yet)
The following screen shot shows nwa application rendered with sap_bluecrystal theme.
Running Inside the SAP Enterprise Portal
As you already know , when Web Dynpro java applications are running inside the SAP Enterprise Portal, the portal defined theme is automatically used by the Web Dynpro java applications. Also, any user or role-based personalization of the theme is automatically used by the Web Dynpro applications.
If sap_bluecrystal theme is defined in the Portal then when the Portal is in LESS mode(the new theming structure) and the browser is in Standard Mode, Web Dynpro java applications running in Portal will be rendered with sap_bluecrystal theme. SAP Enterprise Portal ensures that when Portal is in LESS mode, sap-theme parameter is passed to Web Dynpro java framework with the appropriate value.
For Web Dynpro application running in portal if Web Dynpro theme has to be used instead of the portal theme, sap.useWebDynproStyleSheet property has to be set to true .