Time dependent Master data via History tables in SAP HANA

1.1k Views Asked by At

I was looking for the best way to capture historical data in HANA for master data tables without the VALID_TO and VALID_FROM fields.

From my understanding, we have 2 options here.

  1. Create a custom history table and run a stored procedure that populates this history table from the original table. Here we compromise with the real-time reporting capability on top of this table.

  2. Enable the History table flag in SLT for this table so that SLT creates this as a history table which solves this problem.

Option 2 looks like a clear winner to me but I would like your thoughts on this as well.

Let me know.

Thanks,

Shyam

1

There are 1 best solutions below

0
On

You asked for thoughts... I would not use history tables for modeling time dependent master data. That's not the way history tables work. Think of them as system versioned temporal tables using commit IDs for the validity range. There are several posts on this topic in the SAP community.

Most applications I know need application time validity ranges instead (or sometimes both). Therefore I would rather model the time dependency explicitly using valid from / valid to. This gives you the opportunity e.g. to model temporal joins in CalcViews or query the data using "standard" SQL. The different ETL tools like EIM SDI or BODS have also options for populating such time dependent tables using special transformations like "table comparison" or "history preserving". Just search the web for "slowly changing dimensions" for the concepts.

In the future maybe temporal tables as defined in SQL 2011 could be an option as well, but I do not know when those will be available in HANA.