To connect and login SAP application automatically using VBScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roberttonafelix
    New Member
    • Oct 2012
    • 16

    #1

    To connect and login SAP application automatically using VBScript

    hi friends,

    If it is possible to create a VB Script for auto log on in to SAP app...

    I tried with the below code but it was working for the first window but it was not used for second window which currently opened...

    here is the code....

    Code:
    Set sapsHShell = WScript.CreateObject("WScript.Shell")
    
    quotes=chr(34)
    
    sapSHShell.Run quotes & "C:\Program Files\SAP\FrontEnd\SAPgui\saplgpad.exe" & quotes ,2,false
    
    wscript.sleep 1000
    
    'Note: Sap Gui Scripting activex control is called from the SAP Launch pad I believe.
    
    Set SapGui = GetObject("SAPGUI")
    
    Set application = SapGui.GetScriptingEngine
    
    Set connection = application.OpenConnection("Prd", True)
    
    wscript.sleep 1000
    
    Set Session = application.children(0)
    
    session.findById("wnd[0]/S_APPL_LOG").text= Username
    
    session.findById("wnd[0]/S_APPL_LOG").text= Password
    
    session.findById("wnd[0]").sendVKey 0
    Thanks in Advance,
    Robert.J
    Last edited by Rabbit; Dec 8 '12, 08:21 AM. Reason: Please use code tags when posting code.
Working...