on 06-25-2013 12:03 AM
HI Everyone , I tried to play the recorded script after hitting stop. But its not moving heres 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
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell/shellcont[0]/shell/shellcont/shell").setCurrentCell 6, "SEL_ICON1"
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell/shellcont[0]/shell/shellcont/shell").pressButtonCurrentCell
Session.findById("wnd[1]/tbar[0]/btn[24]").press
Session.findById("wnd[1]/tbar[0]/btn[0]").press
Session.findById("wnd[1]/tbar[0]/btn[8]").press
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell/shellcont[0]/shell/shellcont/shell").currentCellRow = 8
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell/shellcont[0]/shell/shellcont/shell").pressButtonCurrentCell
Session.findById("wnd[1]").sendVKey 4
Session.findById("wnd[2]/usr/lbl[8,4]").setFocus
Session.findById("wnd[2]/usr/lbl[8,4]").caretPosition = 5
Session.findById("wnd[2]").sendVKey 2
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").setFocus
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").caretPosition = 0
Session.findById("wnd[1]").sendVKey 4
Session.findById("wnd[2]/usr/lbl[8,5]").setFocus
Session.findById("wnd[2]/usr/lbl[8,5]").caretPosition = 4
Session.findById("wnd[2]").sendVKey 2
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,2]").setFocus
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,2]").caretPosition = 0
Session.findById("wnd[1]").sendVKey 4
Session.findById("wnd[2]/usr/lbl[8,7]").setFocus
Session.findById("wnd[2]/usr/lbl[8,7]").caretPosition = 9
Session.findById("wnd[2]").sendVKey 2
Session.findById("wnd[1]/tbar[0]/btn[0]").press
Session.findById("wnd[1]/tbar[0]/btn[8]").press
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell/shellcont[0]/shell/shellcont/shell").currentCellRow = 1
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell/shellcont[0]/shell/shellcont/shell").pressButtonCurrentCell
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,0]").text = "10"
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").text = "20"
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,2]").text = "75"
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,2]").setFocus
Session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,2]").caretPosition = 2
Session.findById("wnd[1]/tbar[0]/btn[0]").press
Session.findById("wnd[1]/tbar[0]/btn[8]").press
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell/shellcont[1]/shell").pressButton "DO_QUERY"
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").pressToolbarContextButton "&MB_EXPORT"
Session.findById("wnd[0]/usr/cntlCLFRM_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").selectContextMenuItem "&PC"
Session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
Session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus
Session.findById("wnd[1]/tbar[0]/btn[0]").press
Session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "Test1"
Session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 5
Session.findById("wnd[1]/tbar[0]/btn[0]").press
I hope someone can help how to play this in SAP.
Hi Maria Cristina,
first of all you have to change the file name "Script1.vbs" of your recorded script into a new name witch describes exactly the task of the code (with suffix .vbs) and save it in a directory of your own e. g. C:\Program Files\SAP\script.
In addition to ScriptMan you can create a favorite in your SAP Easy Access Menü to run the code when SAP is open.
In german SAP you chose in Easy Access Menü the Menü item "Favoriten / Sonstige Objekte einfügen".
Then you dobbleklick on line "WebAdresse oder Datei". After that you fill the field "Text" with a simple Program name. In the field "Web-Adresse o. Datei" you write the Path and file name of your code e. g. C:\Program Files\SAP\script\program_name.vbs
Then press button OK.
Have fun with it.
BR, netkid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Maria Cristina,
there are several ways to start a script. For example:
1. Double-click in Windows Explorer on the script
2. ALT / F12 => Script-Recording and -Playback => green button => run the script
3. Create a link on the desktop to the script => define hotkey => run the script in SAP using hotkey
4. ...
What error appears when you start the script?
Regards,
ScriptMan
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.