OData Gateway Part 7: GET_ENTITYSET with Filters, Paging and Sorting
Preview · a free account unlocks the full lesson
Implement production-grade list reads: translate $filter into SELECT-OPTIONS-like ranges, apply $top/$skip paging in the database, map $orderby to a dynamic ORDER BY, return $inlinecount/$count, handle $search, and avoid reading everything and filtering in ABAP.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 6 covered reading a single record; now comes the list read that every Fiori list report depends on. Query options arrive as method parameters: it_filter_select_options carries $filter, is_paging carries $top/$skip, it_order carries $orderby, iv_search_string carries $search, and io_tech_request_context carries things like inlinecount and $select.
For $filter, simple conditions (eq, ne, gt, ge, lt, le, between, startswith for strings) arrive in it_filter_select_options as a property plus select_options (sign, option, low, high) — note the property names here are the external OData names, so io_tech_request_context->get_filter( )->get_filter_select_options( ) is what gives you the ABAP field names instead.
More complex filters, such as those spanning several properties or using functions, may only arrive as iv_filter_string, which needs to be parsed carefully or rejected if it's too complex to handle safely.
These filters have to actually reach the database — build a range such as DATA lt_r_kunnr TYPE RANGE OF kunnr, fill it from the select_options with an ALPHA conversion on low/high, and use it directly in a SELECT ... WHERE kunnr IN lt_r_kunnr AND erdat IN lt_r_erdat; an empty range simply means no restriction, just as with classic SELECT-OPTIONS.
Reading all rows and filtering in ABAP instead of in the database kills performance and should be avoided.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.