SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
Cannot UseLOOP AT
In ABAP Objects, the following statements cause an error message:
t100 = space.
t100-sprsl = 'D'.
t100-arbgb = 'BC'.
t100-msgnr = '1'.
LOOP AT t100.
...
ENDLOOP.
Correct syntax:
DATA wa TYPE t100.
SELECT * FROM t100 INTO wa WHERE sprsl = 'D' AND
arbgb = 'BC' AND
msgnr LIKE '1%'.
...
ENDSELECT.
Cause:
The Open-SQL and SELECT statements have replaced LOOP
AT. The latter only works with database tables, whose name corresponds to R/2-ATAB naming conventions
(no more than five places, beginning with T) or with table work areas declared using theTABLES statement,
which is not allowed in ABAP Objects. Access is by generic key values, which are taken from the filled
part of the table work area from left to right. For this reason, you should declare keys explicitly in the WHERE clause of the SELECT statement instead.