Introduction:
Paging is used for restricting data(instead of feeding ALL) from the backend to the frontend which helps to improve the performance by reducing the records in the response.
Let’s take an example, suppose there is a UI5/Fiori application in which you need to display the list of sales orders. In that case, we need to fetch the list of sales orders from the database and send it as a response in that case the data volume will be huge and it degrades the performance of the application. Hence the concept of Paging.
There are two keywords used in paging – one is $top and the other is $skip. top always holds the fix value i.e the list of rows to be displayed on the page. Skip contains the incremental value like for the first page it will be 0 (means it will start from the beginning ) for the next page it will 0 + top like so on.
top and skip are used for get_entityset method. Before implementing the logic there is a concept called offset and up to rows in Select query in ABAP.(you can check more details on the link ). So offset is used for skip and up to rows is used for top.
Note: In order to use offset, there must be order by clause in the select query
IS_PAGING will be filed when $top and $skip passed from the URI
URI: /sap/opu/odata/SAP/ZXYZ_SAMPLE_ODATA_SRV/OrderrHeaderSet?$top=5&$skip=0
it will give top five sales orders without skipping any records i.e from Vbeln 1 to 5
URI: /sap/opu/odata/SAP/ZXYZ_SAMPLE_ODATA_SRV/OrderrHeaderSet?$top=5&$skip=5
It will give the next 5 records by skipping the first five records i.e from 6 to 10
Output To give an overview of how these $top and $skip in UI5/Fiori Application
The event can also be set during page scrolling/button press
No comments:
Post a Comment