Skip to Content
0
Former Member
Oct 08, 2009 at 01:23 AM

Logged in user ID retrieval irrespective of UME?

26 Views

Hi,

I have found below code which can retrieve currently logged in user and it's working fine. Reading the code I assume this will only work if the user datasource is ABAP, will the below code work if we change to LDAP as user datasource? If not, is there a generic coding which can be used to retrieve logged in userid irrespective of user datasource? We are currently using ABAP as datasource, but we will be moving to LDAP soon, so I'm writing a WD app which needs to work in both situation.

String strUserName = null;

try {

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

IUser sapUser = wdClientUser..getSAPUser();

if (sapUser != null) {

IUserAccount[] acct = sapUser.getUserAccounts();

if (acct[0] != null) {

strUserName = acct[0].getDisplayName();

}

}

} catch (WDUMException e) {

e.printStackTrace();

} catch (UMException e) {

e.printStackTrace();

}

return(strUserName);

Thanks

Praveen