Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Numeric Calculations →  arith_exp - Arithmetic Expressions →  arith_exp - Arithmetic Operators 

Arithmetic Calculations

This example demonstrates the use of different divisions.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA: pack TYPE p DECIMALS 4,
          n    TYPE decfloat16 VALUE '+5.2',
          m    TYPE decfloat16 VALUE '+1.1'.


    pack = n / m.
    cl_demo_output=>write( |{ n } / { m } = { pack }| ).

    pack = n DIV m.
    cl_demo_output=>write( |{ n } DIV { m } = { pack }| ).

    pack = n MOD m.
    cl_demo_output=>display( |{ n } MOD { m } = { pack }| ).

Description

In this example, the functions of the three division operators, DIV, MOD, and / are demonstrated.