Ansicht
Dokumentation

ABENOO_OBS_LOOP_DBTAB_2 - OO OBS LOOP DBTAB 2

ABENOO_OBS_LOOP_DBTAB_2 - OO OBS LOOP DBTAB 2

General Material Data   General Material Data  
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.






TXBHW - Original Tax Base Amount in Local Currency   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 1755 Date: 20240419 Time: 115032     sap01-206 ( 34 ms )