Está en la página 1de 23

ABAP Development: Six kinds of debugging

tips to find the source code where the


message is raised
Posted by Jerry Wang Nov 15, 2013
Approach1 - Use "Where Used List" function in ABAP workbench on page 2
Approach2 - Use Watchpoint to observe sy-msgid in ABAP debugger on page 5
How to switch into debugging mode for a modal( pop up ) window on page 7
Approach3 - Leverage the breakpoint type "ABAP Commands" to debug more efficiently on page
7
Approach4 - source code scan on page 8
Approach5 - ABAP Runtime Analysis Tool SAT shows its power on page 11
Approach6 - Have you used ST05 like this way on page 13
Deal with those messages raised in ABAP webdynpro / CRM Webclient UI on page 15
Use SAT to trace web application on page 15
Other Blogs / Wikis in SCN which could make your debugging more efficient on page 16
Troubleshooting an unfamiliar ABAP issue by Noel Connolly on page 16
How to leverage breakpoint with Exception type - A real example on page 16
How to efficiently debug in ERP and CRM application on page 16
Summary on page 16
I would like to share with you my debugging tip in my daily life, which makes my life much eaiser. In case you
found your own tip are not listed here, please kindly comment it so that it could benefit more people here
I will use a simple example to demonstrate. Input an invalid name in SE38 and click display button. An
message is displayed in the bottom. I will show you how to find the exact line of code which raises this
information.

Generated by Jive on 2015-01-06+01:00


1

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.

Approach1 - Use "Where Used List" function


in ABAP workbench
click on the green icon and we can find message class ID: DS, number 017

Generated by Jive on 2015-01-06+01:00


2

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

SE91, use where use list:

OOPS, so many hits...

Generated by Jive on 2015-01-06+01:00


3

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.

Generated by Jive on 2015-01-06+01:00


4

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

yes it is confirmed by debugging:

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.

Approach2 - Use Watchpoint to observe symsgid in ABAP debugger


type /h in command area, and click display button to trigger debugger.

Generated by Jive on 2015-01-06+01:00


5

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:

Generated by Jive on 2015-01-06+01:00


6

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

How to switch into debugging mode for a modal( pop


up ) window
Since the command line is not available if there is a modal( pop up window) involved, in this case please refer
to SAP Note 118184 about how to switch into debugging mode or refer to this wiki.

Approach3 - Leverage the breakpoint type


"ABAP Commands" to debug more efficiently
Launch the debugger just the same as A2, create a dynamic breakpoint with ABAO command = MESSAGE.
The debugger will again stops at the correct line.
With this approach again I only spent 20 seconds.

Or you can use menu via Breakpoints->Breakpoint at->Breakpoint at messages to achieve the same result.

Generated by Jive on 2015-01-06+01:00


7

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.

Approach4 - source code scan


Tcode SE93, find the package name of SE38:

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.

Generated by Jive on 2015-01-06+01:00


8

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

We only have 4 results.

Generated by Jive on 2015-01-06+01:00


9

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:

Generated by Jive on 2015-01-06+01:00


10

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.

Approach5 - ABAP Runtime Analysis Tool SAT


shows its power
tcode SAT, create a new variant, ensure the radio box item "Aggregation - None" is selected.

Generated by Jive on 2015-01-06+01:00


11

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

Then launch the SE38 within SAT by clicking "Execute" button.

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.

Generated by Jive on 2015-01-06+01:00


12

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.

Approach6 - Have you used ST05 like this way


First you open SE38, type and invalid program name.
Open a second session, switch on your ST05 with default settings.
Go back to your SE38 window, click display button.
Go back to your ST05 trace, deactivate and display trace result:
We know that the PROGDIR table stores the header information of report. It makes sences for ABAP editor
to check whether the program name is valid by search it in that table, doesn't it? So the undoubted next step

Generated by Jive on 2015-01-06+01:00


13

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.

Generated by Jive on 2015-01-06+01:00


14

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

Deal with those messages raised in ABAP


