cancel
Showing results for 
Search instead for 
Did you mean: 

Get login user name in iView

Former Member
0 Kudos

Hi All,

Could any body provide me the code for to get username in my iView. means in textview button.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182374
Active Contributor
0 Kudos

Try this:

IWDClientUser clientUser = WDClientUser.forceLoggedInClientUser();
com.sap.security.api.IUser sapUser = clientUser.getSAPUser();
String user = sapUser.getUniqueName();
wdContext.currentContextElement().set<context field that binded to textview>(user);

Don't forget to add 'com.sap.security.api.jar' to your project.

Omri

Former Member
0 Kudos

Hi Cohen,

I have one more button Logout and Region. Could you give me the code for these buttons also plz.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Say you have a context attribute say <b>Username</b> defined in you context which holds the username value,use the following code to get the username.

String name = wdContext.CurrentContextElement.getUsername();