abap--How to debug backgroud job

最近被一个朋友问起如何调试后台进程(一个abap的面试题),我一时也不知道如何答,他后来告诉我到sdn上找答案,我现在将答案收集供大家参考:
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.


url:http://www.sapfans.com/forums/viewtopic.php?t=2150

你可能感兴趣的:(C++,c,PHP,面试,UP)