Background
[wp_ad_camp_1]
A problem ticket was created for a production issue wherein the SAP NetWeaver Portal application’s Unlock Users functionality is taking too long to even just list the all locked accounts from a specific country. During the investigation, I found out that the application first retrieves the list of user IDs from an Oracle database, and uses each user ID to determine whether or not an associated account in SAP NetWeaver Portal is locked or not.
There is a better way to do this. The available API allows for user account search using other user properties like country name, User Account Locked, Logon ID, and etc.
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)
Create a Web Dynpro

Modify the View
[wp_ad_camp_2]
Place a TextView and DropDownByIndex UI components.
Then, modify the view’s context.
The Codes
Place the following codes in the wdDoModifyView() method and within //@begin wdModifyView and //@end lines
[wp_ad_camp_3]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | try { IUserAccountSearchFilter filter = UMFactory.getUserAccountFactory().getUserAccountSearchFilter(); // We'll search for locked accounts filter.setLocked(true); IUserFactory usrFactory = UMFactory.getUserFactory(); IUserSearchFilter usrFilter = usrFactory.getUserSearchFilter(); // We'll search for accounts from Australia usrFilter.setCountry("Australia", 0, false); // Execute the search ISearchResult result = usrFactory.searchUsers(usrFilter, filter ); int i = 0; // For counter while(result.hasNext()) { IPrivateTestView.IVn_userIdsElement e = wdContext.createVn_userIdsElement(); String userId = (String) result.next(); IUser currentUser = usrFactory.getUser(userId); e.setUserId(currentUser.getUniqueName()); // Add to a Value node in the context wdContext.nodeVn_userIds().addElement(e); i++; } // Set the value for TextView UI component wdContext.currentContextElement().setVn_idCount(i); } catch(Exception e) { e.printStackTrace(); } |
A Locked User Account For Testing
Sample Output
[wp_ad_camp_5]


[wp_ad_camp_4]