Skip to Content
Author's profile photo Archana Shukla

Getting Started – Model simple decision table

By now, you must be familiar with the concepts of decision table – in general. For more refer blog: Decision Table in SAP HANA – Concept. Before I start the explaining various flavors of modeling Decision table in SAP HANA, there are few things that you need to know.

  • This and other blogs does not suffice in any way the official guides of SAP HANA. It acts as a pointer and initial learning tool on functions and operations related only to decision tables. As decision table is integrated to SAP HANA – it inherits SAP HANA Modeling lifecycle like other Analytical Models and  leverages the groundbreaking performance through highly optimized HANA Servers. I would recommend that you read SAP HANA Developer’s Guide to know more on complete lifecycle.
  • Decision table in SAP HANA can be used for two purpose (1) Update the database content based on rules-conditions (2)  Select database content based on rules-condition – for simulation or other analytics. Both the purpose have different and non-reversible modeling approach. You must therefore be aware of your purpose before start modeling the business rules in form of decision table.

To model a simple decision table without any database table, you use Parameters. Decision table modeled on Parameter falls in 2nd category of Select – where the result set can be used for simulation purpose and is not based on actual database content.

Parameters are relatively simple. This means that they are not only easy to understand, but also easy to implement and does not have to rely on complex database table structures. The benefit comes to affect when a trend has to be analyzed for a certain change in the value of business rule conditions or actions without original content. For Example –  A vendor wants to know how much affect a seasonal discount will cause in its overall sale. Here he can create Sales and Seasonal Discount as Parameters to observe the trend.

Let us start with the steps that would guide you to create and use decision tables with parameters. First step towards it is to create decision table and next is to create Parameters. What you see below is the snapshot of how to create the Parameters in the decision table – 



Figure – 2.1: A Parameter created from Decision Table Output view

Next, define condition and action columns based on these Parameters and fill the values as shown


Figure – 2.2: A Decision table modeled on Parameters to calculate DISCOUNT based on QUANTITY and AMOUNT of the Order placed by the Customer

Finally, Save, Validate and Activate the decision table. Once activated, the decision table is now ready to be consumed in applications.

/wp-content/uploads/2013/10/ifo_294777.pngDecision table is modeled in HANA Studio and only when activated can it be consumed in applications. This consumption is done by making a call to decision table procedure – generated after activation. You can find the procedure at
HANA System/Catalog/ _SYS_BIC/ Procedures/<package-name>/<decisiontable-name>

/wp-content/uploads/2013/10/ifo_294777.pngTo execute this decision table use the following syntax and watch the result set.

call “_SYS_BIC”.”<package-name>/<decision-table-name>”(IN… parameters, ? … OUT parameters)

/wp-content/uploads/2013/10/ifo_294777.pngWatch out the following in call statement–

  1. IN parameters – Parameter used as condition is regarded as IN Parameter. While execution, user has to enter comma separated values for these Parameters. Watch-out for 2 things here – (a) Order of IN parameters – The order of in-parameter is commanded by the order in which the parameter is added in output view (b) Compatible Data type – the value of in-parameter must match with the data type of the parameter.
    For Example: 4000 is the INTEGER value for QUANTITY Parameter that is first entry under the parameters folder node in Output view ; 300,000 is the INTEGER value for ORDER_AMOUNT parameter is second entry. The same order and data type is maintained when setting the value as IN in the call statement.
  2. OUT parameters – Parameter used as action is regarded as OUT Parameter. While execution, user has to enter as many number of comma separated ? (after the IN parameters). For Example: As there is only one Action in the decision table that is of Parameter type so enter single ‘?

You can see below the call statement to the execute the decision table used in this example:
call “_SYS_BIC”.”rulesonhana/SIMPLE” (4000,300000,?)

Also, see how the simulated DISCOUNT is fetched from decision table based on the input values:

               Figure 2.3 – SQL editor will the call statement and the results view

You must be wondering how does the evaluation of decision table was achieved. Here is the answer to it : The red mark in the figure below says the story:

  1. Engine checks for the condition row in the decision table which satisfies first input for QUANTITY = “4000” (which is satisfied by Decision table column QUANTITY with cell value “>2000”)
  2. Next, it checks for second input for ORDER_AMOUNT= “300000” (which is satisfied by decision table column ORDER_AMOUNT having cell value  “>100000”)
  3. Finally based on these evaluations, 3rd row in the Action column (DISCOUNT) is satisfied and is returned. 

                        Figure 2.4 – Execution flow

Let me summarize in general how to model decision table using Parameters

  1. Create a Decision Table in HANA Studio
  2. Create Parameters
  3. Set these parameters as Condition(s) and Action(s) columns of Decision table
  4. Set values to these Condition and Action columns
  5. Save, Validate and Activate

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

Through this way of modeling decision table, you can achieve data simulation, which happens based on the conditions and action set of the decision table.
Hint: You may also use data preview feature of SAP HANA to analyze the trend by providing relevant input data. Anybody who is interested can also see the youtube video (by Thomas Jung) that features the modeling of decision table on Parameters. There is also a Step-by-Step guide that would help you model and consume decision table for your need.

Other Related Blogs

Upcoming Blogs in Store

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member


      Author's profile photo Former Member
      Former Member

      Really good one... 🙂