Liquid UI - Documentation - 6.08 copytext()

6.08 copytext()


Purpose

With copytext(), you can copy text between files, screen areas or text variables.

The copytext command replaces any text to the intended destination. This command works both on native SAP fields and on user-created fields.


Syntax

copytext({"source/destination command":"location","source/destination command":"location"});

There are several possible syntaxes, depending on the source and desitnation of the text to be copied. These syntaxes are as follows:

SyntaxDescription
copytext({"fromtext":"textbox_name",
"totext":"textbox_name"});
Copies from one text box to another. Textboxes can be
native SAP elements or user-created elements.
copytext({"fromtext":"textbox_name",
"tostring":"variable_name","line":x});
Copies text from a textbox to a string variable.
copytext({"fromtext":",
"toscreen":"X[area_name]"});
Copies text from a textbox to a screen element such as a
long text field.
copytext({"fromstring":"variable_name",
"toscreen":"X[area_name]"});
Copies text from a string variable to a screen element
such as a long text field.
copytext({"fromstring":"variable_name",
"tostring":"variable name"});
Copies text from a string variable to a different string
variable.
copytext({"fromstring":"variable_name",
"totext":"textbox name"});
Copies text from a string variable to a text box.
copytext({"fromscreen":"X[area_name]",
"totext":"textbox_name"});
Copies text from a screen element such as a long text
field to a text box.
copytext({"fromscreen":",
"tostring":"textbox_name"});
Copies text from a screen element such as a long text
field to a string variable.


Properties

Source - location from where to copy text

  • Screen - from a native SAP screen element using the fromscreen option
  • Textbox - from a user-created textbox using fromtext option
  • Variables - from a variable using fromstring option

Destination - location to where to copy text

  • Screen - to a native SAP screen element using the toscreen option
  • Textbox - to a user-created textboxes using totext option
  • Variables - to a variable using tostring option


Available Options

You can use the following options with the copytext:

"append":".."

"append":true - The source text is appended to the target text.

"appendline":".."

"appendline":true - The source text is appended to the target text in a new line.

"delimiter":".."

"delimiter":"X" - Works only in combination with toString= and line=. Instead of "line feed" the specified character is considered as delimiter.

"fromscreen":".."

"fromscreen":X[area_name] - To copy text from a user-specified screen element, such as a long text field.

"fromstring":".."

"fromstring":"var_name" - To copy text from a string variable.

"fromtext":".."

"fromtext":"textbox_name" - To copy text from a native or user-created textbox on a SAP screen.

"line":".."

"line":X - You can only use this option in combination with toString=. You can specify the desired line number, starting with 1.

"toscreen":".."

"toscreen":"X[area_name]" - To copy text into a user-created screen element such as a long text field.

"tostring":".."

"tostring":"var_name" - To copy text into a string variable.

"totext":".."

"totext":"textbox_name" - To copy text into a user-created or a native SAP textbox.


Options Detail

append

  1. The append option appends the content to the end of the last line in the target text.

  2. copytext({"fromtext":"z_text_box","toscreen":"X[TEXT]","append":true});
  3. As per the code, the source text is appended to the target text. The copytext command overrides an existing content if present in a destination field. To avoid over-writing, the append or appendline options can be used.

appendline

  1. The appendline option works very similar to the append option, but will add the source text to the destination text in a new line.

  2. copytext({"fromtext":"z_text_box","toscreen":"X[TEXT]","appendline":true});
  3. As per the code, The appendline option appends the text to a new line.

delimiter

  1. The delimiter option specifies a character to separate the text joined by the delimiter. The character to be used as a delimiter should be placed in the quotes.

  2. copytext({"tostring":"z_text_box","fromscreen":"X[TEXT]","line":1,"delimiter":":"});
  3. As per the code, The delimiter option copies the text untill colon (:) in to the z_text_box.

    Note: Delimiter option needs to be used with line option.

fromscreen

  1. This option copies text from a user-specified screen element, such as a long text field.

  2. copytext({"totext":"z_text_box","fromscreen":"X[TEXT]"});
  3. As per the code, the text in the screen area X[TEXT] is copied into text z_text_box, when "Copy Text from SAP Box to LUI" is clicked.

fromstring

  1. This option will copy text from a string variable.

  2. copytext({"fromstring":"z_text_box","toscreen":"X[TEXT]"});
  3. The content avaialble in the varible name, z_text_box is copied into X[TEXT].

fromtext

  1. This option will copy text from a native or user-created textbox on a SAP screen.

  2. copytext({"fromtext":"z_text_box","toscreen":"X[TEXT]"});
  3. As per the code, the text from LUI is copied to SAP Box, when "Copy Text from LUI to SAP Box" is clicked.

line

  1. This option enables users to specify the desired line number to be copied into the string, starting with '1'.

  2. copytext({"tostring":"z_text_box","fromscreen":"X[TEXT]","line":2});
  3. As per the code, the text in the X[TEXT] at line number 2 is copied in to LUI text(z_text_box), when "Copy Text from SAP Box to LUI" is clicked.

toscreen

  1. This option will copy text into a user-created screen element such as a long text field. You can also use the 'append' and 'appendline' options.

  2. copytext({"fromtext":"z_text_box","toscreen":"X[TEXT]"});
  3. As per the code, the text in z_text_box is copied into X[TEXT], when "Copy Text from LUI to SAP Box" is clicked.

tostring

  1. This option will copy text into a string variable.

  2.  copytext({"tostring":"z_text_box","fromscreen":"X[TEXT]"});
  3. The text X[TEXT] is copied into a string variable.

totext

  1. This option will copy text into a user-created or a native SAP textbox. You can also use the append and appendline options.

  2. copytext({"totext":"z_text_box","fromscreen":"X[TEXT]"});
  3. As per the code, the text X[TEXT] is copied into a z_text_box, when "Copy Text from SAP Box to LUI" is clicked.


Example

The following scenario demonstrates the copytext() command usage.

We will create a notification screen to add notification details. On saving the notification, the details appear on the PM notification screen. On updating the original notification, the updated notification appears on the PM notification home screen.


Script

copytext({"fromtext":"z_iw21_textbox1","toscreen":"X[TEXT]","append":true}); 
copytext({"totext":"z_iw21_textbox","fromscreen":"X[TEXT]"});
enter("/3");

Script Details


Usage Details


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