on 05-21-2015 7:20 PM
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.
Hello Will,
welcome to this Scripting forum.
In my case the dialog looks a little bit different from your description.
The path and the file name is in one field, called ctxtRLGRAP-FILENAME.
In your case you have two fields:
ctxtDY_PATH
ctxtDY-FILENAME
Are you sure that the underscore in ctxtDY_PATH is correct? I think ctxtDY-PATH is the correct form.
Let us know your results.
Cheers
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Will,
thanks for your reply.
The Program RSAQEXCE calls function rsaq_download, it is part of the SQUE package, in the function group AQDW. Here you find dynpro 200, the download dialog.
RLGRAP is a structure and FILENAME is a part of it.
The DY_FILE_... are "only" fields,
Cheers
Stefan
P.S. As you can see, my guess about the hyphen in the variable name was wrong.
I greatly appreciate your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.