cancel
Showing results for 
Search instead for 
Did you mean: 

using css with webdynpro

Former Member
0 Kudos

hi

I am using ep6sp9 was 640, and development tool : sap developer studio.

i would like to implement a style sheet with the webdynpro application. Please can you you point me to a guide or give me some info on this.

Many thanks

RD

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Its taking a long time because its going into a infinite loop. (firing the onplugdefault again and again).

Initially the parameter sap-cssurl will be null .we can use this is as a condition. To get that parameter value ..

String URLParams = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("sap-cssurl");

if (URLParams == null){

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

String a=WDURLGenerator.getApplicationURL(currentAppPart);

wdThis.wdFirePlugThemeplug(a+"?sap-cssurl=http://cgnsap15:50000/webdynpro/resources/sap.com/tcwddispwda/global/SSR/themes/sap_chrome");

}

}

This will ensure that it is excecuted only once.

This has been a long discussion and i have learnt a lot on how to answer a question..

Regards

Bharathwaj

Former Member
0 Kudos

Hi Bharathwaj

THANK YOU BUNCHES!!!

This solved my problem!

Yes this has been a long discussion!! I have learnt allot on wd's and how to ask a question

Have a great day!!

Former Member
0 Kudos

RD

Did you get this to work once the application is in Portal? I have followed all the steps in this thread and everything works great when deployed in NWDS - but as soon as I create a Web Dynpro iView the exit plug no longer seems to work or at least the custom theme is not applied.

Answers (9)

Answers (9)

Former Member
0 Kudos

hi,

For the exit plug what is the parameter name u r giving..

(i.e in the parameter tab of outbound plug..)

It should be "Url" of type String and not anything else. Even the case has to be maintained.

Regards

Bharathwaj

Former Member
0 Kudos

Hi Bharathwaj

I did not have "Url" as the parameter for exit plug. I think this was the problem.

I have changed it to use Url. deployed the application, though this is taking a very long time to load.

This is probably a good sign since i think it is loading the sap_chrome theme.

Does it usually take very long to load when you change a theme?

Former Member
0 Kudos

Hi,

Instead of firing with this fire with a standard url.

ex. http://google.com

if it goes to the site then fire plug is working...

Otherwise go to the plug tab and see if u have marked it as exit.(Exit plug will be in the interface view of the particular component.)

Regards

Bharathwaj

Message was edited by: Bharathwaj R

Former Member
0 Kudos

Hi,

It will throw an exception.U should catch the exception and print it. You have not written anything inside catch,thats y u r not able to c the error.

And then try printing the URL string ur obtaining.And dont forget abt the points

Regards

Bharathwaj

Former Member
0 Kudos

hi

i added the code for catching an exception and print it out to the screen...but it does not at all give an exception.

What baffels me is that when i deploy the application, in the browser the url is : <b>http://frodo:50300/webdynpro/dispatcher/local/sappitng_tools/Sappitng_tools?SAPtestId=16 </b>

This somehow does not contain the appended theme!!

If print to screen the url that the exit plug fires , it is :

<b>http://frodo:50300/webdynpro/dispatcher/local/sappitng_tools/Sappitng_tools?sap-cssurl=http://frodo:50300/webdynpro/resources/sap.com/tcwddispwda/global/SSR/themes/sap_chrome</b>

If i run this in the browser it displays correctly.

My question is:

Why does the <b>sap-cssurl<etc..></b> NOT append to <b>http://frodo:50300/webdynpro/dispatcher/local/sappitng_tools/Sappitng_tools?SAPtestId=16</b>

surely it will work if it does.

My code does append the theme to the application url.

String themeurl = applicationURL  + "?sap-cssurl=http://frodo:50300/webdynpro/resources/sap.com/tc~wd~dispwda/global/SSR/themes/sap_chrome";

Is there somewhere else i need to append the sap-cssurl and it's value?

Any further assistance is very much appreciated.

Thanks in advance

Message was edited by: Rakhee Dajee

Former Member
0 Kudos

Perhaps because there is already an URL parameter in the application URL. Additional parameters have to be separated by "&" instead of "?".

Armin

Former Member
0 Kudos

It seems the plug is not getting fired. Where are you firing the plug?

Former Member
0 Kudos

hi all

