求助高手:ABAP输入一组数值,用逗号隔开,然后按大小排序列印出来,谢谢!
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了求助高手:ABAP输入一组数值,用逗号隔开,然后按大小排序列印出来,谢谢!相关的知识,希望对你有一定的参考价值。
REPORT Zxxx01.types: begin of itab_type, num(3) type n, end of itab_type.data: itab type STANDARD TABLE OF itab_type with HEADER LINE.data : begin of itab2, num2 type i, end of itab2.data : itab3 LIKE TABLE OF itab2.data : itab4 like table of itab2.SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.PARAMETERS : c1(100) type c.SELECTION-SCREEN END OF BLOCK BLK2.START-OF-SELECTION. SPLIT c1 AT ',' INTO table itab.*BREAK-POINT. WRITE : '您输入的内容是:',c1. skip. LOOP AT itab.* WRITE: itab. move itab-num to itab2-num2. APPEND itab2 TO itab3. APPEND itab2 TO itab4. ENDLOOP. sort itab3 DESCENDING BY num2 ASCENDING . sort itab4 DESCENDING BY num2 DESCENDING . write : / '从小到大排序结果是:'. LOOP AT itab3 INTO itab2. WRITE: (3) itab2-num2,','. ENDLOOP. skip. write : / '从大到小排序结果果是:'. LOOP AT itab4 INTO itab2. WRITE: (3) itab2-num2,','. ENDLOOP.end-of-selection. 参考技术A DATA : LV_STR TYPE STRING.
DATA : STR1 TYPE STRING, STR2 TYPE STRING, STR3 TYPE STRING, TEXT TYPE STRING.DATA : LT_TAB TYPE TABLE OF STRING.LV_STR = '9,3,8,4,1,7'.SPLIT LV_STR AT ',' INTO TABLE LT_TAB IN CHARACTER MODE.SORT LT_TAB ASCENDING.LOOP AT LT_TAB INTO STR1. CONCATENATE STR1 TEXT INTO TEXT.ENDLOOP.WRITE : / TEXT. 要满意答案哈,我团队要升级了。。。差一个满意回答。。。
以上是关于求助高手:ABAP输入一组数值,用逗号隔开,然后按大小排序列印出来,谢谢!的主要内容,如果未能解决你的问题,请参考以下文章