parameters: current_number_progress, max_number_of_process, your progress text.Increase current_number_progress by + 1.
You can run PERFORM display_indicator All X% percent of the process(max_number_of_process = Total process records).
REPORT ztest_process_indicator.
** ------------ Code section to be copied!!!
** Status progress field.
DATA: lv_count TYPE i,
lv_number_of_processes TYPE i,
lv_current_process TYPE i,
lv_stop(4).
INCLUDE: zsapgui_progress.
** ------------ End of copi section!!!
**
START-OF-SELECTION.
** ------------ Code section to be copied!!!
** Calculate break status progress.
lv_count = 1. " Start counter
lv_number_of_processes = 10. " Maximum counter
** Display first status progress.
PERFORM display_indicator
USING '1'
lv_number_of_processes text-100.
** ------------ End of copi section!!!
** Start loop of 10 seconds.
WHILE lv_stop IS INITIAL.
WAIT UP TO 1 SECONDS.
** ------------ Code section to be copied!!!
lv_current_process = lv_current_process + 1.
IF lv_current_process > lv_count.
** Calculate how many time do you want to process display indicator!
lv_count = lv_count * 1.
PERFORM display_indicator USING lv_current_process lv_number_of_processes text-100.
ENDIF.
** ------------ End of copi section!!!
** Stop loop after 10 seconds.
IF lv_current_process > 10.
lv_stop = 'STOP'.
ENDIF.
ENDWHILE.
END-OF-SELECTION.
*& Include ZSAPGUI_PROGRESS
*&---------------------------------------------------------------------*
form display_indicator using iv_current_process type i
iv_number_of_processes type i
iv_prc_type_desc type char50.
**
data: lv_percentage type p.
data: lv_indicator_text(60) type c.
data: lv_text0(30),
lv_text1(10),
lv_text2(10),
lv_text3(30).
**
check sy-batch is initial.
if iv_number_of_processes = 0.
iv_number_of_processes = 1.
endif.
lv_percentage = ( iv_current_process * 100 ) / iv_number_of_processes.
lv_text1 = iv_current_process.
lv_text2 = iv_number_of_processes.
if sy-langu = 'E'.
lv_text0 = 'Processing'.
lv_text3 = 'in progress'.
else.
lv_text0 = 'Process'.
lv_text3 = 'in progress'.
endif.
** Create the indicator text
shift lv_text1 left deleting leading space.
shift lv_text2 left deleting leading space.
concatenate lv_text0 lv_text1 '/' lv_text2 ':' iv_prc_type_desc lv_text3
into lv_indicator_text separated by space.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = lv_percentage
text = lv_indicator_text.
**
endform. " DISPLAY_INDICATOR
** ------------ Code section to be copied!!!
** Status progress field.
DATA: lv_count TYPE i,
lv_number_of_processes TYPE i,
lv_current_process TYPE i,
lv_stop(4).
INCLUDE: zsapgui_progress.
** ------------ End of copi section!!!
**
START-OF-SELECTION.
** ------------ Code section to be copied!!!
** Calculate break status progress.
lv_count = 1. " Start counter
lv_number_of_processes = 10. " Maximum counter
** Display first status progress.
PERFORM display_indicator
USING '1'
lv_number_of_processes text-100.
** ------------ End of copi section!!!
** Start loop of 10 seconds.
WHILE lv_stop IS INITIAL.
WAIT UP TO 1 SECONDS.
** ------------ Code section to be copied!!!
lv_current_process = lv_current_process + 1.
IF lv_current_process > lv_count.
** Calculate how many time do you want to process display indicator!
lv_count = lv_count * 1.
PERFORM display_indicator USING lv_current_process lv_number_of_processes text-100.
ENDIF.
** ------------ End of copi section!!!
** Stop loop after 10 seconds.
IF lv_current_process > 10.
lv_stop = 'STOP'.
ENDIF.
ENDWHILE.
END-OF-SELECTION.
Include: ZSAPGUI_PROGRESS
*&---------------------------------------------------------------------**& Include ZSAPGUI_PROGRESS
*&---------------------------------------------------------------------*
form display_indicator using iv_current_process type i
iv_number_of_processes type i
iv_prc_type_desc type char50.
**
data: lv_percentage type p.
data: lv_indicator_text(60) type c.
data: lv_text0(30),
lv_text1(10),
lv_text2(10),
lv_text3(30).
**
check sy-batch is initial.
if iv_number_of_processes = 0.
iv_number_of_processes = 1.
endif.
lv_percentage = ( iv_current_process * 100 ) / iv_number_of_processes.
lv_text1 = iv_current_process.
lv_text2 = iv_number_of_processes.
if sy-langu = 'E'.
lv_text0 = 'Processing'.
lv_text3 = 'in progress'.
else.
lv_text0 = 'Process'.
lv_text3 = 'in progress'.
endif.
** Create the indicator text
shift lv_text1 left deleting leading space.
shift lv_text2 left deleting leading space.
concatenate lv_text0 lv_text1 '/' lv_text2 ':' iv_prc_type_desc lv_text3
into lv_indicator_text separated by space.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = lv_percentage
text = lv_indicator_text.
**
endform. " DISPLAY_INDICATOR
Hello it is me
ReplyDelete