diff --git a/clean-abap/CleanABAP.md b/clean-abap/CleanABAP.md index 21209a31..409ddce2 100644 --- a/clean-abap/CleanABAP.md +++ b/clean-abap/CleanABAP.md @@ -32,6 +32,7 @@ The [Cheat Sheet](cheat-sheet/CheatSheet.md) is a print-optimized version. - [Mind the performance](#mind-the-performance) - [Prefer object orientation to procedural programming](#prefer-object-orientation-to-procedural-programming) - [Prefer functional to procedural language constructs](#prefer-functional-to-procedural-language-constructs) + - [Avoid obsolete language elements](#avoid-obsolete-language-elements) - [Use design patterns wisely](#use-design-patterns-wisely) - [Constants](#constants) - [Use constants instead of magic numbers](#use-constants-instead-of-magic-numbers) @@ -591,6 +592,54 @@ IF line_exists( value_pairs[ name = 'A' ] ). Many of the detailed rules below are just specific reiterations of this general advice. +### Avoid obsolete language elements + +> [Clean ABAP](#clean-abap) > [Content](#content) > [Language](#language) > [This section](#avoid-obsolete-language-elements) + +When upgrading your ABAP version, +make sure to check for obsolete language elements +and refrain from using them. + +For example, the `@`-escaped "host" variables +in the following statement make a little clearer +what's a program variable and what's a column in the database, + +```ABAP +SELECT * + FROM spfli + WHERE carrid = @carrid AND + connid = @connid + INTO TABLE @itab. +``` + +as compared to the [obsolete unescaped form](https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenopen_sql_hostvar_obsolete.htm) + +```ABAP +SELECT * + FROM spfli + WHERE carrid = carrid AND + connid = connid + INTO TABLE itab. +``` + +Newer alternatives tend to improve readability of the code, +and reduce design conflicts with modern programming paradigms, +such that switching to them can automatically clean your code. + +While continuing to work, obsolete elements may stop benefitting +from optimizations in terms of processing speed and memory consumption. + +With modern language elements, you can onboard young ABAPers easier, +who may no longer be familiar with the outdated constructs +because they are no longer taught in SAP's trainings. + +The SAP NetWeaver documentation contains a stable section +that lists obsolete language elements, for example +[NW 7.50](https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/index.htm?file=abenabap_obsolete.htm), +[NW 7.51](https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenabap_obsolete.htm), +[NW 7.52](https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_obsolete.htm), +[NW 7.53](https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/index.htm?file=abenabap_obsolete.htm). + ### Use design patterns wisely > [Clean ABAP](#clean-abap) > [Content](#content) > [Language](#language) > [This section](#use-design-patterns-wisely) diff --git a/clean-abap/cheat-sheet/CheatSheet.md b/clean-abap/cheat-sheet/CheatSheet.md index ac038e02..f95c475d 100644 --- a/clean-abap/cheat-sheet/CheatSheet.md +++ b/clean-abap/cheat-sheet/CheatSheet.md @@ -12,7 +12,7 @@ is versioned according to the [Semantic Versioning specification](https://semver ## Download -- [**Cheat Sheet**](CleanABAPCheatSheetV1.2.1.pdf) · Latest version · PDF +- [**Cheat Sheet**](CleanABAPCheatSheetV1.3.0.pdf) · Latest version · PDF - [**The Golden Rules**](CleanABAPTheGoldenRulesV1.0.0.pdf) · Latest version · PDF @@ -20,6 +20,8 @@ is versioned according to the [Semantic Versioning specification](https://semver ### Cheat Sheet +- [v1.3.0](CleanABAPCheatSheetV1.3.0.pdf) · 8 May 2019 + - Added section _Avoid obsolete language elements_ - [v1.2.1](CleanABAPCheatSheetV1.2.1.pdf) · 7 May 2019 - Replaced _imperative programming_ with _procedural programming_ - [v1.2.0](CleanABAPCheatSheetV1.2.0.pdf) · 6 May 2019 diff --git a/clean-abap/cheat-sheet/CleanABAPCheatSheet.docx b/clean-abap/cheat-sheet/CleanABAPCheatSheet.docx index 72be7ce0..d661cd0b 100644 Binary files a/clean-abap/cheat-sheet/CleanABAPCheatSheet.docx and b/clean-abap/cheat-sheet/CleanABAPCheatSheet.docx differ diff --git a/clean-abap/cheat-sheet/CleanABAPCheatSheetV1.3.0.pdf b/clean-abap/cheat-sheet/CleanABAPCheatSheetV1.3.0.pdf new file mode 100644 index 00000000..df174c14 Binary files /dev/null and b/clean-abap/cheat-sheet/CleanABAPCheatSheetV1.3.0.pdf differ