六十四、SAP中的内表的9种定义方式
一、内表一共有9种定义方式,如下:
二、执行如下
*&---------------------------------------------------------------------* *& Report Z_TIANPAN_20190717_HELLO *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT Z_TIANPAN_20190717_HELLO MESSAGE-ID Z_TIANPAN_201907_MSG. * 内表的9种定义方法 * 自定义类型的内表 TYPES: BEGIN OF ty_itab1, field1 TYPE CHAR10, FIELD2 TYPE INT2, END OF ty_itab1. TYPES:t_itab1 TYPE ty_itab1 OCCURS 0. TYPES:t_itab2 TYPE TABLE OF ty_itab1. *定义内表变量 DATA:itab1 TYPE TABLE OF ty_itab1, "方法1 itab2 TYPE t_itab1, "方法2 itab3 TYPE t_itab2. "方法3 DATA itab4 LIKE itab1. "方法4 *直接定义 DATA:BEGIN OF itab5 OCCURS 0, "既是itab5工作区又是内表,itab5[] field1 TYPE char10, field2 TYPE int2, END OF itab5. "方法5 DATA itab6 TYPE TABLE OF sflight. "方法6 DATA itab7 TYPE STANDARD TABLE OF sflight. "方法7 *排序表,哈希表 DATA itab8 TYPE SORTED TABLE OF sflight WITH UNIQUE KEY carrid. "方法8 DATA itab9 TYPE HASHED TABLE OF sflight WITH UNIQUE KEY carrid. "方法9 * 字符串拼接 WRITE: / '青青子衿' & '悠悠我心'. BREAK-POINT.