Ansicht
Dokumentation

ABENOO_OBS_LOOP_DBTAB_1 - OO OBS LOOP DBTAB 1

ABENOO_OBS_LOOP_DBTAB_1 - OO OBS LOOP DBTAB 1

CPI1466 during Backup   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.
SAP E-Book

Cannot UseLOOP AT

You cannot use the LOOP AT statement to read data from database tables in ABAP Objects.

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.






ABAP Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 1755 Date: 20240328 Time: 230706     sap01-206 ( 31 ms )