The copytext command copies text between files, screen areas or text variables.
There are several possible syntaxes, depending on the source and desitnation of the text to be copied. These syntaxes are as follows:
| Syntax | Description |
|---|---|
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":"textbox_name", "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":"X[area_name]", "tostring":"textbox_name"}); | Copies text from a screen element such as a long text field to a string variable. |
The copytext command can copy text between the following sources and destinations:
In addition, the copytext command can copy text into the following areas:
Specifies that the text will be copied from a user-specified screen element such as a long text field.
{"fromscreen":"X[area_name]"}
Specifies that the text will be copied from a string variable.
{"fromstring":"var_name"}
Specifies that the text will be copied from a native or user-created textbox on a SAP screen.
{"fromtext":"textbox_name"}
Specifies that the text will be copied into a user-designated screen element such as a long text field. The 'append' and 'appendline' options can be used in this case.
{"toscreen":"X[area_name]"}
Specifies that the text will be copied into a string variable.
{"tostring":"var_name"}
Specifies that the text will be copied into a user-created or a native SAP textbox on a SAP screen. The append and appendline options can be used in this case.
{"totext":"textbox_name"}
The copytext command will normally over-write any content in the destination field. To avoid over-wrioting, the append or appendline options can be used. The append option appends the content to the end of the last line in the target text. The syntax is:
{"append":true}
The appendline option works very similarly to the append option, but will add the source text to the destination text as a new line. The syntax is shown below:
{"appendline":true}
This option specifies the character used to separate text to be copied. The character to be used as a delimiter would be placed in the quotes. The syntax is below:
{"delimiter":""}
This option enables users to specify the number of the desired line to be copied into the string, starting with '1'.
{"line": X}
Please see the following examples for more information.