Liquid UI - WS Reference Library

text()


Purpose

With text(), you can display text on the screen.

You can use the text() command to display text on a SAP screen, use text in variables, and add icons to SAP elements.

Text command help in changing the name of the SAP elements; checkbox, context menus, inputfield, pushbutton, radiobutton, and tab.


Syntax

text([startrow,startcol],"Label name",{option:"options,values"});


Properties

  • startrow, startcol - row and column co-ordinates
  • 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 tool tip and icon


Available Options

You can use the following options with the text:

"comment":".."

"comment":true - The text is displayed in different font and color.

"fixedfont":".."

"fixedfont":true - The text is displayed in fixed font.

"intensified":".."

"intensified":true - The text is displayed in blue color.

"left":".."

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


Options Detail

comment

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

  2. text([1,10],"Shipping Conditions",{"comment":true});
  3. The difference between comment and intensified option is that, comment would change both color and font, whereas intensified will only change color of the text.

fixedfont

  1. This option will display font style in fixedfont.

  2.  text([1,10],"Shipping Conditions",{"fixedfont":true});
  3. The Shipping Conditions text would change into fixedfont.

intensified

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

  2. text([1,10],"shipping conditions",{"intensified":true});
  3. As per the code, the text "shipping conditions" would turn into blue color with the same font.

left

The left option will draw a line from the text to the nearest screen element, which is towards right from the text.

  1.  text([1,10],"shipping conditions",{"left":true});
  2. As per the code, a line is drawn from the text to the right.


Example

The following examples demonstrate the usage of text() command.

Text display using variable

Script

text([7,30],"Enter Notification Information"); 

Script Details


Tips and Tricks

  • Changing the screen element name

    The text command may also be used to change the name of an existing field, pushbutton, or radiobutton. In this example, we will change the name of Sales Organization field on the va01 initial screen. navigate to initial va01 screen and enter the following code.

    //SAPMV45A.E0101.sjs 

    text("F[Sales Organization]","Sales Org.");

    As per the code, the name of the Sales Organization will change to "Sales Org.".

  • Displaying text from variables

    To use the text command to display text stored in a variable, please navigate to va01 screen. Then open the script file, and enter the following code.

    //SAPMV45A.E0101.sjs 

    var z_txt = "create  sales order screen!";
    text([12,4],"You are on: "+z_txt);

    As per the code, the output is You are on: create sales order screen!. This text is displayed on va01 initial screen.

  • Replace the field name

    If you want to replace a field name throughout the SAP system, you can do it by means of the SAP repository or with the command GlobalTextReplace. For example:

    Enter the following code in ESESSION.sjs file.

    globaltextreplace(/Order/,'Request',{"ocx":true});

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