Skip to Content

PERSONAS : Can we switch theme using script?

May 03 at 03:13 PM


avatar image

Hi experts,

I have a flavor with (among others) 2 buttons.

The first one launch tcode IW32 with a custom flavor. I have done admin maintenance to bind user/role/tcode/theme (There is a bug because custom theme is not applied, Note OSS 2492693 should correct this bug but i can't implement it but this is not the point of this post. So for now i have to activate it manually)

Now for the next button, my customer wants to launch also IW32 but the original screen, with the default sap theme.

To switch to original screen, i use "session.utils.changeToOriginalScreen()" everything is fine but my custom theme is still On...Or i want the standard SAP theme with the original screen.

How can i do that through scripting?

EDIT : My scope being very wide, i have several shortcuts for standards Tcode which must be displayed with the classic SAP theme. Or, like IW32, the custom theme is kept...


Kind Regards,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Tamas Hoznek
May 04 at 05:11 PM

Hi Alexandre,

This is currently not possible, since there is no script command for theme switching. As far as I heard, there was a technical (authorization-related) reason why theme switching was not implemented.

However, you could use a workaround and switch to a different flavor, which is set up to have a direct theme link. The theme itself could be just like the default SAP theme. That way, the new flavor would also switch the theme. If your other flavor is just simply the copy of the Original Screen, then this would achieve what you are looking for. Not elegant, but it would work.

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Thanks Cris and Tamas,

As i can't apply a default theme to a flavor right now through admin maintenance (bug OSS 2191624) I can't test your solution. My only hope was scripting but it's not possible as you said.

I'm working in a P.O.C context and sadly we don't have the authorization to implement sap notes or upgrade to SP06 (for now).

So i will tell them that's not possible and that they have to upgrade their personas or implement some sap notes.

Have a good day,




The mentioned note is ancient (for SP01), and it is not applicable to your installation. It is certainly possible to assign themes to flavors directly, even in SP05. If it doesn't work, that is a bug.


Yeah there is clearly a bug.

I've tried to push further my investigation and i've found something.

  • I have one custom theme, THEME_POC_PERSONAS
  • I have 2 flavors, one for SMEN, the other for IW53
  • I have 1 role, /PERSONAS/ADMIN_ROLE which i use to restrict the access to the flavors (it will not be the final solution it's just for testing)


Now in "Theme Assignement" :

=> When i launch my browser, the dashboard is display correctly with the good theme

When i jump to IW53 with one of my script button, the theme is lost! Normal you will say because i have only linked the SMEN with the theme and the role.

Back to /PERSONAS/ROLES, i add this line :

=> When i launch my browser, the theme is neither displayed in SMEN and IW53 and i'm on the default SAP Theme.

I hope i will not have this problem when my customer will upgrade his personas component to SP06.

EDIT : So it seems that just one line in "Theme assignement" is working for me. So i tried to just fill the IW53 tcode. the result is a bit different.....the first screen has my custom theme displayed BUT when i press enter to go the next screen (notification details) the theme is lost. There is a new problem here...


This seems to be a different issue than what you were initially asking about. I agree that it doesn't appear to be working correctly.

However, back to the original question about IW32 and the default SAP theme, after selecting a theme for the user... what I meant in my workaround solution is assigning the theme directly to the flavor, instead of through a role. Did you try whether this fulfills the original requirement you described?


As you said, associate a custom theme (which is like the default SAP theme) to a custom flavor (with no changes) does the trick, thank you. In the end, i would have preferred a solution with scripting because theme administration is not working well on my system, but i hear your point.

I will not open a new thread about the theme administration bug. I just hope it will not be there when they'll upgrade to SP06.

Have a good day.



Cristiano Hansen
May 03 at 04:39 PM

Hi Alexandre,

AFAIK, this is not possible. I'll do some tests and come back to you later (probably during the weekend - you might receive an answer from another colleague earlier).

Kind regards,


10 |10000 characters needed characters left characters exceeded