Improving Performance by Providing a Business Key

Analytical services require aggregation and grouping to be performed on the database. If the business key (semantic key) of the business entity mapped to the service is part of the properties selected by the client, the groups will contain exactly one record, thus rendering the grouping useless. The runtime of your service is improved by suppressing aggregation and grouping in this case.

Context

If the business entity does not have a key, or no key elements are mapped to the service properties, you should override the business key in order to retain the performance gain.

Procedure

  1. In the DPC_EXT class of your service, overwrite the if_sadl_gw_query_control~set_query_options method.
    PUBLIC SECTION.
      METHODS if_sadl_gw_query_control~set_query_options REDEFINITION.
  2. In the method implementation, set the elements of the business key.
    io_query_options->set_business_key_for_analytics( VALUE #( ( 'ProductID' ) ) ).
  3. Save and activate the classes.

Results

The runtime of your Gateway Service is now optimized by avoiding unnecessary database operations.