将工作区转换为内部类型行 table
Convert work area to the line of type internal table
我收到这个语法错误:
"WA_1" cannot be converted to the line type of "IT_1"
我正在尝试显示来自内部 table 的内容,如下所示:
REPORT ZSAM.
DATA: ITable Type ZMUAZ_STRUCTURE OCCURS 10,
IT_1 Type ZSTRUCT1 OCCURS 10,
IT_2 Type ZSTRUCT2 OCCURS 10,
WA_1 like IT_1,
WA_2 like IT_2,
WA_3 like ITable.
WRITE: 'vbeln', 'vtweg', 'posnr', 'matnrr','vrkme'.
select vbeln audat netwr waerk vkorg vtweg from VBAK into corresponding fields of Table IT_1.
LOOP AT IT_1 INTO WA_1.
write: / WA_1-vbeln, WA_1-audat, WA_1-netwr, WA_1-waerk, WA_1-vkorg, WA_1-vtweg.
endloop.
知道如何解决这个错误吗?
wa_1
声明为内部 table(不是工作区)。最简单的解决方案是用 LINE OF
:
完成声明
... wa_1 LIKE LINE OF it_1,
但是像您在 OCCURS
is obsolete, its modern equivalent is STANDARD TABLE OF
中所做的那样声明内部 tables 和工作区:
DATA: it_1 TYPE STANDARD TABLE OF zstruct1,
wa_1 TYPE zstruct1.
我收到这个语法错误:
"WA_1" cannot be converted to the line type of "IT_1"
我正在尝试显示来自内部 table 的内容,如下所示:
REPORT ZSAM.
DATA: ITable Type ZMUAZ_STRUCTURE OCCURS 10,
IT_1 Type ZSTRUCT1 OCCURS 10,
IT_2 Type ZSTRUCT2 OCCURS 10,
WA_1 like IT_1,
WA_2 like IT_2,
WA_3 like ITable.
WRITE: 'vbeln', 'vtweg', 'posnr', 'matnrr','vrkme'.
select vbeln audat netwr waerk vkorg vtweg from VBAK into corresponding fields of Table IT_1.
LOOP AT IT_1 INTO WA_1.
write: / WA_1-vbeln, WA_1-audat, WA_1-netwr, WA_1-waerk, WA_1-vkorg, WA_1-vtweg.
endloop.
知道如何解决这个错误吗?
wa_1
声明为内部 table(不是工作区)。最简单的解决方案是用 LINE OF
:
... wa_1 LIKE LINE OF it_1,
但是像您在 OCCURS
is obsolete, its modern equivalent is STANDARD TABLE OF
中所做的那样声明内部 tables 和工作区:
DATA: it_1 TYPE STANDARD TABLE OF zstruct1,
wa_1 TYPE zstruct1.