gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 08:01:08 26 4
gpt4 key购买 nike

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


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'.

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

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

Short text Field symbol has not yet been assigned.

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

最佳答案

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

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

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'.

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

关于abap - 将 SELECT 结果分配给字段符号 GETWA_NOT_ASSIGNED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1338347/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com