cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

Hi,

I have a recorded sap script to run, but I can see all  the steps visible in the screen. Is there a  solution in SAP to set displayalerts or screenupdate as false like excel. I do not want the viewers to see the macro running in all steps. I tried iconify, but it works only for main screen, the child screen are still visible. Please help.

Thanks

Mercy

Accepted Solutions (0)

Answers (1)

Answers (1)

holger_khn
Contributor
0 Kudos

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