Liquid UI - WS Reference Library

message()


Purpose

With message(), you can display messages on SAP screens.

You may sometimes find it useful to display messages on the screen, either for educational or troubleshooting purposes. The message command can be used to display these messages on any screen in SAP. Messages on SAP screen can be any one of the following types:

  • User - defined custom messages
  • Captured system messages

To display a custom message, you must first define the message and then display it as a string.


Syntax

var z_msg = "String"
message("This message is: " +z_msg);		


Property

  • z_msg - string variable.


Available Option

You can use the following options with the message:

"popup":".."

"popup":value - Using the message command, we can utilize different types of pop-ups for different scenarios and perform different actions depending on available options.


Options Detail

popup

    1. The pop-up will vary on how it looks depending on what “type” is specified in the options for the message command. To display an Icon on the message along with the popup, you need to calculate the "type" by adding the Icon type value and Popup type value.

    2. POP-UP TYPEVALUE
      ABORT, RETRY, IGNORE 2
      CANCEL, TRY, CONTINUE 6
      HELP 16384
      OK 0
      OK, CANCEL 1
      RETRY, CANCEL 5
      YES, NO 4
      YES, NO, CANCEL 3

       

      ICON TYPE

       

      VALUE

      INFORMATION ICON 64
      QUESTION ICON 32
      STOP ICON 16
    3. On SAP EASY ACCESS Screen, run the following command to know how the popup option works with message command:
      message_result = message("ARE YOU SURE YOU WANT TO GO TO VA02?", {"type":4,"title":"NAVIGATE TO VA02?"});
    4. A popup will come up. Select either “Yes” or “No” and the screen will either navigate to VA02 or stay on the same screen.
Note: This feature does not work for Liquid UI Server.

Using the message() command, you can display following two types of messages:

  • User defined message
  • System messages


Example

User-defined message

The following message() command displays user defined message:

  • Create a script file for SAP 'VA01' screen (sapmv45a.e0101.sjs).
  • Enter the following command:
    var z_va01 = "Demonstrating the message command!"
    message("S: Your message appears here: " +z_va01);
  • 'S' in the message command displays 'checkbox' icon. Execute the script file.
  • The message appears, as shown in the following figure:

System message
The following message() command displays user defined message:
  • Create a script file for SAP 'VA01' screen (sapmv45a.e0101.sjs).
  • Enter the following command:
    message("S:The transaction ID of the screeen is >>> " +_transaction);
  • Execute the script file. The message appears, as shown in the following figure:


Tips and Tricks

  • search_option function

    The search_option function is used to replicate searchhelp option used in Classic GuiXT.

    order_num = search_option(z_message,"Order");

    Learn more about search_option as how it extracts an order number from a successful saving message.

  • Message command with popup

    Using the popup type values, we can see if we wanted a Pop-up that gave the options “ABORT, RETRY, IGNORE”, with a STOP ICON, we would need to add 2+16. Our calculated “type” is 18.

    Learn more about popup option.