Wednesday 7 November 2012

Popup Window Debugging in SAP

First let me tell you there are basically three types of debugging in SAP:
1.       System Debugging.
2.       Update Debugging.
3.       tRFC Debugging.
For more info regarding these types of debugging go through the links that I have mentioned in References.
Normally Debugger can be started in three ways:
1.       By hard coding “Break-Point” statement in the program.
2.       By setting Session Breakpoint at a particular LOC.
3.       By setting External/User Breakpoint at a particular LOC.
The main difference between Session break point and External/User break point is that, In Session Breakpoint the breakpoints exist till the time the session is active whereas in External/User Breakpoint the breakpoints exist even if the session is terminated.
Now coming to Debugging a Screen/Pop-up, we just need to add four lines of code and to know how? Fallow the below steps:
1.       Open the Note/Text File.
2.       Add the fallowing LOC into it.
[FUNCTION]
Command=/H
Title=Debugger
Type=SystemCommand
3.       Save the File as Batch File (Say Debug. Bat).
4.       Drag and Drop the Bat file on the screen which you want to debug.
5.       Finally you will see “Debugger Switched On” message in the status bar.
6.       Then use the fallowing keys based on your need.
F5 -  For Step By Step Debugging.
F6 - To Skip the Loops and Sub routines.
F7 -  To Skip Loops/Sub routines and to return to last cursor position.
Shift+F12 (Debugger --> Goto Statement) - To go to the line of code where cursor is positioned.
F8 - Execute the program and Come out of the debugging mode.

If you think that the above steps are too many to fallow then let me tell you the alternative. There is a shortcut of creating a bat file for pop-up screen debugging and for that you just have to click on create shortcut button in SAP screen.





 Now enter the Tiile, Type as "System Command" and Command as "/h"



















After that you just have to click on Next fallowed by Finish button. Once you are done with it you will see a shortcut on your desktop with the tittle you have given. Now you just have to drag and drop that shortcut on the pop-screen that you want to debugg :-)


References:

Tuesday 6 November 2012

Batch Job Debugging in SAP


At the very outset let me tell you guys that as an Abaper (Rookie) the first object that you get to work on is to debug a Batch job, Report, Smartform, Idoc or to do Dump Analysis. Some senior team mates in the project even say “IF YOU KNOW DEBUGGING THEN YOU KNOW ABAP”. So Abapers’ (Especially Rookies) be good at Debugging.           

Coming to debugging a batch job, first let us know what exactly the batch job is? Let me put this way, Batch Job is a scheduled program which runs in the background and which doesn't require any action from the user end. 

The Batch job can be scheduled in two ways. 


·      One is through the T-Code : SM36. 
·      Second is through the Job Wizard. To schedule a batch job through wizard, you have to execute the T-Code: SM36 and click on Job Wizard in application bar.

Now coming to the main question how to debug a batch job?

The STATUS of the Batch Job decides the way in which Batch Job can be debugged.

If the Batch Job is having Scheduled/Released/Finished/Cancelled Status then we can debug the batch job through SM37 Tcode. In SM37, the job needs to be selected first and then type “JDBG” in the command line to start debugging. Below screen shots illustrate the way to enter the debugging mode of a batch job.












































If the Batch Job is having Ready/Active Status then we can debug the batch job through SM51 Tcode. In SM51, the job needs to be selected first and then click on the menu item Program/Mode --> Program --> debugging.

We can debug the batch job even using the T-Code SM50. For that go to SM50 Tcode, select the batch job and click on the menu item Administration  -->  Program  --> debugging.
















There is one more T-Code SM35p for Batch Input Log Overview which allows you to view the Logs with/without session and SM66 is used for debugging Asynchronous update tasks.

References: