SAP ABAP Data Element AQ_COMP (SAP Query: Formula)
Hierarchy
SAP_BASIS (Software Component) SAP Basis Component
   BC-SRV-QUE (Application Component) SAP Query
     SQUE (Package) Application Development R/3 SAP Query
Basic Data
Data Element AQ_COMP
Short Description SAP Query: Formula  
Data Type
Category of Dictionary Type D   Domain
Type of Object Referenced     No Information
Domain / Name of Reference Type AQS_C60K    
Data Type CHAR   Character String 
Length 60    
Decimal Places 0    
Output Length 60    
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 Formula 
Medium 10 Formula 
Long 25 Calculation formula 
Heading 55 Calculation formula 
Documentation

Definition

To calculate the value of a local field, you can specify a calculation formula. In its simplest form, this formula describes how the value of the local field is calculated from other values. The structure of such formulae is explained below.

In more complex cases, the calculation formula may consist of several conditions and formulae. A formula is assigned to each condition and the value of the local field is then determined by evaluating each condition in sequence. If one of the conditions is satisfied, the assigned formula is used to determine the value. If none of the conditions is satisfied, the local field is usually set to the initial value, but even here you can specify a formula to determine the value (this would be the 'otherwise' block in the editor).

You structure formulae in the normal manner using operands (values) and operators (operand links).

The following are valid operators:

- * (multiplication)
- / (division)
- DIV (whole number division, i.e. the result is an integer)
- MOD (remainder)
- + (addition)
- - (subtraction)

The operators + and - can also be 'one-character' operators. In this case, they do not link two operands, but refer to subsequent operands.
The processing sequence follows the usual rules, where 'one-character' operators + and - take priority over the 'point operators' *, /, DIV and MOD, and these in turn take priority over the operators + and - . However, you can change the processing sequence to suit your own requirements by using parentheses.

The following operands are valid:

- Short names of fields
- %NAME, %DATE, %TIME
- Numeric constants (e.g. 10 or 153.72)
- Character strings in the form 'xxxxxxxx'
- Names of symbols and icons

%NAME, %DATE and %TIME are special fields automatically provided by the system. %NAME is a 12-character text field containing the name of the user entered when logging on to the R/3 System. %DATE is a date field containing today's date. %TIME is a time field containing the current time.
If the character ' appears within a character string, you must precede it by a ' so that it is correctly interpreted. Also, the following special notation is possible for field names and the special fields %NAME, %DATE and %TIME:

- field[n1:n2]
- field[YEAR], field[MONTH], field[DAY]
- field[HOUR], field[MINUTE], field[SECOND]

With field[n1:n2], field must be a text field. In addition, both n1 and n2 must be whole number numeric constants (without decimal points) and n1 < n2. field[n1:n2] is the part of the text field that extends from the character at n1 to the character at n2. The first character of a text field appears at position 1.
With field[YEAR], field[MONTH] or field[DAY], the field must be a date field. The year, the month and the day can then be provided (in number form).
With field[HOUR], field[MINUTE] or field[SECOND], the field must be a time field. Hours, minutes and seconds can then be provided.

The names of symbols and icons are fixed and begin with SYM_ or ICON_ . You can use the functions Symbols and Icons to determine valid names. If you use a symbol or icon in a formula, the formula can only consist of symbol or icon name.

Formulae may extend over one or several lines in free format, i.e. the individual operands and operators can appear one immediately after the other in a consecutive sequence, or there may be any number of blnaks between them. However, there can be no blanks within field names and field names and character strings cannot extend over more than one line.

To include the names of fields, symbols and icons in a formula, you can place the cursor on the position in the formula where the want to make the insertion, call one of the functions 'Fields', 'Symbols' or 'Icons' and then choose the your field, symbol or icon.

Supplementary Documentation - AQ_COMP 0220

Use

Procedure

Examples

Dependencies

If the fields specified on the screen for the formula and the condition are sufficient to allow full specification of the calculation formula for the local field, you can use these fields for input. Otherwise, use the Complex calculation function. This takes you to an editor where you can enter all the necessary calculations.
If you used the editor earlier to enter a calculation formula that was too complex to be entered in the fields on the screen, these fields are not ready for input. To change the calculation formula, you must use the Complex calculation function.

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