0

I have recorded a script for automation for ordering parts (IW31). It works very well, however, when I passed it to another person, it failed.

What I found was that he keeps his long text window collapsed, while I keep mine open. (I would have thought they would be the same control, but no.)

So, how to test which long text window is displayed?

This is the collapsed long text window:

Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/txtCAUFVD-KTEXT").Text = "BENCHSTOCK"

While this is the expanded long text control.

Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/subSUB_TEXT:SAPLCOIH:1103/cntlLTEXT/shell").Text = "BENCHSTOCK"

I tried creating a variable to test it, but it tests True no matter the selection.

Set ShortComment = Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/txtCAUFVD-KTEXT")

'Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/txtCAUFVD-KTEXT").Text = "TESTING"

If IsObject(ShortComment) Then
 Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/txtCAUFVD-KTEXT").Text = "BENCHSTOCK"

Else

 Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/subSUB_TEXT:SAPLCOIH:1103/cntlLTEXT/shell").Text = "BENCHSTOCK"

End If

Thanks in advance!

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Tinbendr
  • 104
  • 4

1 Answers1

0

OK, I found a solution. It was a different approach than my sample code. I found the hint here.

The text field has a changeable property. If the long text field is extended, the regular field property CHANGEABLE=False.

By testing this property, I can ascertain whether the long field is extended or not.

Tinbendr
  • 104
  • 4