cancel
Showing results for 
Search instead for 
Did you mean: 

Script recording and Playback

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Rana,

I am Vietnamese I am new too, but i know how to get your question.

You set the path before session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "mdc.xls" by this script:

session.findById("wnd[1]/usr/ctxtDY_PATH").text = "C:\Database\SAPDownloads\"

Kind regards,

TanAnh

ThomasZloch
Active Contributor
0 Kudos

This is the forum for "SAPScript", among others, but your issue is not related to that. Looks like a topic for the Application Server - SAP GUI forum. Please have a look there and close this thread if you find a better home for your issue.

Thomas