Quantcast
Channel: SCN : All Content - Scripting Languages
Viewing all articles
Browse latest Browse all 522

Transfer to local file; specifying path.

$
0
0

To start this is literally my first day attempting at scripting in SAP. I have been doing VBA and now need to utilize the scripting in SAP as well. I have used the recording tool and can get the file name to save dynamically (they do it daily), but I cannot find out how to specify a file path.

 

[code]

 

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]").resizeWorkingPane 178,34,false

session.findById("wnd[0]/tbar[0]/okcd").text = "sq00"

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

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

session.findById("wnd[0]/usr/ctxtRS38R-QNUM").setFocus

session.findById("wnd[0]/usr/ctxtRS38R-QNUM").caretPosition = 11

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

session.findById("wnd[1]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").currentCellColumn = "UZEIT"

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

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

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

session.findById("wnd[1]/usr/ctxtDY_PATH").text = "C:\Users\wxp13\Documents"

session.findById("wnd[1]/usr/ctxtDY-FILENAME").text = "Ranges" & "_" & Replace(date + 1, "/", "-") & ".XLS"

session.findById("wnd[1]/usr/chkRSAQDOWN-COLUMN").selected = true

session.findById("wnd[1]/usr/chkRSAQDOWN-COLUMN").setFocus

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

 

[/code]

 

This is what I have. This is from recording and then adding in the dynamic file name. I can get it to work if I just leave it at the default, but can't figure out how to change the file path properly.

 

Any help would be much appreciated! Also an explanation would be wonderful because I would like to understand rather than it just being handed to me and not really understanding why.

 

Please let me know if I need to post to a different area of the forum.


Viewing all articles
Browse latest Browse all 522

Latest Images

Trending Articles



Latest Images

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