Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert
In continuation to my previous blog, in this blog I will explain how to further venture into decision orchestration capabilities to create, manage and work with formula rules that can be reused during business rules modelling.

Some initial key information first:

  • Vocabulary Rule is the term used for reusable rule or formula rule.

  • Rule can be used in expression modelling and as normal rule.

  • Rule used in expression modelling are called vocabulary rules and will be executed during expression evaluation.

  • Rule that is used for expression modelling can also be used as normal rule by adding them to ruleset. Such rules would be executed as part of ruleset evaluation.

  • Cyclic dependency will be determined during deploy time and fails the deployment if you have modelled rules in cyclic fashion. For Example: You have used Rule1 as expression in same Rule1 or you have used Rule1 as expression in Rule2 and used Rule2 as expression in Rule1

Vocabulary rule is not a new modelling concept. It comes with the sole intension to ease the modelling experience for reusable use cases like for defining complex formulas that can be reused over and again while modelling expressions, for SaaS scenarios where predefined standard rules can be shipped as part of the base project which can be reused for further rule modelling etc.

» Important Note: This feature is supported only for cloud-based rules (which means rules deployed to SAP Cloud Platform) and ABAP-based rules (which mean rules deployed to S/4HANA)

Let us now see (a) how to model vocabulary rules and use them in expression modelling, and (b) how to invoke such rules and see the change in the output.

Modelling vocabulary rule

  • There is no special way as how you model vocabulary rules

  • Vocabulary rule as modelled as any general rule

  • All you need is include the rule in Vocabulary of the Ruleset

    • As soon as you add the rule to vocabulary, it becomes available as suggestions while expression modelling

    • You can include both text and decision table rule as vocabulary rule.




  • Vocabulary rule can be used as formula and can also be included in the ruleset as main rule (see the screenshot below).

  • You though have to be careful while using it in both categories because it may lead to cyclic dependency. Cyclic dependencies will be identified during deployment.

    • Recommendation is to use rule either for formula rule or for normal rule.

  • In both the cases, there is something to keep in mind from execution stand-point:

    • Be it vocabulary rule or main rule, they will be executed during the course of rule service invocation – and each invocation would need an input data object. It is the responsibility of business rules developer to ensure that input data object is either provided via rule-service vocabulary or ruleset vocabulary.

      • In case where you have included rule ONLY as vocabulary rule (which means you have added it as vocabulary of the ruleset and not as main rules) then you need to ensure that data objects (both conditions and results) on which vocabulary rule is modelled must be declared via Included Data Objects in Vocabulary of Ruleset.

  • In case where you have included the vocabulary rule also under Rules section of the ruleset, then you need to ensure that data objects (both conditions and results) on which vocabulary rule is modelled must be declared in Vocabulary of Ruleservice.

Bottomline is - you need to ensure that input and output data objects of all the rules in the ruleset (whether under Vocabulary or Rules section) must be declared either via rule-service or ruleset vocabulary

Invoking Vocabulary Rule

  • As said, vocabulary rule is no special rule. It can be executed as part of the normal rule service invocation API both in Neo and CF environment. The only difference is when you add the vocabulary rule as intermediate rule (by adding it only to vocabulary of the ruleset) then the rule execution will happen internally (during expression evaluation) and result would be consumed without giving you any output explicitly.

This completes the overview on decision orchestration capabilities in SAP Cloud Platform Business Rules. It strengthens the overall experience of using the tool and covers many more use cases especially with interleaving decision points.