Skip to content

Instantly share code, notes, and snippets.

@kubrick06010
Created August 30, 2013 17:38
Show Gist options
  • Select an option

  • Save kubrick06010/6392392 to your computer and use it in GitHub Desktop.

Select an option

Save kubrick06010/6392392 to your computer and use it in GitHub Desktop.
sapscript under vbs
'On Error Resume Next
'If Not IsObject(Application) Then
Set SapGuiAuto = GetObject("SAPgui")
Set oApplication = SapGuiAuto.GetScriptingEngine
'End If
If Not IsObject(Connection) Then
Set Connection = oApplication.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 oApplication, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "KO02"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtCOAS-AUFNR").Text = ordenes
session.findById("wnd[0]/usr/ctxtCOAS-AUFNR").caretPosition = 12
session.findById("wnd[0]/tbar[1]/btn[42]").press
session.findById("wnd[0]/mbar/menu[1]/menu[0]").Select
session.findById("wnd[1]/usr/sub:SAPLBSVA:0201/radJ_STMAINT-ANWS[1,0]").Select
session.findById("wnd[1]/usr/sub:SAPLBSVA:0201/radJ_STMAINT-ANWS[1,0]").SetFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/mbar/menu[1]/menu[3]").Select
'session.findById("wnd[1]/tbar[0]/btn[0]").press ' En el caso que deba actualizarse el cebe
' Bloquear
session.findById("wnd[0]/mbar/menu[1]/menu[6]/menu[0]").Select
'Salir
session.findById("wnd[0]/tbar[0]/btn[11]").press
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
'On Error GoTo 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment