Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Scripting - Export to Excel

0 Kudos
341

Hi,

I need help with SAP scripting. I have created a script but unable to automatically export the excel file in a specified drive. Can someone please help with adding arguments in the script below that will let SAP to export the data automatically to a D drive as I am new to SAP scripting? I will appreciate your assistance in this regard

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]/tbar[0]/okcd").text = "sqvi"

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

session.findById("wnd[0]/usr/ctxtRS38R-QNUM").text = "FR-2"

session.findById("wnd[0]/usr/btnP1").press

session.findById("wnd[0]/usr/ctxtSP$00001-LOW").text = "1000"

session.findById("wnd[0]/usr/ctxtSP$00001-HIGH").text = "7500"

session.findById("wnd[0]/usr/ctxtSP$00002-LOW").setFocus

session.findById("wnd[0]/usr/ctxtSP$00002-LOW").caretPosition = 0

session.findById("wnd[0]/usr/btn%_SP$00002_%_APP_%-VALU_PUSH").press

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,0]").text = "KZ"

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").text = "ZP"

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").setFocus

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").caretPosition = 2

session.findById("wnd[1]").sendVKey 8

session.findById("wnd[0]/usr/ctxtSP$00004-LOW").text = "01.01.2023"

session.findById("wnd[0]/usr/ctxtSP$00004-HIGH").text = "31.03.2023"

session.findById("wnd[0]/usr/ctxtSP$00004-HIGH").setFocus

session.findById("wnd[0]/usr/ctxtSP$00004-HIGH").caretPosition = 10

session.findById("wnd[0]").sendVKey 8

session.findById("wnd[0]/usr/cntlCONTAINER/shellcont/shell").setCurrentCell 1,"USNAM"

session.findById("wnd[0]/usr/cntlCONTAINER/shellcont/shell").selectedRows = "1"

session.findById("wnd[0]/usr/cntlCONTAINER/shellcont/shell").contextMenu

session.findById("wnd[0]/usr/cntlCONTAINER/shellcont/shell").selectContextMenuItem "&XXL"

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

0 REPLIES 0