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":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
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
- 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:
Usage Details
-
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