cancel
Showing results for 
Search instead for 
Did you mean: 

using in UME

Former Member
0 Kudos

i try to count the amount of users that

the company = "SAPerClub"

and i don't get result (the result is 0)

i have the script

if somone can help me and tell me what's the problem

try {

IUserFactory userFact = UMFactory.getUserFactory();

IUserSearchFilter userFilt = userFact.getUserSearchFilter();

userFilt.setCompany("SAPerClub", ISearchAttribute.LIKE_OPERATOR,false);

ISearchResult result = userFact.searchUsers(userFilt);

if (result.getState() == ISearchResult.SEARCH_RESULT_OK) {

while (result.hasNext()) {

String uniqId = (String) result.next();

IUser thisUser = userFact.getUser(uniqId);

String company = thisUser.getCompany();

}

}

else {

// print error or warning

}

wdContext.currentContextElement().setCountusers(result.size());

} catch (UMException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

10x

yossi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

There are different codes of search process [Search Result States|http://help.sap.com/javadocs/NW04S/current/se/com/sap/security/api/ISearchResult.html]. What is the state after execution this piece of code?

Former Member
0 Kudos

Hi Yossi

What does the the line result.getState() return in the case where your result is 0?

Br

Göran