Skip to Content
avatar image
Former Member

How to correct Message Code HEL 0510 ?

how can I correct this warning ?

Programa: YY_TEST Línea: 8 [Prio 3]
Do not declare fields and field symbols (GLB_TXT) globally.
Deactivatable using pragma ##NEEDED. Message Code HEL 0510

this is the ABAP code -->

REPORT yy_test.

DATA glb_txt TYPE string.

glb_txt = 'HELLO WORLD !'.

WRITE / glb_txt.

Add comment
10|10000 characters needed characters exceeded

  • Does the warning appear in normal syntax check or in extended syntax check SLIN? What are the settings in the latter?

  • Former Member

    The warning appears in transaction code SLIN and SCII ( code inspector )

    The setting in transaction code SLIN is only one option --> "Programming Guidelines"

  • Get RSS Feed

3 Answers

  • Best Answer
    Nov 09, 2017 at 07:32 AM

    The message is a warning from extended program check (SLIN) that occurrs only, if in SLIN the checks for Programming Guidelines are switched on.

    Of course it is recommended to check this, but you don't have to.

    In order to circumvent the message, you have to program according to the programming guidelines

    Do not declare global variables

    and avoid global data by implementing your code in (local) classes.

        CLASS-DATA var TYPE i.
        CLASS-METHODS main.
      METHOD main.
        cl_demo_output=>display( var ).
      cls=>main( ).
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 07, 2017 at 05:58 PM

    Which release are you on? There is no HEL message class in EHP6.

    The message is quite self-explanatory though. In a nutshell, it doesn't like that you're declaring the variable at the top (=global) and then just using it everywhere. In case of a "hello world" program it's not really a problem IMHO (although some folks here might disagree :) ). But how to change this is up to you. I suspect it'll become apparent when you move on to learning about modularization.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 07, 2017 at 05:58 PM

    1) You can move the Data declaration to be within the START-OF-SELECTION

    2) Suppress the message by suffixing for your declaration :
    DATA glb_txt TYPE string. ##NEEDED

    Hope this helps.

    Add comment
    10|10000 characters needed characters exceeded

    • 1). "Oops". for this specfic report, the declaration should move with a form routine

      2) (Based on the approach you have given) :
      Some project quality deliverables, recommend, the Extended check to be free of errors/warnings, with no changes in SLIN parameters. These QA document other wise known as "Code review checklist".
      Here, ECCheck is run, downloaded and attached to the document

      In such cases use of Pragmas "##" can not be avoided.

      Good, that this a "Hello world" program, the warning can be avoided with Object Oriented approach.
      In real time scenario, if its 2000 lines of procedural code, this approach is close to impossible. The change request on the development, will have the whole program re-written just to avoid a warning in ECCheck :-D

      Take the case, the usage of a SELECT-OPTIONS parameters. These are inevitable global variables, that has to pass through ECCheck. (if there is no choice of keeping the warning)

      The suggestive approach is to use Pragmas - "##", telling the system : "Hey !! there is nothing i can do about this warning, but to bypass it"