Skip to Content
Author's profile photo Nicolai Benz

How to Define OData $top-Parameter for an aggregation binding

Setup: A UI5 Application using a OData Model

Target: Limit the data that is fetched for an aggregation binding by specifing the $top parameter

Why?: This solution works with any aggregation binding. Not only when using a control based on the sap.m.ListBase, which provides properties for specifing the number of records that should be returned.

Solution: In the definition of the aggregation binding specify the parameter “length”:


Length - Code Snippet.png

In this example a list of the first three business partners should be rendered. Therefor only the first 3 need to be loaded.

This will then result in the following OData Request:


I could not found this feature in the documentation so thats why I’m sharing this with you.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Thilo Seidel
      Thilo Seidel

      Interesting! thanks for sharing.

      I am not sure if this is save to use but still it works. Most things that are not documented are also not part of the contract. That`s why it should be handled with care.

      Some things I came across here:

      This will not work for aggregations that do support paging out of the box.

      sap.m.List (and all controls inherting from ListBase) have the parameter

      growingThreshold that in combination with growing is handling paging.

      Another thing is that this will overrule the sizeLimit defined for your model.

      if you do something like


      and then define the length to 4 in your binding you will end up having 4 entities in your 2 entities sized model.

      The save way to request only a certain number of entities would be to limit the size of the model:


      Unfortunatly you cannot use skip and top as parameters in xml directly as you can do with expand. Would be the most transparent way to do it.

      Author's profile photo Nicolai Benz
      Nicolai Benz
      Blog Post Author

      Thanks for your additional information! 🙂 I definitely aggree with you.

      But the problem of using the this.getModel().setSizeLimit(4) - Approach is that you can not specify the top paramater only for a certain binding.

      Would be great if this feature would come in future versions. Like you said similar to expand.

      Author's profile photo Simon Kemp
      Simon Kemp

      Hi Thilo Seidel where is it possible to find out which parameters you can use in XML directly?