Liquid UI - Documentation - 10.11 Get the message, message type, message number, and message id using _message, _msgtype, _msgno, and _msgid

10.11 Get the message, message type, message number, and message id using _message, _msgtype, _msgno, and _msgid


Prerequisites


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:

  1. Open Create Material: Initial screen
  2. Perform enter
  3. 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

  1. 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};
    

     
  2. 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);
         }      
      }
    

     
  3. Navigate through the Create Material: Initial screen(MM01) and click enter on the Create Material Initial screen without entering any values on the fields.
     

     
  4. You will see the error message on the status bar and message details displayed on the console window.
     

     


Next Steps

Change readonly status dynamically
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.


Can't find the answers you're looking for?