ABAP Keyword Documentation → ABAP − Reference → Program Flow Logic → Expressions and Functions for Conditions → log_exp - Logical Expressions → rel_exp - Comparison Expressions → rel_exp - Comparison Rules
rel_exp - Comparing Internal Tables
It is possible to compare internal tables with other internal tables if their row types can be compared. Internal tables are compared based on the following hierarchy:
Other versions: 7.31 | 7.40 | 7.54
Note
If an internal table with a header line is specified as an operand of an assignment, the header line is addressed in nearly all
operand positions and not the
table body. To address the table body of a table with a header, []
must be appended to the name.
Example
itab2
is larger than itab1
, despite having the same number of rows, because the content of its second row is larger than that of itab1
.
DATA:
itab1 TYPE TABLE OF i WITH EMPTY KEY,
itab2 TYPE TABLE OF i WITH EMPTY KEY.
itab1 = VALUE #( ( 1 ) ( 2 ) ( 3 ) ).
itab2 = VALUE #( ( 1 ) ( 3 ) ( 3 ) ).
ASSERT itab2 > itab1.