webdynpro / CRM Webclient UI
If the message is not raised in SAP GUI but from ABAP webdynpro or CRM webclient UI, all of these six
approaches still work.
This blog is focusing on how to efficiently locate the source code where the message is raised in CRM
Webclient UI environment.

Use SAT to trace web application


The approach 5 has made good use of powerful tool SAT. Please keep in mind that SAT could not only trace
the transactions running in SAP GUI but also work for Web application. For more detail please read this nice
document Measure Performance and Analyze a Web UI Transaction using SE30 from Bhushan Dharmik.

Generated by Jive on 2015-01-06+01:00


15

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

Other Blogs / Wikis in SCN which could make


your debugging more efficient
These blogs / wikis do not talk about the dedicated solution to find message raising location, but contain
generic tips which would accelerate your debugging and make your life easier.

Troubleshooting an unfamiliar ABAP issue by Noel


Connolly
How to leverage breakpoint with Exception type - A real
example
This tip has actually the similar logic as Approach3, the only difference is another type of ABAP breakpoint is
used.

How to efficiently debug in ERP and CRM application


When I am a beginner in CRM and have to debug CRM business transaction application to resolve ticket
reported, I felt really frustrated since although I have used ALL OF THE SIX approaches I described here, still
the breakpoint could not be triggered
Finally I realized that just works as designed. I share you with my tips
gained through painful debugging in that area and hope they are helpful.

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.

Generated by Jive on 2015-01-06+01:00


16

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

Generated by Jive on 2015-01-06+01:00


17

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

Generated by Jive on 2015-01-06+01:00


18

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

Very Helpful Blog...... Nice One !!


jigar thakkar
Feb 28, 2014 8:38 AM
Very informative blog..
Bronwyn St Clair
Jan 28, 2014 2:32 AM
A helpful blog.
It's worth noting, especially for those new to SAP, that approaches 2,3, and 6 have the benefit of finding
messages that are issued dynamically, which you can't find with a where-used list. I'll generally start with the
specifc message, and widen the search to any message statement if I still get no result.
Siow Fong Chen
Jan 27, 2014 3:49 AM
Thanks Jerry for the wonderful blog. Certainly look forward to you sharing more debugging tips on debugging
web based system like the CRM UI. It is definitely not the easiest system to debug!
Jerry Wang in response to Fabian Geyer on page 21
Jan 25, 2014 6:19 AM
Hi Fabian,
Thank you very much for your suggestion. The message handling logic described by you in ERP sometimes
took more time and effort for developers to debug indeed. I think the tip suggested by you is worth a separate
blog. I have created one using CRM service contract as example. I have added it to part "Other Blogs / Wikis in
SCN which could make your debugging more efficient". Thank you.
Best regards,
Jerry
Jerry Wang in response to Jim Tasker on page 19
Jan 25, 2014 3:32 AM
Hi Jim,
Thank you for your screenshot. I just added it to Approach2, so that it can help more SCNers which are not
familiar with it yet.
Best regards,
Jerry
Jim Tasker
Jan 24, 2014 9:39 PM
Thanks Jerry, nice blog.

Generated by Jive on 2015-01-06+01:00


19

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.

Jerry Wang in response to Adi Sieker on page 21


Jan 24, 2014 4:05 PM
Hi Adi,
Thank you very much for reading the blog with your kind suggestion. I have added your tip into the blog.
Best regards,
Jerry
Jerry Wang in response to Noel Connolly on page 22
Jan 24, 2014 3:51 PM
Hi Noel,
Thank you very much for your comment. I read your wiki, it is really helpful. I have added the link to this blog
and mark you as the author. Thank you for your kind suggestion.
Best regards,

Generated by Jive on 2015-01-06+01:00


20

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.

Generated by Jive on 2015-01-06+01:00


21

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.

Generated by Jive on 2015-01-06+01:00


22

ABAP Development: Six kinds of debugging tips to find the source code where the message is raised

Nabheet

Generated by Jive on 2015-01-06+01:00


23

También podría gustarte