Purpose
Using the textbox command, you can create a text box for inputting and displaying lengthy text or data. You can customize the textbox's position, name, text properties, and display settings with various options.
Syntax
You can create a textbox at the desired position with the required functionality.
textbox([startrow,startcol],[endrow,endcol],{"name":"name","option":"option"});
Properties
- startrow, startcol, endrow, endcol - row and column co-ordinates
Available Options
You can use the following options with the textbox command:
"name":string - This option specifies the technical name of the textbox for Liquid UI scripts, which is invisible to the user. |
|
"nowordwrap":true - Text doesn't wrap automatically, users must press Enter to begin a new line. |
|
"readonly":true - When this option is true, text cannot be edited or modified. |
|
"textfont":"font_name" - This option determines the text font, with the default being Arial. |
|
"textheight":x - This option sets the text height in pixels, with the default height at 16 pixels. |
|
"textweight":x - This option sets the text's boldness, with a default weight of 5 and a default bold setting of 7. |
Options Detail
Example
Creating a textbox
In this example, we will create a textbox on SAP User Maintenance: Initial Screen (SU01). Follow the steps to create a textbox:
- Navigate to the SU01 screen.
- Open the 'SAPLSUU5.E0050.sjs' script file and enter the code from the below script. Create the file if it does not exist.
- Save the changes and refresh the SAP screen. It will display the textbox created, as shown below:
Script
//Creates a textbox at specified row and column textbox([7,0],[11,51],{"textfont":"Arial","textheight":"12","textweight":"5"});
Tips and Tricks
-
Creating a Notification
Using the textbox(), you can create notifications. For instance, notifications created on the PM Notification screen can be displayed on the final screen with the notification details that are auto-populated from the Initial screen.
Script
//Creates notification based on notification type textbox([8,15],[14,66],{"name":"z_iw21_textbox1","enter text":true,"textfont":"Arial","left":true,"textheight":"15","textweight":"5"});
-
Copy text between files
The copytext and textbox are combined to copy text between files, screen areas, and text variables. For instance, in the Create PM notification screen, the text entered in the textbox is appended to the previous notification. The image below illustrates text copying between screen areas.
Script
//Copytext text from one screen to another screen copytext({"fromtext":"z_iw21_textbox1","toscreen":"X[TEXT]","append":true});
Learn more about copytext using copytext and textbox.