Hi experts,
I have developed and integrated a Web Dynpro application into SAP Neteaver portal. When user logged in to portal and run the web dynpro application, the web dynpro application will get the current user info such as logon Id. I discovered the logon id was not always retrieved (is null) and it not happen all the time.
Following are my code to retrieve logon id of the current user:
String logonId = null;
IWDClientUser wdUser = WDClientUser.getLoggedInClientUser();
IUser user = wdUser.getSAPUser();
try {
if (user!=null) {
IUserAccount[] userAccs = user.getUserAccounts();
if (userAccs!=null && userAccs.length > 0) {
IUserAccount userAcc = userAccs[0];
logonId = userAcc.getLogonUid();
}
}
}catch (UMException ex){
}
Btw anyway know what is the different between WDClientUser.getCurrentUser() and WDClientUser.getLoggedInClientUser()?