AS ABAP Release 758, ©Copyright 2024 SAP SE. All rights reserved.
ABAP - Keyword Documentation → ABAP - ABAP Release News → News for ABAP Release 7.40 and its SPs → News for ABAP Release 7.40, SP08 →
Expressions and Functions in ABAP Release 7.40, SP08
Predicative Method Calls
can now be specified in a short form as a predicate method call
This makes is possible to use
predicate methods in logical expressions as if their return value had a real Boolean data type.
New Boolean Function
The new Boolean function xsdbool returns the value X or a blank of the type c with the length 1, depending on the truth value of the logical expression specified as the argument. This expands the existing function boolc, whose return value has the type string. This can produce unexpected results in comparisons with text fields and in checks on the initial value.
The return value of xsdbool still references the special type XSDBOOLEAN from ABAP Dictionary. This means it is handled like a real truth value in serializations and deserializations to or from asXML and asJSON.
Critical uses of boolc now produce a syntax check warning.
Iteration Expressions
The iteration expressions introduced using FOR (until now only available for table iterations in table comprehensions) have been expanded to include conditional iterations with the additions UNTIL and WHILE. This makes it possible to program any iteration in the constructor expressions NEW and VALUE for creating internal tables.
A new reduction operator REDUCE can execute these conditional iterations and table iterations to construct the results of any data types. In the case of table iterations, this is also known as
table reduction.
Table Filtering
The new filter operator FILTER can be used to perform
table filtering in
which conditions are used to select or remove lines from an internal table. The result is used to construct a new internal table.
Start Value for Constructor Expressions
The new addition BASE can be used to provide the return value of a constructor expression for structures or internal tables with a start value, before the actual construction starts. The addition BASE can be used in the following constructor expressions:
Inserting Table Lines in Constructed Tables
When internal tables are constructed using the instance operator NEW and the value operator VALUE, LINES OF can now be used to insert multiple lines from an existing internal table in the target table.
Grouping Internal Tables
The new variants FOR GROUPS ... OF and FOR ... IN GROUP in an
iteration expression for
table iterations using
FOR can be used to group the lines of internal tables and to evaluate the groups.
Default Value for Table Expressions
If the type of the result of a table expression
or a chaining of table expressions is controlled using the constructor operators VALUE or REF, the additions OPTIONAL and DEFAULT can be used to specify a default value. If no lines are found, no exception is raised and the default value is returned instead.
Restrictions Removed
The following restrictions were removed:
This makes the conversion operator CONV a full replacement for the value operator VALUE for elementary data types. As before, the value operator cannot be used to construct any values for elementary data objects except for the initial value.