Get Example source ABAP code based on a different SAP table
• ## ABAP_ELEMENT
Pragmas
ABAP_SYNTAX ... ##code[par][par]...>
What does it do? Pragmas are program directives> that can be used to hide warnings from various check tools. BEGIN_SECTION VERSION 5 OUT The following are supported:
Warnings from the ABAP Compiler syntax check>
Warnings from the extended program check> END_SECTION VERSION 5 OUT A pragma is not case-sensitive and does not contain blanks. The pragma code (code>) determines the effect and parameters (par>) further restrict the effect if necessary. A warning is affected by a pragma if all the parameters specified > match the concrete> parameters. The concrete parameters can also be taken from the long text of the message. Compulsory> parameters are underlined in the long text and must not be omitted. Non-compulsory parameters are optional. Optional parameters can be omitted using empty parentheses []> at the appropriate position or by completely omitting an end part. A pragma applies to the current statement, that is to the statement that ends at the next .> or ,>. Pragmas in front of the :> of a chained statement apply to the entire chained statement. BEGIN_SECTION VERSION 5 OUT Pragmas that are used when calling a macro> apply to all statements of the macro. END_SECTION VERSION 5 OUT Pragmas must only be used at specific positions in the source code for reasons of readability, namely:
At the start> of a line, after any number of blanks
At the end> of a line, only followed by .>, ,>, or :>.
Not> after> .>, ,>, or :>. Multiple pragmas may be positioned one after another, separated by blanks, at allowed positions. Unknown, formally incorrect, or incorrectly parameterized pragmas produce a syntax warning. Incorrectly positioned pragmas for warnings in the syntax check have no effect.
Latest notes:
For a system check warning, the existence of a pragma and its rules can be checked using the long text of the message>, which in this case always exists. The description of a message in the extended program check also indicates the pragma that can be used to hide it.
A pragma in a type definition made using TYPES>> ,for example, to hide the warning for redundant secondary keys of table types, can also be applied to data declarations using DATA>> in the case of non-generic types and related statements that reference the data type using TYPE> >. If a reference is made to a generic data type defined using TYPES>, that is, a table type for which no primary table key is defined, a pragma specified there is not applied to the data declaration, since it uses a full table type implicitly and the pragma must potentially be specified again. NON_V5_HINTS
Pragmas replace the previously used pseudo comments> to hide warnings from the extended program check. These pseudo comments are therefore obsolete and should no longer be used. The program ABAP_SLIN_PRAGMAS>> shows which pragmas are to be used instead of the obsolete pseudo comments.
In a program that uses pragmas to deactivate warnings, the statement SET EXTENDED CHECK>> and the pseudo comment> #EC *> can no longer be used and produce an extended program check warning that cannot be deactivated. ABAP_HINT_END BEGIN_SECTION SAP_INTERNAL_HINT While pragmas for the ABAP compiler are stored internally, other pragmas, especially those for SLIN>, are stored as external pragmas in database table TRPRAGMA> as transportable objects and have respective TADIR> entries. The ABAP Workbench (SE80>) allows insertion of user-defined pragmas into TRPRAGMA>. Those can be used in programs without raising a syntax warning but are not evaluated by the ABAP compiler or other ABAP tools. The addition WITH PRAGMA> of the SCAN> statement evaluates all pragmas in statements. END_SECTION SAP_INTERNAL_HINT
BEGIN_SECTION SAP_INTERNAL_HINT Allowed pragmas are those for the ABAP compiler and external pragmas from database table TRPRAGMA>. A user-defined pragma in database table TRPRAGMA> can be used in a program but is not evaluated by the ABAP compiler or other ABAP tools. Wrong positioned pragmas for the extended program check suppress the respective warning, but nevertheless are regarded as formally incorrect and produce a syntax warning. END_SECTION SAP_INTERNAL_HINT
ABAP_EXAMPLE_VX5 The following is an example of a pragma for syntax check warnings: ##SHADOW> This pragma can be used to hide a syntax warning in a method definition that reports the hiding of a built-in function. The pragma has an optional parameter in which the name of the function can be specified as well. ##SHADOW[SUBSTRING]> A warning about SUBSTRING> is suppressed using one of the following:
##SHADOW>
##SHADOW[SUBSTRING]>
##SHADOW[]> but not using SHADOW[FIND]>. ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 An example of pragmas for hiding warnings from the extended program check is: DATA TEXT TYPE STRING ##needed.> text = 'Hello Pragmas' ##no_text.> ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 In some executable examples for key accesses to internal tables ( read>, delete>), syntax warnings are hidden by the associated pragma. The pragmas are found in the long text of the syntax warnings. ABAP_EXAMPLE_END