Copyright 2024 - BV TallVision IT

As of ABAP release 7.0 EhP2: Pragmas or Program Directives can be used to hide errors and warnings from check tools, the Abap compiler syntax check and the extended program check (but not the code inspector - I'm afraid). Pragma's have no effect (affect) on the actual program flow. A pragma is very simlilar to a compiler directive, and pragma's and compiler directives should not be used together. They can be mixed, but it confuses the h.ll out of people. The pragma is the official successor of the compiler directive, which should no longer be used.

A pragma is structured like this:

##code[par][par]

Not case sensitive, no spaces. The code specifies the effect and the optional parameters (the [] brackets are not optional) may further limit the effect. Report ABAP_SLIN_PRAGMAS lists available pragma codes. If you find (like me) that the report is not very helpful, try transparent table SLIN_DESC which holds a bit more information, along which an English description (field DESCRIPTION_E). The SLIN_DESC table holds settings which are used by transaction SLIN Code inspector. The error level and todo-priority can be adjusted according to customer needs (use SM31 to apply changes if needed). Entries on this table can be grouped by key (field ID which are listed on table SLIN_CHCK).

An example use of pragmas:

DATA lv_text TYPE STRING   ##needed. 
lv_text  = 'Hello Pragmas' ##no_text. 

With a parameter the pragma can be made more specific (identifying the actual parameter the pragma is for):

DATA lv_text TYPE STRING   ##needed[lv_text].

Which would make more sense as

DATA: lv1, lv2, lv3, lv4 TYPE STRING   ##needed[lv2].

Overview of practical pragmas:

AUT Authorizations
A	AUTH_FLD_MISSING	Authorization Field Missing
A	AUTH_OBJ_OK	Authorization Object not Entered in the Table TOBJ
A	AUTH_FLD_NO	Wrong Number of Authorization Fields
A	AUTH_DOM_VAL_OK	Authorizations: Fixed Vals for Domns Falsely Entered for ID
A	AUTH_FLD_LEN	Authorizations: Field Length Too Long
C	NOCOMMENT	Authorizations: Field is duplicative
BRE Superfluous Statements
A	NO_BREAK	BREAK-POINT Statement
C	NEEDED	Obsolete statement SYNTAX-TRACE
C	NEEDED	Statement for runtime/performance measurement
B	NEEDED	Redundant statement (e.g. Var1 = Var1 )
C	NOCOMMENT	Statement contains only a Dot
A	STMNT_EXIT	Statement after EXIT/STOP/RETURN/RAISE/SUBMIT cannot be reached
C	NOCOMMENT	Pseudo comment without effect
C	NEEDED	Macro-Definition not be used
B	CALLED	Method will not be called
C	NEEDED	Duplicate macro definition
B	NEEDED	Statements for a FORM missing (empty unit, obsolete object ?!)
C	FS_UNTYPED	Untyped field symbol
B	DO_OK	No exit for DO-loop / no leave of loop
C	NEEDED	Statements between DO - ENDDO missing (endless loop, undefined result,..?!)
A	NOCOMMENT	Report Event out of  Report
C	NEEDED	Report Event out of  Report
B	NEEDED	Statements for method missing
B	NEEDED	Statements for function module missing (empty unit, obsolete object ?!)
B	NEEDED	Statements for dialog module missing (empty unit, obsolete object ?!)
B	NEEDED	Statements for macro missing
C	NEEDED	Statements between TRY-ENDTRY missing
C	NEEDED	Statements between WHILE-ENDWHILE missing (performance, endless loop,..)
C	NEEDED	Statements between LOOP-ENDLOOP missing (performance,..)
C	NEEDED	Code between SELECT-ENDSELECT miss.(performance, uncontrolled result,..)
C	NEEDED	Statements between IF--ENDIF missing
C	NEEDED	Statements between ELSE-ENDIF missing
C	BOOL_OK	Condition is redundant
B	BOOL_OK	Condition is always true
B	BOOL_OK	Condition is always false
C	BOOL_OK	Condition is redundant
C	BOOL_OK	Condition is redundant
C	BOOL_OK	Condition is always true
B	BOOL_OK	Condition is always false
C	BOOL_OK	Condition is redundant
CAL CALL FUNCTION Interfaces
A	EXISTS	Called up function module does not exist
A	FM_PAR_MIS	Function Module Parameter Is Not Called
A	ARG_OK	Function Module Parameter Missing
A	EXCEPT_TRY	Class-based exception is not handled
A	FM_OLDED	Called function module marked as "obsolete"
B	NOCOMMENT	Update function module called with useless parameters
A	FM_SUBRC_OK	Access to Undefined Return Code After CALL FUNCTION
B	FM_SUBRC_OK	Return Code of FM-EXCEPTION ignored (use exception xx = 0  or Code IF RC...)
B	NOCOMMENT	Wrong order for asynchron RFC addition
A	NOCOMMENT	Asynchronous RFC with Empty DESTINATION Clause
A	FM_UPDATE_OK	Update Module with Invalid Statement
B	FM_RAISE_OK	For RAISE-statement  the related EXCEPTION is missing in function module
B	EXCEPT_OK	EXCEPTION in FM has no RAISE in function group
B	FM_UPDATE_OK	Function module is no update module
B	FM_RFC_OK	Function module is not a RFC function
B	FM_DEST_OK	RFC with incorrect DESTINATION Specification
A	NOCOMMENT	RFC with Incorrect TASK Specification
A	NOCOMMENT	RFC with Incorrect GROUP Specification
C	FM_NO_TYPE	Missing type declaration of "formal" parameter
B	NOCOMMENT	RFC with incorrect Argument Call
C	RAISE_OK	No use of MESSAGE RAISING
B	NOCOMMENT	Source for function module missing in function group
B	NOCOMMENT	Usage of syntax: KEEPING LOGICAL UNIT OF WORK
B	IS_SUPP_OK	IS SUPPLIED used for a parameter of a remote function module
C	FM_EXCEPT_OK	Name of EXCEPTION starts with CX
A	ARG_OK	Function Module Exception Missing
B	NOCOMMENT	RFC without RFC specific exception
B	NOCOMMENT	asynchronic RFC with application specific EXCEPTION
B	NOCOMMENT	RFC without Exception Handling
B	NOCOMMENT	RFC use for an Application Exception a System Exception
B	NOCOMMENT	RECEIVE Statement with EXPORTING Clause
A	NOCOMMENT	Warning of Syntax Check with Very High Change Priority
DAT Field Attributes
A	SEARCH_HELP_OK	Undefined Search Help
A	FS_ASSIGN_OK	Field-Symbol not assigned
A	VALUE_OK	Initial Value Too Long for Field Type
A	NEEDED	Reference is not written
B	FIELD_HYPHEN	Field name with "-" (no Dictionary)
B	NEEDED	Unused fields
B	NEEDED	Unused TYPE Pool
B	NEEDED	No read for fields
B	NEEDED	Field symbol not used
C	NEEDED	Unused Field (Include is shared)
C	NEEDED	No read for fields (Include is shared)
C	FLD_TYPE_NAME	Misleading field name
B	SECTION_OK	PROTECTED SECTION in final Class
C	CLASS_FINAL	Class is final
A	TIME_ARITH	Calculations with Time Stamp Fields
B	TIME_ASSIGN	Assignment for time stamp field
B	TIME_COMP	Comparison of time stamp field
C	NEEDED	Reference (without instance access) not written
C	NEEDED	SY-INDEX used out of WHILE/DO iteration
C	ASSIGN_OK	Write access to a non writable field
B	NEEDED	Type has no Use
B	NEEDED	Lokale Klasse wird nicht benutzt
DYC Dynpro Consistency
B	NOCOMMENT	Errors in screens
B	CALLED	Errors in screens
B	NOCOMMENT	Screen number field is not of type N
ESY Test Environment
A	NOCOMMENT	Program contains syntax errors
A	NOCOMMENT	Program contains generation errors
A	NOCOMMENT	Internal Error: program contains scan errors
A	NOCOMMENT	Internal Error: SCAN WITH STRUCTURE Is Inconsistent
A	NOCOMMENT	Program contains space characters
A	NOCOMMENT	The function module definition has no TFDIR entry
A	NOCOMMENT	Program with invalid namespace
A	NOCOMMENT	Program source text cannot be read
B	NOCOMMENT	Function group has not program type F (->attributes)
A	NOCOMMENT	Program contains inconsistent time stamp
A	NOCOMMENT	Programm source cannot be analyzed
A	NOCOMMENT	Program package has no TDEVC entry
A	NOCOMMENT	Program has no Object Directory entry
C	NOCOMMENT	Duplicated Call of SET EXTENDED CHECK OFF
C	NOCOMMENT	Call of SET EXTENDED CHECK ON missing
A	NOCOMMENT	Pseudo comments contains unvalid character (for space)
A	NOCOMMENT	Program contains inactive program INCLUDES
B	NOCOMMENT	External referenced Program contains syntax errors
A	NOCOMMENT	Invalid test program (INCLUDE or no TRDIR entry)
A	NOCOMMENT	Cannot change program in current system
B	NOCOMMENT	Exchange SET EXTENDED CHECK with pragmas
A	NOCOMMENT	Program has a transport mismatch
A	NOCOMMENT	Internal Tool Error: ASSERT Condition Violated
GES SET/GET Parameter IDs
A	GS_TWENTY	GET/SET Parameters: Field Length Too Long
A	EXISTS	GET/SET-Parameter Not Entered in TPARA
HEL Programming Guide Lines
B	NOCOMMENT	EXIT Statement out of a LOOP
C	NOCOMMENT	CHECK Statement out of a LOOP
B	NOCOMMENT	Possible Read Access before Write Access
C	NOCOMMENT	CHANGING parameter has no write access
C	NOCOMMENT	Use of a numeric literal
B	NOCOMMENT	Unicode checks are inactive
B	NOCOMMENT	Fixpoint arithmetic is not active
B	NOCOMMENT	No valid mathematical notation
B	INCL_OK	Include is shared
B	NOCOMMENT	Use of a non class bases exception
B	NEEDED	Program uses global fields
B	NOCOMMENT	Program uses the TABLES statement
C	NOCOMMENT	EXPORTING parameter has no direct write access
C	NOCOMMENT	EXPORTING parameter has no write access
C	NOCOMMENT	IMPORTING parameter has no read access
LOA Check Load Sizes
A	NOCOMMENT	Potential Generation Bottleneck: Load Table Over 98% Full
A	NOCOMMENT	Potential Generation Bottleneck: Load Table Over 90% Full
MES Message
A	MG_MISSING	T100 MESSAGE Not Defined
A	MG_MISSING	MESSAGE call contains the wrong number of WITH parameters
B	MG_ARG_LEN	MESSAGE-parameter too long
B	MG_USER	MESSAGE within customer namespace
A	MG_MIS_ATT	Missing Attribute in Exception Class for T100 Message
B	MG_WRN_ATT	Wrong Attribute in Exception Class for T100 Message
MLS Internationalization
A	STRING_OK	Character String in Source Code Contains Invalid Characters
A	DATE_FORMAT	Not all supported date formats are handled
A	DATE_FORMAT	It is possible that not all supported date formats are handled
B	TEXT_CHAR	Text element ends with "Umlaut" (unvalid character within unicode)
MOD Modifications
B	NOCOMMENT	Modification Assistant bracket structure is inconsistent
NOC No Use
OPF Output CURR/QUAN Fields
A	UOM_IN_MES	Display of CURR Field Without CURRENCY Addition
A	UOM_IN_MES	Display of a UNIT Field Without a UNIT Addition
B	UOM_IN_MES	Output of UNIT-Field without UNIT-addition with DECIMALS
PAC Package Check
PER PERFORM/FORM Interfaces
A	PERF_NO_FORM	There is no subroutine for this PERFORM call
A	PERF_NUM_ARGS	Wrong number of parameters for this PERFORM call
A	PERF_TABLE_CATEGORY	Undefined TABLES Parameter for This PERFORM Call
A	COMPATIBLE	Formal Parameter Incompatible with Actual Parameter
A	PERF_INCL_OK	External PERFORM in an INCLUDE
A	COMPATIBLE	STRUCTURE Parameter too Short for the Formal Parameter
A	LIT_COMPATIBLE	Literal Incompatible with Formal Parameter
A	NOCOMMENT	Program source text cannot be read
B	PERF_CAT_OK	Parameter categories do not match (USING/CHANGING)
B	CALLED	FORM not be called
B	PERF_GLOBAL_PAR_OK	FORM-Parameter will also be used globally
C	CALLED	FORM not be called (Include is shared)
C	PERF_NO_TYPE	Missing type declaration of "Formal" parameter
A	NOCOMMENT	Warning of Syntax Check with Very High Change Priority
B	PART_OK	COMMON PART definition is different
PFS GUI Status and Titlebar
A	STAT_UNDEF	GUI Status Not Defined
A	TITL_UNDEF	TITLE not Defined
B	NOCOMMENT	STATUS-definition in Formpool
B	NOCOMMENT	SET TITLE call in Formpool
C	STAT_PROG	Program without GUI-Status
PUT Cross-Program Checks
B	CONST_WRITE	Constant overwritten
A	CURSOR_LOST	SELECT Loop contains statement that destroys cursor
C	CURSOR_LOST	SELECT-Loop with PERFORM-call (potential Cursor lost)
B	LIT_INCOMP	Character/Literal transferred to incompatible parameter
C	NOCOMMENT	INCLUDE not used
A	LOOP_ASSIGN	Use of ASSIGN or UNASSIGN on field symbol forbidden
C	NOCOMMENT	Includes of class are obsolete -> SE24/SE80 cleanup class includes
A	NOCOMMENT	text element longer than the formal parameter
SEC Security Checks
A	NOCOMMENT	Hard coded username
B	NOCOMMENT	User-dependent program flow
A	NOCOMMENT	Possible SQL injection
A	NOCOMMENT	Possible Directory Traversal
A	NOCOMMENT	Possible system command injection
A	NOCOMMENT	Possible ABAP command injection
A	NOCOMMENT	Possible SQL injection
A	NOCOMMENT	Possible SQL injection
B	NOCOMMENT	Possible SQL injection
B	NOCOMMENT	Possible SQL injection
A	NOCOMMENT	Possible SQL injection
A	NOCOMMENT	Possible SQL injection
A	NOCOMMENT	Possible SQL injection via Object Services
A	NOCOMMENT	Possible Directory Traversal vie File Utilities class
A	NOCOMMENT	Possible SQL injection via ADBC (DDL)
A	NOCOMMENT	Possible SQL injection via ADBC (DML)
A	NOCOMMENT	Possible Cross Site Scripting
C	NOCOMMENT	Possible Response Header Tampering
C	NOCOMMENT	User controlled dynamic object creation
C	NOCOMMENT	User controlled dynamic procedure call
A	NOCOMMENT	User controlled dynamic program unit call
C	NOCOMMENT	User controlled dynamic transaction call
C	NOCOMMENT	User controlled dynamic transaction call
B	NOCOMMENT	Usage of an obsolete Escaping method
A	NOCOMMENT	In Tag htmlb:content the attribute forceEncode="enabled" is missing
A	NOCOMMENT	In Tag htmlb:content an obsolte Design is specified, or none at all
A	NOCOMMENT	AUTHORITY-CHECK without processing of sy-subrc
A	NOCOMMENT	Call of System Function CALL 'SYSTEM'
A	NOCOMMENT	AUTHORITY-CHECK for specified User
A	NOCOMMENT	SUBMIT for specified User
C	NOCOMMENT	The dynamic WHERE condition allows a potential code injection.
A	NOCOMMENT	Authority Check before CALL TRANSACTION
STE Structure Enhancements
A	NOCOMMENT	Structural Enhancement by Customer (Very Serious Problem)
A	NOCOMMENT	Structural Enhancement by Customer (Serious Problem)
A	NOCOMMENT	Structural Enhancement by Customer (Medium-Priority Problem)
B	NOCOMMENT	Structural Enhancement by Customer (Low-Priority Problem, semantic change)
SUB External Program Interfaces
A	TSTC_MISS	Transaction Code not Entered in TSTC
A	SUB_PAR	SUBMIT Parameter Does Not Exist
A	SUB_SELOP	SELECT-OPTION Missing for SUBMIT Parameters
A	TDCT_MISS	Dialog module is not entered in the TDCT
A	SUB_NO_REP	Report called using SUBMIT is not Type 1
A	USER_SMOD	User Exit Enhancement Missing
A	USER_FM	Function Module with Interface Missing in Func. Group (X..)
B	USER_FM	FM is not deactivated by TMOD/SMOD
A	SUB_FR_SEL	Report called using SUBMIT has no dynamic selections
TXT Character Strings
A	NO_TEXT	Text Element Missing in a Character String
A	TEXT_POOL	Text Element not Defined in Text Pool
B	TEXT_UNIQ	Different character strings with same Text element-ID
B	TEXT_DIFF	Text element vs. program defined different
B	TEXT_USE	Text element not being used (translation effort !)
B	SHARE_OK	Text element within shared INCLUDE
B	NOCOMMENT	Unnecessary selection text
C	SEL_WRONG	Selection text not yet maintained
A	NOCOMMENT	Text Pool Inconsistent
C	NO_TEXT	For a character string the text element is missing
C	TEXT_DUP	Character Literal with duplicate text element
UNR Problematic Statements
A	WHEN_DOUBLE_OK	CASE Statement with Identical WHEN Conditions
A	LOOP_AT_OK	LOOP with WHERE/TO condition contains an AT (Warning)
A	LOOP_TO_OK	The TO limit in the LOOP is overwritten in the loop body
A	PREFIX_OK	Name begins with a reserved prefix '%_'
A	FREE_MEMORY_OK	FREE MEMORY Statement Without ID Entry
A	INCL_TYPE_OK	INCLUDE Program Is Not Type I
A	WHEN_CHAIN_OK	WHEN Statement Written in Chained Statement
B	NO_HANDLER	Exception handling is empty
A	NO_HANDLER	Exception Handling Empty
A	STOP_IN_MODULE	STOP Statement in MODUL Definition
C	CATCH_ALL	Exception handling with CX_ROOT
B	WRITE_OK	SY-Field overwritten
A	NO_HANDLER	Exception Handling Empty
B	DECL_EVENT	Declaration within event
B	STR_NUM	Unnecessary conversion CHARACTER-LITERAL (String, Text,..) to INTEGER
A	LOAD_STMNT_OK	LOAD-OF-PROGRAM Event with Invalid Statement
B	DUPL_EVENT	Duplicate definition of program event
B	RAISE_NO_FM	RAISE-statement outside of function group
B	NEEDED	EXPORTING-parameter not be used/called
A	STOP_IN_FM	STOP Statement in Function Module
B	MODUL_IN_POOL	MODULE-statement in FORM-POOL
B	GEN_OK	Unnecessary  Generic ("Generizität")
B	ENDLESS_CALL	Procedure calls have an endless loop
B	NOCOMMENT	Default CASE is a Literal (String, Text,..)
C	ASSIGN_LEN	ASSIGN above field limit
C	DECL_MODUL	Declaration in Module (Offset w/o Length definition)
C	WRITE_MOVE	WRITE TO statement can be replaced by MOVE
C	LOOP_AT_OK	LOOP with FROM-restriction contains AT (Info)
C	BLANK_OK	Comparison ignores closing spaces
A	WRITE_OK	Important SY Field Is Overwritten
B	TYPE_CHAIN_OK	Missing type definition within a chained statement
C	TYPE_CHAIN_OK	Missing type definition within a chained statement (_N)
B	SUBRC_AFTER_COMMIT	Handling of SY-SUBRC after COMMIT WORK
B	NOCOMMENT	CONNECTION name without braces
B	NOCOMMENT	CONNECTION name without braces
B	NO_HANDLER	Exception handling is empty for CX_..
B	NO_HANDLER	Exception of category CX_NO_CHECK  not handled
B	NO_HANDLER	Exception of category  CX_DYNAMIC_CHECK  not handled
B	NO_HANDLER	Exception of category  CX_STATIC_CHECK not handled
B	SUBRC_READ	Reading of SY-SUBRC without Setting
C	CHAIN_OK	Dubious Chained Statement
A	SAPRL_OK	Compare of SY_SAPRL with an Integer field
A	NOCOMMENT	Important SY Field Is Overwritten
B	INCL_OK	INCLUDE without statements/code
C	INCL_OK	INCLUDE with only one statement (only comments,..)
A	LOOP_INDEX	Index Access to Internal Table Outside a LOOP
C	LOOP_INDEX	Index access to internal table outside LOOP (within FORM)
A	INDEX_NUM	Non-Numeric Index Access to an Internal Table
A	NOCOMMENT	Changing Access on Internal Table with Control Level Processing
B	NOCOMMENT	Changing Access on Internal Table with Control Level Processing
WOO Outdated Statements
B	NOCOMMENT	Command raises syntax error within ABAP-OO context
B	NOCOMMENT	Command raises warning within ABAP-OO context
C	NOCOMMENT	Command raises serious warning within ABAP-OO context
WRN Syntax Check Warnings
A	NOCOMMENT	Warning of Syntax Check with Very High Change Priority
A	NOCOMMENT	Warning of Syntax Check with High Change Priority
A	NOCOMMENT	Warning of Syntax Check with Medium Change Priority
B	NOCOMMENT	Warning with medium priority
B	NOCOMMENT	Warning with medium priority (no pseudo comments)
+95 more