无法识别内联声明的变量

发布于 2025-01-09 03:58:37 字数 468 浏览 0 评论 0原文

我遇到一个问题,系统无法识别我声明的局部变量。代码如下:

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.

该程序在我在程序中输入的行中给出了一个错误,其中显示“没有 LV_DMBTR 语句。请检查拼写。

”知道问题可能出在哪里吗?

提前谢谢大家!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼角的笑意。 2025-01-16 03:58:37

该行在

lv_dmbtr / 10000000 = lv_tenmillions.

语法上确实不正确。我和 ABAP 解释器一样对这行代码感到困惑。所以我不确定你到底想用它来完成什么。但我猜测这似乎是对某个变量的某种计算赋值。在赋值中,分配给的变量始终位于= 符号的左侧,而创建值的表达式位于右侧 = 符号的 >。

因此,等号左边有一个数学公式是没有意义的。

要么你想说“lv_tenmillion 应为 lv_dmbtr 除以 10000000”。在这种情况下,正确的行是

lv_tenmillions = lv_dmbtr / 10000000.

或者您试图说“lv_dmbtr 的百万分之一应等于 lv_tenmillion”,这相当于说“lv_dmbtr 应等于 lv_tenmillion 乘以 10000000”或

lv_dmbtr = lv_tenmillions * 10000000.

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.
孤芳又自赏 2025-01-16 03:58:37

试试这个:

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.

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文