Skip to Content

What is wrong with this adjusted script?

May 12, 2017 at 10:59 PM


avatar image

I am simply trying to use the Script Recording and Playback functionality and read from an open Excel file. I am not a developer, just don't have access to use LSMW, etc. so this is the next best thing. Just trying to update the category type on a series of FLOC records. The category is a constant, so all that needs to be read is the FLOC. I picked up this code from another post here, which said to record the steps then modify the script with the inserts.

Here it is..and thanks in advance for your help.

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 REM ADDED BY EXCEL************************************* Dim objExcel Dim objSheet, intRow, i Set objExcel = GetObject(,”Excel.Application”) Set objSheet = objExcel.ActiveWorkbook.ActiveSheet For i = 2 to objSheet.UsedRange.Rows.Count COL1 = Trim(CStr(objSheet.Cells(i, 1).Value)) ‘Column1 REM ADDED BY EXCEL************************************* session.findById("wnd[0]/usr/ctxtIFLO-TPLNR").text = COL1 session.findById("wnd[0]/usr/ctxtIFLO-TPLNR").caretPosition = 15 session.findById("wnd[0]").sendVKey 0 session.findById("wnd[0]/mbar/menu[1]/menu[3]").select session.findById("wnd[1]/usr/ctxtIFLO-FLTYP").text = "3" session.findById("wnd[1]/tbar[0]/btn[0]").press session.findById("wnd[2]/tbar[0]/btn[0]").press session.findById("wnd[0]/tbar[0]/btn[11]").press REM FINALIZATION CONTROL CHECK ************************ aux=col1 CreateObject(“WScript.Shell”).run(“cmd /c @echo %date% %time% ” & aux & ” >> C:\SCRIPT\PlOrCreationLog.txt”) next msgbox “Process Completed” REM FINALIZATION CONTROL CHECK ************************

The first two rows of the excel is this

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Debra Miller May 16, 2017 at 08:14 PM

Hello, I figured it out

The answer is that in most cases when you copy to notepad from Word or in my case the web, some of the characters change.

For example, ‘Rem out a line we need the apostrophe, which is ASCII character 39; but if you copy and paste, you often get ASCII 96.

Luckily, you can look up the correct ASCII characters and insert or overwrite them.

I also found that if I right click on the document and select Open with....there is an option for "Microsoft Windows Based Script Host". I selected this option and the exact location of the invalid character is identified by line and character position.

10 |10000 characters needed characters left characters exceeded
Ziv Markovich May 13, 2017 at 06:08 AM


You can use the IBIP Tool to complete your requirement if you have accsses to the IBIP transaction
ses thgis link for more information.


10 |10000 characters needed characters left characters exceeded
Debra Miller May 15, 2017 at 03:59 PM

Hello, thanks for writing. IBIP, LSMW are not available to the average user. The Script Recording and Playback tool is available and should be simple - it is simple but for some reason I am not able to set one up to read from an Excel file, and without this last part the full functionality is lost.

10 |10000 characters needed characters left characters exceeded