Skip to Content

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

Script recording and Playback

Hi all,

I'm new in SAP scripting and I don't know much about SAP script command. I have created this script to run a report and save the report file to a specific folder or drive. Can you help me find the right command to save the file to specific folder or drive? Can I save the report file to excel? Below is the script that I have created using SAP Script Recording and Playback

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.Children(0)

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

session.findById("wnd[0]").maximize

session.findById("wnd[0]/shellcont/shell/shellcont[0]/shell").selectedNode = "000002"

session.findById("wnd[0]/mbar/menu[6]/menu[5]/menu[2]/menu[2]").select

session.findById("wnd[1]/usr/sub:SAPLSPO5:0101/radSPOPLI-SELFLAG[1,0]").select

session.findById("wnd[1]/usr/sub:SAPLSPO5:0101/radSPOPLI-SELFLAG[1,0]").setFocus

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

session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "mdc.xls"

session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 7

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

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

session.findById("wnd[0]/shellcont/shell/shellcont[0]/shell").selectedNode = "000003"

session.findById("wnd[0]/mbar/menu[6]/menu[5]/menu[2]/menu[2]").select

session.findById("wnd[1]/usr/sub:SAPLSPO5:0101/radSPOPLI-SELFLAG[1,0]").select

session.findById("wnd[1]/usr/sub:SAPLSPO5:0101/radSPOPLI-SELFLAG[1,0]").setFocus

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

session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "dstr.xls"

session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 8

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

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

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

session.findById("wnd[1]/usr/btnBUTTON_YES").press

Thanks,

Louie

Former Member
Not what you were looking for? View more on this topic or Ask a question