Liquid UI - Documentation - 5.12 textbox()

5.12 textbox()


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.

 
You can specify the position of the textbox in different ways. Learn more about positioning the screen elements.


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":".."

"name":string - This option specifies the technical name of the textbox for Liquid UI scripts, which is invisible to the user.

"nowordwrap":".."

"nowordwrap":true - Text doesn't wrap automatically, users must press Enter to begin a new line.

"readonly":".."

"readonly":true - When this option is true, text cannot be edited or modified.

"textfont":".."

"textfont":"font_name" - This option determines the text font, with the default being Arial.

"textheight":".."

"textheight":x - This option sets the text height in pixels, with the default height at 16 pixels.

"textweight":".."

"textweight":x - This option sets the text's boldness, with a default weight of 5 and a default bold setting of 7.


Options Detail

name

  1. This option allows you to set the technical name for the textbox. This name is for Liquid UI script reference and does not display on the screen. 

  2. textbox([1,48],[4,87],{"name":"z_va01_term_of_delivery_text"});
  3. As per the code, the column name is Plant and the technical name is z_plant.

nowordwrap

  1. This option disables automatic text wrapping, requiring the user to manually press Enter to start a new line in the textbox. 

  2. textbox([31,8],[36,43],{"name":"z_mm0x_gen_text","nowordwrap":true});
  3. As per the code, users need to hit Enter to begin a new line. 

readonly

  1. Enabling this option makes the textbox non-editable. Users cannot modify the default text within the textbox.

  2. textbox([1,48],[4,87],{"name":"z_va01_term_of_delivery_text","readonly":true});
  3. As we have set readonly to true, the text in the textbox is not editable. 

textfont

  1. This option determines the font for the text within the textbox, with the default being Arial.

  2.  textbox([31,8],[36,43],{"name":"z_mm0x_gen_text","textfont":"Times New Roman"});
  3. As per the code, the text is displayed in Times New Roman font.

textheight

  1. This option sets the height of the text in pixels, with the default height at 16.

  2.  textbox([7,4],[11,54],{"name":"z_se37_structure_obj_text","textheight":"12"});
  3. As per the code, the height of the text characters in the textbox is 12 pixels.

textweight

  1. This option determines the boldness of the text, with values ranging from 1 (thin) to 9 (heavy). The default weight is 5, and the default bold setting is 7. 

  2. textbox([1,5],[5,50],{"name":"z_va01_term_of_delivery_text",'textweight':'10'});
  3. As per the code, the boldness of text in the textbox is set to 10. 


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:

  1. Navigate to the SU01 screen.
  2. Open the 'SAPLSUU5.E0050.sjs' script file and enter the code from the below script. Create the file if it does not exist.
  3. 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.

 

Usage Details


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