Liquid UI - Documentation - 11.07 Display log file information as the status message

11.07 Display log file information as the status message


 Prerequisites


Purpose

You will learn how to display the information in log file which is produced during execution of the script files, as message in the status bar. We will walk you through the following steps. 

  1. Add a pushbutton.
  2. Add a logs_message function.

//Create this file inside your script folder for Remove from Storage Other screen: SAPLMIGO.E0001.sjs
//Now let's start adding the content to the above file

  1. Add a Display log message pushbutton to display log file information on the status bar.
    //Creates a pushbutton with label name as Display log message to execute the logs_message process on click. 
    pushbutton([1,72], "Display log message",{"process":logs_message});
     

     
  2. Add a function to display message on status bar.
    // Function to display message on status bar
    function logs_message(){
       onscreen 'SAPLMIGO.0001'
          set('F[Material]', '100-300');
          enter();
    
    // Function prototype to trim blank characters from a string
    String.prototype.trim = function () {
       return this.replace(/^\s+|\s+$/g, "");
    }
    
       // Goods Issue Other 
       onscreen 'SAPLMIGO.0001'
          enter('/7');  //Check
    
       // Goods Issue Other 
       onscreen 'SAPLSBAL_DISPLAY.0120'
          for(j=0; j<3; j++){
             rb = new Reebok([2+j,1]);
             if(rb.name.toString().indexOf("Warning")>-1){
                if(isBlank(msg_type)){
                   msg_type = 'W:';
                   rb2 = new Reebok([2+j,10]);
                   msg_content = rb2.name.substring(rb2.name.indexOf("@",2)+1, rb2.name.length).trim();
                }
             } else if(rb.name.toString().indexOf("Error")>-1){
                msg_type = 'E:';
                rb2 = new Reebok([2+j,10]);
                msg_content = rb2.name.substring(rb2.name.indexOf("@",2)+1, rb2.name.length).trim();
                break;
             }
          }
          enter();
    
       onscreen 'SAPLMIGO.0001'
          if(msg_type == 'E:'){
             message("E:"+msg_content);
          }   
          enter('?');
    }
     

     
  3. Navigate to MIGO transaction and click on Display log message button.

     
  4. You can see error in log file displayed as message on status bar on the bottom of the screen.
     

     

This article is part of the Conditional scripts tutorial.


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