3

I'm developing an automation process on SAP with Automation Anywhere using the SAP DLLs provided by Automation Anywhere itself. I need to find IDObject with specify attribute to click/get value the specify element , but seems that there are no fuctions that allow you to do it. An example of code generated from the SAP recorder is the following:

session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").setCurrentCell 0,"ICON_EXEC" session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").selectedRows = "0" session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").clickCurrentCell

using the dlls I have already tried the following functions:

Step 1 : Login on existing session (in this case 0)

Step 2 : Search Object by ID (in this case wnd[0]/shellcont[1]/shell/shellcont[0]/shell )

Step 3: CurrentCellRow (in this case 0)

Step 4: DoubleclickCurrentCell

The problem is that it doesn't click where i want, because as you can see there is the attribute "ICON_EXEC" that specify the element that i want to click . (i also tried to insert in the SearchObjectbyID all the string with the attribute, but it doesn't work)

Currently to avoid that i'm using Execute VBscript, but it seems that error handling does not work with scripts, so i would like to avoid them too

Any tips?

Thanks,

U.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
umbyrulez
  • 31
  • 1

2 Answers2

2

You can find out the SAP-Object ID (IDObject) by recording a (.vbs-)macro in SAP:

  1. Hit Alt + F12 or click the respective icon and choose "Record script and playback" ("Skript-Aufzeichnung und -Playback" in my screenshot):

enter image description here

  1. In the following dialogue window, hit the record button and click the desired object:

enter image description here

  1. Open the recorded .vbs-macro and and look for something like this (=the desired object ID):

enter image description here

Pingui
  • 1,312
  • 4
  • 15
  • 28
  • Hi @bromelio, thanks for your answer. The problem is that i want to find an ObjectID with attribute, as you can see in the post i've write the line code that i want to find. session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").setCurrentCell 0,"ICON_EXEC" In this case if i only use wnd[0]/shellcont[1]/shell/shellcont[0]/shell i get another object, i need to find this object with the attribute "ICON_EXEC" , i mean there is any specify function of dlls or way to get it? – umbyrulez Jun 13 '19 at 13:05
1

You can handle errors in sap vb script , please refer below articles as reference and handle error as per you requirement.

1) https://answers.sap.com/questions/9676858/error-while-logging-to-sap-through-excel.html

2) https://wiki.scn.sap.com/wiki/display/Img/Scripting%3A+Error+Handling+and+Debugging