SAP NetWeaver AS ABAP Release 750, ©Copyright 2016 SAP AG. All rights reserved.
ABAP - Keyword Documentation → ABAP - Reference → Obsolete Language Elements → Obsolete Processing of Internal Data → Obsolete Calculation Statements →
ADD - THEN, UNTIL
Obsolete Syntax
ADD { { dobj1 THEN dobj2 UNTIL dobj
{ {TO result} | {GIVING result [ACCORDING TO sel]} } }
| { dobj FROM pos1 TO pos GIVING result } }
[RANGE range].
Effect
This variant of the statement ADD, which is not allowed in classes, adds strings of data objects that are stored in equal distances from one another in the memory.
In both variants, a non-handleable exception is raised if addresses are accessed that do not contain suitable data objects.
All data objects of the string must be within a structure. If this cannot be detected statically in the syntax check, a structure 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, a non-handleable exception is raised.
The calculation type of the addition is usually determined from the operands in question.
Note
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
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.
Handleable Exceptions
CX_SY_ARITHMETIC_OVERFLOW
CX_SY_CONVERSION_OVERFLOW
Non-Handleable Exceptions