on 09-11-2014 7:28 AM
Hello everybody
I use scripting to update data in SAP. the script open a txt.file and automatise some actions.
The scripting works fine with windows XP but on other computer in windows 8 or seven the script don't find the file. message : file not found.
I have update the sap gui 7.30 to package 10 but we had the same problem even if we execute SAP in administrator side.
Someone have an idea ?
Best reagrds
Bruno
Hello.
May you adopt your coding e.g. to Excel VBA and check from there. We work on Windows 8. But I never have used WSH (vbs) for SAP Scripting. Always MS Office VBA (Excel or ACCESS) without any Problems.
Best regards,
Holger
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for you answer. i 'm not aware in VBA script language. perhaps could you correct my script ?
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
dim ds()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("todo.txt", 1)
Set objFilelog = objFSO.OpenTextFile("log.txt", 8, true)
objFilelog.WriteLine("-----------------------------------------------------")
objFilelog.WriteLine("--------Start: " & now & "-------------------")
objFilelog.WriteLine("-----------------------------------------------------")
i = "0"
Do Until objFile.AtEndOfStream
strInputline = objFile.readLine
if len(strInputline) > 0 then
Redim Preserve ds(i)
ds(i) = strInputline
i = i + 1
end if
Loop
for each datensatzausdatei in ds
'--- begin to putin your recoded source code here
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/ctxtLAGP-LGPLA").text = datensatzausdatei
session.findById("wnd[0]/usr/ctxtLAGP-LGPLA").caretPosition = 6
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/mbar/menu[0]/menu[5]").select
session.findById("wnd[1]/usr/btnSPOP-OPTION1").press
'-- end of putin from your recode source code here
next
objFilelog.WriteLine("-----------------------------------------------------")
objFilelog.WriteLine("--------Ende: " & now & "--------------------")
objFilelog.WriteLine("-----------------------------------------------------")
Msgbox("Fertig /end")
Hello.
Seems like you miss to define fullpath of Textfiles. This cause issue:
Set objFile = objFSO.OpenTextFile("todo.txt", 1)
Set objFilelog = objFSO.OpenTextFile("log.txt", 8, true)
Should defined as fullpath:
e,g,
Set objFile = objFSO.OpenTextFile("C:\YourDirectory\todo.txt", 1)
Set objFilelog = objFSO.OpenTextFile("C:\YourDirectory\log.txt", 8, true)
Then it should work.
Best regards,
Holger
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.