Show TOC

 Operators, Commands, and Functions

The assignments that can be found in the THEN part of a rule always have one of the following forms:

<Fact to be modified>










This operator produces a simple assignment.

X := ["1", "2"] results in ["1", "2"]


This operator interprets the fact on the left as a set and adds the fact on the right to this set if an identical element does not already exist. The check for identical elements is not case sensitive. This means, for example, that the texts "AA", "Aa", "aA", and "aa" are considered the same.

X += "3" results in ["1" , "2", "3"]


This operator interprets the fact on the left as a set and removes the fact on the right from this set. The check for identical elements is not case sensitive. This means, for example, that the texts "AA", "Aa", "aA", and "aa" are considered the same.

X -= "1" results in ["2" , "3"]

You can use the following operators in expressions in the IF and THEN part of a rule:





You can use the Boolean logic operators AND, OR, and NOT in expressions as usual. If parts of an expression are linked by multiple Boolean operators, AND has priority over OR, that is, A<4 OR B<2 AND C<2 is equivalent to A<4 OR (B<2 AND C<4).

A < 5 AND B > 6 is TRUE if A is less than 5 and B is greater than 6.

A < 5 OR B > 6 is TRUE if A is less than 5 or B is greater than 6.

NOT (A = 5) is TRUE if A is not equal to 5.

( )

You can place expressions within brackets as required in order to determine the sequence of the analysis.

(1 + 2) * 3 results in 9

[ ]

Sets are entered in square brackets. The individual elements are separated by commas. The elements can be any expressions you require.

X := [1+2,3+4,5] results in [3, 7, 5]

+, -, *, /

The four basic math operations can be used in the usual way.

If applied to ranges, the upper and lower limits are taken into account.

{1 to 5} + 3 results in {4 to 8}


This operator is used to calculate the exponent.

4^3 results in 64

<, >, <=, >=, = ,<>

You can use simple relational operators to compare the sizes of numbers.

The operators = and <> are also used to check that text values correspond. This check is not case sensitive.

If applied to ranges, statements must apply to both limits to be true.

1 < 3 is TRUE

3 <= 3 is TRUE

3 <> 3 is FALSE

"ABC" = "abc" is TRUE

{1 to 5} < 8 is TRUE

{1 to 5} < 3 is FALSE

[<], [>], [<=], [>=]

These operators are used to compare sets. They can be understood as a means of checking for supersets or subsets.

["1" , "2" , "3"] [>] ["1" , "2" , "3"] is FALSE

["1" , "2" , "3"] [>=] ["1" , "2" , "3"] is TRUE

["1" , "2" , "3"] [>] ["4"] is FALSE


This operator forms the difference between two sets.

["1" , "2" , "3"] [\] ["2"] results in ["1" , "3"]

["1" , "2" , "3"] [\] ["2" , "4"] results in ["1" , "3"]

["1" , "2" , "3"] [\] ["4" , "5"] results in ["1" , "2", "3"]


This operator forms the union.

["1" , "2"] [&] ["3"] results in ["1" , "2", "3"]

["1" , "2" ] [&] ["2" , "3"] results in ["1" , "2" , "3"]


This operator forms the intersection. The sequence of the elements in the first operand is retained.

["1" , "2" , "3"] [^] ["2" , "3"] results in ["2" , "3"]

["1" , "2" , "3"] [^] ["3" , "4"] results in ["3"]

| |

You can use this operator to determine the cardinality (or the number of elements) of a set.

| [ "1" , "2" , "3"] | results in 3

| [ ] | results in 0


This operator compares whether a range lies within another range.

{1 to 5} IN {1 to 8} is TRUE

{1 to 5} IN {3 to 8} is FALSE


If a rule is to perform an error check for the input data and, if errors are found, is to issue an appropriate message to the SAP system and, if necessary, terminate the application of further rules, you can use the following commands to handle the errors:



ERROR("message number","<message text>"[,parameter,...])

This command sends a message text to the calling SAP system. An EH&S message number is defined in the message number that can have up to 24 characters. The first letter in the message number is either an I, E, or W (Information, Error, or Warning), followed by up to 20 characters for the message class. The last three digits specify the message number. The message text specified is output if no text was specified in the SAP system. Afterwards, if required, you can specify a maximum of three parameters that are inserted into the message text in place of the & placeholders.


This command terminates further processing of the set of rules.


Like the ABORT command, this command terminates further processing of the set of rules, but the data generated up to this point is treated as having being successfully generated and, if necessary, is written to the specification database.


This command calls a subset of rules .

In addition, you can use several commands to influence the strategy for rule execution (see Control of the Rule Execution Process ).

You use theCOMMITcommand to create a new instance for the record and to make it available for normal rule access (see Record ).






This function always returns TRUE.


This function always returns FALSE.


This function tests whether the expression has the value NULL, that is, no value.

ISNULL(<fact>) is TRUE if the fact has no value.


This function returns an empty value. This allows you to explicitly assign the value NULL to a fact.

<fact> := NULL() assigns the value NULL to the fact, that is, the fact has no value.

The following functions always return a value and can therefore be used everywhere in expressions. The type of returned value (text, numerical value, or value set) depends on the respective function.





