Debugger is a wonderful tool used by ABAP programmers to track down an issue in a given piece of code and also to understand the logic used by other programmer in writing that program.
With this tool you can display data objects and check the flow logic by executing a Program by line or by section.
In this blog I will take you through the step by step process of how to debug a sample program in ABAP.
To start with, you can open debugger by setting breakpoints in the ABAP editor. Break points are of two types. These are Session Break Point and External Break Point.
Line by Line debug:-
Step 1:- Below I have created a sample program in the name of Zdebug.
Step 2: Now Place the cursor on the line and Set Session Breakpoints.
Step 3 : Now I execute the program
Step 4 : Executed again.
Step 5 : Checked the values in output table T_KNA1.
Step 6 : There are 4 different options in the debugger to execute the program. They are:
F5 : By using this button F5 , executes our program step by step.
F6 : By using this button F6, executes a subroutine or function module without entering into it.
F7 : By using this button F7, comes out of a subroutine or function module.
F8 : By using this button F8, directly executes the program, if there is more than one breakpoint then it can move one breakpoint to another.
Debugging By Session:
If you want to debug a particular row in an internal table instead of going line by line you can go to that particular row by creating a watch point.
Step 1 : In this table T_KNA1 we want to reach 10th row i.e. kunnr = 1030.
Step 2 : Place the cursor on the variable and click on create watch point button.
Step 3 : Set the condition as below in Free Condition Entry
Step 4 : Watch point created.
Step 5 : Here we can see the value of variable w_kna1-kunnr as 1030.
This way we learnt how to debug a program By Line and By Sessions method.
In case you need assistance on SAP NetWeaver Platform, please contact us. Please send us your questions, comments or assistance request and our team would be glad to assist you.
By Seetharam Pallaprolu (on behalf of SAP Consulting Team)
SAP :: Streamlined
We offer variety of services including SAP ECC ,SAP HR,SAP BW,SAP CRM, SAP SCM,SAP BPM, Business Objects, SAP ABAP Development, SAP BASIS and SAP NetWeaver consulting. We have expertise in providing implementation, development, SAP Migration and SAP support services to SAP customers across diverse industries at a global level.
Have a question on SAP? Write to our SAP Architect : AskTheArchitect@Apprisia.com
(We promise a no-obligation consulting reply)