Recently I played around Data Aging concept in S/4HANA system and today I would like to show you how to perform the initial configuration based on SFLIGHT data. This sample data model delivered by SAP allows us to understand the process of data aging without having to worry how to create sample business documents as data generation is simple and straightforward.
Having system running for months or years we need to properly maintain it. We need to ensure the system is available during business hours and performance is on required level. System is growing together with your company and at one moment you have to decide what to do with data that is no longer used. So far the best solution was data archiving, which allows us to store data on separate storage outside SAP system.
Data aging is new possibility to manage outdated information and helps to move sets of data within a database by specifying a data temperature. Hot data resides in current area of the database, when the warm / cold data is moved to historical area.
System preparation and SFLIGHT data generation
For data aging using SFLIGHT data SAP prepared separate set of tables:
DAAG_SPFLI – Flight schedule
DAAG_SFLIGHT – Flights
DAAG_SBOOK – Single Flight Booking
You can either generate the data using SAPBC_DATA_GENERATOR and copy content of the tables or copy the whole report and change the target tables directly in the source code (I used the second approach).
We can check the table contents directly in SE16n:
When our data is ready we can prepare system to support Data Aging. Firstly, we need to enable new profile parameter:
The second preparation step is to activate Business Function DAAG_DATA_AGING in SFW5.
First Data Aging transaction we are going to use is DAGPTM – Manage Partitions, where we can create and modify partitions for all partitioning objects available in the system. Partitioning object is a set of tables that will be partitioned together. In our case it consists of two tables: DAAG_SBOOK and DAAG_SFLIGHT:
Currently there is no partitions defined in our system for SFLIGHT. There are two ways of creating partitions. We can do it manually or use additional tool delivered by SAP – Partition Proposal.
To enter Partition Proposal, click on desired Partition Object and choose “Propose Partition Ranges” from menu (or click F9).
Depending on partitioning object setting value in Date Field may be already filled. In our case let’s choose FLDATE as the date field for DAAG_SFLIGHT and DAAG_SBOOK. After execution, we can see Proposed Partition Ranges and Data Volume in each year / month.
In Proposed Partition Ranges we can easily simulate creation of new partitions and the tool will update us with information about projected data volume.
After confirmation of the dialog box we can run partitioning.
Background job ran only for few second to create partitions.
You can see there is one partition created without Start and End date defined. This partition stores current (hot) data, others are for the historical area.
When we expand partitioning object and select table we can click on the ‘eye’ button to check how many data is in current and historical areas. As we didn’t execute aging, all data resides in current area.
Let’s have a look on what happened in HANA database. Choose DAAG_SFLIGHT table and display runtime information:
We can see our table is partitioned on database level according to our requirements defined in previous steps. At the moment there is no records in any other partition than the current one – which is good. We can also check if the partition is loaded to memory (last column).
Now we need also to decide what shall be the residence time for our documents. We can set thevalue in table DAAG_RT_SFLIGHT. It’s quite flexible – we can set different values based on Carrier and/or Flight Connection. For our testing scenario I want all objects older than one day to be moved to historical area.
Activating Data Aging object
To display all data aging objects, go to transaction DAGOBJ.
When we double click on the object name we can see details like participating tables or implementation class (which actually drives the data aging run by selecting objects to be moved to another partition).
To activate the object, on previous screen select DAAG_SFLIGHT and click Activate button from the menu.
During activation system is running various checks, like data object consistency or existence on partitions at database level.
Data aging run
Once our partitions are created and data aging object is activated we can execute the actual Data Aging. In order to do that enter transaction DAGRUN.
Now we need to define data aging group for our objects. In menu select Goto -> Edit data aging groups. On the screen create following entry:
Once saved go to Data Aging Objects and select DAAG_SFLIGHT model:
If you are not able to save your entries and there is error message displayed saying “DAAG_SFLIGHT is not an application data aging object” there is one correction needed. Please update table DAAG_OBJECTS by setting DAAG_OBJ_TYPE = “A” for data object DAAG_SFLIGHT.
Finally, we finished preparation steps and we can schedule Data Aging run.
After confirming the dialog box the job will start at chosen date / time.
And when it’s done we will find a green light in status column.
In statistics for Data Aging run we can see that 66 308 rows were processed:
Let’s see what happened to our data. Go to Manage Partition to display Hot and Cold Data for Partitions of Table DAAG_SBOOK.
We can also go to HANA Studio and check Runtime Information for table
Success! Our data is now aged!
Standard SAP records have this functionality already implemented, but what happens if we want to access the historical data in our custom reports? In SE16n we can see only current data:
Based on blog I was able to write a small report to count rows by setting data temperature.