Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8372

Re: How to make SAP Script/Macro run in background like xl macros

$
0
0

Hello.

 

In my knowledge there is no Option from SAP GUI Scripting.

 

When you run this from VBA you can use USER32-API function

 

Public Declare Function LockWindowUpdate Lib "user32" _  (ByVal hwndLock As Long) As Long

Call function via public Sub:

 

Public Sub DisableScreenUpdating(xhWnd&)  If xhWnd <> 0 Then LockWindowUpdate xhWnd
End Sub
Public Sub EnableScreenUpdating()  LockWindowUpdate 0&
End Sub

And call this whenever you have a new handle during your script:

 

        Session.FindById("wnd[0]/usr/btn%_STAE1_%_APP_%-VALU_PUSH").Press        DisableScreenUpdating Session.FindById("wnd[1]").Handle        Session.FindById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,0]").Text = "DLFL"        Session.FindById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").Text = "INAC"        Session.FindById("wnd[1]/tbar[0]/btn[8]").Press        DisableScreenUpdating Session.FindById("wnd[0]").Handle        Session.FindById("wnd[0]/usr/btn%_STRNO_%_APP_%-VALU_PUSH").Press        DisableScreenUpdating Session.FindById("wnd[1]").Handle        Session.FindById("wnd[1]/tbar[0]/btn[24]").Press        Session.FindById("wnd[1]/tbar[0]/btn[8]").Press

 

When your script is completed call

 

EnableScreenUpdating

Of course People can get nervous at it seems like nothing happen. May they kill this session as they think it´s crashed.

 

Hope this help.

 

Br, Holger


Viewing all articles
Browse latest Browse all 8372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>