首先,创建 TYPE 是较新且推荐使用的方法。
当您创建一个数据时,假设是一个内部表;
DATA: BEGIN OF employee_information OCCURS 0, "itab with header line
name TYPE c LENGTH 20,
surname TYPE c LENGTH 20,
tel_no TYPE n LENGTH 12,
END OF employee_information.
您可以拥有带有标题行的内部表。但这是旧方法。
当你使用 TYPE 来声明一个内部表时,你可以同时使用它的标题和它的内容;
TYPES: BEGIN OF t_employee_information,
name TYPE c LENGTH 20,
surname TYPE c LENGTH 20,
tel_no TYPE n LENGTH 12,
END OF t_employee_information.
DATA: employee_information TYPE STANDARD TABLE OF t_employee_information INITIAL SIZE 0, "itab
employee_information TYPE t_employee_information. "work area (header line)
例如:您可以使用此 TYPE 来创建任意数量的内部表,例如:
DATA: employee_information_1 TYPE TABLE OF t_employee_information, "itab1
employee_information_1 TYPE t_employee_information. "work area1 (header line)
DATA: employee_information_2 TYPE TABLE OF t_employee_information, "itab2
employee_information_2 TYPE t_employee_information. "work area2 (header line)
DATA: employee_information_3 TYPE TABLE OF t_employee_information, "itab3
employee_information_3 TYPE t_employee_information. "work area3 (header line)