TYPES: BEGIN OF T_MARA,
MATNR LIKE MARA-MATNR,
END OF T_MARA.
DATA: IT_MARA TYPE STANDARD TABLE OF T_MARA INITIAL SIZE 0,
WA_MARA TYPE T_MARA.
DATA: MARA_LINES TYPE I,
GD_PERCENT TYPE I.
************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
SELECT MATNR
INTO TABLE IT_MARA
FROM MARA.
CHECK SY-SUBRC EQ 0.
MARA_LINES = SY-DBCNT.
CLEAR: GD_PERCENT.
LOOP AT IT_MARA INTO WA_MARA.
PERFORM PROGRESS_BAR USING 'Retrieving data...'(001)
SY-TABIX
MARA_LINES.
* WAIT UP TO 2 SECONDS.
ENDLOOP.
WRITE: /20 'Report is "Complete" OK'.
*&---------------------------------------------------------------------*
*& Form PROGRESS_BAR
*&---------------------------------------------------------------------*
FORM PROGRESS_BAR USING P_VALUE
P_TABIX
P_NLINES.
DATA: W_TEXT(40),
W_PERCENTAGE TYPE P,
W_PERCENT_CHAR(3).
W_PERCENTAGE = ( P_TABIX / P_NLINES ) * 100.
W_PERCENT_CHAR = W_PERCENTAGE.
SHIFT W_PERCENT_CHAR LEFT DELETING LEADING ' '.
CONCATENATE P_VALUE W_PERCENT_CHAR '% Complete'(002) INTO W_TEXT.
* This check needs to be in otherwise when looping around big tables
* SAP will re-display indicator too many times causing report to run
* very slow. (No need to re-display same percentage anyway)
IF W_PERCENTAGE GT GD_PERCENT OR P_TABIX EQ 1.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = W_PERCENTAGE
TEXT = W_TEXT.
GD_PERCENT = W_PERCENTAGE.
ENDIF.
ENDFORM. " PROGRESS_BAR
좋은 정보 감사합니다~