一、定义
(一)常常用下面的方法定义:
(1)先要定义结构类型或结构对象:
DATA/TYPES: BEGIN OF ineobj/inetype,
...
END OF ineobj/inetype.
(2)定义内表
DATA itab {TYPE tabkind OF linetype|LIKE tabkind OF lineobj}
WITH [UNIQUE|NON-UNIQUE] key
[INITIAL SIZE n] [WITH HEADER LINE].
说明:tabkind: a) standard table
b) sorted table
C) hashed table
经验:我一直常用如下方法定义内表,且不使用带表头行,这样对较清楚,例如:
DATA : BEGIN of wa_student,
no type c,
name type c,
END OF wa_student.
DATA itab_student like table of wa_student.
(二)在SAP标准程序中经常会看到如下定义方法:
带有表头行的内表定义如下:
DATA: BEGIN OF itab OCCURS n,
...
END OF itab.
DATA itab type|like linetype|lineobj occurs n [with header line].
上面的相当于如下所示定义方法:
DATA itab type standard table of linetype
with non-unique default key
initial size n
with header line.