As a developer in my daily life I always need to quickly locate the source code where raises a given message in webclient ui.

(If you would like to know how to quickly find the source code which raises message in SAP GUI environment, please refer to this blog of mine instead. )

Here below are four approaches using which almost all messages I meet with so far could be located:

1. If some invalid data is input which blocks the account save, the generic message saying “data contains error” without dedicated erroneous field is not helpful. Suppose I would like to find the exact code which raises error message. You can observe that if I put the mouse onto the error message, there would be a tooltip poped up with message technical information like message id and message number. By default this behavior is not activated for your user. You can manually activate it via:

/wp-content/uploads/2013/09/clipboard2_285465.png

go to transaction code SU3 and maintain user parameter BSPWD_USER_LEVEL = 6

/wp-content/uploads/2013/09/clipboardlevel_285466.png

6 means “Experienced user”. You can find the description of all possible value in domain BSPWD_MSGLEVEL.

clipboardLEVELTEXT.png

Now we know the message id is CRM_BUPA_BOL and number is 036. Go to transaction code SE91 and search code via where use list:

clipboardW1.png

we get 2 hits: double click on one of them. Why there is if 1 = 2 whose condition will never be met?

/wp-content/uploads/2013/09/clipboardhit_285488.png

actually the red code below is just what we look for. The above code in line 86 is just simply written in order to enable itself to be found by where use list,

since where used list in abap workbench would only find the static message usage like keyword MESSAGE + <message type like e,i,w><message number>

(<message id>). The red code does not really raise message via keyword MESSAGE but just put the given message into an internal table via global message service and thus would not be found by where use list.

/wp-content/uploads/2013/09/red_285489.png

2. In IC agent inbox, if an unsupported search attribute is specified, the search could not be performed and the corresponding message is raised in ui.

/wp-content/uploads/2013/09/clipboard1_285464.png

unfortunately now if I follow approach 1, no hit in where use list.

/wp-content/uploads/2013/09/notfound_285490.png

so I try to use report RS_ABAP_SOURCE_SCAN, use 559 as search key, and maintain CRM_IC_APPL_INBOX as package. The report will scan 559 within all ABAP source codes which are stored in that package.

/wp-content/uploads/2013/09/search_285506.png

So how can I get the package name CRM_IC_APPL_INBOX? Just click F2 on UI, I can know the view name ICCMP_INBOX/InboxSearch.

/wp-content/uploads/2013/09/f2_285507.png

in its event handler for event SEARCH, I can know that the search implementation is actually provided by class CL_CRM_AUI_QUERY_SERVICE.

/wp-content/uploads/2013/09/handler_285508.png

so now I can ensure that the code which raises the information message is definitely inside that package.

/wp-content/uploads/2013/09/package_285527.png

after a while the report runs over and I can simply double click the result to jump into the source code.

/wp-content/uploads/2013/09/2hit_285528.png

3. When it comes to product area, it is pretty easy to find the source code of given message. Almost all underlying messages in product application is raised by utility function module COM_PRODUCT_ADD_MESSAGE. In example below I input an invalid item category group WWW and would like to find which code does validation check and raise error message. All I have to do is just to set a breakpoint in that function module, and re-save in UI:

/wp-content/uploads/2013/09/3a_285529.png

breakpoint is hit as I expect after I click save button again:

/wp-content/uploads/2013/09/3hit_285533.png

the sy-subrc indicates that there is some exception raised, and just above the FM COM_PRODUCT_ADD_MESSAGE, we can find the FM COM_PRODUCT_CHECK_FIELD_ENTRY complains that the input WWW is not valid.

/wp-content/uploads/2013/09/3hit2_285535.png

4. This is the most powerful debugging method. Suppose I need to find which line of code raises this message below:

/wp-content/uploads/2013/09/4a_285536.png

Use F2 button I know that the current search page is built on BP_HEAD_SEARCH/MainSearch:

/wp-content/uploads/2013/09/4b_285537.png

So I set a break point on search event handler:

/wp-content/uploads/2013/09/4bb_285538.png

The breakpoint is hit when I click search again. However I will not debug it line by line. Click tab “Break./Watchpoints”, and create a dynamic breakpoint for ABAP command MESSAGE. As a result the breakpoint will be triggered wherever the keyword MESSAGE is written in ABAP code.

/wp-content/uploads/2013/09/message_285539.png

I just click F8, and debugger automatically stops in the line below, which is just what we are looking for.

/wp-content/uploads/2013/09/4over_285540.png

Summary

all the four methods above makes my trouble shooting life easier. If you have any other approaches to achieve the same, welcome to share with us 🙂

To report this post you need to login first.

11 Comments

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

  1. Naresh Kumar Malik

    Nice Blog Jerry!!!

    I tried the program RS_ABAP_SOURCE_SCAN but it didn’t give me desired results.

    But i usually use the transaction CODE_SCANNER for code search .which i found very good.

    Naresh


    (0) 
  2. Parveen Kumar

    Hello Jerry,

    This is a fantastic compilation. I would like to add the following technique which I believe can come to rescue if every thing else fails.

    1. Go to transaction SAAB and activate breakpoints for CKP group : CRMUIF_CONDITIONAL_BREAKPOINTS

    2. Open the Web UI using WUI_DBG transaction.

    3. Press ALT + F2 and enable breakpoints for

    Genil -> Text message

    UI     -> Text message.

    Now the debugger will pop-up whenever there is a message raised in the Web UI.

    From the Call stack the user can go to the program which raised the message.

    Hope this helps.

    Parveen

    (0) 
    1. Jerry Wang Post author

      Hello Parveen,

      Thank you very much for your kind share. I agree with you that conditional breakpoint is the last resort. However I am a lazy guy and I do not like to click too much mouse to set up the environment … 😉

      Best regards,

      Jerry

      (0) 
  3. Arthur Zhao

    very helpful,thanks jerry.

    i think that if you know the message id and number, using sy-msgid or sy-msgno to create a watch point is better than  statement of ‘MESSAGE’ in the approch four.

    (0) 
    1. Jerry Wang Post author

      Hi Arthur,

      Thank you very much for your comment. Yes you are right, and actually I have already documented the tip you mentioned in another blog.

      Best regards,

      Jerry

      (0) 

Leave a Reply