Skip to Content
0
Former Member
Sep 21, 2017 at 06:13 PM

Use variable to increment the row when inputting Materials on a contract (ME31k) - SAP Gui Script

543 Views

I am running a script on the Create Contract: Item Overview screen. I want to add multiple lines by running a script several times in a row, but each time I run the script I want to add the next material to the next row on the screen. The normal script logic looks like this:

'Material

session.findById("wnd[0]/usr/tblSAPMM06ETC_0220/ctxtEKPO-EMATN[3,0]").text = vMat

[3,0] indicates the 4th column in the first row. I tried to substitute a variable for the row number like this:

session.findById("wnd[0]/usr/tblSAPMM06ETC_0220/ctxtEKPO-EMATN[3,vRow]").text = vMat

but when I execute the script I get the following error:

Error in script: 619 The control could not be found by id.

I am new to SAP Gui scripting, and new to VBS in general.

Am I using the wrong syntax, or is not possible to use a variable there?