You can limit the number of items returned in a Query, at runtime. Some query
BAPIs and
RFC function modules allow you to
restrict the number of returned items by means of a
Max Hits
importing parameter. You can set a parameter as
Max
Hits in data source view. The Service Builder automatically defines
input fields from the data source as
Max
Hits if the field name has one of the following options:
- MAXROWS
- MAX_ROWS
- MAX_HITS
- MAX_LINES
- MAX_CNT
You can set a data source parameter as
Max Hit
in the Data source view, by selecting the
Set/Unset
Max Hits, if it has not been set automatically. You can either set a
constant value to
Max Hits and by default
limit the returned items, or you can rely on the runtime handling of
Max Hits. Also, you can specify
Max Hits even if the remote function
module does not have explicit Max Hits parameter. You do so to enable paging at
runtime. In this case, the paging is done after getting the
RFC results. The
RFC returns all the results from the
application, and the Service Builder deletes all the unnecessary results. To map a
Max Hits to a constant value, proceed as
follows:
- Add a row to the Entity Set column of the Mapping table. And enter a constant
value, for example, '10'.
- Select the max_row parameter in the Data source view, and then click
Set/Unset Max Hits.
- Drag and drop the selected Max Hits parameter into the same row as the
specified constant value in the Mapping table.
In both cases, if the returned items are controlled from the client environment
(with the
$top option in OData), the runtime
component tries to pass the value to the BAPI or RFC only if there is an importing
parameter. You can use
$top and
$skip options to page through table
results, at runtime.
$top and
$skip can be facilitated by mapping
against
MAXROWS or similar parameters as listed above. If you
set a constant value and the
$top option is also
defined, the number in the
$top option takes precedence. There
is no default value.