Skip to content

Rule - Resolve equals sign chain into several commands with variables in different formats #173

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

Closed
thorsten79G opened this issue Oct 25, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@thorsten79G
Copy link

Hello,

Maybe the coding is not the ideal way for the conversion, but the cleaner leads to an initial value.
The sql statement is used to read a float value. In this example, the value is a characteristic in the format date. Therefore, the float value is to be converted into a date field.
For this purpose, a second variable lv_numc8 is used because a direct conversion from float to date is not possible. First, the float value is converted into the variable lv_numc8. In the second step, the numeric value is converted into the date variable. For convenience, this is in one line.

DATA lv_numc8 TYPE n LENGTH 8.
DATA lv_datum TYPE datum.

SELECT SINGLE
    FROM ausp
    FIELDS atflv
    WHERE objek = @lv_objek
      AND atinn = @lv_atinn
      INTO @DATA(lv_float_value).
IF sy-subrc = 0.
 lv_datum = lv_numc8 = lv_float_value.
ENDIF.

Using the cleaner the result looks like this:

SELECT...
IF sy-subrc = 0.
 lv_numc8 = lv_float_value.
 lv_datum = lv_float_value.
ENDIF.

In this particular case, where there is an assignment with different formats, the value is lost.

@jmgrassau jmgrassau added the bug Something isn't working label Oct 25, 2023
@jmgrassau jmgrassau self-assigned this Oct 25, 2023
@jmgrassau
Copy link
Member

Hi Thorsten,

thanks very much for this example! That was indeed not correctly considered yet, so I guess we must change the cleanup rule "Resolve equals sign chain into several commands" to never repeat the final term, but instead to always do the assignments step by step:

  " input:
  a = b = c = d = <any term>.

  " output:
  d = <any term>.
  c = d.
  b = c.
  a = b.

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi Thorsten,

okay, with the next release, this cleanup rule will now always make sure that all conversion steps are kept. This is also true if the rightmost term is a literal:

image

I also added this to the description:

image

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

P.S.: This also means that the options …
image
… were now removed.

@jmgrassau
Copy link
Member

Hi Thorsten,

thanks again for reporting this bug! The issue should now be fixed in version 1.9.0, which was just released.

Kind regards,
Jörg-Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants