0

I have 3 types of different icons that represent status of the record. I need to programmatically (using SAP Scripting) read rows and understand their statuses: enter image description here

The issue that method GetAbapImage(key, name) returns the same value @5 for both Error (red) and Success (green) statuses. For unprocessed it returns value @B.

The sample code snippet that demonstrates my approach is the following:

Dim container
Set container = session.findById("wnd[0]/usr/cntlMAIN_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[2]/shell")
WScript.echo TypeName(container)        'returns: ISapTreeTarget
WScript.echo container.GetTreeType()    'returns: 2
WScript.echo container.GetAbapImage("        230", "STATUS")        'returns: @B
WScript.echo container.GetAbapImage("        235", "STATUS")        'returns: @5
WScript.echo container.GetAbapImage("        243", "STATUS")        'returns: @5

Where IDs 230, 235 and 243 are respective IDs for the three lines shown above on the screenshot.

Suggestion on how to more properly get row statuses is highly welcome!

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
AndrewG10i
  • 661
  • 1
  • 6
  • 21

2 Answers2

0

As a small suggestion, I can only list one solution from the SAP GUI scripting environment.

for example:

myICON = container.getcellvalue (0, "%_ICON")
if left(myICON,3) = "@5C" then msgbox "red"
if left(myICON,3) = "@5B" then msgbox "green"
if left(myICON,3) = "@BZ" then msgbox "other"

Regards, ScriptMan

ScriptMan
  • 1,580
  • 1
  • 9
  • 9
  • Thank you for your suggestion! It works good with `GuiGridView` object but unfortunately didn't work with `GuiTree` object in my case. Also looks like the `getCellValue()` method is not available in the `GuiTree`. Any other suggestions are welcome! :) – AndrewG10i Feb 13 '19 at 06:17
  • What does a recorded script look like when you just have a mouse click, for example positioned in the red icon? – ScriptMan Feb 13 '19 at 10:35
  • Sorry for delay with my response: when I record the script it does the following for the doubleclick: `session.findById("wnd[0]/usr/cntlMAIN_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[2]/shell").doubleClickItem " 21","STATUS"` – AndrewG10i Feb 22 '19 at 09:34
0

A modified variant for an SAP Tree could look like this:

myICON = container.getitemtext (" 21","STATUS")
if left(myICON,3) = "@5C" then msgbox "red"
if left(myICON,3) = "@5B" then msgbox "green"
if left(myICON,3) = "@BZ" then msgbox "other"

The parameter " 21" is variable. As it looks at the other colors, you will notice in a familiar way.

Regards, ScriptMan

ScriptMan
  • 1,580
  • 1
  • 9
  • 9