まず、TYPEを作成することは、使用するための新しく推奨される方法です。
DATAを作成するとき、内部テーブルについて考えてみましょう。
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)