Prerequisites
- Products: Liquid UI WS, Liquid UI Server or Local DLL, Client Software
- Commands: onUIEvents(), enter(), _message
Purpose
You will learn how to find the id, number, and type of an SAP message displayed in any transaction. The three system variables associated with the SAP message are _msgid, _msgno, _msgtype. These variables are useful in error handling scenarios and to conditionalize scripts based on their values. We will walk you through the following steps:
- Open Create Material: Initial screen
- Perform enter
- Add a function to display SAP message details
//Create this file inside your script folder for customizing Create Material screen: SAPLMGMM.E0060.sjs
//Now let's start adding the content to the above file
- Add an OnUIEvent command to execute a function on performing enter.
// Executes z_message process on performing enter onUIEvents["Enter"]= {'fcode':"/0",'process':z_message};
- Add a function to display SAP message details on the console window using println statements.
//Creates message to display message details function z_message() { enter(); onerror if(_message){ println("Message: "+_message); println("Message Type: "+_msgtype); println("Message Number: "+_msgno); println("Message ID: "+_msgid); } }
- Navigate through the Create Material: Initial screen(MM01) and click enter on the Create Material Initial screen without entering any values on the fields.
- You will see the error message on the status bar and message details displayed on the console window.
Next Steps

Learn how to change the read-only status of the elements on the Create, Change, and Display Maintenance Order screens.
10 min.
This article is part of the Interpreting function codes tutorial.