Tuesday, February 26, 2013

Navigating to one t-code from another using QTP

Navigating to one t-code from another using QTP By Ankesh Pandey  

Many of us may be aware of this topic which i am posting. But for me it took almos 5 months to discover this trick.:(

Let me explain what i use to do before discovering this cool trick.
Suppose you are on a t-code page , say VA01. After completing your operation, you need to navigate back to home page. I use to click on back button for this, which inturn was increasing OR size. This was not reliable too.
'Navigate back
SAPGuiSession("Session").SAPGuiWindow("").SAPGuiButton("Back").click

'Or to jump to another T-code from here, i was using /n in the t-code box

SAPGuiSession("Session").SAPGuiWindow("").SAPGuiOKCode("OK").Set "/nVA03"

For the above code to run, all the objects must be present in OR. Miss of any will result in error.

To resolve this we can use the 'Reset' option available in QTP.


SAPGuiSession("Session").Reset  // This code will take you to home page, doesnt matter where you are.
SAPGuiSession("Session").Reset "VA03"  //This code will take you to VA03 t-page from anywhere.

This will save lot of time and will optimize memory as well.

Wasn't it cool? Go ahead, use this option in your code.

No comments:

Post a Comment