源程序在华亭的博客上:
NON-UNICODE系统下使用可以修改为:
REPORT z_barry_test NO STANDARD PAGE HEADING .
DATA index TYPE sy-index.
DO 20 TIMES.
index = sy-index * 5 .
PERFORM show_progressbar USING index .
WAIT UP TO 1 SECONDS.
ENDDO.
MESSAGE 'Finished!'(fin) TYPE 'S'.
*&---------------------------------------------------------------------*
*& form show_progressbar
*&---------------------------------------------------------------------*
FORM show_progressbar USING upct TYPE i.
DATA: fbar TYPE c LENGTH 26,
fmsg TYPE c LENGTH 70.
CONSTANTS:percent1(2) TYPE c VALUE '▏',
percent2(2) TYPE c VALUE '▎',
percent3(2) TYPE c VALUE '▍',
percent4(2) TYPE c VALUE '▌',
percent5(2) TYPE c VALUE '▋',
percent6(2) TYPE c VALUE '▊',
percent7(2) TYPE c VALUE '▉',
percent8(2) TYPE c VALUE '█'.
DATA: fmod TYPE n,
ftim TYPE i,
ffield TYPE c LENGTH 10,
fidx TYPE c LENGTH 3.
FIELD-SYMBOLS: TYPE c.
ftim = upct DIV 8.
fmod = upct MOD 8.
CLEAR: fbar.
DO ftim TIMES.
* CONCATENATE fbar percent8 INTO fbar.
CALL FUNCTION 'STRING_CONCATENATE'
EXPORTING
string1 = fbar
string2 = percent8
IMPORTING
string = fbar.
ENDDO.
IF fmod NE 0.
CONCATENATE 'percent' fmod INTO ffield.
ASSIGN (ffield) TO .
* CONCATENATE fbar INTO fbar.
CALL FUNCTION 'STRING_CONCATENATE'
EXPORTING
string1 = fbar
string2 =
IMPORTING
string = fbar.
ENDIF.
fidx = upct.
* CONCATENATE fbar fidx '%' INTO fmsg.
CALL FUNCTION 'STRING_CONCATENATE_3'
EXPORTING
string1 = fbar
string2 = fidx
string3 = '%'
IMPORTING
string = fmsg.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = upct
text = fmsg.
ENDFORM. "show_progressbar
阅读(3175) | 评论(0) | 转发(0) |