SAP® Documentation

Single view

ABAPDESCRIBE_DISTANCE - DESCRIBE DISTANCE

Fill RESBD Structure from EBP Component Structure   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

DESCRIBE DISTANCE

Short Reference



Syntax

DESCRIBE DISTANCE BETWEEN dobj1 AND dobj2 INTO dst
                          IN ${BYTE$|CHARACTER$} MODE.

Effect

This statement determines the distance between the start positions of the data objects dobj1 and dobj2.

The return value has the type i. The following can be specified for dst:

  • An existing variable to which the return value can be converted.
  • An inline declaration DATA(var), where a variable of type i is declared.

It is not important in which order dobj1 and dobj2 are specified.

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. When this addition is used in IN CHARACTER MODE and the determined distance cannot be converted into a number of characters, a non-handleable exception is raised.

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.

Notes

  • The distance between data objects should only be determined within the same structure and only the components of the structures 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

The results of the two statements in a Unicode system are 5 and 10.

DATA text TYPE c LENGTH 10 VALUE '0123456789'.

DESCRIBE DISTANCE BETWEEN text+2(1) AND text+7(1)
         INTO DATA(cdist)
         IN CHARACTER MODE.

DESCRIBE DISTANCE BETWEEN text+2(1) AND text+7(1)
         INTO DATA(bdist)
         IN BYTE MODE.

Determining Data Object Distances

Exceptions

Non-Catchable Exceptions

  • Cause: Distance cannot be converted into characters.
    Runtime Error:UC_NO_CHAR_NUMBER





PERFORM Short Reference   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 4318 Date: 20191017 Time: 151352     sap01-206 ( 31 ms )

Our Service

Looking for Support? Questions?

The

Consolut

Callback-Service

Leave us your contact details and we will call you back. Panels marked with * are mandatory.