ABAPADD_SEQUENCES - ADD SEQUENCES
TXBHW - Original Tax Base Amount in Local Currency General Material DataThis documentation is copyright by SAP AG.
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 ADDstatement, which is not allowed in classes, adds sequences of data objects that are stored in the memory in equal distances from one another.
- In the variant with THEN and UNTIL, the sequence is defined by the distance between thedata objects dobj1 and dobj2. At all storage locations whose distances to dobj1 are multiple values of this distance - up to and including the position dobj -,numeric data objects of with the sametechnicaltype attributes must be stored. The content of all these data objects is added. In the variant withTO, the total is added to the content of the data object result and the result is assignedto it. In the variant with GIVING, the total is directly assigned to the data object result.The data object result must be a numeric variable. If you use addition ACCORDING, a data object of the sequence is added to the total only if its position in the sequence fulfills the condition in theselectiontable sel. For the components low and high of the selection table, the data type i is expected.
- In the variant with TO and FROM, the sequence is formed by data objects directly adjacentin the storage, whose first data object is dobj and which must all have the same numeric datatype. For pos1 and pos, data objects of type i are expected, whose values definea subset of the sequence. The contents of the data objects of the subsequence are added and assignedto the data object result. The data object result must be a numeric variable. If pos1or pos contain negative values or if pos1 is greater than pos, the statement is not executed and result remains unchanged.
In both variants, an untreatable exception occurs if addresses are accessed that do not contain suitable data objects.
In Unicodeprograms, all data objects of the sequence must lie within one structure. If in the syntax check,this cannot be recognized statically, you must specify a structure range with addition RANGE.If during execution of the statement, the data objects of the sequence are not part of the specified structure, an untreatable exception is triggered.
In non-Unicode programs, the sequence of the data objects can extend over the entiredataarea of the current program. Only if the first data object of the sequence is specified as a fieldsymbol, the area boundaries defined using the addition range_specof statement ASSIGN at the same time specify the allowed area of the sequence.
Note
The function of these variants of the ADD statement depends on the structure of the working memory.They are not allowed in classes and can be replaced as required by the statement ASSIGNwith the addition INCREMENT.
Example
The components of structure numbers specified on theselection 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.
Exceptions
Catchable Exceptions
- Cause: Overflow while adding, type I in additions UNTIL or FROM ... TO
Runtime Error: ADDF_INT_OVERFLOW (catchable) - Cause: Overflow during arithmetic operation (type p)
Runtime Error: BCD_OVERFLOW (catchable) - Cause: Integer overflow while adding
Runtime Error: COMPUTE_INT_PLUS_OVERFLOW (catchable)
- Cause: Overflow during arithmetic operation (type p, with specified length)
Runtime Error: BCD_FIELD_OVERFLOW (catchable)
Non-Catchable Exceptions
- Cause: Access to data outside of the area specified in the RANGE addition
Runtime Error: ADD_FIELDS_NOT_IN_RANGE - Cause: Invalid access to tables, strings, field references, or object references within the range specified by the RANGE addition.
Runtime Error: ADD_FIELDS_ILLEGAL_ACCESS - Cause: p field does not contain a correct BCD format
Runtime Error: BCD_BADDATA
BAL Application Log Documentation General Material Data
This documentation is copyright by SAP AG.
Length: 8502 Date: 20120518 Time: 190745 triton ( 254 ms )






