Copyright 2024 - BV TallVision IT

Compiler directives can be used to indicate that the error should no longer be listed in the code inspector. It's a way to make problems disappear, by the hand of the developer who chose to add the directive. If the choice is founded - the whole setup works. If the developer just runs through the code inspector errors to put a directive behind them - he/she should leave the errors as-is. A compiler directive that has been put in place incorrectly is a developers sin. Should never happen. Ever.

 An example of the use of compiler directives: we run the code inspector on the following short program: 

DATA lv_TEXT TYPE STRING. 

lv_TEXT  = 'Hello directives'.

The code inspector would throw a warning about the use of variabele lv_TEXT as it is defined and assigned a value, but it is never used. The definition of the parameter will get directive NEEDED. Then the line that assigns a value to the parameter will show up in the code inspector as a value that should be set up as translatable. Directive NO_TEXT will take care of that. Adding (001)and double clicking on it in the editor. Text-001 will be created and the text is assumed translatable from that moment on.

DATA lv_TEXT TYPE STRING. "#EC NEEDED

lv_TEXT  = 'Hello directives'. #EC NO_TEXT

An important note is the directive that can be used to disable a code inspector error is indicated on the same code inspector error.

So what to do if there are multiple violations on the same line ? Won't happen very often, you should solve at least one of the issues or use compiler directive #EC * .

Please note: there is also pragmas which were introduced after compiler directives.