Skip to Content

There might be a problem when you need to debug such a program, because you never know, when your code will be called.

Here is the simple trick:

    DATA: lv_counter TYPE i.

*   Call neverending loop in your code

    WHILE lv_counter = 0.

          “this will stop, when you change lv_counter

           “to s/thing else in debugger

    ENDWHILE.

And run your program.

Go to transaction “SM50” find your running program in a process. Select the process -> click Program/Session -> Program -> Debugging. In debug mode, just change the value of lv_counter to something else and now, you are able to debug your dynamically called program in background.

Enjoy 😉

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

    1. Rama Krishna Ganji

      In SM37: Select the job, type JDBG in the OK-code and press enter. This can be used for both completed jobs and jobs to be processed (just make sure you have enough time to debug before the job actually starts). Breakpoints set in the job flow works.

      Thanks & Regards,

      Ram Ganji

      (0) 
    2. Custodio de Oliveira

      I first saw the WHILE…ENDWHILE aproach in 2000, and it was suggested by SAP 🙂

      Although the JDBG is the preffered option I still think WHILE “technique” is valid in some situations and I am not ashamed of using it. 😎

      (0) 

Leave a Reply