ABAP Keyword Documentation →  ABAP Programming Guidelines →  Structure and Style →  Alternative Spellings → 

Alternative Language Constructs

Background

Alternative language constructs are parts of statements that can be written in different ways. One reason for this are the constant new developments in the language. Often, new spellings are introduced and the old spellings retained for reasons of downward-compatibility.

Rule

Using consistent spelling

If there is more than one spelling for a statement, choose one of these spellings and use it consistently throughout your development work It is best to choose the spelling that most accurately reflects the semantics of the statement.

Details

To make your programming easier to understand, always choose the spelling that is most accurate and easiest to read, and which (where applicable) matches the spelling used in other statements. The following list contains some examples:

Bad example

The following piece of source code shows how the statement FIND is used inconsistently within a program. The first and third FIND statements are alternative spellings with the same meaning.

DATA text TYPE string.
...
FIND '...' IN text.
...
FIND REGEX '...' IN text.
...
FIND SUBSTRING '...' IN text.
...

Good example

The following piece of source code shows the same statements as in the example above, but with consistent spelling. This expresses the semantic distinction between searching for a substring and searching for a regular expression in clear syntax.

DATA text TYPE string.
...
FIND SUBSTRING '...' IN text.
...
FIND REGEX '...' IN text.
...
FIND SUBSTRING '...' IN text.
...