Tips and Tricks for the ABAP® Programming Language
Y9030017: Testing/Debugging – See which subroutine was processed
A random generator decides what subroutine will be processed next in this example. For test purposes one can now see which subroutine is actually processed.
ABAP™-Source-Code
You can copy and paste the source code directly into the ABAP™-Workbench.
REPORT Y9030017 LINE-SIZE 250. "Release 3.1G, 4.5A ************************************************************************ * Copyright (c) 1999 by CT-Team, 33415 Verl * * you can use or modify this report for your own work as long * as you don't try to sell or republish it. * in no event will the author be liable for indirect, special, * Incidental, or consequental damages (if any) arising out of * the use of this report. * ************************************************************************ *//////////////////////////////////////////////////////////////////////* MOVE: 'Additional infos during server-runtime at the SAPGUI' TO SY-TITLE. *//////////////////////////////////////////////////////////////////////* *************** Variablendeklaration ********************** DATA: ROCKS TYPE I. DATA: R_TIME1 TYPE I. DATA: N_TIME1(10) TYPE N. DATA: WORK1(150) TYPE C. DATA: LOTTO1(1) TYPE N. *//////////////////////////////////////////////////////////////////////* ************* Programmsteuerung ******************* *//////////////////////////////////////////////////////////////////////* * GET RUN TIME FIELD R_TIME1. DEFINE FILL1. WRITE &1 TO WORK1+100. IF WORK1 CP '*# '. ENDIF. MOVE '/' TO WORK1+SY-FDPOS(1). CONDENSE WORK1. END-OF-DEFINITION. * DEFINE DISPLAY1. ROCKS = ROCKS + 5. CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING PERCENTAGE = ROCKS TEXT = WORK1. WRITE: /1 WORK1. ULINE. SKIP. CLEAR WORK1. END-OF-DEFINITION. *....................................................................... *####################################################################### GET RUN TIME FIELD R_TIME1. WRITE: /1 'Information for programming ...' COLOR 6. ULINE. *............................................................... DO 9 TIMES. MOVE R_TIME1 TO N_TIME1. MOVE N_TIME1+8(1) TO LOTTO1. IF LOTTO1 GT 0. PERFORM LOTTO1 OF UPRO-1 UPRO-2 UPRO-3 UPRO-4 UPRO-5 UPRO-1 UPRO-2 UPRO-3 UPRO-4. ELSE. PERFORM UPRO-5. ENDIF. ENDDO. * *//////////////////////////////////////////////////////////////////////* ************* Unterprogramme ******************* *//////////////////////////////////////////////////////////////////////* ************************************************************************ * upro-1 ************************************************************************ FORM UPRO-1. * WRITE: /5 'upro-1 is here' COLOR 5. *....................................................................... * *....................................................................... WAIT UP TO 1 SECONDS. "time of delay GET RUN TIME FIELD R_TIME1. * FILL1: 'upro-1', SY-UZEIT, R_TIME1. DISPLAY1. * ENDFORM. ************************************************************************ * upro-2 ************************************************************************ FORM UPRO-2. * WRITE: /5 'upro-2 is here' COLOR 5. *....................................................................... * WAIT UP TO 2 SECONDS. "time of delay GET RUN TIME FIELD R_TIME1. * FILL1: 'upro-2', SY-UZEIT, R_TIME1, SY-REPID. DISPLAY1. * ENDFORM. ************************************************************************ * upro-3 ************************************************************************ FORM UPRO-3. * WRITE: /5 'upro-3 is here' COLOR 5. *....................................................................... * WAIT UP TO 3 SECONDS. "time of delay GET RUN TIME FIELD R_TIME1. * FILL1: 'upro-3', SY-UZEIT, R_TIME1, SY-UNAME. DISPLAY1. * ENDFORM. ************************************************************************ * upro-4 ************************************************************************ FORM UPRO-4. * WRITE: /5 'upro-4 is here' COLOR 5. *....................................................................... * WAIT UP TO 4 SECONDS. "time of delay GET RUN TIME FIELD R_TIME1. * FILL1: 'upro-4', SY-UZEIT, R_TIME1. DISPLAY1. * ENDFORM. ************************************************************************ * upro-5 ************************************************************************ FORM UPRO-5. * WRITE: /5 'upro-5 is here' COLOR 5. *....................................................................... * WAIT UP TO 5 SECONDS. "time of delay GET RUN TIME FIELD R_TIME1. * FILL1: 'upro-5', SY-UZEIT, R_TIME1. DISPLAY1. * ENDFORM. ************************************************************************ ************************************************************************ ******************* Programmende ***************************************