SAP GUI Scripting Error, “The Enumerator of the collection cannot find an element with the specified index.”

前端 未结 3 1575
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-14 11:27

A few weeks ago I generated a script via SAP\'s built in GUI scripting functionality, and then put the vba in an excel document and attached it to a button.

this wo

相关标签:
3条回答
  • 2021-01-14 11:48

    Had the same problem and found this thread, so I'm reviving it with the solution that worked for me:

    Scripting is probably deativated. sapgui/user_scripting must be set to true

    0 讨论(0)
  • 2021-01-14 11:51

    I know it's old, but probably might help someone else. I don't know the reason for this, out of the blue started having problems with my scripts. I recorded a new operation to see what SAP would write for those actions (since that part of the code is standard for the connection). Same code, same problem.

    Fix (or at least temporary): Change the number of the child being searched. Previous code:

    *Set Connection = Sap_Application.Children(0)*
    

    New code:

    *Set Connection = Sap_Application.Children(1)*
    

    Not sure what the difference is, I know that if you also change the number in this line:

    *Set session = Connection.Children(0) 'This is the line that causes the error*
    

    the execution takes place in the second session, if you do change this one, also have to change the previous line of code.

    Hope it helps!

    0 讨论(0)
  • 2021-01-14 11:52

    I think something else I installed (or maybe even my company's updating scripts), messed up the vba support that is installed when you install SAP.

    Re installing the SAP Logon application fixed my issue

    (if someone else gives a better reason to WHY this happened, I'll accept that answer)

    0 讨论(0)
提交回复
热议问题