Skip to Content
0

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

Sep 21, 2017 at 06:13 PM

36

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
Former Member

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

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

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

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

Share
10 |10000 characters needed characters left characters exceeded