ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Attributes of Data Objects → DESCRIBE
DESCRIBE DISTANCE
Other versions: 7.31 | 7.40 | 7.54
Syntax
DESCRIBE DISTANCE BETWEEN dobj1 AND dobj2 INTO dst
IN {BYTE|CHARACTER} MODE.
Effect
This statement assigns the difference between the starting positions of the data objects dobj1
and dobj2
to the data object dst
, which expects the data type i
. In the case of
deeper data types, the referenced
data object is not relevant but the position of the internal reference (for strings and internal tables)
or the reference variables instead. It is not important in which order dobj1
and dobj2
are specified.
You must specify the addition MODE
in
Unicode programs. The
variant with the addition IN BYTE MODE
determines the distance in bytes.
The variant with the addition IN CHARACTER MODE
converts the distance into characters that can be stored in this length according to the current character format. In
non-Unicode programs,
the addition MODE
can be omitted. In this case, the addition IN
BYTE MODE is used implicitly. When you use this addition in IN CHARACTER
MODE and the determined distance cannot be converted into a number of characters, an non-handleable exception is raised.
Notes
-
The distance between data objects should only be determined within the same structure and only the structure's
components should be used, since this is the only way to guarantee that they follow each other immediately in the memory. Note that the
alignment gaps are counted
as well. Therefore, use the addition in
IN BYTE MODE
to avoid a non-handleable exception. -
With respect to
DESCRIBE DISTANCE
, every substructure declared as a boxed component is an independent structure. The distance between components which are not in the same boxed component is undefined.
Example
Exceptions
Non-Catchable Exceptions
-
Cause: Distance cannot be converted into characters.
Runtime Error:UC_NO_CHAR_NUMBER