SAP ABAP Data Element FORMULA4 (Line for Boolean rule)
Hierarchy
BBPCRM (Software Component) BBPCRM
   CRM (Application Component) Customer Relationship Management
     CRM_APPLICATION (Package) All CRM Components Without Special Structure Packages
       GBAS (Package) FI-SL Customizing / integration / Basis
Basic Data
Data Element FORMULA4
Short Description Line for Boolean rule  
Data Type
Category of Dictionary Type D   Domain
Type of Object Referenced     No Information
Domain / Name of Reference Type CHAR53    
Data Type CHAR   Character String 
Length 53    
Decimal Places 0    
Output Length 53    
Value Table      
Further Characteristics
Search Help: Name    
Search Help: Parameters    
Parameter ID   
Default Component name    
Change document    
No Input History    
Basic direction is set to LTR    
No BIDI Filtering    
Field Label
  Length  Field Label  
Short 10 Bool. rule 
Medium 15 Boolean rule 
Long 20 Line for Bool. rule 
Heading BR 
Documentation

Definition

A statement consists of several lines. You can use several operators and rules in each logical rule; the elements in round brackets are processed first.

Operators

AND (conjunction)

When you use the AND operator (conjunction), both statements must be true for the combined statement to be true.

OR (disjunction)

When you use the OR operator (disjunction), at least one of your logical statements must be true for the combined statement to be true.

NOR

When you use the NOR operator, both statements must be false for the combined statement to be true. This operator is the same as using the statement NOT (A OR B).

NAND

When you use the NAND operator, at least one statement must be false for the combined statement to be true. This operator is the same as using the statement NOT (A AND B).

--> implication

When you use the --> operator (implication), the two statements depend on each other to determine the truth value of the statement ("If A, then B"). The combined statement is always true if the second statement is true or the first statement is false.

<-> equivalence

When you use the <-> operator (equivalence), both statements must be true or both statements must be false for the combined statement to be true.

Operands

  • <Table> $field = 'literal'
  • <Table> $field:n1-n2: = 'literal'
  • <Table1> $field1 = <Table2> $field2
  • <Table> Set ID
  • TRUE, T
  • FALSE, F
  • &Rule

Operand description

In the SAP environment, a statement always refers to table fields (for example, COBL-HKONT). Therefore, the table must first be defined. By specifying <tnam>, you define to which table you want to refer. Within a statement, this table definition is valid until a different table is specified. You can use several tables in a statement.

There are three ways to refer to table fields:

Direct comparison of a table field with a constant

Syntax: $fname op 'fvalue'

Meaning:

Field 'fname' is compared with the value 'fvalue' according to the relational operator op. If this comparison is positive, the statement is true, if not, the statement is false.

The following is used:

  • - fname field name,
  • - op relational operators
    • = (equal to)
    • > (greater than)
    • >= (greater than or equal to)
    • < (smaller than)
    • <= (smaller than or equal to)
    • <> not equal to
  • - fvalue value with which the field value is to be compared.

Direct comparison of a table field with a field

Syntax: $field1 op $field2

This is like the direct comparison of a table field with a constant, but a second field name is used instead of the constant.

Example: <COBL> $BLDAT = <SY> $DATUM

Direct comparison of a part of a table field with a constant or a field.

You can use parts of a field for the comparison.

Syntax: $fname:n1-n2: op 'fvalue'

$fname:n1-: op 'fvalue'

$fname:n1:

n1 is the position of the first letter, n2 is the position of the last letter.

:n-: means from n1 to the end of the character string

:n: means the nth letter

Example: $UNAME:2-4: = 'ONE'
($UNAME = 'JONES' true, $UNAME = 'JOHNSON' false)

Sets

When you create a basic or single-dimension set, the values entered in the set are assigned to a field in a table. If you define a basic or single-dimension set in a statement, the system validates the table field against the values in the set. The statement is TRUE if the value of the table field is contained in the set. If the value is not contained in the set, the statement is FALSE.

When you create a multi-dimension set, the values you enter are assigned to a table containing all of the dimensions used in the set. If you define a multi-dimension set in a statement, the system checks all table fields against the relevant values. The statement is TRUE if all table field values are contained in the relevant sets of the multi-dimension set. If at least one value is not included in the sets, the statement is FALSE.

Example 1

A formula is true if the document type in the document header segment is SA, SB, SC, or SD and the currency key is DM, FF, SFR, LIT, BRF or HFL.

Solution:

You can define a statement by linking together 10 different field comparisons. However, it is easier to use set maintenance to create the basic set DOCTYPE for table field BKPF-BLART, containing the values SA, SB, SC, and SD, and the basic set CURRENCY for the table field BKPF-WAER, containing the values DM, FF, SFR, LIT, BFR and HFL.
Example: <BKPF> DOCTYPE AND CURRENCY.

Direct entry of the truth values TRUE and FALSE

It is possible to directly declare a statement as TRUE or FALSE (for example, as a substitute for a set name that will be inserted later).

Rules

A rule is a Boolean statement that can be used more than once.

Syntax: &rule name

Example: &RULE1 OR &RULE2

History
Last changed by/on SAP  20100310 
SAP Release Created in