This example shows my technique so that the user knows the execution time and to cancel the query if not appropriate. Hope you helps.
CODE:
*&---------------------------------------------------------------------*
*& Report Z_TEST_COUNT
*&
*&---------------------------------------------------------------------*
*&
*& By: J.Julio González
*&---------------------------------------------------------------------*
REPORT Z_TEST_COUNT.
DATA: L_SYTABIX LIKE SY-TABIX.
DATA: LINES TYPE I.
DATA: PERCENT TYPE I.
DATA: CHARPERCENT TYPE STRING.
DATA: VPERCENT TYPE I.
DATA: TEXTPROGRESS TYPE STRING.
DATA: T_TEMP TYPE TIMESTAMP.
DATA: TOTAL_TEMP TYPE TIMESTAMP.
DATA: REST_TEMP TYPE TIMESTAMP.
DATA: SECONDS TYPE I.
DATA: SECONDS_C TYPE STRING.
DATA: TEMP TYPE STRING.
DATA: TI_SFLIGHT LIKE SFLIGHT OCCURS 0 WITH HEADER LINE.
*LOAD INTERNAL TABLE FOR EXAMPLE
SELECT * FROM SFLIGHT INTO TABLE TI_SFLIGHT.
*CALCULATE THE NUMBER OF RECORDS
DESCRIBE TABLE TI_SFLIGHT LINES LINES.
*DATA PROCESSING
LOOP AT TI_SFLIGHT.
PERCENT = 100 * SY-TABIX / LINES.
MOVE PERCENT TO CHARPERCENT.
L_SYTABIX = SY-TABIX.
VPERCENT = PERCENT MOD 5.
****EMULATE PROCESSES********
WAIT UP TO 1 SECONDS.
**************************
* RECALCULATED EVERY 5 PERCENT.
IF VPERCENT = 0.
GET RUN TIME FIELD T_TEMP.
IF T_TEMP IS NOT INITIAL AND PERCENT IS NOT INITIAL.
VPERCENT = PERCENT MOD 10.
IF PERCENT = 5 OR VPERCENT = 0.
TOTAL_TEMP = ( T_TEMP * 100 ) / PERCENT .
REST_TEMP = ( TOTAL_TEMP - T_TEMP ) / 1000000.
ENDIF.
ENDIF.
SECONDS = REST_TEMP.
MOVE SECONDS TO SECONDS_C.
CONCATENATE SECONDS_C 'S' INTO TEMP.
CONCATENATE 'DATA PROCESSING...' CHARPERCENT '% COMPLETE, REMAINING TIME:' TEMP INTO TEXTPROGRESS SEPARATED BY SPACE.
* SHOW THE PROGRESS INDICATOR
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = PERCENT
TEXT = TEXTPROGRESS.
CLEAR VPERCENT.
ENDIF.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |