Show TOC

Restrict the Attributes Returned by the ServiceLocate this document in the navigation structure

You can restrict the properties in each dataset returned by the service.

Context

This is especially recommended in cases where the service is meant to be reused in different scenarios, and hence contains more elements than are needed for each usage. Reducing the number of requested elements will directly reduce the load on the database.

To set the requested elements, perform the following steps:

Procedure

  1. Define the list of requested elements.
    Note Use the ABAP field names of the properties.
    DATA lt_requested_elements TYPE if_sadl_public_types=>tt_requested_elements.
    	lt_requested_elements = VALUE #( ( `PRODUCT_ID` ) ( `PRICE` ) ).
  2. Alternatively, you can also get the complete list of elements from the service and delete unnecessary elements from there.
    io_query_options -> get_requested_elements (
    		IMPORTING et_elements = lt_requested_elements ).
    DELETE lt_requested_elements WHERE table_line = `SUPPLIER_ID`.
  3. Set the requested elements.
    io_query_options->set_requested_elements( lt_requested_elements ).