将 SELECT 结果分配给字段符号 GETWA_NOT_ASSIGNED

发布于 2024-08-02 23:46:55 字数 838 浏览 3 评论 0原文

我很困惑为什么注释掉的查询不起作用。


REPORT  z_hello_world_local.

TYPES:  BEGIN OF bkpf_type,
          xblnr          TYPE bkpf-xblnr,
        END OF bkpf_type.

DATA: t_bkpf                 TYPE TABLE OF bkpf_type.

FIELD-SYMBOLS:  <bkpf>        TYPE bkpf_type.


*This query does not work?
*SELECT xblnr
*      INTO CORRESPONDING FIELDS OF <bkpf> UP TO 1 ROWS
*      FROM bkpf
*      WHERE belnr = '1800001017'.
*    ENDSELECT.
*
DATA: t_xblnr TYPE bkpf-xblnr.

*This query works and in my head it is roughly the same thing.
SELECT SINGLE xblnr
      INTO t_xblnr
      FROM bkpf
      WHERE belnr = '1800001017'.


write 'Done'.

如果我运行注释掉的查询,我会收到错误:

运行时错误 GETWA_NOT_ASSIGNED 日期和时间
2009年8月26日19:54:19

短文本 尚未分配字段符号。

为什么我会收到此运行时错误?

I am confused as to why the commented out query doesn't work.


REPORT  z_hello_world_local.

TYPES:  BEGIN OF bkpf_type,
          xblnr          TYPE bkpf-xblnr,
        END OF bkpf_type.

DATA: t_bkpf                 TYPE TABLE OF bkpf_type.

FIELD-SYMBOLS:  <bkpf>        TYPE bkpf_type.


*This query does not work?
*SELECT xblnr
*      INTO CORRESPONDING FIELDS OF <bkpf> UP TO 1 ROWS
*      FROM bkpf
*      WHERE belnr = '1800001017'.
*    ENDSELECT.
*
DATA: t_xblnr TYPE bkpf-xblnr.

*This query works and in my head it is roughly the same thing.
SELECT SINGLE xblnr
      INTO t_xblnr
      FROM bkpf
      WHERE belnr = '1800001017'.


write 'Done'.

If I run the commented out query I get the error:

Runtime Errors GETWA_NOT_ASSIGNED Date and Time
08/26/2009 19:54:19

Short text
Field symbol has not yet been assigned.

Why do I get this runtime error?

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

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

发布评论

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

评论(1

断念 2024-08-09 23:46:55

我假设(基于错误和我实际上看不到的代码片段)您正在尝试将数据直接选择到字段符号中。你不能那样做。字段符号不是内存区域,它(基本上)是指针。

您可以执行以下操作之一:

data: wa_bkpf type bkpf_type.

select xblnr
  into corresponding fields of wa_bkpf
  up to 1 rows
  from bkpf
  where xblnr = '1800001017'.
endselect.

或者

field-symbols: <bkpf> type bkpf_type.
append initial line to t_bkpf assigning <bkpf>.
select xlbnr
  into corresponding fields <bkpf>
  up to 1 rows
  from bkpf
  where xblnr = '1800001017'.
endselect.

在这种情况下,您将字段符号指向已添加到内部表中的新行。

或者

select xblnr
  into corresponding fields of table t_bkpf
  from bkpf
  where xlbnr = '1800001017'.

在这种情况下,您将检索所有匹配的文档并将它们直接放入您的内部表中。

I assume (based on the error and the pieces of code that I can't actually see) that you're trying to select data directly into a field symbol. You can't do that. A field symbol is not a memory area, it is (basically) a pointer.

You could do one of the following:

data: wa_bkpf type bkpf_type.

select xblnr
  into corresponding fields of wa_bkpf
  up to 1 rows
  from bkpf
  where xblnr = '1800001017'.
endselect.

or

field-symbols: <bkpf> type bkpf_type.
append initial line to t_bkpf assigning <bkpf>.
select xlbnr
  into corresponding fields <bkpf>
  up to 1 rows
  from bkpf
  where xblnr = '1800001017'.
endselect.

In this case, you are pointing the field symbol to a new line that you've added to the internal table.

or

select xblnr
  into corresponding fields of table t_bkpf
  from bkpf
  where xlbnr = '1800001017'.

In this case, you will retrieve all documents that match and place them directly into your internal table.

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