on 07-26-2018 1:43 PM
Hello Experts,
i am currently trying create a VBScript which is supose update a list of composite roles
with one set single role in pfcg.
The list should be stored in a simple Excel sheet containig only one column
However my mostly copied script is getting the error message "unallowed character"
What am i doing wrong?
Kind Regards
when i try to Playback the 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
session.findById("wnd[0]").maximize
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
session.findById("wnd[0]/tbar[0]/okcd").text = "/npfcg"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtAGR_NAME_NEU").text = COL1
session.findById("wnd[0]/usr/btn%#AUTOTEXT001").press
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpTAB8").select
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpTAB8/ssubSUB1:SAPLPRGN_TREE:0600/tblSAPLPRGN_TREECTRL_AGRLIST2/ctxtI_ACTGROUPS-AGR_NAME[0,0]").text = "T:TEST:S"
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpTAB8/ssubSUB1:SAPLPRGN_TREE:0600/tblSAPLPRGN_TREECTRL_AGRLIST2/ctxtI_ACTGROUPS-AGR_NAME[0,0]").setFocus
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpTAB8/ssubSUB1:SAPLPRGN_TREE:0600/tblSAPLPRGN_TREECTRL_AGRLIST2/ctxtI_ACTGROUPS-AGR_NAME[0,0]").caretPosition = 8
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[11]").press
aux=col1
CreateObject(“WScript.Shell”).run(“cmd /c @echo %date% %time% ” & aux & ” >> C:\Script\PlOrCreationLog.txt”)
next
msgbox “Process Completed”
Hello Leonid,
as far as I can see you use e.g. in the line msgBox not normal quotes:
msgbox “Process Completed”
instead of
msgbox "Process Completed"
Do you see the difference of the quotes? Instead of " you use “ and ”.
This is often a problem of copying and pasting source code.
Also in this line
Set objExcel = GetObject(,”Excel.Application”)
and that line
CreateObject(“WScript.Shell”).run(“cmd /c @echo %date% %time% ” & aux & ” >> C:\Script\PlOrCreationLog.txt”)
Maybe this is the reason of the error. Please correct that and 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 Stefan,
you are right on this one! It seems like i messed up the the code of the script file somehow while copy and paste bettween Notepad, Notepad++ and the sourcecode.
After converting into UTF-8 everything working correctly.
Thank you kindly
Leonid Glik
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.