DIVIDE-CORRESPONDING

This statement is not allowed in an ABAP Objects context. See Cannot Perform Arithmetic Operations on Identically-Named Structure Components

Basic form

DIVIDE-CORRESPONDING s1 BY s2.

Effect

Interprets s1 and s2 as structures, i.e. if s1 and s2 are tables with header lines, the statement is executed for their header lines.

Searches for all subfields that occur both in s1 and s2 and then generates, for all field pairs corresponding to the sub-fields ni, statements similar in the following form:

DIVIDE s1-ni BY s2-ni.

The other fields remain unchanged.

With more complex structures, the complete names of the field pairs must be identical.

Example

DATA: BEGIN OF MONEY,
        VALUE_IN(20) VALUE 'German marks'.
        USA TYPE I VALUE 100,
        FRG TYPE I VALUE 200,
        AUT TYPE I VALUE 300,
      END   OF MONEY,
      BEGIN OF CHANGE,
        DESCRIPTION(30)
            VALUE 'DM to national currency'.
        USA TYPE F VALUE '1.5',
        FRG TYPE F VALUE '1.0',
        AUT TYPE F VALUE '0.14286',
      END   OF CHANGE.
DIVIDE-CORRESPONDING MONEY BY CHANGE.
MONEY-VALUE_IN = 'National currency'.

The above DIVIDE-CORRESPONDING statement is equivalent to the following three statements:

DIVIDE MONEY-USA BY CHANGE-USA.
DIVIDE MONEY-FRG BY CHANGE-FRG.
DIVIDE MONEY-AUT BY CHANGE-AUT.

Note

All fields of the same name are divided, whether numeric or not. The conversions performed are the same as those for DIVIDE.

Exceptions

Catchable Exceptions

CX_SY_ARITHMETIC_OVERFLOW

CX_SY_CONVERSION_OVERFLOW

CX_SY_ZERODIVIDE

Non-Catchable Exceptions

Related

DIVIDE, MOVE-CORRESPONDING, ADD-CORRESPONDING, SUBTRACT-CORRESPONDING, MULTIPLY-CORRESPONDING

Additional help

Arithmetic Calculations ________________________________________________________________________