SAP DEBUGGING
SAP DEBUGGING
Hariharan Rajagopal
SAP Junior Functional Consultant
SAP
DEBUGGING
Page |1
Table of Contents
What is the use of Debugging? .............................................................................................................. 2
Way of Debugging .................................................................................................................................. 2
Breakpoint .............................................................................................................................................. 2
Execution Keys ........................................................................................................................................ 3
System Variables .................................................................................................................................... 3
Features in Debugging mode for internal table .................................................................................... 3
1. List preview. ............................................................................................................................... 3
2. Search ......................................................................................................................................... 4
3. Source Code ................................................................................................................................ 4
Memory ID .............................................................................................................................................. 5
Watch Point ............................................................................................................................................ 5
Debugging during the Pop-Up Windows. .............................................................................................. 6
Debugging “Update Task” ...................................................................................................................... 6
Script ....................................................................................................................................................... 6
1. We can stop the debugger on the selection of tables ................................................................ 7
2. We can stop the debugger on an update of tables. ................................................................... 7
Skip AUTHORITY-CHECK ......................................................................................................................... 8
Page |2
Debugging – De-Bug
What is the use of Debugging?
We can detect, analyse, and resolve the bugs using debugging.
Way of Debugging
1. Breakpoint
2. Transaction Code: /H
Breakpoint
We can’t put the breakpoint on the Data declaration
We can only put a breakpoint on Executable Statements like IF, DO, Select
Breakpoint – If we set a session breakpoint, the system will stop reading the program at that point/
particular line.
1. Session Breakpoint – the breakpoint is attached to the user session and exits until the user
logs out from the SAP. We can use this internal SAP system for debugging.
2. External Breakpoint – the breakpoint is only valid for 2 hours for the respective user. Even
though we logout from the system the breakpoint will be there because of 2 hours’ validity.
We can use this internal SAP system and also for external debugging, for example, Webdynpro
application, BSP, etc…
Pathway – SE80 where only the external breakpoint will be available
1. Static Breakpoint – User-independent breakpoint, which means once we set the “Static
Dynamic Breakpoint” it will apply to all users. When the breakpoint is set for a transaction
code or executable program user Trainee01, Trainee02, and Trainee03 enter into it the
debugging will triggered
Keyword – Break-Point.
The Breakpoint can be set in the pathway—Breakpoints in the Menu bar Breakpoint at Breakpoint at
Statement. Here, we can set breakpoints at CALL FUNCTION, SELECT, MESSAGE, and Source Code. By
the way, the breakpoints will be set to the whole statement, though we can easily analyse the code.
Temporary – We can Temporarily delete the breakpoint by deactivating the breakpoint in the
particular session, and then the program allows us to execute. When we run the program again, the
debugger will start again.
Permanent—We can permanently delete the breakpoint. Though we can execute the program
without debugging, if we run it again, it won’t call debugging mode.
Page |3
Execution Keys
1. F5 Step by Step if there is a Call Function it will read
2. F6 Line by Line It will execute the reusable components like, Call Functions, Class, and
Subroutine and go to the next line
3. F7 Return from the reusable components
4. F8 Execute
System Variables
1. SY-SUBRC – Return Code
We can analyse the number of times the loop has been triggered.
1. List preview.
Where we can analyse the preview in debugging mode without executing it.
Page |4
2. Search
We can search Control + F. This feature wide used to find the value without exporting it.
3. Source Code
By using this feature, we can reduce our time by debugging again and again because a new screen will
be proposed where we can analyse the source code by debugging.
Page |5
Memory ID
How we can check the memory using debugging? Generally, the memory ID is not treated as a Variable
in debugging. So we can’t see the value by double-clicking it. Using System area.
By double-clicking the SAP Memory we can see the values of the variables.
Watch Point
Used to monitor the values of the variables and internal tables.
Page |6
Using this, we can monitor the value. We can also monitor the required data by keeping a “Watch
Point”.
“[FUNCTION]
COMMAND = /H
TYPE=SYSTEMCOMMAND”
Save this code in Notepad. Drag the Notepad and paste/put it over the Pop-Up window. By the way,
the debugging mode will be activated.
For the Update task – the normal debugging or breakpoint won’t read the updated task. So we have
to trigger the updated debugging by the above-mentioned pathway. The debugging will start after the
committed work, which means the debugging will trigger after committing, and then we can read the
Updated Functional Module. We can able to find the updated module by the radio button mentioned
above screenshot.
Script
Using Script, we can stop the debugger on the selection of tables, we can stop the debugger on an
update of tables.
Page |7
Without Script tab usage: Set the breakpoint at INSERT DBTAB and MODIFY DBTAB. By this, we can
analyze where the data will be stored.
For updating the table, we need to activate the update debugging, if not we can debug the system
and create the document. If the update debugging is activated, then the document will be created
then update debugging will be triggered where we can analyze the updating of the table.
Page |8
Using Script Tab: Just pass the Script name and start the script, where the system will create a
document and start update debugging.
Pass the required tables, by the way, we can analyze the updating of fields.
Skip AUTHORITY-CHECK
Note: It’s just for the Knowledge. Don’t process without a Basis person for such kinds of errors.
If we face any authorization issues for the respective user, by using debugging we can skip that error.
Whenever the system is unsuccessful for the input the SY-SUBRC will be other than zero, to pass the
condition we can edit the SY-SUBRC to zero. The system will allow us to process.