SM50 transaction is used to monitor and manage work processes. (A workprocess can be any dialog, background, Update, Enque, Spool processes). This transaction lets any process to be checked, debugged, terminated at any point.
Terminating a process is neccessary if a particular process is consuming more than a definete period. But when do we need to debugg a work process? Why do we need the help of SM50 to check what is happening in the code? How do we stop at a desired point in the code while debugging a definete work processes ?
Lets look into this using an example:
F110 - This transaction allows us to process Payment Proposals and Payment Runs.
- When a payment proposal is done: All the open items in the invoices for the vendors listed in the transaction are fetched
- When payment run is carried out: All open items will be cleared from the vendor accounts
Files will be created to transfer the payments.
This F110 setsup the payment program such that the IDOCs are generated by it. All we need is to ensure that the payment method is associated to program RFFOEDI1 and the RFFOEDI1 should have a variant with the company code, payment method and the bank partner profile data. So, now we are clear that the IDOCs are only generated by the program background by calling the program RFFOEDI1 and passing the varaint to it via the F110 transaction.
With all this being said, lets take a scenario of a particular IDOC ( PEXR2001 message type PAYEXT) needs to be enhanced -
We know that having a break point at the IDOC function-exits or BADIs wouldn't definetly trigger the break point.That's were we can make use of SM50 debugging.
We know the location we want the code to stop, what we need to do now is to pause the work process at our desired point this can be done by including an in-definete loop -
Ex of an in-definite loop
data num type c value 0.
while num = 0.
If num = 1.
Exit.
endif.
endwhile.
This in-definite loop will hold the compiler at this point. Now select the specific job from SM50 work processes list and select the debugging option from the SM50 menu and wait to see the compiler waiting for you at the in-definite loop in the debugging mode. Now change the value of num to 1 to exit from the loop and have fun debugging and exploring your code.