SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Create Decision Table and Text Rules

Create and activate the decision tables and text-based rules to create the decision logic.

Overview

🎓 beginner 15 min. Business RulesBeginnerCloudSAP Business Technology PlatformSAP BTP Cloud Foundry Environment

You will learn

  • โœ”How to create decision table rules
  • โœ”How to create text rules A decision table rule is the collection of rule expressions in tabular format. The rule expressions are sequentially executed, and the matching rows are returned. A text rule is a decision logic in a simple if-then-else format. A text rule evaluates a single rule expression and returns the result that matches the condition. In this tutorial, we will create the decision logic required to assign equipment for the new hire, both as a text rule as well as a decision table.
Vandana Vasudevan V Vandana Vasudevan December 10, 2024
Created by December 10, 2024
Contributors

Prerequisites

Steps

Step 1 Create decision table rules
โ€”

  1. Navigate to the Rules > Local Rules tab, then choose +.

    Rules tab
    Rules tab

  2. In the New Rule prompt, provide the following details:

    NameType
    DetermineEquipmentRulesDecision Table

    Then choose Create.

    New Rule Window
    New Rule Window

  3. In the New Rule page, provide the following details and then choose Settings icon.

    LabelDescription
    DetermineEquipmentRulesRule to determine equipment for the new hire based on the country and job title of the new hire.

    New Rule Page
    New Rule Page

    The decision table settings window opens.

  4. In the decision table settings window, select the Hit Policy as First Match. With Hit Policy as First Match, the decision table returns the first row that matches the condition.

    Hit Policy
    Hit Policy

    In this tutorial, we are using the First Match hit policy. If you select All Match hit policy, all the rows of the decision table that matches the condition are returned. In this case, the result data object EquipmentInfo should be of type Table to hold all the row values.

  5. Press CTRL + SPACE to load the autosuggestion list, and then choose Employee under Vocabulary section.

    Autosuggestion list
    Autosuggestion list

  6. Choose the attribute Country or Region of Company from the Vocabulary section and then in the Label field enter Country or Region.

    Attribute in autosuggestion list
    Attribute in autosuggestion list

  7. From the Fixed Operator dropdown list, select None.

    Fixed operator
    Fixed operator

  8. Similarly, create the following condition expressions:

    Condition ExpressionsLabelFixed Operator
    Employee.companyCompanyNone
    Employee.jobTitleJob TitleNone
    Employee.isFullTimeEmployeeFull time/Part timeNone

    The label is displayed in the decision table column header.

    Choose EquipmentInfo as the Result data object from the dropdown list and then choose Apply.

    DT settings
    DT settings

    A decision table gets created with the condition columns and result columns.

  9. In the Country or Region column, press CTRL + SPACE. Under Comparison Operators, select is equal.

    Comparison Operators
    Comparison Operators

  10. Under Fixed Value section, select the value help icon to select the value.

    Value help
    Value help

    Select USA from the value help.

    Value help1
    Value help1

  11. In the Company column provide the following value using the autosuggestion list:

    ='ACE_USA'

    Company details
    Company details

  12. In the subsequent cells, provide the following values:

    Job TitleFull Time/Part TimeProduct IDEquipment TypePriceProduct DescriptionCurrency
    MATCHES '.*'= true OR Employee.IsFullTimeEmployee = false'A106743''Audio and Video'35.96'Lovely Sound 5.1'EUR

    Company details
    Company details

  13. Select the first row, then choose Add Row > Insert After.

    Company details
    Company details

  14. Enter the following values in the condition and result columns of the new row:

    Country or RegionCompanyJob TitleFull Time/Part TimeProduct IDEquipment TypePriceProduct DescriptionCurrency
    = 'USA'MATCHES '.*'MATCHES '.*'= true OR Employee.IsFullTimeEmployee = false'C106875''Notebook'956.00'Notebook Basic 15''EUR'

    Then, choose Activate.

    Company details
    Company details

Step 2 Create text rules
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 2
1. Create decision table rules 2. Create text rules

Learn more →