i have tried firing it just using a standard url(http://www.google.com), this does not go to google.

So I think that my plug is not getting fired.

In the plugs tab, under "Outbound plugs", i have a themeplug , the "Exit plug" option is checked and defined a string parameter for it.

Noufal, I fire this plug in the <b>onPlugDefault</b> method in the interface view. Please look at the code below:

public void onPlugDefault(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onPlugDefault(ServerEvent)

try{
WDDeployableObjectPart currentAppPart = wdThis.wdGetAPI().getComponent().getApplication().getDeployableObjectPart();
String applicationURL = WDURLGenerator.getApplicationURL(currentAppPart);
String themeurl = applicationURL  + "?sap-cssurl=http://frodo:50300/webdynpro/resources/sap.com/tc~wd~dispwda/global/SSR/themes/sap_chrome";
<b>wdThis.wdFirePlugThemeplug(themeurl);</b>
}
catch(Exception IOException){
this.wdComponentAPI.getMessageManager().reportSuccess("IOEXCEPTION :"+IOException);
}

//@@end
}

Where should this plug be fired??

Thanx in advance for any help!

Rakhee

Former Member
0 Kudos

Hi,

Now follow these steps.

1. Get the application URL using the following code.This should be wriiten in onPjugDefault of the interface view.

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

String a=WDURLGenerator.getApplicationURL(currentAppPart);

When u print the string a it should give the URL of your application .

2. Once u get this string append the sap_chrome path i have mentioned. Use a "?" instead of a "&" bcoz when we extract the URL programatically we wont have SAPTestID

a=a"?sap-cssurl="<the sapcssurl i.e http://<hostname>:50300/webdynpro/resources/sap.com/tcwddispwda/global/SSR/themes/sap_chrome

and fire the exit plug with URL value as the string a.

I hope it works this time...

Regards

Bharathwaj

Former Member
0 Kudos

hi

I have tried it out using the code you have suggested.

The onPlugDefault looks like this :

<b>public void onPlugDefault(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onPlugDefault(ServerEvent)

try{

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

String applicationURL = WDURLGenerator.getApplicationURL(currentAppPart);

String themeurl = applicationURL + "?sap-cssurl=http://frodo:50300/webdynpro/resources/sap.com/tcwddispwda/global/SSR/themes/sap_chrome";

wdThis.wdFirePlugThemeplug(themeurl);

}

catch(Exception IOException){

}

//@@end

}</b>

This still brings up the original theme..

<b>onPlugDefault</b> does not seem to be executed..

Before I changed the code I changed the project and app name of this statement:WDURLGenerator.getApplicationURL(,) to poit to something that does not exist. Surely this should have given me an error, but it did not.

how do i trigger this method? or is onplugdefault equivalent to a onLoad event(html/js)?

Former Member
0 Kudos

Hi,

A few points from my side :

1. When u run the application whats the URL displayed after excecution of the code.?This should be like

your normal URL followed by & sap-cssurl = <the theme url>.

2. Setting the value sap.theme.default in property sheet is to change the theme for ur server.Its not related to application specific themes.

3. For application specific themes u just need to put the themes folder u have created inside SSR\themes folder.

4.Did u check manually appending ->

& sap-cssurl = <the theme url> after the actual application url.

Chk them .Answer each one seperately . We will solve it... 2day !

Do one thing .First get the application URL and print it. Check if ur getting the correct URL.Send me the URL.Does it have "?SAPTestId = 1"

in the end.?

Regards

Bharathwaj

Message was edited by: Bharathwaj R at 4.45 PM

Former Member
0 Kudos

Hi Bharathwaj

I have tried out your points :

1. When i do run the application and the manually append the sap-cssurl it changes the color to the chrome theme. YAYYY

2. sap.theme.default in property sheet: I have changed it back to the default. Thanx for clarifying this.

3. I will save the customized theme in that specific path you have given earlier. I first want to know how to make it work with sap_chrome.

ok, so to make this work without doing this the manual way..the problem lies in my code.

the URL if i just run the application is :

<b>http://frodo:50300/webdynpro/dispatcher/local/sappitng_tools/Sappitng_tools?SAPtestId=10</b>

Former Member
0 Kudos

Hi ,

Try giving sap_chrome in the end instead of ur own project theme folder.If the color changes then the theme project is not placed in the correct folder.

You have to copy the theme u have created and put it in

<drive name >:\usr\sap\J2E\JC00\j2ee\cluster\server0\temp\webdynpro\web\sap.com\tcwddispwda\global\SSR\themes\

sap_chrome is a standard theme .Giving that as a theme name should work, even if there is a problem with ur theme.

Chk it out..

Regards

Bharathwaj

Former Member
0 Kudos

hi

i unfortunately was not successful in changing the theme.

this is what i have done:

1. In the onPlugDefault method, this is my code where

sappitng_tools is project and application name.

<b>public void onPlugDefault(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onPlugDefault(ServerEvent)

try{

String applicationURL = WDURLGenerator.getApplicationURL("local/sappitng_tools", "Sappitng_tools");

wdThis.wdFirePlugThemeplug(applicationURL + "&sap-cssurl=http://frodo:50300/webdynpro/resources/sap.com/tcwddispwda/global/SSR/themes/sap_chrome");

}

catch(Exception IOException){

}

//@@end

}</b>

2.I have changed the value for the property <b>propertysheet default</b> of <b>sap.useWebdynproStyleSheet</b>. So the default is <b>false</b> and the custom is <b>true</b>

I have restarted j2ee.

When i deploy & run the application now..it still brings up the original theme.

When you said I should <i><b>".. set this for URL parameter of exit plug and fire it."</b></i>

I implemented that is this statement. Is this correct :

<b>wdThis.wdFirePlugThemeplug(applicationURL + "&sap-cssurl=http://frodo:50300/webdynpro/resources/sap.com/tcwddispwda/global/SSR/themes/sap_chrome");</b>

Any help on this?

Thnx

RD

Message was edited by: Rakhee Dajee

Message was edited by: Rakhee Dajee

Former Member
0 Kudos

Hi ,

Sorry Rakhee it was my mistake .

Try this

http://<hostname>:50000/webdynpro/dispatcher/local/Example/Test?SAPtestId=18

&sap-cssurl=http://<hostname>:50000/webdynpro/resources/sap.com/tcwddispwda/global/SSR/themes/sap_chrome

Try to append the second part from & to ur application url manually and check.It should work.I think the problem was because there is already a parameter called SAPtestID ..For adding more parameters u should add

" & "and not question mark.

Best of luck ..

Regards

Bharathwaj

Former Member
0 Kudos

Hi ,

You can apply different themes to different webdynpro applications.(I dont think u can apply different themes to portal directly ).

For applying different themes to different webdynpro applications

In the interface view create a exit plug with URL parameter.

in interface view controller onplug default write this

Using the function getApplication url in the wdurlgenerator,get the current application url and append it with

"?sap-cssurl="+ http://<hostname>:50000/webdynpro/resources/sap.com/tcwddispwda/global/SSR/themes/<theme project folder>

(By the by this theme shud b created as mentioned by the link given by anil)

And set this for URL parameter of exit plug and fire it.

Tis will give u a theme specific to ur application.

IN visual admin property sheet set the use webdynpro theme to true.This will make overwrite ur portal theme.

Regards

Bharathwaj

Message was edited by: Bharathwaj R

Former Member
0 Kudos

Hi Bharathwaj

I have created the theme (have used the documentation provided by anil)

Now i want to integrate this with the webdynpro.

In interface view I have created an exit plug with a string parameter("themeparam").

In the onPlugDefault method i have this code:

<b>try{

String applicationURL = WDURLGenerator.getApplicationURL("sappitng_tools", "Sappitng_tools");

this.wdThis.wdFirePlugThemeplug("applicationURL?"sap- cssurl"=http://frodo:50300/webdynpro/resources/sap.com/t cwddispwda/global/SSR/themes/Prj_ToolsTheme");

}

catch(Exception IOException){

}</b>

this gives an error on "sap-cssurl" : <b>sap and cssurl cannot be resolved</b>. is this code wrong?

should i import a class for this?

thanx

rd

Former Member
0 Kudos

Wrong placing of quotes?

Instead of

wdThis.wdFirePlugThemeplug(
"applicationURL?"
+ sap-cssurl
+ "=http://frodo:50300/webdynpro/resources/sap.com/t c~wd~dispwda/global/SSR/themes/Prj_ToolsTheme");

it should probably be


wdThis.wdFirePlugThemeplug(applicationURL
  + "?sap-cssurl="
  + "http://frodo:50300/webdynpro/resources/sap.com/t c~wd~dispwda/global/SSR/themes/Prj_ToolsTheme");

Armin

Former Member
0 Kudos

Hi

Thanx, that solved the error problem. I ran and deployed this application and the changes i did on the theme did not take effect.

I would think that i need to specify the specific theme in this path <b>"..SSR/themes/Prj_ToolsTheme"</b>

Prj_ToolsTheme is just the name of the project and there are many themes within it for eg. the sap themes and my theme. I have tried it with the theme name..so the path is now <b>"..SSR/themes/Prj_ToolsTheme/testtheme"</b>

The theme still does not take effect. How do i view these theme changes to the view?

Will this only happen once i display it in the portal in an iview?

Any further help is very much appreciated!!!

Thanx

Rakhee

Former Member
0 Kudos

Please refer to this.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/ho... to edit web dynpro themes.pdf

Regards, Anilkumar

Former Member
0 Kudos

I will deploy these webdynpro's in the portal. Will the portal theme overwrite the wedynpro theme?

Could you have more than 1 theme in the portal at SAME time?

For example : If you click on Content Administration the 2nd level navigation bar is orange and if you click on User Administration the theme changes and the 2nd level navigation bar is green.

Any help on this?

Message was edited by: Rakhee Dajee