Liquid UI - Documentation - 5.11 text()

5.11 text()


Purpose

The text() is used to display various types of text on the SAP screen, including single-line text, text in variables, icons for SAP elements, and creating comments. Additionally, text() allows you to modify the names of SAP elements, including checkboxes, context menus, input fields, push buttons, radio buttons, and tabs.

 

Note: Learn more about positioning the screen elements.


Syntax

Using the following formats, you can add text at the desired position with the required functionality.

Format 1:

To create a text with a label at the specified position and options.

text([row,col],"label name",{option:"options,values"});

//Creating a text using size option text([7,25],"Enter Notification Information"{size:30});
// Creates a text with intensified option text([1,10],"shipping conditions",{"intensified":true});
 
 

Format 2:

To create a text without options.

text([row,col],"label name");

// Creates a text with label name text([7,25],"Enter Notification Information"{size:30});
// Creates a text using a variable text([12,4],"You are on: "+z_txt);
 
 

Format 3:

To replace the name of a screen element with text()

text(F[screen element],"screen element name");

// Replaces the screen element name with the label name text("F[Sales Organization]","Sales Org.");
 
 

Format 4:

To create a text with reference to the other fields of the same screen.

text("F[screen element]+[row,col]","label name");

//Creates a text with respect to other field elements on the screen text(F[Material]+[0,46],"Raw Material");
 


Properties

  • row, col - row and column coordinates
  • label name- name of the text label
  • @0Y@label name - name of the field with icon
  • @4V\\Qlabel Tip@label name - name of the field with tooltip and icon
  • screen element - field name


Available Options

You can use the following options with the text:

"comment":".."

"comment":true - This option displays the text in different fonts and colors.

"fixedfont":".."

"fixedfont":true - This option displays the text in a fixed font.

"intensified":".."

"intensified":true - This option displays the text in blue color.

"left":".."

"left":true - Draws a line from the text to the next nearest element.

"size":".."

"size":value - Allows you to specify the size of text.


Options Detail

The following options demonstrate the usage of text() in customizing the SAP screens.

comment

  1. The comment option will change the text color and font.

  2. text([20,12],"The notification information appears on the Create PM screen",{"comment":true});
  3. The difference between the comment and intensified options lies in their effects: the comment option alters both color and font, while the intensified option affects only the color of the text.

fixedfont

  1. This option will display the text in a fixed font.
  2. text([F[Notification type]],"Select Notification type",{"fixedfont":true});
  3. As per the code, the text font is fixed.

intensified

  1. The intensified option will display text in blue color.

  2. text([2,33],"Do you want to create a new class?",{"intensified":true});
  3. As per the code, the text will appear in blue while maintaining the same font.

left

  1. The left option will draw a line from the text to the closest screen element, positioned to the right of the text.
  2. text([2,3],"Requisitions with line items and release codes",{"left":true});
  3. As per the code, a line is drawn from the text to the right.

size

  1. The size option permits you to allocate a specific number of character spaces for the text on the screen.
  2. text([1,4],"Select Notification type",{"size":26});
  3. As per the code,  text is displayed with a specified number of characters spaces.


Example 1: Display text using a variable in format 2

The following example demonstrates how to create a text without options.

Script

//Creates a text without options 
text([7,30],"Enter Notification Information"); 

Script Details


Example 2: Display text with respect to an input field using format 4

The following example demonstrates how to create a text with respect to an input field.


Script

//SAPLMGMM.E0060

text("F[Material]+[0,46]","Raw Material"); 


Example 3: Display text with the size option using format 1

The following example demonstrates the usage of the text() command with the size option.


Script

//SAPLIQSO.E0100.sjs

text([7,25],"Enter Notification Information"{size:30}); 

Script Details


Usage Details Tips and Tricks

  • Changing the screen element name

    1. The text command can also be utilized to rename an existing field, push button, or radio button. In this example, we will modify the name of the Sales Organization field on the Create Sales Order: Initial Screen (VA01).
       
    2. Create this file inside your script folder and add the following Liquid UI script for customizing Change Sales Order: Initial Screen, SAPMV45A.E4001.sjs.
       
      //Changes the name of Sales Organization input field to Sales Org.
      text("F[Sales Organization]","Sales Org.");
    3. Logon to SAP and navigate to the VA01 Initial screen. Now, you can see the name of the Sales Organization is changed to Sales Org, as shown in the image below.
       

  • Displaying text from variables

    The text command is used to display the text stored in a variable. Enter the following code in the SAPMV45A.E0101.sjs script file and save it. Navigate to the VA01 screen, you can see the text You are on: create sales order screen! , as shown below. 

    //Displays the text stored in variable
    var z_txt = "create  sales order screen!";
    text([12,4],"You are on: "+z_txt);
     

     

  • Replace the field name

    If you want to replace a field name throughout the SAP system, you can do it using the SAP repository or with the command GlobalTextReplace

    Enter the following code in the SAPMV45A.E0101.sjs file and save it. Now, navigate to the VA01 screen, you can see the text "Order" is replaced throughout the SAP GUI with "Request".

    //Replaces the text Order to Request
    globaltextreplace(/Order/,'Request',{"ocx":true});
     

    As per the code, the text "Order" is replaced throughout the SAP GUI with "Request".

 

Usage Details


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