I guess you've come across this from time to time, how on earth we could do debugging when we run our code in background(batch) mode.
I've come across two methods:
1. If the job is not running yet or already completed, go to your code, put a break point and then go to SM37, select the job that you want to debug and issue JDBG in the OK_CODE field. Hit Enter key and just press F8 until it goes to the break-point that you set.
2. If the job already running, go to SM50 and select the work process and go to Program/Mode -> Program -> Debugging.