Micro Focus QTP (UFT) Forums
SAPGuiSession get the active SAPGuiWindow dynamically - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: SAPGuiSession get the active SAPGuiWindow dynamically (/Thread-SAPGuiSession-get-the-active-SAPGuiWindow-dynamically)



SAPGuiSession get the active SAPGuiWindow dynamically - cko77 - 01-24-2014

Hello everybody!

I need to set the actual window of a SAPGuiSession dynamically.

For example:
I'm calling a transaction by entering the transaction code in the OKCode-Field and pressing the Continue-Button.
Then, I'm in a transaction (the transaction codes are saved in a data table) and need to press the back button (F3). But I need to know the name of the window I'm in.

Take a look at the following:

Code:
SAPGuiSession("SAP").SAPGuiWindow("XYZ")

I need to get the SAPGuiWindow("XYZ") dynamically. I've tried different things but without any success. Can anybody help me please.

Regards

Chris


RE: SAPGuiSession get the active SAPGuiWindow dynamically - supputuri - 01-24-2014

If I understand you question correctly....
We can use "ActiveWindow" method which will fetch the active window object. Then we have to use the "Text" method on the window object to get the name of the active window.
Code:
Set oActiveWindow = SAPGuiSession("SAP").ActiveWindow
Msgbox oActiveWindow.Text



RE: SAPGuiSession get the active SAPGuiWindow dynamically - cko77 - 01-27-2014

Hello supputuri!

Thanks a lot. That hint did it for me. It works!

Thanks!!!!Big Grin

Greetings

Chris