cancel
Showing results for 
Search instead for 
Did you mean: 

How to know if Hierarchy is expanded

0 Kudos

Hi!

Just want to ask if there's any way we can able to identify if an Hierarchy is currently Expanded or collapsed,

This is what it looks like when collapsed

This is when collapsed

Already know how to collapse and expand it, but how do i know if it's currently expanded or collapsed.

'Expand

sapSession.FindById("wnd[0]/usr/lbl[29," & icpRow & "]").SetFocus

sapSession.FindById("wnd[0]/usr/lbl[29," & icpRow & "]").caretPosition = 10

sapSession.FindById("wnd[0]").SendVKey 2

'Do something between

'Collapse

sapSession.FindById("wnd[0]/usr/lbl[29," & icpRow & "]").SetFocus

sapSession.FindById("wnd[0]/usr/lbl[29," & icpRow & "]").caretPosition = 10

sapSession.FindById("wnd[0]").SendVKey 2

thank you!

sveabecker
Community Advocate
Community Advocate

Welcome and Thank you for visiting SAP Community to get answers to your questions. I would like to recommend to do this tutorial https://developers.sap.com/tutorials/community-qa.html

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.

Regards, Svea

SAP Community Global Moderator

Sandra_Rossi
Active Contributor

As you can see in the online SAP GUI Scripting documentation, you have the attribute "Text":

Set field = sapSession.FindById("wnd[0]/usr/lbl[29," & icpRow & "]")
msgbox( field.Text )

msgbox to see the value of field.Text, corresponding to + or - symbol (I don't know what exact symbol value it is).

Thank you, Sandra! was able to identify it, seems that when it's expanded the value is 4, otherwise 5. created while loop to check if all expandable buttons has been collapsed before proceeding to next.

Accepted Solutions (1)

Accepted Solutions (1)

For l_cntrCol = 3 To l_cntrWatch

While sapSession.FindById("wnd[0]/usr/lbl[5," & l_cntrCol & "]").DisplayedText = 5

sapSession.FindById("wnd[0]/usr/lbl[5," & l_cntrCol & "]").SetFocus

sapSession.FindById("wnd[0]/usr/lbl[5," & l_cntrCol & "]").caretPosition = 0

sapSession.FindById("wnd[0]").SendVKey 2

Wend
Next

Sandra_Rossi
Active Contributor
0 Kudos

Thanks for the feedback!

Is it required to use the property DisplayedText, or is it the same value as the property Text?

"5" for collapsed (and "4" for expanded)

We can find the values in the SYM type pool/group in SE11 (and also the values of all other ABAP List symbols):

SYM_2 SYM_PLUS_FOLDER        '4 '."  folder with plus inside   +  [+  52
SYM_2 SYM_MINUS_FOLDER       '5 '."  folder with minus inside  -  [-  53

Answers (0)