100% found this document useful (1 vote)
253 views4 pages

SAP ABAP Debugging Techniques Guide

Debugging techniques in SAP ABAP programming involve using breakpoints to pause program execution. There are two types of breakpoints: static breakpoints set using BREAK-POINT statements, and dynamic breakpoints set in the ABAP editor that are user-specific. Function keys like F5, F6, F7 and F8 are used to control the debugging process, allowing the programmer to step through code line-by-line or complete modules/programs in a single step. External breakpoints can be used to debug programs called from external interfaces.

Uploaded by

SUDHARSANA S
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
253 views4 pages

SAP ABAP Debugging Techniques Guide

Debugging techniques in SAP ABAP programming involve using breakpoints to pause program execution. There are two types of breakpoints: static breakpoints set using BREAK-POINT statements, and dynamic breakpoints set in the ABAP editor that are user-specific. Function keys like F5, F6, F7 and F8 are used to control the debugging process, allowing the programmer to step through code line-by-line or complete modules/programs in a single step. External breakpoints can be used to debug programs called from external interfaces.

Uploaded by

SUDHARSANA S
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Debugging techniques in SAP ABAP programming, working with debugging

controls in SAP ABAP debugging

Debugging is one of the important part in trouble shooting of an ABAP application, we can debug
ABAP code by using breakpoints.
SAP provides Classical Debugging & New Debugging
New Debugging is available from ECC onwards. whereas classical debugging available in sap r/3
and even in ECC also.
In SAP Programming there are two kinds of breakpoints.
Static Breakpoints: These can be set by using statement BREAK-POINT in ABAP code, these
breakpoints are not user specific, these will trigger for every user. We need to delete these
breakpoints manually.
Dynamic Breakpoints: These breakpoints are user specific, these will trigger for specific user only.
These breakpoints will be deleted automatically when you log-off from SAP. These can be set in
ABAP editor. Dynamic breakpoints can be set in active (activated) source code only. BREAK JBL.
Dynamic breakpoints are of two types.
External break-point: These is a type of break-point, which will get activated even for Non
SAP Applications, these breakpoints will be triggered from SAP or from Non-SAP example
from portal screen.
Session break-point: This break-point will be activated for call only within SAP system and its
active till the User session is on.
Ex:- SE38
These breakpoints have different behaviors in different types of coding blocks ex: Function
Modules, Sub-routines etc.
In this lesson we will discuss the behavior of breakpoints in each.
When we put break-point in some ABAP code, control will stop at the specific place when
executing the ABAP program, then it is debugging mode. We can control debugging using
function keys F5, F6, F7 and F8 or using toolbar buttons in debugging screen.

1. Working with static break point.


Go to SE38, create a program ZSAP_DEBUGGING, add below code and activate.
REPORT ZSAP_DEBUGGING.

SKIP.

BREAK-POINT. "Static break-point

Save, activate and execute the program.

2. Working with Dynamic Breakpoint.


Go to SE38, create a program ZSAP_DEBUG, and add below code
REPORT ZSAP_DEBUG.

DATA : IT_MARA TYPE TABLE OF MARA,


WA_MARA TYPE MARA.

PARAMETERS: P_MTART TYPE MARA-MTART.

SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS


WHERE MTART = P_MTART.

LOOP AT IT_MARA INTO WA_MARA.


WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL, WA_MARA-MEINS, WA_MARA-SPART.
ENDLOOP.

Go to program source code, put cursor where you wants to set break-point and click on
set/delete external break-point icon (see image below).

Now execute the program, provide input ex: FERT and execute (F8), breakpoint will trigger.
Now go to 'Desktop 3', which is friendly to see run-time variables and data, double click on
any variable to see respected value and data in right pane.

Techniques of debugging
Now, we will learn and understand the real techniques of debugging.
What are uses of F5, F6, F7 and F8 in debugging ?
These are function keys, which are used to control debugging ex: go to next break-point,
execute perform/function module which out going into it etc.
F5 - When you press F5 in debugging, you will go to next step means you program control
goes to next line.

