Frank
Frank

Reputation: 183

The inline-declared variable is not recognized

I am having a problem where the system does not recognize a local variable that I have declared. The code is as follows:

DATA(lv_dmbtr) = ZSD_LGS-DMBTR.

  IF ( lv_dmbtr MOD 10000000 ) LE 9.
    lv_dmbtr / 10000000 = lv_tenmillions.      //Error line
    lv_tenmillions_check = lv_tenmillions MOD 1.

    IF lv_tenmillions_check > 0.
     "Convert
   ENDIF.

   IF lv_tenmillions_check < 0.
     "ZERO
   ENDIF.
  ENDIF.

The program gives me an error in the line that I have input in the program, where it says "There is no LV_DMBTR statement. Please check the spelling."

May anyone of you know where the problem may be?

Thank you all in advance!

Upvotes: 0

Views: 148

Answers (2)

MrSamael
MrSamael

Reputation: 5

Try this:

DATA(lv_dmbtr) = ZSD_LGS-DMBTR.
lv_dmbtr  = ZSD_LGS-DMBTR MOD 10000000
  IF lv_dmbtr MOD 10000000 LE 9.
    lv_dmbtr / 10000000 = lv_tenmillions.      //Error line
    lv_tenmillions_check = lv_tenmillions MOD 1.

    IF lv_tenmillions_check > 0.
     "Convert
   ENDIF.

   IF lv_tenmillions_check < 0.
     "ZERO
   ENDIF.
  ENDIF.

Upvotes: 0

Philipp
Philipp

Reputation: 69663

The line

lv_dmbtr / 10000000 = lv_tenmillions.

is indeed not syntactically correct. I am as confused by that line as the ABAP interpreter. So I am not sure what exactly you are trying to accomplish with it. But I would guess that it seems to be some kind of assignment of a computation to some variable. In an assignment, the variable you assign to is always on the left of the = sign, while the expression which creates the value is on the right of the = sign.

So having a mathematical formula on the left-hand side of an equal sign makes no sense.

Either you are trying to say "lv_tenmillion shall be lv_dmbtr divided by 10000000". In that case the correct line would be

lv_tenmillions = lv_dmbtr / 10000000.

Or you are trying to say "one millionth of lv_dmbtr shall be equal to lv_tenmillion" which would be equivalent to saying "lv_dmbtr shall be equal to lv_tenmillion multiplied by 10000000" or

lv_dmbtr = lv_tenmillions * 10000000.

Upvotes: 2

Related Questions