Skip to Content
avatar image
Former Member

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

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 21, 2017 at 08:29 PM

    I found the answer to this question here: https://archive.sap.com/discussions/thread/1281629

    It works!

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

    Add comment
    10|10000 characters needed characters exceeded