Displaying multiple messages

In the first example, all system messages have been turned on, so any relevant system message will display in the listbox. In the second example, only certain types of system messages are enabled, restricting the number and type of system messages that will display in the listbox.

In the following example, we will display a listbox containing four separate status messages, generated from several different screens in the VA01 transaction.

  1. Go to the VA01 initial screen.
  2. Open the 'SAPMV45A.E0101.sjs' script file, and enter the following code to crate the mesage variables. Create the file if it does not already exist.
    var z_msgtitle = "Sample StatusMessage Listbox";
    var z_msg = "Statusmessage command example!";
    var z_msg2 = "This is another statusmessage example!";
            
  3. Now add code to create a toolbar pushbutton. We need this to initiate our process. An example is shown below:
    pushbutton([TOOLBAR], "Test StatMsg", {"process":z_statmsg});
              
  4. Add code for the function that will execute our process. An example is shown below:
    function z_statmsg() {
      onscreen 'SAPLSMTR_NAVIGATION.0100'
      statusmessage({"title":z_msgtitle, "size":[10,60], "position":[5,10], "addstring":z_msg});
      statusmessage({"addstring":"Navigating to VA01!"});
      enter('/nva01');
      onscreen 'SAPMV45A.0101'
      set("F[Order Type]", "OR");
      enter();
      statusmessage({"title":z_msgtitle, "size":[10,60], "position":[5,10], "addstring":"VA01 Overview screen!"});
      statusmessage({"addstring":z_msg2});
    }
              
  5. Save the changes and refresh the SAP screen.

The VA01 screen will now display as shown below: