ABAP Keyword Documentation →  ABAP Programming Guidelines →  ABAP-Specific Rules →  Programm Type and Program Properties → 

Program Attributes

Background

In addition to various, less important properties, each ABAP program has a set of program attributes that control specific aspects of the program behavior and syntax check severity:

The program attributes are defined when a program is created, by using the relevant tool (Class Builder, Function Builder, ABAP Editor). They can also be changed later.

Rule

Use the default settings for program attributes

Set the program attributes for new programs as follows:

When a new program is created, these settings are the same as the default values. This means that they can be applied without making any changes. Once the program attributes are set they should no longer be modified.

Details

Different behaviors or check severities are only provided for compatibility reasons, to ensure that existing programs can still be compiled and executed. New programs should definitely not use obsolete settings.

Because any later changes to the program attributes potentially involve extra work, the correct attributes should be configured right from the start and not changed later. It is particularly important for attributes that influence the syntax check (currently the Unicode check) that the highest possible check severity is chosen. This ensures the best preparation for any subsequent switches.

The following sections assume that only the Unicode check is used and fixed point arithmetic is activated and that logical databases are not used. These guidelines no longer contain a special rule for obsolete or problematic language constructs, which are only available if the Unicode checks are switched off. These constructs are only mentioned briefly in regard to the list of obsolete language elements.

Example

In the following source code, a write access to a subfield across two numeric components of a structure is executed.

METHOD ...
  DATA:
    BEGIN OF struct,
      comp1 TYPE i,
      comp2 TYPE i,
    END OF struct.
  struct+2(4) = 'XXXX'.
ENDMETHOD.

This is only possible in non-Unicode programs. Here an implicit casting of the subarea is performed for type c. The result in the components depends on the alignment gaps, the internal presentation of numeric values (byte order), and the code page used. Therefore, the result is extremely platform-dependent. A live program must never contain this type of code. This type of code often results in incorrect data or runtime errors that are difficult to trace.

The above code results in a syntax error, when used in an ABAP program where the Unicode Checks Active attribute is selected in the program properties (in accordance with the above rule). Unwanted subfield accesses are prohibited, just like any other unwanted accesses to structures or other parts of the working memory. If these accesses cannot be identified by the syntax check, a runtime error occurs with a descriptive short dump while the program is running.