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.

/wp-content/uploads/2013/11/clipboard1_324288.png

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

/wp-content/uploads/2013/11/clipboard2_324289.png

SE91, use where use list:

/wp-content/uploads/2013/11/clipboard3_324317.png

OOPS, so many hits…

/wp-content/uploads/2013/11/clipboard5_324318.png

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.

/wp-content/uploads/2013/11/clipboard6_324319.png

yes it is confirmed by debugging:

/wp-content/uploads/2013/11/clipboard7_324320.png

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 sy-msgid in ABAP debugger

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

/wp-content/uploads/2013/11/clipboard8_324321.png

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.

/wp-content/uploads/2013/11/clipboard9_324326.png

For detailed screenshot about how to create a watch point in Debugger, see picture provided by Jim Tasker:

/wp-content/uploads/2013/11/watchpoing_371869.jpg

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.

/wp-content/uploads/2013/11/clipboard10_324327.png

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

/wp-content/uploads/2013/11/another_334844.png

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:

/wp-content/uploads/2013/11/clipboard11_324328.png

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.

/wp-content/uploads/2013/11/clipboard12_324335.png

We only have 4 results.

/wp-content/uploads/2013/11/clipboard13_324336.png

You can use an alternative tcode CODE_SCANNER which can achieve the same result:

/wp-content/uploads/2013/11/clipboard14_324337.png

/wp-content/uploads/2013/11/clipboard15_324341.png

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.

/wp-content/uploads/2013/11/clipboard16_324342.png

Then launch the SE38 within SAT by clicking “Execute” button.

/wp-content/uploads/2013/11/clipboard17_324343.png

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:

/wp-content/uploads/2013/11/clipboard18_324347.png

click tab “Call Hierarchy”, click find button. Input Statement = MESSAGE and go. You will see two search results.

/wp-content/uploads/2013/11/clipboard19_324348.png

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.

/wp-content/uploads/2013/11/clipboard20_324349.png

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 would be the raise of a message if database search fails. Click the “Display ABAP call location” button to go to the source code:

/wp-content/uploads/2013/11/clipboard21_324353.png

We see the logic is that first try to search in DB with inactive version, if failed, try with active version.

/wp-content/uploads/2013/11/clipboard22_324354.png

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.

/wp-content/uploads/2013/11/clipboard23_324355.png

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.

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

Three ways to achieve conditional break point in your ABAP programAsked by my colleagues, so I write it πŸ™‚

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.

Do you have additional tips not included in this article? Please kindly share with us πŸ™‚

To report this post you need to login first.

49 Comments

You must be Logged on to comment or reply to a post.

  1. nabheet madan

    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.

    Nabheet

    (0) 
    1. Jerry Wang Post author

      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

      (0) 
    1. Jerry Wang Post author

      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,

      Jerry

      (0) 
  2. Fabian Geyer

    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.

    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 πŸ™ )

    (0) 
  3. Andriy V. Bazdyrev

    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

    (0) 
    1. Jerry Wang Post author

      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

      (0) 
  4. Adi Sieker

    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.

    (0) 
    1. Jerry Wang Post author

      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

      (0) 
  5. Jim Tasker

    Thanks Jerry, nice blog.

    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.

    /wp-content/uploads/2014/01/watchpoing_371869.jpg

    (0) 
    1. Jerry Wang Post author

      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

      (0) 
  6. Siow Fong Chen

    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!

    (0) 
  7. Bronwyn St Clair

    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.

    (0) 
  8. Prasad KG

    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.

    (0) 
  9. Derby Lim

    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

    (0) 
  10. Pradeep Mani

    Hi,

    First of all i should thank you for presenting this.

    I am a functional consultant,your post was helpful for me.

    My error message was F5351.

    I used the were used list,got few programs listed

    The program concerned is LFACSU10.

    FORM lock_check USING i_bukrs    LIKE t001bukrs

                           i_account  LIKE skb1saknr

                           i_sperr

                           i_sperr_b.

    *

       CHECK NOT i_sperr   IS INITIAL

       OR    NOT i_sperr_b IS INITIAL.

       MESSAGE e351 WITH i_account i_bukrs

                    RAISING account_locked.

    My message type is “5”,my error was with “Message e351”.

    How can i come to a conclusion at this stage.

    (0) 
    1. Marius Ciuperca

      Hi,

      When you have the messagge class and the number (in your case messagge class F5 and messagge number 351) the fastest way is to create a breakpoint like this :

      /wp-content/uploads/2015/04/debug_681984.jpg

      If you also know if it is an error messagge you can type E in the field Ty.

      In your case , in the messagge statement, the ID of the messagge is not given because it is declared in the top include of your function group.

      id.PNG

      Hope it helps.

      (0) 
  11. Mark Suarez

    Hi Jerry,

    I am a WM functional consultant and I am not familiar in any abap transactions. I’m having an issue on my replenishment for fixed bins in tcode LP21. Configuartion on IMG are all okay, but still this error always occur on batch managed articles.

    Capture.JPG

    Below is the error description but I believe all config regarding batch management are already set.

    Capture2.JPG

    Now, I want know how this error 999 is taken and under what circumstances.

    Hope you can help.

    Thanks in advance.

    Mark

    (0) 
    1. Jerry Wang Post author

      Hi Mark,

      It is really difficult to locate the exact position of line where the error message is raised without debugging.

      Best regards,

      Jerry

      (0) 

Leave a Reply