Syntax
语法
DESCRIBE TABLE itab [KIND knd] [LINES lin] [OCCURS n].
Extras:
选项
1. ... KIND knd
2. ... LINES lin
3. ... OCCURS n
Effect
作用
This statement determines some properties of the internal table itab and assigns them to the specified variables. The various additions enable you to determine the table type, the number of currently filled rows and the initial memory requirement.
这个语句判断内表itab的某些属性并把它们指定到指定的变量中。不同的选项使你能够判断表类型,当前字段行数和初始化需要的内存大小 。
In addition, the system fields sy-tfill and sy-tleng are filled with the current number of table rows and the length of a table row in bytes.
另外,系统字段sy-tfill和sy-tleng保存着当前表行数量和以字节计的表行长度。
Notes
注
For detailed information about an internal table, you should use the methods of RTTS instead of the statement DESCRIBE TABLE.
为了更详细的关于内表的信息,你应该用RTTS的方法代替语句describe table.
Without the specification of an addition, the statement DESCRIBE TABLE only sets the system fields sy-tfill and sy-tleng.
没有指定一个附加项,语句describe table只设置系统字段sy-tfill 和sy-tleng的值。
Addition 1
选项1
... KIND knd
Effect
作用
The table type of the internal table itab is determined and a corresponding one-digit identification is assigned to the data object knd. A character-type data type is expected for the data object. The identifications are "T" for standard tables, "S" for sorted tables and "H" for hashed tables. These values are also defined as constants sydes_kind-standard, sydes_kind-sorted, and sydes_kind-hashed in the type group SYDES.
判断内表itab的表类型并且把一个相应的一字符的标识赋给字符型的数据类型的数据对象knd. 标识为T时代表是标准表,为S时为排序表,为H是为哈唏表。这些值在类型组SYDES中也被定义成常量sydes_kind-standard,sydes_kind-sorted,sydes_kind-hashed。
Addition 2
选项2
... LINES lin
Effect
作用
The current number of table rows of the internal table itab is determined and is assigned to the data object lin.The data type i is expected for the data object.
决定内表表行的当前数量并且把值赋给数据对象lin。Lin为I类型的数据对象。
Note
注
As of release 6.10, the current number of rows of an internal table can also be determined using the in-built function lines.
在版本6.10中,内表表行的当前数量也可以用内建函数lines来判断。
Addition 3
选项3
... OCCURS n
Effect
作用
The initial memory requirement defined during the creation of the internal table with the addition INITIAL SIZE or the obsolete addition OCCURS is determined and assigned to the data object n. The data type i is expected for the data object.
在内表用选项initial size或者老式的选项ocurs创建期间决定内表所需的初始化内存大小并且把值赋给数据对象n.N为i类型的数据对象。
Example
例子
Descending sorting of a generically typed internal table in a subprogram. Since sorted tables cannot be sorted in a descending order, the table type is checked to avoid an exception that cannot be handled.
在一个子程序中对一个一般内表进行递减排序。因为排序表不能降序排列,所以会进行表类型检查来避免不能处理的异常。
TYPE-POOLS sydes.
...
FORM sort_descending CHANGING itab TYPE ANY TABLE.
DATA tabkind(1) TYPE c.
DESCRIBE TABLE itab KIND tabkind.
IF tabkind = sydes_kind-standard OR
tabkind = sydes_kind-hashed.
SORT itab DESCENDING.
ELSEIF tabkind = sydes_kind-sorted.
MESSAGE '...' TYPE 'E'.
ELSE.
MESSAGE '...' TYPE 'E'.
ENDIF.
ENDFORM.