显示小闹钟的函数详解编程语言

 示例一:

 1 DO 100 TIMES. 
 2   WAIT UP TO  1 SECONDS. 
 3   num = sy-index. 
 4   PERFORM clock_show USING num '显示进度条……'. 
 5 ENDDO. 
 6 *&---------------------------------------------------------------------* 
 7 *&      Form  clock_show 
 8 *&---------------------------------------------------------------------* 
 9 *       text 
10 *----------------------------------------------------------------------* 
11 *      -->PERCENTAGE text 
12 *      -->TEXT       text 
13 *----------------------------------------------------------------------* 
14 FORM clock_show  USING     percentage  TYPE  int1 
15                             text TYPE string. 
16  
17   CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' 
18     EXPORTING 
19       percentage = percentage 
20       text       = text. 
21  
22 ENDFORM.                    "clock_show

显示小闹钟的函数详解编程语言

 示例二:

 1 DO 100 TIMES. 
 2   PERFORM show_progressbar USING sy-index. 
 3   WAIT UP TO 1 SECONDS. 
 4 ENDDO. 
 5 MESSAGE 'Finished!'(fin) TYPE 'S'. 
 6  
 7 *&---------------------------------------------------------------------* 
 8 *&      Form  show_progressbar 
 9 *&---------------------------------------------------------------------* 
10 *       text 
11 *----------------------------------------------------------------------* 
12 * -->PCT        text 
13 *----------------------------------------------------------------------* 
14 FORM show_progressbar USING upct TYPE i. 
15  
16   DATA: fbar TYPE c LENGTH 13, 
17         fmsg TYPE c LENGTH 70. 
18  
19   CONSTANTS: percent1 TYPE c VALUE '', 
20              percent2 TYPE c VALUE '', 
21              percent3 TYPE c VALUE '', 
22              percent4 TYPE c VALUE '', 
23              percent5 TYPE c VALUE '', 
24              percent6 TYPE c VALUE '', 
25              percent7 TYPE c VALUE '', 
26              percent8 TYPE c VALUE ''. 
27  
28   DATA: fmod TYPE n, 
29         ftim TYPE i, 
30         ffield TYPE c LENGTH 10, 
31         fidx TYPE c LENGTH 3. 
32  
33   FIELD-SYMBOLS: <fs> TYPE c. 
34  
35   ftim = upct DIV 8. 
36   fmod = upct MOD 8. 
37   CLEAR: fbar. 
38   DO ftim TIMES. 
39     CONCATENATE fbar percent8 INTO fbar. 
40   ENDDO. 
41   IF fmod NE 0. 
42     CONCATENATE 'percent' fmod INTO ffield. 
43     ASSIGN (ffield) TO <fs>. 
44     CONCATENATE fbar <fs> INTO fbar. 
45   ENDIF. 
46   fidx = sy-index. 
47   CONCATENATE fbar fidx '%' INTO fmsg. 
48  
49   CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' 
50     EXPORTING 
51       percentage = upct 
52       text       = fmsg. 
53   . 
54 ENDFORM.                    "show_progressbar

显示小闹钟的函数详解编程语言

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/18290.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论