Skip to Content

Decision Table on HANA Database Tables

Just simulation to observe the trend does not suffice all the productive use cases. You may still want to manage the tremendous amount of data contained in tuples in SAP HANA  – in real time, with significant turnaound time and basic knowledge on SQL Language. This blog introduces you to Decision Table modeling on single tuple or multiple tuples with joins.

In real world database, you would find data spanning across multiple tuples – more often we find the case that certain columns are predominantly used and remaining have low usage. In such cases, you use Data Foundation of Decision Table to model business rules on selected columns of database tables. Data Foundation handles the tuples efficiently by providing the options of joins and selection of a fixed set of prime columns on which the rules could be written and executed. Decision Table modeled on database tables have capabilities to update the content of the database.

Let us model business rules to calculate discount on an electronics gadget. To start with, first you have to create the decision table and construct Data Foundation.  What you see here is snapshot of Data Foundation. Few things to mark –

  • The tuples in HANA Studio could be seen in HANA Studio at: HANA System/Catalog/<your-schema>/Tables
  • Two tuples SALES.ORDER and SALES.PRODUCT are joined together where SALES as schema and ORDER and PRODUCT are tuples in that schema
  • Only selective columns from two tuples have been considered as Condition and Actions


          Figure 3.1 – Data Foundation view where in left pane ORDER and PRODUCT tuples JOINed together and

                              right pane has the vocabulary for the decision table, together with columns selected as Conditions and Actions                             

Next you fill the Condition and Action Values in the Decision table


          Figure 3.2 – Decision table with values

Finally – Save, Validate and Activate the decision table. Your decision table is now ready to be consumed ! Let us do a quick sneak-peek into the data content, of PRODUCT and ORDER tuples respectively, before the decision table is executed so that you are able to trace the difference. Note the DISCOUNT column – all the values are 0:


     Figure 3.3 – Content of PRODUCT (top) and ORDER (bottom) tuples

Now, execute the decision table by making a call to the generated procedure and note the DISCOUNT column again. You see that the DISCOUNT column values in the database has changed as per the decision table evaluation.


     Figure 3.4 – SQL Editor showing the call statement (top) executed to comsume decision table and the content of ORDER tuple (below) after consumption

You may be wondering – is it that simple ? And answer is Yes. The additional advantage lies in simplicity to design, no technical details and easy adaptation.

Let me summarize the steps again to model a decision table using database columns:

  1. Create Decision table in HANA Studio
  2. Drag and Drop database tables onto Data Foundation section
  3. Join the tables (if there are more than 1 table) using database join
  4. Add selective columns as Conditions and Actions of the decision table
  5. Set the values of Condition and Action
  6. Save, Validate and Activate

For more refer > HANA Developers Guide > Setting up the Analytical Model > Creating Decision Tables

Compared to use of Parameters, business rules modeled on decision tables – based on tuples – can update millions of records efficiently in quick real time and the impact can be directly accessed by the applications where decision have to made quick decisions – based on changing market.

In conclusion, it is important that you know your purpose for modeling business rules and consequently model the decision table based on Parameters and/or  Tuples. The two approaches enables use of Decision Tables for analysis and/or actual data revisions and offers opportunities for completely new applications. Get started with decision table modeling and comsumption – and share with us your feedback and let us know if you need support.

Other Related Blogs

Upcoming Blogs in Store

You must be Logged on to comment or reply to a post.
  • hi

    if I want create decision table on data base table in my schema which is coming by SLT say example on VBKD table, after save and validate will my VBKD original will get change? if not on which table changes will happen after execute the procedure?

    • The database table on which the decision table is modeled would change after you run the rules. In your case, the answer is – VBKD table that is replicated in HANA would be changed not the backend ERP VBKD table.

      • Thanks for your time Archana

        you mean table  wont change in ECC, it will change in HANA studio under the schema as per business logic right?

        in that case, if I want to use the original VBKD table in some other hana view do I need to replicate again from ECC to HANA (because the existing VBKD table has changed as we applied business logic  for decision table )

        Thanks in Advance

        • Hello,

          Yes you have to but I do not understand your usecase, if you do not wish to change the table then why do you apply the rules ? – and now after applying rule you would want to view the original version. Strange !

  • Hi , Archana!

    Thanks a lot for this document!

    I have 2 quesnons to you

    1. How can I transprot Decision Table form dev system to prod. ? (DT is not available form Delivery Unit . I need to transport just one DT ( in DU i can transport only all package)

    2.For example, I have two conditions ( flag1 and flag2) . I need to create action like –

    If flag1 = 1 then … ( I mean that flag2 can be any value)

    if lag1 =2 and flag2 = 3 then …


  • Hi All,

    There are curently 2 types of Decision Tables in HANA.

    The one described above (with repo extension .hdbdectab) and the new(er) one based on HANA Rule Framework (with the extension .hprrule). The DecTab from HRF provides more options, I believe, although a lot of the concepts remain the same of course.

    Noam Gilady can you comment?

    • Hi Wout,

      The Decision Table on HANA which is mentioned here – was consolidated into HANA Rules Framework. So the same UIs (described here by Archana) in the latest HANA versions, create HANA Rules Framework’s design time artifacts (hprrule, hprruleservice, hprvocabulary) and generate HANA run-time code (procedure) in the same manner like HRF’s Web app and/or HRF’s UI controls (embedded into UI5 app)…

      BR, Noam

  • Hi Archana Shukla! Nice Job explaining this subjects.

    I’m new to developing in HANA. I’ve had this same scenario in a demo program. I completed successfully the DT with data foundation. The problem I’m facing, and I haven’t been able to solve, is how should be the sentence to call this DT in a, for instance, calculation view (or another stored procedure)?



    • Hello Jose,
      As the runtime artefact for decision is a stored procedure, so you need to call the stored procedure generated after activating the decision table, in your calculation view.  Also, decision table on HANA is no more supported, instead use SAP HANA Rules Framework for future developments in rules on HANA. Here is the link and tutorials HANA Rules Framework

    • Hello  Vijaya,
      Please use SAP Cloud Platform Business Rules for future rules implementation. Read my blogs. Through SCP Business Rules you can directly import CDS views from S/4HANA and build your rules.