Skip to Content
Author's profile photo Ajalesh P Gopi

Accessing the aged data

Accessing the aged data

Business Data is accessed quite frequently in the beginning of its lifecycle, when the business processes are still active. After sometime the data may not be accessed at all during the normal business operations. However, there may be instances wherein these old data become relevant for access, during an audit or analytical reports. Data aging characterizes the mechanism through which the operationally relevant data (known as current data) is kept in the in-memory and data that is no longer accessed in normal operations (known as historical data) stored in the disk space. In data aging the data temperature is used to horizontally partition the application data for optimizing the resource consumption and performance.

When the data is aged the aged data resides in the cold/historical area of the HANA database and the remaining data resides in the hot/ current area of the database. In this article, we discuss the data access behavior of the aged and non-aged data.

When the data is accessed from ABAP, only HOT/ Current data is retrieved by default. This is done in order to optimize the memory footprint when the data is accessed. In most of the use cases, the default behavior will suffice. However there are certain exceptions where the historical data access is justified.

The decision whether to access cold data or not should be derived from business criteria rather than using an aging specific UI control in the screens.

Core Classes

The following classes provide the necessary methods to access the aged data.

  • CL_ABAP_SESSION_TEMPERATURE
  • CL_ABAP_STACK_TEMPERATURE

We will examine the class methods and usage with a business example below. Please remember that, the data aging strategy should be in accordance with the data access pattern.

CL_ABAP_SESSION_TEMPERATURE

This class enables the data temperature to be set for the entire internal ABAP session. The temperature is then inherited by further calls in the in the call stack.

If a call stack is created (e.g. by calling a class method in a report), the temperature is inherited by the called units.

The below given diagram explains this behavior.

Session_Temp.png

In the above diagram, the main program sets the temperature to be COLD with CL_ABAP_SESSION_TEMPERATURE. This temperature is inherited by all the modules (represented here as function modules).

CL_ABAP_STACK_TEMPERATURE

This class enables the ABAP session temperature (including the default Hot that is set implicitly) to be overwritten within procedures (FORM, FUNCTION or METHOD).

Stack_Temp.png

In the above diagram, the main program sets the temperature as COLD using CL_ABAP_SESSION_TEMPERATURE. However, in one of the calling modules (Func.Module3) the temperature is changed to HOT/Current using CL_ABAP_STACK_TEMPERATURE. This temperature (HOT) is valid only in the module in which it is set. i.e; in Func.Module3. Once the control is out of this module, the globally assigned temperature gets validity.

Both the classes mentioned above provide different methods which helps in accessing the aged data. Two of the prominent methods are

  • SET_COLD
  • SET_TEMPERATURE

Difference between SET_COLD and SET_TEMPERATURE

The diffference between the SET_COLD and SET_TEMPERATURE is described in the diagram below. As is visible in the diagram, the SET_COLD will load the whole data in the COLD/Historical area in to the memory. When SET_TEMPERATURE is used, only the partitions relevant are loaded in to the memory.

Comparison.png

Example

Let’s look at the sales order selection program as an example. The selection screen is as given below.

As mentioned before, the data selection need to be based on business logic rather than the hot/cold flag.

The “open” sales orders are mainly accessed/updated quite frequently and they should reside in the hot/current area and should not be aged. The following screen explains the data access behavior when the hot/current data is retrieved. The default data access is always HOT/Current.

Code1.png

Screenshot: For Open sales orders, there is no need to look in COLD/Historical Area


However when it comes to the closed orders, these could be in HOT/Current or could be in COLD/Historical area depending on the aging run frequency. When the data need to be accessed from COLD, the coldness could be set using the CL_ABAP_SESSION_TEMPERATURE as given below.

Code2.png

Alternatively, the CL_ABAP_STACK_TEMPERATURE could also be used as given below to do the data access from COLD/Historical area.

Code3.png

Follow us @SAPILM for more news and information on data aging.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo SUDEEPTI BANDI
      SUDEEPTI BANDI

      Hi Ajalesh,

      Thank you for this blog, it is very helpful.

      Is this blog applicable to only S4  HANA? Because Suite on HANA only has data aging  for technical objects and you are talking about business data here.

      Regards