Debugging For Functional Consultants - SAP Blogs
Debugging For Functional Consultants - SAP Blogs
Introduction to Debugging
SAP consists for various transactions codes and data. Data are stored in the tables and the transaction codes
have ABAP programs at the back end. Literal meaning of debugging is ,to make something(a program in current
discussion) bug-free. But that is just one aspect of debugging.
Through debugging, we can analyze a program, understand the ow logic and most importantly nd out the
root cause to any issue .Although Debugging is the obvious task of an ABAP consultant, the debugging
knowledge would be of great help to functional consultants. It will save their time for analysis and issue
resolution , reduce over-dependence of ABAP team , help in e ort estimation.
Let’s look at the di erent aspects of debugging. We will divide the discussion in to the below parts.
3. Breakpoints
4. General tips
When we execute the program, the control runs through the program and delivers the output. When we debug,
the control remains in our hand and runs through the program line by line, thereby allowing us to nd out a
speci c bug, or clarity about a speci c logic.
the transaction.
As functional consultants , we would be mostly using the 1st option. The 2nd option is used, generally by
ABAPers, where they want to see the behavior of a particular section of the code. Let’s see examples of each of
the above mentioned methods.
Example
1. If any Break-point is there, the control will directly ow there.(Break-Points have been discussed in more
detailed way in coming slides)
2. If no break-point is there, the debugging will end and the program will get executed.
As we move along the program, we may encounter, Subroutines/function modules, which are nothing but a
piece of code within the program, which take inputs and provide a speci c output.
If we Keep pressing on F5, we will go inside the Subroutines/function modules and go through each line.
If we have yet not entered Subroutines/function modules , then by pressing F6 , we will skip going through
the code piece and the Subroutines/function module will be completely executed.
If we have entered Subroutines/function modules , then by pressing F7 , we will come out of the code piece
and the Subroutines/function module will be completely executed.
b. Putting a break-point, at a particular line of the program and executing the transaction
This can be done by going in to the source code editor (SE38/37 etc.) and putting the break point at the desired
line. Cursor can be put on the particular line , at which we need the control to stop and click on the break point
button(highlighted in the below screenshot).This will create the breakpoint in the program.
When we execute the program, the control will go to that point and stop.
3. Break-Points
Break-point is the point where the Program execution comes to a halt and from there on we can continue
debugging or straight away execute the program , by pressing F8.
There are various ways, through which we can put a break-point in a program . Two mostly used ways are as
below.
This is one of the important methods and by far the most useful for functional consultants.
Generally we tend to debug, when we encounter an error message. In that case, we can put the breakpoint,
exactly at the point , where the error originated. And once we execute the program, that will take us straight to
that point.
Let’s take an example of the current program. It takes the input as an AL11 path. The path must be a valid one. If
we put an invalid one, it would ideally end in error. Suppose We encounter such an error, while executing the
transaction in question.
Above is the initial screen and upon execution, we got the below error.
1st thing to do after this is double clicking the error message which will give us the message class and the
message number In the screen below AD is the message class and 010 is the message number and the
message, being in red, indicates that it’s an error message.
We start the debugging, by using /h and then, we put this message class and number in the debugging screen
as mentioned in the following screenshot.
Now executing the program(F8) will take us to the exact point of error, where we can analyze the reason of the
error. In this speci c case, the IF statement below says, if the 1st two characters (OFILE_SAVE+0(2)) is not ‘\\’,
then issue an error. The input that we provided in the selection screen started with ‘//’ , and hence it resulted in
error. That’s how, we nd out the reason of an error, in this method.
Once the debugging screen appears, breakpoint can be put by using the highlighted breakpoint option.
2. Before Debugging/Executing the program
This can be done by putting a breakpoint in the source code editor (SE38/37 etc.). When we execute the
program, the control will go to that point and stop.
In SE38, Cursor can be put on the particular line , at which we need the control to stop and click on the break
point button(highlighted in the below screenshot).
Next when we execute the program or transaction, the control stops at this point.
4. General Tips:
Given below are some general tips, suggestions and terminologies involved in debugging.
Debugging with the new Debugger Opens a new session. Hence , before debugging, ensure that we have
enough room for the same, else, automatically the old debugger opens.
During Debugging, if at any point, we want to see the source-code, we can do so in the following way.
During debugging, we come across select statements, which are nothing but the statements, which fetch
data from database table and store in the internal table in the run-time. If we click on the table
icon(highlighted in the below screenshot) , It opens up the table in the next window. We can download the
table data in an excel format for our analysis.
Below are few important parameters and terminologies with respect to debugging.
SY-SUBRC : It’s an indicator, that shows , whether the execution of a “Select statement” , “Function Module”,
“Subroutine” , “Method”, is successful or not. When sy-subrc is 0, it indicates that the execution is
successful.
Variable : It’s a temporary storage parameter, that holds a value during the program run-time.
Constant: As the name suggests, it holds a constant value, which is hard-coded in the program.
Tables : When the control passes through a select statement, up on successful execution, the table(internal
table) gets lled in the run-time.
Structures : Structure is di erent than a table. Its just a template, but not a table.
These were some basic information, which can be handy to the functional consultants. Debugging has far more
aspects and we can explore more of them, as we continue to be involved in more of debugging. Your comments
and suggestions are most welcome.
Alert Moderator
Assigned tags
FIN (Finance) | abap | debug | debugging for functional consultants | debugging techniques |
Related Questions
47 Comments
You must be Logged on to comment or reply to a post.
Former Member
Rudra,
Regards
Sam
Like (0)
Rudra
Like (0)
Jyothi Pammina
Hello Rudra,
Its useful for functional consultants like me. Thanks for sharing 🙂
KR,
Jyothi
Like (0)
Jobi Sebastian
Hi Rudra,
Jobi
Like (0)
Former Member
Hi Rudra,
Thank you for sharing the document and today i have learned some Debugging Techniques.
Regards,
Ajay.
Like (0)
Thanks Ajay for the nice comments . Glad that it has been useful to you. 🙂
Like (0)
Hi Rudra,
Very good!
B/R
Like (0)
Thanks Prashant.
Like (0)
Aarti Hinge
Hi Prashant,
If you already worked on Report Painter earlier Or has knowledge about it, kindly help us in completing this
enhancement as early as possible.
Like (0)
Former Member
Like (0)
Thanks Ganesh 🙂
Like (0)
Former Member
Thanks Rudra
Like (0)
Thanks Venkata 🙂
Like (0)
Former Member
Nice document
Like (0)
Phi Dang
Like (0)
Emmanuel Fuentes
Like (0)
Ganesh Sadula
Dear Rudra,
With Regards,
Ganesh
Like (0)
Former Member
Hi Rudra, Thanks for helping us out with this document. Keep it up.
Like (0)
Former Member
Hi Rudra,
Nice document and the way you presented is also good, helps functional guys for sure.
Thanks.
Regards,
KR
Like (0)
Former Member
July 2, 2015 at 5:45 pm
Hello All,
I have created a WIKI with debug tips for posting and clearing process. I hope that helps!Debug – Posting with
Clearing in Detail – ERP Financials – SCN Wiki
Regards,
Raquel
Like (0)
Former Member
Thanks.
Regards,
KR
Like (0)
Adityaz Febriandri
Like (0)
Former Member
Hi Rudra,
Great work.
Regards,
Venki
Like (0)
Former Member
Hi Rudra,
Regards
G Srinivas
Like (0)
Former Member
Hi Rudra,
Regards
Venkateshh
Like (0)
Former Member
Nice document
Like (0)
Sattaiah Gundu
Satta a Gu du
Good Document
Like (0)
Ajay Jawalkar
Hello Rudra,
Like (0)
Former Member
Best Regards,
Chirag Panchal
Like (0)
Thanks all for your comments, I am glad that you are nding this helpful. 🙂
Regards
Rudra
Like (0)
Former Member
Adityaz Febriandri
Like (0)
Ajith Kumar
Like (0)
Ritesh Ingale
Thanks
Like (0)
Former Member
Like (0)
Rudra Prasanna Mohapatra | Post author
Like (0)
Former Member
Like (1)
Valdimir Putin
Wonderful blog
Thanks
Like (1)
Former Member
Like (0)
Rahul Patil
Like (0)
AMOL NAMJOSHI
Very Value added Information and thanks for sharing step by step process.
Like (0)
Sitemap
Newsletter