Skip to Content
avatar image
Former Member

Role used to access WDJ application

Hi Friends,

I have a Web Dynpro Java application deployed in our portal 731. This WD app will be accessed from role A, Role B, Role C. End User will be having all three roles assigned. Depending on the role selected, we have to fetch master data from our backend server.

In WD init (), how can we know which role is selected?

I have tried below code and it is listing all the roles assigned to the user and I am unable to track which role he has navigated(selected).


IUser currentUser = WDClientUser.getCurrentUser().getSAPUse();// identifying current loggedin user

Iterator<String> rolesAssignedToUser = currentUser.getRoles(true);// getting the role list assigened

I want to know from which role he is viewing the current app view and not the list of roles assigned to his user id.


Rakesh Mathew

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 25, 2014 at 06:32 PM

    IWDNavigationHelperService wdNavHelperService =

              (IWDNavigationHelperService) WDPortalUtils.getService(IWDNavigationHelperService.KEY);

          INavigationNode navigationNode = wdNavHelperService.getCurrentNavNode();

          String navNode = navigationNode.getName();

    add tc/ep/navigation/api as dependency

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2014 at 07:21 AM

    hi Mathew ,

    im not aware of finding out the current selected role at runtime , but one solution to your requirement is to have three different pages for role A, role B and role C , so that in the page you can maintain parameters which is accessible at runtime by using the code


    in the page ,. you have application parameter property there for role a -> page -> add parameter like


    and simillary in other pages at role b -> CurrentRole=B

    rolec -> CurrentRole = C

    in wdDoinit() methods you can use this.


    String currentRoleSelected = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("CurrentRole");

    make sure that CurrentRole parameter added in the page application parameters , will be case sensitive ,i.,e same name should be used at wdprotcol..... getparameter("parametername added in the page") 


    Govardan Raj S

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Govardan Raj,

      Yes.But in this case i need to create more than 40 pages. That's why i am checking alternative options (current selected role at run time). Thanks for the update.