REPORT z_barry_test NO STANDARD PAGE HEADING .
DATA: BEGIN OF text_line,
sort_indx TYPE xstring,
text TYPE string,
END OF text_line.
DATA: hs_tab LIKE HASHED TABLE OF text_line WITH UNIQUE KEY sort_indx.
text_line-text = '中国人'.
PERFORM fill_hs_tab.
text_line-text = '人民'.
PERFORM fill_hs_tab.
text_line-text = '中国'.
PERFORM fill_hs_tab.
text_line-text = '中国人民'.
PERFORM fill_hs_tab.
SORT hs_tab BY text.
PERFORM write_hs_tab.
SET LOCALE LANGUAGE '1'.
SORT hs_tab BY sort_indx.
PERFORM write_hs_tab.
*&---------------------------------------------------------------------*
*& Form fill_hs_tab
*&---------------------------------------------------------------------*
FORM fill_hs_tab.
CONVERT TEXT text_line-text INTO SORTABLE CODE text_line-sort_indx.
INSERT text_line INTO TABLE hs_tab.
ENDFORM. "fill_hs_tab
*&---------------------------------------------------------------------*
*& Form write_hs_tab
*&---------------------------------------------------------------------*
FORM write_hs_tab.
FIELD-SYMBOLS LIKE text_line.
LOOP AT hs_tab ASSIGNING .
WRITE / -text.
ENDLOOP.
SKIP.
ENDFORM. "write_hs_tab
***比 SORT text_tab BY text AS TEXT. 效率要高一些,但是功能一样
阅读(3180) | 评论(0) | 转发(0) |