Copying to and from Strings

Go to the VA01 screen. Open the 'SAPMV45A.E0101.sjs' script file. Create the file if it does not already exist.

When copying text into a string with the copytext command, the string can be used as a source to copy into another destination, such as a text box or table cell. However, this cannot be done directly. Instead, we use the set command to move the text from the string to the intended destination. This is demonstrated below.

  1. Create a toolbar pushbutton and a related function on the VA01 screen. The code is as follows:
    pushbutton([TOOLBAR],"String Copy","/nva01",{"process":copy_test});
    
    function copy_test(){
      onscreen 'SAPMV45A.4001'
      copytext({"fromstring":"z_copytext","tostring":"z_copystring"});
      set('cell[All items,Material,1]', '&V[z_copystring]');
      set('cell[All items,Order Quantity,1]', '1');
      enter();
    }
    			
  2. Enter a material code in the textbox you just created. In our example we used t-bw03-05
  3. Click the toolbar pushbutton to initiate the copy function.

The material value will be copied from the textbox to the table cell as shown below: