In this article, you will learn how to use the screen copy method to copy text to and from SAP screen blocks, even those with long text fields. To copy text to a screen, you can use either the append or appendline options. Follow the steps below to copy text to and from SAP screen blocks:
- Add a textbox to enter the text.
- Add a toolbar push button to copy the text.
Note: Use fromstring instead of fromtext when copying text to screen blocks.
User Interface
//Create this file inside your script folder for customizing the Change Order: Initial Screen, SAPLCOIH.E3000.sjs
//Now, let's add the Liquid UI script to the above file and save it.
Customization
- Add a textbox to enter the text.
//Creates a textbox textbox([2,87], [7,121],{"name":"iw32_text", "textfont":"Arial", "textheight":"20", "textweight":"5"});
- Add a two-toolbar push buttons with labels Screen Copy and Copy Text to copy the text.
// Creates a two toolbar push buttons labeled Screen Text and Copy Text pushbutton([TOOLBAR], "Screen Copy",{ "process":copy_test}); pushbutton([TOOLBAR], "Copy Text",{ "process":copy_screen_to_text});
- Add the function to copy the text from and into the textbox.
//Function to copy the text function copy_test(){ onscreen 'SAPLCOIH.3000' copytext({"fromstring":"iw32_text","toscreen":"X[LTEXT]"}); enter(); } function copy_screen_to_text(){ onscreen 'SAPLCOIH.3000' copytext({"tostring":"iw32_text","fromscreen":"X[LTEXT]"}); enter(); }
SAP Process
- Refresh the IW32 Screen. Select the Maintenance Order type and continue to the next step. Now, click Enter to proceed further.
- You will be navigated to the Change Maintenance Order: Central Header screen, as shown below.
- Clicking on the show long text icon displays the Order description field, as shown below.
- Enter text in the textbox and click Screen Copy. This action copies the text from the textbox to the description field, as shown below.
- Similarly, click Copy Text to copy the text from the description field to the textbox, as shown below.