Background
[wp_ad_camp_1]
The current user may be set on some context variables but it may be out-of-sync, e.g. user id of previously logged in other user, or inadventently updated by other components. The safer approach is to retrieve it straight from WDClientUser.
Software Environment
- Windows 7 Professional SP1
- Java 2 SDK 1.4.2 for Windows 32-bit
- SAP NetWeaver Developer Studio Version 7.0.09 for Java
- SAP NetWeaver Application Server
- sap.com/SAP-JEECOR – 7.00 SP26 (1000.7.00.26.1.20120307143343)
- sap.com/SAP-JEE – 7.00 SP26 (1000.7.00.26.0.20120109175405)
The Codes
1 2 3 4 5 6 7 8 9 10 | String result = null; IWDMessageManager manager = wdComponentAPI.getMessageManager(); try { IUser currentUser = WDClientUser.getCurrentUser().getSAPUser(); String userId = currentUser.getUniqueName(); result = userId; } catch (WDUMException ue) { manager.reportException(ue.getMessage(), false); } //return result; |
[wp_ad_camp_5]