Beruflich Dokumente
Kultur Dokumente
ABAP Keyword Documentation ABAP - Reference Declarative statements Classes and Interfaces ABAP Objects - Overview Statements in ABAP Objects Replacements for Obsolete Language Constructs in ABAP Objects
Note: This does not apply to SELECT statements in sub-queries. You cannot use the INTO clause with a sub-query. See the EXISTS construction of the WHERE and HAVING clauses of the SELECT, UPDATE, DELETE, andOPEN CURSOR statements.
In ABAP Objects, the following statements cause an error message: t100 = space. t100-sprsl = 'D'. t100-arbgb = 'BC'. t100-msgnr = '100'. READ TABLE t100. Correct syntax: DATA wa TYPE t100. SELECT SINGLE * FROM t100 INTO wa WHERE sprsl = 'D' AND arbgb = 'BC' AND msgnr = '100'. Cause: The Open-SQL statement SELECT has replaced READ TABLE. The latter works only with database tables whose names correspond to the naming conventions for R/2-ATAB tables (maximum of 5 characters, starting with T) and with table work areas declared using TABLES, which are not supported in ABAP Objects. Generic key values are used for accesses, which are taken from the filled area of the table work area from left to right. Instead, declare the key explicitly in the WHERE clause of the SELECT statement.
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.
vers = 'T' && vers. DELETE (vers) FROM dbtab. MODIFY (vers) FROM dbtab. Reason: The VERSION addition only works with database tables whose name satisfies the naming convention for R/2-ATAB tables. Dynamically defining the database table with bracketed field names replaces the VERSIONaddition.
DO. EXEC SQL. fetch next c1 into :wa ENDEXEC. IF sy-subrc <> 0. EXIT. ENDIF. ... ENDDO. EXEC SQL. close c1 ENDEXEC. Reason: You should not call subroutines of the main program in local classes and you cannot call them in them from global classes. The called subroutine has no interface, working instead with the global data of the main program. The EXIT FROM SQL statement ends the SQL processing without reference to the actual SQL statement.