rel_exp - Predicative Method Call
7.31 | 7.40 | 7.54
... meth( ... ) ...
A predicative method call is a relational expression whose only operand is a
The result of the relational
expression is true if the result of the functional method call is not initial and false if the result
of the functional method call is initial. The result of the functional method call (the return value of the called function method) can have any data type. A check is made on the type-dependent initial value.
A predicative method call, like any relational expression, can be a full logical expression or part of a logical expression. This means it can be specified as a condition in control statements and other statements, as an argument in Boolean functions or conditional expressions, or in joins with Boolean operators.
- A predicative method call is a short form of the predicate expression:
... meth( ... ) IS NOT INITIAL ...
- Predicate methods
whose return value has the type
abap_boolare particularly well suited as predicative method calls. Calling a predicate method in a predicative method call simulates the call of a method whose return value has the real Boolean data type not present in ABAP.
- As usual, the functional method call
meth( ... )can be specified as a individual method or as a method chaining. If the first method called is an instance method, the functional method call can be introduced as usual using the instance operator
NEWor the casting operator
- Alongside the dedicated predicate functions and an obsolete short form, predicative method calls are the only way of creating a relational expression using a single operand.
- For other expressions or data objects, the full predicate expression
IS INITIALor a comparison must be used to check the initial value and this is not normally recommended for many expressions.
Exits the program if no SAP GUI is available. The called method
check from the class CL_DEMO_SAP_GUI is a
IF NOT cl_demo_sap_gui=>check( ). LEAVE PROGRAM. ENDIF.