Get Example source ABAP code based on a different SAP table
ADD - THEN, UNTIL
Short Reference • THEN UNTIL ADD (obsolete) • TO ADD THEN UNTIL (obsolete) • GIVING ADD THEN UNTIL (obsolete) • ACCORDING TO ADD (obsolete) • FROM TO ADD (obsolete) • GIVING ADD FROM TO (obsolete) • RANGE ADD (obsolete)
ABAP Syntax(Obsolete)ADD { { dobj1 THEN dobj2 UNTIL dobj { {TO result} | {GIVING result [ACCORDING TO sel]} } } | { dobj FROM pos1 TO pos GIVING result } } [RANGE range].
What does it do? 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 the variant with THEN and UNTIL, the string is defined by the distance between the data objects dobj1 and dobj2. At all memory positions whose distances to dobj1 are multiple values of this distance (up to and including the position dobj), numeric data objects with the same technical type attributes must be stored. The content of all these data objects is added. In the variant with TO, the total is added to the content of the data object result and the result is assigned to 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 the addition ACCORDING is used, a data object of the string is added to the total only if its position in the string fulfills the condition in the selection table sel. The components low and high in the selection table expect the data type i. In the variant with TO and FROM, the string is formed by data objects directly adjacent in the memory, the first data object being dobj and all having the same numeric data type. pos1 and pos expect data objects of the type i, whose values define a subset of the string. The contents of the data objects of the substring are added and assigned to the data object result. The data object result must be a numeric variable. If pos1 or pos contain negative values or if pos1 is greater than pos, the statement is not executed and result remains unchanged.