10-02-2019 2:13 PM
Hi,
I am working on a script that will schedule work order operations via IW32. I am running into an issue related to the SAP id. When I recorded the script and attempted to run it, it faulted on the line below. So I then re-recorded and found that the id name was different. This line of code is below, this selects an operation by row number:
seccion.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1101/tabsTS_1100/tabpVGUE/ssubSUB_AUFTRAG:SAPLCOVG:3010/tblSAPLCOVGTCTRL_3010").getAbsoluteRow(1).selected = True
The portion that changed was "…/ssubSUB_LEVEL:SAPLCOIH:1101/…". It was working for a time, then I went back to improve the code and the same issue occurred again. For this specific portion of the code I have seen it as:
(1) ssubSUB_LEVEL:SAPLCOIH:1100
(2) ssubSUB_LEVEL:SAPLCOIH:1101
(3) ssubSUB_LEVEL:SAPLCOIH:1107
Does anyone know why this occurs or know how to handle it? This is just one specific example, this has happened in another case as well, so a general approach to handling is preferred.
The code below is a second example, this one clicks the work order status info button.
ObjSess.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1101/subSUB_KOPF:SAPLCOIH:1102/btnBUTTON_STATUS").press
Thanks!10-02-2019 4:02 PM
Why this occurs: screens 1100, 1101, 1107 are almost identical, but not exactly identical, they are chosen depending on empty contents or not, so that the contents are better displayed, and there are a few more criteria (function module CO_IH_TABSTRIP_ABLAUF).
What to do: detect whether the screen currently displayed is 1100, 1101 or 1107, and change accordingly the field ID.
02-23-2020 6:41 AM
Can you tell me help with how to detect the screen currently being displayed?
I'm having the same issue as the original question.
02-23-2020 8:57 AM
If Not ObjSess.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100") Is Nothing Then
' screen 1100 is displayed
Else If Not ObjSess.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1101") Is Nothing Then
' screen 1101 is displayed
Else If Not ObjSess.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1107") Is Nothing Then
' screen 1107 is displayed
End If