Sometimes, whenever a background job got cancelled or ends up with some error we need to debug it to know the issue why it is getting failed or cancelled.
We can debug a background job in two ways
- Through t-code JDBG
- Through debugging the background work process in t-code SM50
Method 1: Using T-code JDBG
Using this method, we can debug the already completed background job.
Note: Make sure that changes will be committed to data base if there are any data updation statements in the program
Suppose I have a job which is cancelled due to some issue
Note: Keep break-point in the program since it will avoid unnecessary standard code being executed in the debugger
Select the background job by selecting the checkbox and enter the T-code ‘JDBG’ in the command field and press enter
It will navigate to the debugger screen but not exactly to your program. Press F8, if you have already kept break point in your program so that execution point will be reached to report.
Method 2: Through debugging the background work process in t-code SM50
We can also debug a background job through the work process to which the background job is assigned.
Note: If you want to debug background job through work process, the work process may complete the task in just few seconds based on the length of report. In this case, we might not get enough time to navigate to SM50 and debug the work process. Due to this reason, I will include here endless code snippet so that the background job will be running in work process
Select the work process which is holding the program
Click on menu element Administration -> Program -> debugging
It will prompt for confirmation. click on Yes to navigate to debugging screen.