动态内表怎样排序
动态内表要排序时,因为不知道内表中的字段名字,所以不能直接用SORT table BY field1 field2...
可以使用下面的方法来实现:SORT table BY (sorttable)
表类型: ABAP_SORTORDER_TAB
结构类型: ABAP_SORTORDER
代码示例:
DATA:
W_IT_FIELD TYPE ABAP_SORTORDER_TAB,
W_STR_FIELD TYPE ABAP_SORTORDER.
W_STR_FIELD-NAME = 'NAME1'.
W_STR_FIELD-DESCENDING = ''.
APPEND W_STR_FIELD TO W_IT_FIELD.
W_STR_FIELD-NAME = 'KUNNR'.
W_STR_FIELD-DESCENDING = ''.
APPEND W_STR_FIELD TO W_IT_FIELD.
SORT BY (W_IT_FIELD).
Form: http://wenwen.soso.com/z/q340236697.htm