This function determines the length of the text.

LENGTH("SAP") results in 3

CONCAT("<text1>", "<text2>", ...)

This function concatenates all specified text values and returns the complete text.

If a parameter is a set, the elements of the set are also concatenated as individual text values.

CONCAT("Wall", "dorf") results in "Walldorf"

CONCAT(["Heidel", "berg"]) results in "Heidelberg"

INSTR(<start position>, "<source text>", "<search text>")

This function looks for the search text in the source text. It begins at the specified start position (start of text = 1) and returns the position in relation to the start position. If the search text is not found, the function returns the value 0.

INSTR(1, "ABCDEF", "EF") results in 5

INSTR(3, "ABCDEF", "EF") results in 3

SUBSTR("<source text>", <start position> [, <length>])

This function returns a section from the source text, beginning at the start position (start of text = 1). The section of text has the length specified (any length up to the end of the text). If you do not specify a length, the function returns the rest of the source text from the start position onwards.

SUBSTR("Walldorf", 1, 4) results in "Wall"

SUBSTR("Walldorf", 5) results in "dorf"

STRFIELD("<source text>", "<separator>", <index>)

This function returns a part from the source text that is split by the separator specified. The system outputs the part of the text with the specified index (first part of text = 1).

STRFIELD("AAA,BBB,CCC", ",", 1) results in "AAA"

STRFIELD("AAA,BBB,CCC", ",", 3) results in "CCC"

STRFIELDCOUNT("<source text>", "<separator>")

This function returns the number of parts of text that are split by separators in the source text.

STRFIELDCOUNT("AAA,BBB,CCC", ",") results in 3

STRTOLIST( "<source text>“, "<separator>“)

This function returns a value set of parts of text that are split by the specified separator in the source text.

STRTOLIST( "A,B,C", "/") results in [ "A"/ "B"/ "C"]

LISTTOSTR( "<value set>“, "<separator>“)

This function returns a text in which the individual elements of the value set were concatenated, but the separator is still placed between the elements.

LISTTOSTRING([ "A", "B", "C"], ",") results in "A,B,C"

MINLIST([<value set>])

This function returns the numerical minimum in the set of values specified.

MINLIST([4,3,6,1,2,7,8,3]) results in 1

MAXLIST([<value set>])

This function returns the numerical maximum in the set of values specified.

MAXLIST([4,3,6,1,2,7,8,3]) results in 8

DECODE("<key>" or ["<key set>"], ["<set of text tuples>"], "<separator>")

This function searches for and decodes one or more keys in a set of text tuples that are made up of keys and text. Keys and text are split by the separator. The function decodes the key by returning the text.

DECODE(["y","b"], ["y;yellow","b;blue","o;orange","r;red"], ";") results in ["yellow","blue"]

DECODE("y", ["y;yellow","b;blue","o;orange","r;red"], ";") results in "yellow"

NORMLIST([<source value set>], [<prioritized value set 1>], ...)

This function normalizes value sets by deleting values in the source value set that are exceeded by elements with higher values in the prioritized value sets. The sequence in the prioritized value sets determines the prioritization of the values.

NORMLIST([1,2,3,4,5,6,7,8], [1,2,3], [4 ,7,8], [5, 6]) results in [1,4,5]

In this example, 1 is to have a higher priority than 2 and 3, 4 higher than 7 and 8, and 5 higher than 6. This means that after normalization, elements 1, 4, and 5 remain from the source value set.


This function returns the square root of the value specified.

SQRT(16) results in 4


This function returns the sine of the value specified.


This function returns the cosine of the value specified.


This function returns the natural logarithm (to the base e) of the value specified.


This function returns the value of the exponential function of e with the value specified as exponent.

EXP(1) = e


This function returns the lower limit of a range.

LO {1 to 5} results in 1


This function returns the upper limit of a range.

UP {1 to 5} results in 5


This function returns the operator of the lower limit of a range.

OPLO {1 to 5} results in >=

OPLO {>1 to 5} results in >


This function returns the operator of the upper limit of a range.

OPUP {1 to 5} results in <=

ANY(<listed fact>)

This function returns a single value and uses it to trigger the application of rules for each individual element in the set of listed facts. The use of this function in a rule therefore corresponds to a FOR EACH loop around the rule.

See the following section.


RPHRASES := ["R10","R20","R21"]




THEN ...


The action in the THEN part is executed because "R20" is included in the RPHRASES listed fact.

You can also use the ANY function to generate a (temporary) record from a set:


LISTVALUES := ["A","B","C"]











Three instances of the record TMP are generated, with TMP.1.VALUE = "A", TMP.2.VALUE = "B", and TMP.3.VALUE = "C”.

Points to Note When Using Ranges


Is equivalent to the mirroring of the range about zero. To do this, both the signs and the positions of the lower and upper limits are reversed.

- {1 to 3} results in {-3 to -1}

- {-1 to 2} results in {-2 to 1}


The union of two ranges, for example, A = {1 to 3} and B = {5 to 8} to form a range {1 to 8} can be achieved using the functions MINLIST and MAXLIST, and LO and UP.

{MINLIST ([LO(A), LO(B)]) to MAXLIST ([UP(A), UP(B)])}