Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Focus on Shell window (LongText)

Hi im back again.

Now Im trying to solve problem of focusing the VBA script on SHELL window.

It is for example in trsction CO02 - long texts of operations, YMFORD - longtext of inspection characteristic, QM02 - items  -longtext of Items...

I have friend of mine, he created an event catcher in Excel - it looks at where you click or when use TAB key in SAP - in cell it writes down ID of item you are on/ clicked

So:

/app/con[0]/ses[0]/wnd[0]/tbar[0]/okcd

/app/con[0]/ses[0]/wnd[0]/tbar[0]/okcd

/app/con[0]/ses[0]/wnd[0]/usr/ctxtCAUFVD-AUFNR                           ' Transaction CO02

/app/con[0]/ses[0]/wnd[1]/tbar[0]/btn[0]

/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[5]                                                ' Operations

/app/con[0]/ses[0]/wnd[0]/usr/subORD_HEADER:SAPLCOVG:0801/txtPSFC_DISP-AUFNR

/app/con[0]/ses[0]/wnd[0]/usr/tblSAPLCOVGTCTRL_0100/chkRC270-TXTKZ[9,0]                'Longtext Doubleclick

/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[29]                              'Buttons on the SAP taskbar - 29 to 18. Here Im using TAB

/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[38]

/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[31]

/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[28]

/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[26]

/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[18]

/app/con[0]/ses[0]/wnd[0]/usr/shell[1]                                'Now it focus on the Longtext window. That is what i need!

/app/con[0]/ses[0]/ = session.findById so:

/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[18] = session.findById("wnd[0]/tbar[1]/btn[18]").press ' Thats when i click the button

So logically:   session.findById("wnd[0]/usr/shell[1]]").setfocus         should work.

But VBA says: type mismatch

Any suggestions?

Thanks in advice again

replied

Hi Miroslav,

how do you think of a workaround:

session.findById("wnd[0]/tbar[0]/btn[80]").press

or

session.findById("wnd[0]/tbar[0]/btn[83]").press

It's the switch in blue.

Regards,

ScriptMan

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question