The document provides recommendations for replacing commonly used ABAP statements and constructs with alternative expressions. Some key replacements include:
1) Using inline declarations instead of DATA and FIELD-SYMBOLS declarations and constructor expressions with CORRESPONDING instead of MOVE CORRESPONDING.
2) Using constructor expressions like NEW, REF, VALUE instead of CREATE DATA/OBJECT and GET REFERENCE OF.
3) Using constructor expressions like SWITCH, COND instead of IF/ELSE blocks for assigning values within multiple cases.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
661 views1 page
Abap New Syntax 7.5
The document provides recommendations for replacing commonly used ABAP statements and constructs with alternative expressions. Some key replacements include:
1) Using inline declarations instead of DATA and FIELD-SYMBOLS declarations and constructor expressions with CORRESPONDING instead of MOVE CORRESPONDING.
2) Using constructor expressions like NEW, REF, VALUE instead of CREATE DATA/OBJECT and GET REFERENCE OF.
3) Using constructor expressions like SWITCH, COND instead of IF/ELSE blocks for assigning values within multiple cases.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Here we go:
If you see this Consider using this
DATA and FIELD-SYMBOLS declarations Inline declarations MOVE CORRESPONDING Constructor expression CORRESPONDING, or CL_ABAP_CORRESPONDING struc1-field1 = struc2-fielda Constructor expression CORRESPONDING, struc1-field2 = struc2-fieldb or CL_ABAP_CORRESPONDING; … Constructor expression VALUE CREATE DATA / CREATE OBJECT Constructor expression NEW GET REFERENCE OF Constructor expression REF variable only used once, e.g. parameter for a Constructor expression VALUE; Inline declarations method call helper variable for type conversion Constructor expression CONV ?= Constructor expression CAST assigning a value to a single variable within Constructor expressions SWITCH or COND several case or if blocks, e.g. IF cond. var = 1. ELSE. var = 2. ENDIF. READ TABLE Table expressions; Note: throws exception, while READ TABLE sets sy-subrc. Catch exception and handle error case, or use a standard value READ TABLE … TRANSPORTING NO FIELDS line_exists( … ) or line_index( … ) internal table WITH DEFAULT KEY suitable key, or WITH EMPTY KEY LOOP AT… FOR … IN in constructor expressions [result of method call] IS (NOT) INITIAL, or [result predicative method call ( omit the ” = abap_true” part ) of method call] = abap_true/abap_false DO / WHILE FOR … UNTIL / WHILE in constructor expressions calculating or otherwise assembling one result Constructor expression REDUCE; Note: “one result” can be a from input data, e.g. from table rows value, but also a table or complex object LOOP AT … AT NEW, or other means of going LOOP AT … GROUP BY … / LOOP AT GROUP through grouped data LOOP + DELETE Constructor expression FILTER type checking (?= with TRY/CATCH block, or IS INSTANCE OF, CASE TYPE OF usage of CL_ABAP_TYPEDESCR) CONCATENATE; string literals String templates SELECT new SQL expressions; use @ to escape host variables