TM Troubleshooting tip – Message handling & Message Determination
In real time world, we come across with different messages of different types while working on the TM applications. Sometimes they may be expected or unexpected. There may be various reasons why messages are thrown by system. May be Master data / customizing is missing or data incorrectly maintained or coding is wrong.
These messages are of different types –
Error – Icon Appear in red color in front of the message
Warning – Icon Appear in yellow color in front of the message
Success/Information – Icon Appear in green color in front of the message
In this blog we will see various techniques’ to find out the code when such expected/unexpected messages have appeared in the application screen. Therefore it is easier to understand what went wrong after a thorough technical analysis and further corrections can be done in order to fix the problem.
Note that we can find out the message class and message number by putting the cursor on top of the message as soon as it is appeared on screen.
1. Using Where used list
Whenever we come across with a message, first thing that comes in to mind is doing where used list on the message class and message number. Go to SE91 transaction -> enter the Message class and Message number -> Click on where used list.
Sometimes this works and sometimes not. This is because of the various ways of message handling done in the underlying ABAP code. If the ABAP Objects are displayed upon doing the where used list, put a breakpoint at the code where this message is raised and start debugging for further analysis.
Where used list works if coding done in the following manner.
MESSAGE E504(/SCMTMS/UI_MESSAGES) INTO LS_MESSAGE_ERROR-PLAINTEXT WITH MV_ID.
At times you will find MESSAGE statement is used but it is not caught when where used list is done. This is because of written MESSAGE statement is for generic purpose. In such cases we may use the Watch-point technique.
2. Using Breakpoint technique
When where used list approach did not work to find the ABAP code, then we can use the Break-point technique.
You can put a dynamic break-point while in debugging mode by clicking on ‘Create breakpoint’ button -> Then Popup is displayed with multiple Tabs. Here we can choose either of the below options.
- You can put a breakpoint on ABAP
command – Message
- You can put a breakpoint on class – /SCMTMS/CL_COMMON_HELPER
and method – MSG_HELPER_ADD_SYMSG
- You can put a breakpoint on Message by
entering the Message ID, Message Number and Message Type.
3. Using Watch-point technique
When where used list approach did not work to find the ABAP code , then we can also use the Watch point technique.
But if you are not aware where to keep a breakpoint to launch debugging, keep a breakpoint in FPM relevant class. Since TM applications are developed using Floor Plan Manager (FPM) as the frontend framework, relevant classes must be executed upon launching the application.
Class – CL_FPM_EVENT or any other class which you think gets executed.
Method – CONSTRUCTOR
Please note that, above class and method is executed for every action/event performed in the TM Web applications.
Watch-point can be created after debugging is launched.
After debugging session is open, start creating a watch-point on SY-MSGID andSY_MSGNO system variables. You can very well place the additional conditions to arrive at the exact place of code.
4. via Class based approach
Sometimes it happens that we will not be able to find the exact place of code where messages are raised using both the Break-point and Watchpoint techniques. This is especially when framework (PPF / BOPF level) messages are thrown by system.
Then you can put a breakpoint in below class and method to debug and identify how and where messages are coming from.
Class – /SCMTMS/CL_COMMON_HELPER and Method – MSG_HELPER_ADD_SYMSG
Below example code is to display a info message from message class /SCMTMS/UI_MESSAGES and puts it into the BOPF message object EO_MESSAGE. When you execute this code the issued message will also be shown on the User Interface.
DATA: LV_TEMP TYPE C.
MESSAGE I008 (/SCMTMS/UI_MESSAGES) INTO LV_TEMP.
CALL METHOD /SCMTMS/CL_COMMON_HELPER=>MSG_HELPER_ADD_SYMSG
IV_KEY = /SCMTMS/IF_TOR_C=>SC_BO_KEY “INSTANCE KEY
IV_NODE_KEY = /SCMTMS/IF_TOR_C=>SC_NODE-ROOT “BO KEY
CO_MESSAGE = EO_MESSAGE. “CURRENT MESSAGE
Some other important Message handling related classes are:
Class – /BOBF/CL_FRW_FACTORY
Method – GET_MESSAGE
Use: Return a Message Object. This method will return the instance of message class. This method is called for Message handling in BOPF
Class – /SCMTMS/CL_MSG_HELPER
Method – MSG_HELPER_ADD_SYMSG
Use – BOBF Message handling helper: Add SY-message. This method is called to add BOPF specific messages
Use – Whenever messages are coming in FPM application (SAP TM), if we do not know how they are coming or where they are coming from, then keep a breakpoint in Methods of this class.
/BOFU/IF_FBI_VIEW_EXITINTF_RUN – You will find this interface implemented in all VIEWEXIT classes in TM.
Method ADAPT_MESSAGES: Modify the returned messages from the Modify and DO_ACTION service calls.