0

I am trying to write a script which posts invoices in SAP through Excel (fairly new to this), and am running into the following error:

The control could not be found by id

The error is coming up at the below line:

session.FindById("wnd[0]/usr/subITEMS:SAPLFSKB:0100/tblSAPLFSKBTABLE/ctxtACGL_ITEM-HKONT[1,w_counter]").Text = w_glacc

Here, I am trying to pass the GL account number in the first row. There can be multiple rows, so I was hoping that instead of passing ctxtACGL_ITEM-HKONT[1,0]").Text, ctxtACGL_ITEM-HKONT[1,1]").Text etc. I wanted to initialize a counter and pass that value into this method.

Is there any way this can be achieved?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Veena
  • 1

1 Answers1

0

Found a solution:

Instead of passing just w_counter I had to pass "&w_counter&". Previously, code was:

session.FindById("wnd[0]/usr/subITEMS:SAPLFSKB:0100/tblSAPLFSKBTABLE/ctxtACGL_ITEM-HKONT[1,w_counter]").Text = w_glacc

Now, it is:

session.FindById("wnd[0]/usr/subITEMS:SAPLFSKB:0100/tblSAPLFSKBTABLE/ctxtACGL_ITEM-HKONT[1,"& w_counter &"]").Text = w_glacc
Veena
  • 1