Documentos de Académico
Documentos de Profesional
Documentos de Cultura
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
note: some of the approaches listed here might not be efficient for this very case, I just list all of my tips here for
completeness. I do believe each tip could be useful in certain case.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Then I have to manually fitler them one by one to find the correct one. Double click one by one. I ignore all
entries with type MESSAGE E since in my case the message type is not E, but S. After one minute I confirm
the following one is the one I try to find.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Summary: the drawback of A1 is that as you see, if there are many where used list results say a hundred, it still
takes you some time to manually find the correct one.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Create a watch point with below two conditions. After that click F8, the debugger will stop automatically at the
correct line you want. This approach just took me 20 seconds to finish the job.
For detailed screenshot about how to create a watch point in Debugger, see picture provided by Jim Tasker:
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Or you can use menu via Breakpoints->Breakpoint at->Breakpoint at messages to achieve the same result.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Summary: if the scenario you want to debug is quite complex, for example deep callstack with several
components involved, the debugger might stops at the ABAP code with MESSAGE keyword frequently. You
must still manually check whether the code is just the one you are looking for at each stop. However it is still
much more efficient than you debug manually one by one.
Then use report RS_ABAP_SOURCE_SCAN and maintain the search criteria below. The reason why I do not
use program name RSABAPPROGRAM is that it is just a wrapper report. The actual implementation of SE38 is
not put within it.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
You can use an alternative tcode CODE_SCANNER which can achieve the same result:
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
From my point of view, I do like this A4. I can not remember how many times it has helped with my debugging
life. What's more, it would be used not only as a debugging tip, but also one way of studying other people's
code. Suppose you are curious of how a certain function is implemented by a software component, it is a good
starting point to think of a meaningful search keyword and specify the package of that software component and
go deep into the result code.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
repeat your steps as usual - input an non-exist report and click display button to see the message. After that
click back or quit button in SE38. SAT will automatically be opened to show you all runtime trace information. It
will take some time - you can see the progress information in the bottom:
click tab "Call Hierarchy", click find button. Input Statement = MESSAGE and go. You will see two search
results.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
double click on the hit list row and then you can see the source code.
Summary: if the scenario you are tracing with SAT is complex, you will get a huge trace file. Although you can
specify an extremely big size in trace file, according to my real experience, you will fail to open the result trace
file when it exceeds 1 G, at least in my application server.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
would be the raise of a message if database search fails. Click the "Display ABAP call location" button to go to
the source code:
We see the logic is that first try to search in DB with inactive version, if failed, try with active version.
So hopefully the code we are trying to find is just in the very neighborhood of the SQL statement in line 774
and 779. Fortunately in this case, yes it is in line 813.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Summary
In my previous work I used to struggle with some tricky case where I don't know how to start my debugging
at all. The A6 I call it "ST05 weapon" do prevent me from working over late into the night. Even for the most
sophisticated application, I can switch on ST05, repeat the application again, and analyze the trace result to
judge which line is useful to start debugging. So I like this overwhelming tool. You may say that it would not
help if there is completely no database access for the application to be debugged. Well I would say that would
be a rare case at least in my own working area.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Do you have additional tips not included in this article? Please kindly share with us
48574 Views Tags: abap, beginner, message, debug, trace, sat, tips, st05, where_used, efficient, code_scan
Derby Lim
Jul 29, 2014 4:04 AM
Some tips for web dynpro users.
Set breakpoint in
WDA (web dynpro abap): CL_WDR_MESSAGE_MANAGER -> REPORT_MESSAGE
FPM (floorplan manager): CL_FPM_MESSAGE_MANAGER -> IS_POPUP_OPEN
abhijeet sharma
Jul 22, 2014 8:33 AM
Nice And really helpful for budding abapers lyk myself.
Prasad KG
Jul 1, 2014 1:07 PM
Thank you!!
by taking the example of finding the message where it's raised, you have helped me to enhance my debugging
skills as a programmer.
Suman Chakravarthy K
May 22, 2014 7:51 PM
Excellent tips
Will be handy !!
Douglas Santos
May 22, 2014 7:19 PM
Interesting the ST05 for this.
Lokesh Doggala in response to Jerry Wang on page 22
May 15, 2014 1:24 PM
Like the Knowledge flowing here.. Lot of Debugging Tips
Camy su
May 12, 2014 7:55 AM
nice blog.
best regards
Daniel Lippmann
May 3, 2014 2:45 PM
An excellent guide for on-going programmers and consultants (who should be able to debug as well)!
solen dogan
May 2, 2014 1:57 PM
Its a nice blog. Good work
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Theres also
Ewk1 as well
Renukha Rangasami
Apr 21, 2014 1:49 PM
A good time-saver debugging tips.
Always Learner
Apr 17, 2014 9:51 AM
It is very helpful.
Roopa M
Apr 10, 2014 8:41 AM
Thanks for the information.
helpful.
Jayakumar K B
Apr 8, 2014 5:02 PM
very useful.. thanks for sharing
daogui wang
Apr 3, 2014 5:40 AM
It is very helpfull
Viswanadha Reddy
Apr 2, 2014 11:53 AM
Hello Jerry,
Thank you very much for a nice document, these tips would help more for functional people.
Thanks,
VNR
nagendra modupalli
Mar 12, 2014 7:43 AM
Thank you for sharing jerry ,good topics
Siva Ganesh Kumar Kottana
Mar 12, 2014 6:25 AM
Thankyou Jerry , Loved it
Sharon Cooksey
Mar 6, 2014 4:51 PM
SWEET!!! Thanks for sharing Jerry
Onkar Satpute
Mar 4, 2014 8:22 AM
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Here's my personal favorite: activate the debugger and create a watchpoint on SY-MSGNO. Enter a "Free
condition" on the watchpoint of "= 'nnn'" where 'nnn' is the message number. As long as the message is issued
via the MESSAGE statement this will stop at exactly the right spot.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Jerry
Jerry Wang in response to Andriy V. Bazdyrev on page 21
Jan 24, 2014 3:28 PM
Hello Andriy V.
Actually I am using the tip in SAP note 118184 frequently during my daily work, but still thank you very much
to mention it, I have already added it as one part of Alternative 2. Thank you for your kind suggestion and
comment on this blog.
Best regards,
Jerry
Adi Sieker
Jan 23, 2014 9:52 PM
If you are confronted with new style class based exception for error handling, then a good trick is placing a
session break point in the constructor of CX_ROOT the abstract superclass for all global exceptions.
Florian Bauchinger in response to Andriy V. Bazdyrev on page 21
Jan 23, 2014 11:02 AM
Great hint with SAP Note 118184!
I was looking for a functionality like that, but always assumed, it just was not possible.Kudos to you, sir!
Andriy V. Bazdyrev
Jan 23, 2014 10:42 AM
Jerry, thanks for a good compilation of debugging tips.
Just wanted to add more tips to your A2 and A3 approaches.
Sometimes it's not possible to give a "/H" debug command, because the window is modal (i.e. screen for
entering serial numbers in transaction VL02N for outbound deliveries) and neither the command window nor
system menu are immediately available. In this case one can create SAPGUI shortcut for activating debugger
from popup window and use drag-n-drop to initiate it. Official recommendations from SAP on this approach is
given in note 118184
BR, Andriy
Fabian Geyer
Jan 23, 2014 9:27 AM
Several ERP applications (esp. Financials) often use a "message collector" technique especially when handling
"multiple objects", where after the application ist "detecting" an error it will be "stored" to an "error collection"
and after all checks have been done the list of maybe many erros is shown in a popup or list.
In these cases, when the message is "shown" is far to late to analyze, because the application data/situation
which is causing the error is analyzed somewhere else (far earlier in the runtime). In these cases I often use
breakpoints in FM "MESSAGE_STORE".
Similar handling is needed in case the BC Application Log-technique is used (SLG0, SLG1 etc.) a breakpoint in
FM BAL_LOG_MSG_ADD can help.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
When searching for the message occurence in the source with code scanners you should not only look for
"MESSAGE Xnnn WITH" ... occurences but also for "MESSAGE TYPE X ID XYZ NUMBER nnn" strings.
(which is rather difficult :-( )
Noel Connolly
Jan 7, 2014 1:18 PM
When I am completely unfamiliar with the code, I like to set a breakpoint at function module
SAPGUI_PROGRESS_INDICATOR and to work from there. This would probably be more relevant when you
are trying to catch code that does not raise a message (but I think it is still relevant to this discussion). It is
explained here: http://wiki.scn.sap.com/wiki/display/ABAP/Troubleshooting+an+unfamiliar+ABAP+issue
Jerry Wang in response to Jelena Perfiljeva on page 22
Jan 7, 2014 10:08 AM
Hello Jelena,
sorry for late response, I have read the document in your link, it is really helpful! I have formatted the blog. Is it
better now?
Best regards,
Jerry
Jelena Perfiljeva
Dec 23, 2013 9:29 PM
Thank you for sharing, good tips.
Just a suggestion - this is a long blog and might benefit from some formatting to separate/highlight the
sections. I find Jason Lax's documents (e.g. Everything I know about... Inserting Links and Table of Contents )
very helpful in this area.
Jerry Wang in response to nabheet madan on page 22
Nov 15, 2013 7:43 AM
Hi Nabheet,
I didn't know that tip until you tell me today. Thank you very much!
Best regards,
Jerry
nabheet madan
Nov 15, 2013 7:32 AM
Hi Jerry
Thanks for sharing. For your first point where you have put in a message statement you can also put directly
the message number and then it will stop exactly at the same place.
You can follow the path break point->Break point at--> Choose message and provide messag number etc.
ABAP Development: Six kinds of debugging tips to find the source code where the message is raised
Nabheet