Old Syntax Rules for Boolean Statements 

When you create rules in Release 4.0A by entering the Boolean statement directly (that is, not using the Formula Builder), you must use the old syntax rules that were used in releases prior to Release 4.0A.

When you enter statements in validations and substitutions either directly or using the expert mode in the Formula Builder, you use the new syntax rules for Release 4.0A. For more information, see Syntax Rules for Boolean Statements .

You must use the following syntax rules when entering a statement directly in a rule:

  1. Define the table name first in your statement.
  2. A statement must always refer to a table name. This table contains the dimensions that you will use in your statement.

    Enter arrow brackets around the table name.

    <GLT0>

    <GLT1>

    <COBL>

    Within one statement, the table name is valid until you enter a new table. You can refer to more than one table in a statement.

    When you enter a rule in a statement, you do not have to enter a table name for the rule; the table name that the rule uses should have been entered when the rule was defined. For more information about rules, see Introduction to Rules .

    For basic and single-dimension sets, you do not need to enter a table name for the set within the statement.

  3. Separate the elements of your statement with at least one space.
  4. Enter a $ sign and the field name that you will use in the statement.
  5. The field name is the dimension that contains the values that you refer to in your statement.

    <GLT1> $RACCT

    <COBL> $BLART

    The system checks if a value(s) is/are in the dimension entered in front of the value. If the value is in the dimension, the statement is TRUE; if the value is not in the dimension, the statement is FALSE.

    You can also instruct the system to check only part of a field value. To enter this type of instruction, you enter a $ sign, the field name, a colon ( :), the digits that you want to be checked in the field name, and then a colon (:). 1 always represents the first digit of the field. (The number you enter does not represent a value; it represents the position of a value within the field string.)

    · <GLT1> $RACCT:1-3:

    The system checks only the first three digits of the field Account to determine if a condition is true.

    · <GLT1> $RACCT:5-7:

    The system checks digits 5, 6, and 7 of the field Account to determine if a condition is true.

    · <GLT1> $RACCT:2-:

    The system checks from digit 2 to the end of the field Account to determine if a condition is true.

  6. Enter single quotation marks ( ' ) around specific values.
  7. If you use a set in a statement, you do not enter single quotation marks around the set name.

    <GLT1> $RACCT = '500000'
    <COBL> $BLART = 'SA'

  8. Enter set names as follows:
  9. a) The keyword IN

    b) The set name

    The system still allows you to enter the table that the set uses before the set name (IN <table_name> set_name).

    The following example uses the basic set ACCOUNTS created for table GLT1.

    IN ACCOUNTS

    IN <GLT1> ACCOUNTS (with optional table name)

  10. Use parentheses to summarize independent parts of your statement.
  11. <COBL> ($HKONT = '500000' AND $HKONT = '600000') OR $KOSTL = '100'

  12. Enter double quotation marks ( " ) around comments in the statement.
  13. Text in double quotation marks is not processed by the system; it is only used to describe the statement.

  14. Use the Boolean Logic operators NOT, AND, OR, NAND, NOR, -->, and <->.
  15. The operator NOT has the highest priority and is processed first in the statement, except when parentheses are used within the statement.

    NOT (A OR B)

    In this example, the statement within the parentheses is processed first. The other operators are handled in the order in which they occur in the statement.

    For more information, see Using Boolean Operators in Truth Tables .

  16. Use the standard mathematical operators in the following table
  17. Operator

    Definition

    <

    Less than

    >

    Greater than

    <>

    Not equal to

    =

    Equal to

    <=

    Less than or equal to

    >=

    Greater than or equal to

     

  18. If entering a user exit in a statement:
  19. a) Enter =

    b) Enter the character u (for a user-defined user exit) or s (for a standard SAP user exit).

    c) Enter the user exit number (three digits) (for example, =U123 ).

    You configure the form pool name that contains user exits in the table for client-dependent user exits (table T80D) in Customizing for Special Purpose Ledger by choosing Basic Settings ® User Exits ® Maintain Client-Dependent User Exits. The form pool name should conform to the customer naming convention (beginning with the letter Z ) so that is not overwritten when the next SAP upgrade is installed.

  20. If using mathematical processing in a statement:
  21. a) Enter the keyword MATHS( in front of the mathematical expression.

    b) Enter parentheses after the mathematical expression.

    c) Use the mathematical operators in the following table.

    Symbol

    Operation

    +

    Addition

    -

    Subtraction

    *

    Multiplication

    /

    Division

     

    d) Use parentheses to define the order in which the mathematical expressions are to be evaluated.

    If you are creating a matrix validation or substitution, you can also use the operators in the following table when validating or substituting line items in a document.

    Operator

    Description

    SUM( )

    Total of the document

    AVG( )

    Average sum of the document

    MAX( )

    Maximum value of all document lines

    MIN( )

    Minimum value of all document lines

    GROUP BY

    Compare a group of totals with another group of totals.

     

    MATHS( SUM( $HSL ) < 50000 )

    In this example, the user cannot post more than the amount 50000 in local currency for a document.

    MATHS( AVG( $FIELD1 ) GROUP BY $RYEAR $RVERS = AVG( $FIELD2 ) GROUP BY $RYEAR $RVERS )

    In this example, the statement is true if the average value for each year/version combination for FIELD1 is the same as the average value for the year/version combination for FIELD2.

    You can also use rules within a statement that uses mathematical processing.

    MATHS( SUM( $DMBTR ) WHERE &RULE_1 < SUM( $DMBTR ) WHERE &RULE_2 )

    In this example, the system calculates the total of the local currency (DMBTR) for the document lines where RULE1 is true. The system then calculates the total of the local currency for the document lines where RULE2 is true. The statement is TRUE if the first total is less than the second total.

  22. To enter a statement as true or false, you can enter TRUE or FALSE.
  23. To enter currency types in a Boolean statement, enter parentheses around the currency code.

You must specify a currency code in a Boolean statement when the currency amount has more or less than two decimal places.

<BSEG> $DMBTR < ‘10000 (BEF)’