ABAP - Keyword Documentation →  ABAP - Reference →  ABAP Syntax →  Program Directives → 

Pragmas

Pragmas are program directives that can be used to hide warnings from various check tools. The following are supported:

For more information, see:

Syntax of Pragmas

A pragma is structured as follows:

##code[par][par]... ,

is not case-sensitive and does not contain blanks. The pragma code (code) specifies the effect; parameters (par) may further limit the effect.

A message is affected by a pragma if all the parameters specified match the concrete parameters. The concrete parameters can also be found in the long text of the message. Compulsory parameters are underlined in the long text and must not be omitted. Some parameters are optional. Optional parameters can be omitted by using an empty pair of square brackets [] in the appropriate position or by completely omitting an end part.

Notes

Example

An example of a pragma for syntax check warnings is:

##SHADOW

This pragma can be used to hide a syntax warning in a method definition that warns that a predefined function is obscured. The pragma has an optional parameter in which the name of the function can be specified as well.

##SHADOW[SUBSTRING]

Warnings about "SUBSTRING" is suppressed using

but not using SHADOW[FIND].

Example

An example of pragmas for hiding warnings from the extended program check is provided below.

DATA TEXT TYPE STRING   ##needed.
text  = 'Hello Pragmas' ##no_text.

Examples

In some examples for key accesses to internal tables (read, delete), syntax warnings are hidden by the relevant pragma. The pragmas were found in the long text of the syntax warnings (i button selected).

Positioning of Pragmas in ABAP Source Code

A pragma applies to the current statement, that is, for the statement that ends at the next "." or ",". Pragmas in front of the ":" of a chained statement apply to the whole chained statement. Pragmas that occur when calling a macro apply to all statements of the macro.

Pragmas must only occur at certain positions in the source code for reasons of readability:

Unknown pragmas or pragmas with formal errors or pragmas in the wrong position or with incorrect parameters themselves produce syntax warnings. Pragmas in the wrong position for syntax check warnings are ignored.