How To Debug a Canceled Background Job in SAP

 How To Debug a Canceled Background Job in SAP

In every SAP project there will be some programs which will be executed daily to perform tasks and there might be a chance it will get failed or cancelled due to some error. At that time we have to debug the job in SM37 and inform the respective functional consultant what is the problem. 

So, how to debug the cancelled job ? Here we are going to explain the process.

For example, I have a simple program which will fetch records from BKPF table based on company code as input. I have executed this program in background. To check the status of my background job I have entered the job name in SM37 transaction and I have realized that it got cancelled due to some error.



Before debugging the initial step is to check the job log. Here we will get the details of message id and step where the job got failed. Based on the job we can analyze the initial cause of error to some extent.



We can also check the inputs provided to the program through the Step Overview - Variant in Menu.




To debug the error I have to follow the below steps

Steps to Debug a Background Job in SAP:
  1. Go to transaction SM37, enter the job name and execute.
  2. Select the cancelled job and enter the command JDBG and click on enter


  3. Once we click enter the debugger will get activated and a standard program will be visible in debugger.

  4. We have to click F7 till we get to the main program. The main program name can be seen in the debugger.



  5. Once we get to the point of main program we have executed step by step using F5, F6, F7 wherever required and analyze the cause of error.


Some Tips To Analyze the job error without debugging

  • Through job log some messages are visible. These messages are generally declared in text elements. We can search the program for text element and set a breakpoint before that to debug the program

  • It is also possible to go by where used list of message id and number. If there are few results from where used list then we can set breakpoint and debug. This will be useful when there is long code and many routines.

  • If the error is due to some run time exception issue, then the error can analyzed in ST22 transaction.

Post a Comment

Previous Post Next Post