Skip to main content

Celonis Product Documentation

Using hints in SAP S/4 HANA to query data snapshots

SAP HANA allows you to pass hints to SELECT queries to instruct where the query is routed. This is a recommended best practice for customers running S/4 HANA since it allows them to balance the system in terms of query response time, query load, resource utilization and freshness of data.

For example, if your SAP HANA architecture is “high availability” and is “Active/Active read enabled”, you may choose to use this feature to route all of Celonis’s SAP extraction queries to the secondary HANA instance, to reduce the load on the primary one.

  • Make sure you're using RFC Module v3.5.0 or later.

  • Install the Celonis_RFC_S4_Extensions package, which contains the necessary extension to use this new functionality.

    You can download all necessary files directly from EMS. In your EMS instance, go to Admin and Settings > Download Portal. You must be an Admin or an Analyst with the MANAGE DOWNLOAD PORTAL permission to access these files.


To pass the hint RESULT_LAG() should be used. It takes two parameter values to determine:

  • Which data source to use (snapshot or live data).

  • What is the acceptable lag behind the live data.

Here's the syntax for the RESULT_LAG() hint:

WITH HINT (RESULT_LAG(“<short_class_name>”, [seconds])).

The hint is appended to the SELECT statement.



In this example, if the cache is fresher than 30 seconds then data will be read from there. If it is stale, then the freshness of the data replication on the secondary system is evaluated, and is either queried from there if fresh enough or from the primary system if not. For more details on the available classes and their parameters check the official SAP documentation.

To pass the hint to the extraction queries you should:

  1. Modify the application-local.yml configuration file  on the Extractor server as described below.

        enabled: true
          # Any other customisations you may have  
          hdbRouting: true 
          hdbClass: hana_long # can be a custom class or another built in one 
          like hana_sr   
          # hdbMaxLag: optional, retention time value in seconds
  2. Restart the Extractor for the change to take effect.