In general, the rule applies that operands that can be assigned to one another with the MOVE statement can also be compared. An exception is object references, which can be compared but not always assigned.
Comparison of flat structures
Structures can also be compared if they are not compatible. As in the MOVE statement, the fragment views must be the same for the length of the shorter structure. If the structures have different lengths, the shorter structure is filled until it has the length of the other structure. As in the assignment, all character-type components are filled with spaces and all other components with initial values of the right type. The structures are compared fragment by fragment as defined by the fragment view.
Comparison of single fields and structures
The following rules are valid when single fields are compared with structures:
c0(10) TYPE C.
BEGIN OF struc,
c1(15) TYPE C,
i TYPE I,
c2(5) TYPE C,
n(7) TYPE N,
END OF struc.
... c0 logexp struc ...
In this example, c0 is extended to the length of struc in storage. All areas > 10 are filled with initial values of the correct type for components that are not character-type and filled with space for other components.
Comparison of deep structures
As previously, mainly type compatibility of the operands is needed for comparing deep structures. The compatibility test for comparability was generalized so that structure components with references to classes or interfaces can be compared with one another, whatever the class hierarchy and implementation relation, as for single fields. Only comparability of table types is required for table components.
Comparison of internal tables
Tables can be compared if their row types can be compared. The restrictions described above therefore also affect table comparisons.
Use the categories used in the Dictionary when using these types withStructure Enhancements.