Ansicht
Dokumentation

EVAL_FORMULA - Analysis of a syntactically correct formula

EVAL_FORMULA - Analysis of a syntactically correct formula

CL_GUI_FRONTEND_SERVICES - Frontend Services   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

The function module EVAL_FORMULA evaluates Literal or Variable formulas. It accepts:

  • arithmetic formulas (with floating point result of type FLOAT)
  • logical formulas (with result TRUE or FALSE)
  • conditions of the form IF THEN
,,ELSE
  • expressions with fields of structure SY

Example:

FORMEL = COS(A**2+B**2)
FORMEL = IF X>0 THEN SIN(X) ELSE SIN(-X)
FORMEL = SY-TZONE / 2.324

Functions

The FM supports the following functions:

ABS absolute value
NOT negation
SIN sine function
COS cosine function
TAN tangent function
LOG logarithm to base e (natural logarithm)
EXP exponential function to base e
SQRT square root function
ROUND round to a whole number
TRUNC truncate, the whole number part of a real number
MOD modulus function
DIV whole number part of a division

Operators

The operators are classified into 6 priority groups. Group 0 has the lowest priority, group 6 the highest.

The operators are:

group 0:

AND logical AND
OR logical OR

group 1:

= equals
&lt;&gt;, >< not equal to
< less than
> greater than
<=, =< less than or equal to
> greater than
=>, >= greater than or equal to

group 2:

+ positive value (of an expression)
- negative value (of an expression)
+ addition
- subtraction

group 3:

* multiplication
/ division

group 4:

** exponential

group 5:

ABS absolute value
NOT negation (of a logical expression)

group 6:

all other functions.

User-defined formulas

The FM also evaluates user-defined functions, which are defined in a table.





Parameters

DEGREES
FORMULA
NO_EXISTENCE_CHECK
PROGRAM
ROUTINE
UNIT_OF_MEASURE
VALUE

Exceptions

DIVISION_BY_ZERO
EXP_ERROR
FORMULA_TABLE_NOT_VALID
INVALID_EXPRESSION
INVALID_VALUE
LOG_ERROR
MISSING_PARAMETER
PARAMETER_ERROR
SQRT_ERROR
UNITS_NOT_VALID

Function Group

CALC

rdisp/max_wprun_time - Maximum work process run time   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 6512 Date: 20240604 Time: 042213     sap01-206 ( 29 ms )