ABAP on SAP HANA. Part III. Debugging in ADT

Share on Facebook23Share on LinkedIn58Tweet about this on TwitterShare on Google+3
Please Share!!

ABAP Debugging using ADT (Eclipse/HANA Studio)

In ABAP on SAP HANA Part II, we made ourselves comfortable with the HANA Studio screen, icons and buttons. In this article, we will get exposed to Breakpoints and Debugging in ADT. If you have been working as an ABAPer for some time, it would not take much time for you to get familiar with the Debugger in ADT (Eclipse/HANA Studio). It the same wine in new bottle. 🙂 ABAP debugger is completely integrated with Eclipse from Kernel 7.21, SAP Basis 7.31 SP4.

All the standard debugging features which were earlier available in GUI editor are also available in eclipse. Such as:
i) Set breakpoints
ii) Step through the code
iii) Display and change variable values
iv) View internal tables
v)  Monitor the call stacks

Salient Properties of ADT breakpoints:

The breakpoints in ADT are User External breakpoints, so:
i) They are valid in your ABAP project
ii) Programs running under your ABAP user
iii) On all App servers in the backend system

Two types of breakpoints in ADT:

1. Static Breakpoint
Static breakpoints are set at a particular line of the code. A static breakpoint stays with the line of code at which you set it. If you delete code lines above the breakpoint, it slides along with the relocated code at that particular line.

2. Dynamic Breakpoint
Dynamic breakpoints are determined at run time. They are triggered when the running program reaches a particular ABAP statement e.g. loop, perform, select, calls, submits etc.

Static and Dynamic Breakpoints in ADT

Please note: Dynamic breakpoints take effect for all programs that run under your user. You need to be careful to remove the dynamic breakpoint once you have finished your analysis. Or else, it would stop for any application where the dynamic breakpoint condition is found. And we are sure, you do not want speed breakers in a highway. 🙂 We can always limit the scope of dynamic breakpoints to the scope of the debugger.

Advantage of ADT debugger:
One feature of the debugger in ADT is that you can work with the source code in debug mode as you work in ABAP perspective. That means, when you see a bug in the code during debugging, you can correct your code in the same editor in the same screen. Unlike traditional GUI debugger, where you need to go to SE38/SE37/SE80 etc in a separate session to change the code.

[ad1ToAppearHere]

Hands On Section:
Enough of preaching!! Well, above are the theories and I am sure you would be more interested in looking at the actual screens. Let us have a quick look at the Debugger screen and substantiate our understanding.

1. Check the icons/buttons which you can see during debugging:

Debug Buttons in HANA Studio

All the buttons are self-explanatory.

Resume button : Run to the next breakpoint or to the end of the program.
Terminate button : Abort the execution of the program in the debugger. Program execution ends.
Disconnect button : Run to the end of the program, ignoring any intervening breakpoints.
Step Into (F5) button : Execute the next single ABAP instruction in the program in the debugger.
Step Over (F6) button : Execute the next ABAP statement. If the next step is a procedure call, run the entire procedure.
Step Return (F7) button : Run until the current procedure returns to its caller or until the program ends.
Run to Line (Shift F8) button : Run to the statement on which the cursor is positioned. Breakpoints in between will be respected or not is set in Windows->Preferences->ABAP Development->Debug.

Also, check ABAP on HANA. Part II to get accustomed to HANA Studio.

2. Put Static Breakpoint
Double click on the area shown below or right click and choose Toggle Breakpoint or press Ctrl + Shift + B.

Put breakpoint

3. Execute the program
You would get this pop-up. Select OK and continue. The debugger stops at the breakpoint.

ABAP on HANA

4. Check the Variables view, Debugger editor, Breakpoints view, Debug perspective etc
You can change the values of variables at the run time as you used to do in ABAP GUI debugger. You can also move the cursor over the variable to display its value.

ADT Debug

[ad2ToAppearHere]

5. Check the ABAP Internal Table (Debugger) view
Double click on the internal table name and see the values in the internal table view.

Internal table values

You can also right click on the internal table name and choose Open Data Preview to see the values of the internal table.

Check internal table values in SAP HANA

[adToAppearHereLink]

 

6. Let’s set a Dynamic Breakpoint

Go to the Breakpoints View and Add dynamic breakpoints at the statements you need. Type the statment in the search area and get your dynamic statements.

Set dynamic breakpoints

See two examples of dynamic breakpoint below.

Dynamic Breakpoint

7. Manage the Breakpoint Properties of a particular breakpoint
Manage breakpoints using Breakpoints View. Right click on the breakpoint and choose the Breakpoint Properties and choose the restriction you want.

Restrict debugger

8. Manage the Debug Properties for the user/session
You can change the user for which external breakpoints are effective. Breakpoints cab also be effective for the entire project independent of the users.

Manage Breakpoints

Hopefully, this article was successful in giving you the overview of Debugging in HANA ADT. For experienced ABAPers, it is the same thing as in ABAP GUI, with some good additions. For freshers, you need some system to get your hands dirty and learn.

As declared in our previous post, we are planning to allow our subscribers’ free access to SAP HANA system for a couple of hours to get the look and feel of the system for free (for a couple of hours only). We are still compiling the list. After we get the total list of interested users, we would provide the credentials and date/time when they can access it. In the next article, we would see how we can perform ABAP Profiling/Tracing in Eclipse Studio and more.

Next Post: SAP ABAP HANA Tutorial. Part IV. Core Data Services

[ad3ToAppearHere]

If you want to get such useful articles directly to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.

If you liked this post, please hit the share buttons and like us on facebook.

Thank you very much for your time!!

Useful Tutorials in SAPYard

1. ABAP for SAP HANA Tutorials
2. ABAP Web Dynpro Tutorials
3. GOS Tutorial
4. OOPs ABAP Tutorial
5. HANA Tutorial
6. SAP Netweaver and OData Tutorial
7. SAP Adobe Form Tutorial

Call for Guest Authors and Contributors to write SAP Articles on our page and get noticed and also receive cool Gifts.

Do you have any tips or tricks to share? Do you want to write some articles at SAPYard? Please REGISTER and start posting and sharing your knowledge to the SAP world and get connected to your readers. Please check our simple guidelines for contributing your articles and receiving the gifts.

 

Share on Facebook23Share on LinkedIn58Tweet about this on TwitterShare on Google+3
Please Share!!

2 Comments on "ABAP on SAP HANA. Part III. Debugging in ADT"

  1. Nice Presentation !!!!

Comments are closed.