cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Web Dynpro theme using FPM

ChrisPaine
Active Contributor
0 Kudos

Hi all,

I would like to apply a custom Web Dynpro theme to my application (not all the applications running on my server, just one.)

I've seen various blogs etc on how to do this, and it seems fairly simple, the application on initialisation checks to see if it has a URL parameter of sap-cssurl and if it doesn't closes the application and restarts with a new call to itself adding this parameter.

I'm building applications using the FPM, and therefore the component interface view I am calling is the FPM 's not my own custom app's. I can't therefore seem to be able to call the exit plug of any of my own interface view's as they are not instatiated.

Other than modifying the FPM code so that it implements the search for URL parameter and then restart behaviour, any suggestions on how to get around this?

Below is a snippit of code that I put into the onInit of my FC (all my VC's use this FC so I thought it a good place to put the code).


private void checkStylesheet()
	{
		// check if a style sheet has been applied.
		String cssParam =
			WDWebContextAdapter.getWebContextAdapter().getRequestParameter(
				"sap-cssurl");

		if (cssParam == null)
		{
			try
			{
				//		 access the deployable object part of the application you are currently in. 

				WDDeployableObjectPart currentAppPart =
					wdThis
						.wdGetAPI()
						.getComponent()
						.getApplication()
						.getDeployableObjectPart();

				//		 get the URL of the application (deployable object part). 

				String appURL = WDURLGenerator.getApplicationURL(currentAppPart);

				IWDApplicationPropertyInfo appProperty =
					wdComponentAPI
						.getApplication()
						.getApplicationInfo()
						.findInApplicationProperties(HRReportingConstants.STYLE_SHEET);

				if (appProperty != null)
				{
					String cssKeyValue = appProperty.getValue();

					if (cssKeyValue != null)
					{
						//		 append the application URL with the value obtained above. 

						String themeAppURL = appURL + "?sap-cssurl=" + cssKeyValue;

						//	 fire the exit plug with the above obtained value as its string parameter. 
			
					
						wdThis
							.wdGetIBLCWindowInterfaceViewController()
							.wdFirePlugRefreshWithStyleSheet(
							themeAppURL);

					}
				}

			}

			catch (Exception e)
			{

				wdComponentAPI.getMessageManager().reportSuccess(e.toString());

			}

		}

	}

Unfortunately this results in the error message: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Instance of interface view controller IBLCWindowInterfaceView does not exist.

and does not call the exit plug of the interface view, and therefore does not start the application again with the new style sheet specified.

Any thoughts?

Cheers,

Chris

Accepted Solutions (0)

Answers (1)

Answers (1)

ChrisPaine
Active Contributor
0 Kudos

I'm pretty sure that there are now better ways of doing this!

Closed(marked as answered) as I don't want anyone to even think about the resolution! And I needed to to a bit of housekeeping with my unanswered questions...

Cheers,

Chris