The SAP standard progress indicator is implemented by calling the function module sapgui_progress_indicator. It is displayed as a running clock with instructions. However, some users think that the clock is not easy to read and want to use the traditional Windows progress bar. belowProgramIt is the progress bar simulated by characters. However, I think this progress bar is not as good as the clock:-P.
Note: Because the simulated characters belong to the Unicode Character Set, this program can only display the progress bar in the Unicode system. In non-Unicode systems, these characters are displayed as "#".
Programs that display progress are basically encapsulated in a sub-program. You can also encapsulate the program into a function module by yourself and add other user messages.
Code
*&---------------------------------------------------------------------*
*& Report zprogressbar
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
Report zprogressbar.
Do 100 Times.
Perform show_progressbar using SY - Index.
Wait up 1 Seconds.
Enddo.
Message ' Finished! ' (FIN) Type ' S ' .
*&---------------------------------------------------------------------*
*& Form show_progressbar
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
* --> PCT text
*----------------------------------------------------------------------*
Form show_progressbar using upct type I.
Data: fbar Type C Length 13 ,
Fmsg Type C Length 70 .
Constants: percent1 Type C value ' Bytes ' ,
Percent2 Type C value ' Bytes ' ,
Percent3 Type C value ' Bytes ' ,
Percent4 Type C value ' Bytes ' ,
Percent5 Type C value ' Bytes ' ,
Percent6 Type C value ' Bytes ' ,
Percent7 Type C value ' Bytes ' ,
Percent8 Type C value ' Bytes ' .
Data: fmod type N,
Ftim type I,
Ffield Type C Length 10 ,
Fidx Type C Length 3 .
Field - Symbols: < FS > Type C.
Ftim = Upct Div 8 .
Fmod = Upct mod 8 .
Clear: fbar.
Do ftim times.
Concatenate fbar percent8 into fbar.
Enddo.
If fmod ne 0 .
Concatenate ' Percent ' Fmod into Ffield.
Assign (Ffield) < FS > .
Concatenate fbar < FS > Into fbar.
Endif.
Fidx = Sy - Index.
Concatenate fbar fidx ' % ' Into fmsg.
Call Function ' Sapgui_progress_indicator '
Exporting
Percentage = Upct
Text = Fmsg.
.
Endform. " Show_progressbar