F6 - When you press F6 in debugging, it will execute the module without going into it.F6
works for performs (subroutines), Function modules, Class methods etc.
Ex for F6: we have a program, we have some function modules in the program, when we click
F5 in debugging control will go into function module source code, we don`t want to go into
function module, in that case we use F6, it will not go into function module instead it will
execute it in one step.
F7 - When you press F7 in debugging, it will completes the current module/program in a
single step.
Ex for F7: We have a program, we have a function module in the program, we have put break
point, when we press F7 it will completes the program if the control is in program, when we
press F7 it will complete the module( FM) when the control is in function module.
F8 - When you press F8 in debugging, control will go to next break point if any or completes
the program execution.

When do we use external break-point?


Whenever we wants to debug a program, function module, Web Dynpro application or any
other object from external interface (other than GUI) like portal, web dynpro etc, we need to
use external break-point. We can use external break point to debug from GUI also.

Common questions

Powered by AI

F5 progresses the program control to the next line, allowing step-by-step observation. F6 executes a module without stepping into it, beneficial for skipping unnecessary details. F7 completes the current module or program without further interruptions, useful for exiting deeper levels of code. F8 resumes the debugging process towards the next breakpoint or finishes the execution if no further breakpoints are present .

Utilizing function keys accelerates the debugging process by providing structured control over code execution flow. F5 allows step-by-step traversal, providing detailed insight and immediate feedback for each line of code. F6's capacity to execute modules without diving in saves time, enabling a focus on higher-level logic instead of details unnecessary for the current debugging context. F7 efficiently concludes modules, while F8 rapidly moves to the next breakpoint or completes the execution, minimizing manual monitoring and enhancing focus on critical areas of interest .

Static breakpoints within coding blocks such as function modules and subroutines remain consistent across all user interactions since they are not user-specific, ensuring that the code stops at these critical areas for every execution cycle until manually removed. Dynamic breakpoints, however, vary based on session and user-specific triggers, allowing targeted debugging within these blocks primarily for interactive or session-based analysis, rather than a blanket approach. This selective engagement enables developers to focus on user-specific issues within these separable code entities .

Static breakpoints are set using the BREAK-POINT statement in ABAP code and are not user-specific, meaning they trigger for every user until manually deleted. They are commonly used in both SAP R/3 and ECC systems. On the other hand, dynamic breakpoints are user-specific and automatically deleted upon logging off from SAP; they can only be set in active source code, making them useful for debugging user-specific scenarios. Dynamic breakpoints are divided into external breakpoints, which are triggered even from non-SAP applications, and session breakpoints, which are active only within the SAP system during a user session .

Static breakpoints, since they are universal and not user-specific, may inadvertently interrupt program execution for other developers or users, resulting in unnecessary halts in production or testing environments. This can lead to decreased productivity and potential errors if debugging is not intended for a particular session but affects all. Mitigation involves stringent breakpoint management, ensuring static breakpoints are swiftly removed post-debugging or replaced with dynamic breakpoints for ongoing development in collaborative settings, promoting tailored diagnostics without disrupting others .

Breakpoints play a crucial role in ensuring code quality by providing developers the ability to pause and inspect the real-time execution environment. Static breakpoints act as permanent markers allowing validation of fixed points in code logic with every execution cycle, whereas dynamic breakpoints permit focused, user-specific problem isolation. By strategically placing breakpoints, programmers can verify that recently modified code does not interfere with established functionality, allowing for targeted error correction and performance optimization. Regular and judicious use of breakpoints ensures robust error handling, facilitating a maintenance regimen that preserves code base integrity over time .

External breakpoints should be used for situations where debugging is needed from an external interface, such as a web portal or Web Dynpro application, as they allow control from both SAP and non-SAP environments. This makes them ideal for checking integration points or interactions with external applications where the standard user interface is not used. Session breakpoints, conversely, are only applicable within the SAP GUI and don't extend to external interfaces .

Breakpoints in SAP ABAP embody core principles of software debugging by allowing developers to halt program execution to inspect and verify the current state and logic flow. Static and dynamic breakpoints reflect the diverse needs during debugging: static for universal, persistent checks and dynamic for user-specific or session-limited scenarios. The ability to differentiate points for inspection (such as through external vs. session breakpoints) also represents the nuanced control necessary in a robust debugging strategy, reflective of best practices in software engineering for handling complex program architectures and interactions .

Dynamic breakpoints offer significant advantages over static breakpoints in scenarios where debugging needs are user-specific. Since they are tied to user sessions, they provide more granular control in testing scenarios without affecting other users. This feature is particularly useful for collaborative environments or when working on multi-user systems, allowing tests in controlled environments without global interruptions. Dynamic breakpoints automatically clear upon user logout, ensuring no residue in the system, which aids in maintaining a clean testing state .

A deep understanding of the differences between external and session breakpoints allows developers to effectively address diverse debugging needs across multi-system environments. External breakpoints enable cross-platform debugging, crucial for applications involving multiple interfaces like web portals or other non-GUI interactions. This capability ensures that developers can swiftly diagnose and correct interface-specific issues. Session breakpoints, however, focus on within-system debugging, making them ideal for isolated intranet applications or back-office systems. Optimal breakpoint selection thus enhances diagnostic precision, operational efficiency, and system integration coherence .

You might also like