cancel
Showing results for 
Search instead for 
Did you mean: 

UWL API restricts the number of results

Former Member
0 Kudos

Hi gurus,

I'm trying to use UWL API to get all tasks relative to the logged user. I follow this blog:

[http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/16356] [original link is broken];

Here is a detail of my source code:


  IUWLService uwlService =
  (IUWLService) WDPortalUtils.getServiceReference(
  IUWLService.ALIAS_KEY);
  UWLContext myContext = new UWLContext();
  IWDClientUser user;
  user = WDClientUser.getLoggedInClientUser();
  IUser loggedInUser = user.getSAPUser();
  myContext.setUser(loggedInUser);
  IUWLSession mySession =
  uwlService.getUwlSessionForWebDynproClient(myContext);
  IUWLItemManager itemMan = uwlService.getItemManager(myContext);
  QueryResult result = itemMan.getItemsForItemType(myContext,ItemType.UWL_ITEM,null,null);
  
  ItemCollection coll = result.getItems();
  List l = coll.list();
  Iterator iter = l.iterator();
  while (iter.hasNext()) {
	  Item item = (Item) iter.next();
	  // External Type is used to filter the notifications according to application
	  	wdComponentAPI.getMessageManager().reportSuccess("ExternalId: "+item.getExternalId().split("@")[0]);
  }

The problem is that the number of tasks returned is always the same and it never goes over the 100 results. It seems that there is a filter that stops the results after the 100 tasks...

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

you can specify several query properties when calling the API.

For example:

QueryProperties myProps = new QueryProperties();

myProps.setMaxNumberOfItemsToFetch(100);

QueryResult result = itemManager.refreshCacheAndGetItems(myContext, myView, myProps, null);

BR,

Timo

Former Member
0 Kudos

Thanks Timo, it works correctly.