itab like STANDARD TABLE OF line with KEY table_line.在下面程序中这段话为什么like不能换成type.DATA :BEGIN OF line,num TYPE i,sqr TYPE i,END OF line,itab like STANDARD TABLE OF line with KEY TABLE_LINE.DO 5 TIMES.line-num = sy-index.li

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 12:44:48
itablikeSTANDARDTABLEOFlinewithKEYtable_line.在下面程序中这段话为什么like不能换成type.DATA:BEGINOFline,numTYPEi,sqrT

itab like STANDARD TABLE OF line with KEY table_line.在下面程序中这段话为什么like不能换成type.DATA :BEGIN OF line,num TYPE i,sqr TYPE i,END OF line,itab like STANDARD TABLE OF line with KEY TABLE_LINE.DO 5 TIMES.line-num = sy-index.li
itab like STANDARD TABLE OF line with KEY table_line.在下面程序中这段话为什么like不能换成type.
DATA :BEGIN OF line,
num TYPE i,
sqr TYPE i,
END OF line,
itab like STANDARD TABLE OF line with KEY TABLE_LINE.
DO 5 TIMES.
line-num = sy-index.
line-sqr = sy-index ** 2.
APPEND line to itab.
ENDDO.
LOOP AT itab INTO line.
write:/ line-num,line-sqr.
ENDLOOP.
CLEAR itab.

itab like STANDARD TABLE OF line with KEY table_line.在下面程序中这段话为什么like不能换成type.DATA :BEGIN OF line,num TYPE i,sqr TYPE i,END OF line,itab like STANDARD TABLE OF line with KEY TABLE_LINE.DO 5 TIMES.line-num = sy-index.li
我调试了一下,发现如果用Like,后面的line是前面定义的结构体.
如果用type,后面的line则是系统里面的表.
比如写成itab tpye STANDARD TABLE OF line with KEY TABLE_LINE ,则itab是用表line生成的内表.如果用Like,则itab是用上面的结构体line生成的内表.
这个可能是SAP里面规范的写法吧.记着怎么用就行了