range
with the addition RANGE must be specified. If the data
objects of the string are not part of the specified structure when the
statement is executed, an unhandleable exception is raised.
Latest notes: The function of these variants of the ADD statement
depends on the structure of the working memory. Memory-based operations
of this type should be avoided. They are not allowed in classes and can
be replaced as required by the statement ASSIGN
with the addition
INCREMENT .
Example ABAP Coding The components of the structure numbers specified
on the selection screen are added
and the total is assigned to variable sum .
DATA: BEGIN OF numbers,
one TYPE p LENGTH 8 DECIMALS 0 VALUE 10,
two TYPE p LENGTH 8 DECIMALS 0 VALUE 20,
three TYPE p LENGTH 8 DECIMALS 0 VALUE 30,
four TYPE p LENGTH 8 DECIMALS 0 VALUE 40,
five TYPE p LENGTH 8 DECIMALS 0 VALUE 50,
END OF numbers,
sum TYPE i.
SELECT-OPTIONS position FOR sum.
ADD numbers-one THEN numbers-two
UNTIL numbers-five
ACCORDING TO position
GIVING sum.
Runtime Exceptions
Catchable Exceptions
CX_SY_ARITHMETIC_OVERFLOW
Reason for error: Overflow while adding, type I in additions UNTIL
or FROM ... TO
Runtime error: ADDF_INT_OVERFLOW
Reason for error: Overflow in arithmetic operation (type p )
Runtime error: BCD_OVERFLOW
Reason for error: Integer overflow while adding
Runtime error: COMPUTE_INT_PLUS_OVERFLOW
CX_SY_CONVERSION_OVERFLOW
Reason for error: Overflow in arithmetic operation (type p , with
specified length)
Runtime error: BCD_FIELD_OVERFLOW
Non-catchable Exceptions
Reason for error: Access to data outside of the range specified in the
RANGE addition
Runtime error: ADD_FIELDS_NOT_IN_RANGE
Reason for error: Invalid access to tables, strings, field references, or
object references within the range specified by the addition
RANGE
.
Runtime error: ADD_FIELDS_ILLEGAL_ACCESS
Reason for error: p field does not contain the correct BCD
format
Runtime error: BCD_BADDATA
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved