1. 程式人生 > >abap--How to debug backgroud job

abap--How to debug backgroud job

Steps
1. Create variant called BACKGROUND for program(ZWBTEST) to be debugged.
2. Execute ZDEBUGBG (pgm code below) in background for immediate processing.
3. Execute transaction SM50.
4. Select process that runs ZDEBUGBG.
5. Goto 'Program/Session' 'Program' 'Debugging'.
A se80 debug session will open.
6. Change variable W_EXIT to 'E'.
7. Step thru (F6) until ZWBTEST comes up.
*&---------------------------------------------------------------------*
*& Report ZDEBUGBG *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

REPORT zdebugbg.

DATA:
w_exit TYPE c.

FIELD-SYMBOLS <fs> TYPE ANY.

SELECTION-SCREEN BEGIN OF BLOCK one.
PARAMETERS: p_repid LIKE trdir-name DEFAULT 'ZWBTEST'.
SELECTION-SCREEN END OF BLOCK one.

START-OF-SELECTION.
PERFORM loop_time.
PERFORM submit_time.

END-OF-SELECTION.

*---------------------------------------------------------------------*
* FORM loop_time *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM loop_time.
DO.
IF w_exit = 'E'.
EXIT.
ENDIF.
ENDDO.
ENDFORM.

*---------------------------------------------------------------------*
* FORM submit_time *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM submit_time.
ASSIGN p_repid TO <fs>.
SUBMIT (<fs>)  USING SELECTION-SET 'BACKGROUND'.
ENDFORM.