-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$-variables will be deleted even though they are used #202
Comments
This seems to be true for any special character. I've tried it with |
Is this something that can or will be fixed? |
Hi Clemens, wow, I've never seen such a variable. Which ABAP release are we talking about here? We'd have to find out what exactly the naming conventions were at the time. Kind regards, |
Programs are supporting these variable names even on S/4 release 7.57. 😉 |
Hi ConjuringCoffee, you're right, I just tried that … ABAP really goes to great lengths to be downward compatible! However, I didn't find anything on this supported legacy naming in the documentation yet, will ask our documentation expert about it. Kind regards, |
We are currently on 757. I don´t know where this originated from. |
Hi Clemens, here's the result of some trial and error: REPORT zany_report.
" accepted in non-OO context:
DATA: $a, a$.
DATA: %a, a%.
DATA: *a, a*.
DATA: ?a, a?.
DATA: <a. " but NOT a>
DATA: &a. " but NOT a&
DATA: !a. " but NOT a! This declares the variable a (to be used with or without the '!')
DATA: a#. " but NOT #a
DATA: a>. " but NOT >a or a>a
" not possible in Unicode programs (warning)
DATA: -a, a-.
" not possible in Unicode programs (error)
" DATA: a<.
" DATA: a&.
" DATA: a!.
" DATA: #a.
" DATA: >a, a>a.
" DATA: a;.
" DATA: a=.
" DATA: a}.
" DATA: a|.
" DATA: §a, a§.
" DATA: €a, a€.
" DATA: °a, a°.
" DATA: ^a, a^.
" DATA: ~a, a~.
" DATA: [a, [a.
" DATA: ]a, ]a.
" DATA: {a, a{.
" DATA: @a, a@. Usually, if Do you have the impression that my 'accepted in non-OO context' section covers the special characters that you see in those 75%, or do you even have variable names that are not allowed in unicode programs? Kind regards, |
I have seen quite a bit of standard code with |
The only version which i have ever seen is $a with variables - *a is also used but only for table-statements. |
Hi, the more you experiment, the more shocking it gets: " accepted in non-OO context:
DATA: $, %, ?.
" marked in red by ADT, but no syntax error:
DATA: * TYPE i, < TYPE i, & TYPE i.
< = 1.
* = 2.
& = < + *.
IF < + * * < < & * < + *.
< = & + *.
ENDIF.
WRITE: / <, *, &. or, as a screenshot: Try to guess the result of the WRITE statement! With the help of the program DEMO_CHARACTERS_IN_ABAP_NAMES, I now figured out the following regarding characters used in data objects / data types / procedure names / procedure parameters in Unicode programs:
I shall try to adjust ABAP cleaner accordingly! Kind regards, |
Hi Clemens, thank you very much for reporting this! This should be fixed with the next release, meaning that ABAP cleaner should then correctly recognize all of the following variable names in a non-object-oriented context: FORM any_form.
DATA: %a, %_a, a%b, a%, %. " %_a is even possible in an OO context
DATA: $a, $_a, a$b, a$, $.
DATA: ?a, ?_a, a?b, a?, ?.
DATA: *a, *_a, a*b, a*. " * alone would be marked in red
DATA: &a, &_a. " & is only possible as the first char
DATA: <a, <_a. " < is only possible as the first char
DATA: a#b, a#. " # is only possible as a non-first char
DATA: a>. " > is only possible as the last char and only if the first char is NOT <
ENDFORM. The forms with Kind regards, |
Hi Clemens, thanks a lot for reporting this, I really wonder why it came up only now! – Anyway, this should now be fixed with version 1.11.2, which was just released! Kind regards, |
Hi Jörg-Michael, no, thank you so much! ABAP-Cleaner is awesome and it helps us a lot with making legacy code a bit more easy on the eyes! That was an important fix for us - thanks for implementing this so fast! Kind regards, |
Hi Clemens, that's great to hear, very happy that I could help! Kind regards, |
Sadly some legacy code of ours uses variables with the "$" prefix. ABAP-Cleaner deletes the definition no matter what.
Here a quick example.
Before:
After:
Thank you in advance!
The text was updated successfully, but these errors were encountered: