cancel
Showing results for 
Search instead for 
Did you mean: 

Connect avoiding sso with a script

0 Kudos
429

Hi,

I'm currently searching how I could use a script to launch SAP and display the logon screen using a script.

I've written the code below for VBA, but after the last line, it connect directly because SSO is activated.

What I would like is to display the logon screen dispite SSO, to be able to change the connexion language or to log with another account than my main one as display in the capture below when you right click on the system you want to connect to and select Logon without Single Sign-On.

Thanks for your help.

Sub SAP_Connect()
    Dim SapGuiAuto, SapApp, oShell
    
    SAP_SYSTEM_NAME = "blahblahblah"


    'Close all running SAP instance
    oShell.Run "taskkill /f /im Saplogon.exe", , True
    
    'Launch SAP Logon
    CreateObject("wscript.shell").Run ("saplogon.exe")
    Application.Wait Now + TimeValue("0:00:02")
    Set SapGuiAuto = Nothing
    Set SapApp = Nothing
    Do While SapApp Is Nothing
    On Error Resume Next
    Set SapGuiAuto = GetObject("SAPGUI")
    Set SapApp = SapGuiAuto.GetScriptingEngine
    On Error GoTo 0
    Loop
    Application.Wait Now + TimeValue("0:00:02")
    
    'Display logon screen
    Set connection = SapApp.OpenConnection(SAP_SYSTEM_NAME, True)
End Sub
moshenaveh
Community Manager
Community Manager
0 Kudos

Welcome to the SAP Community! Thank you for visiting us to get answers to your questions.

Since you're asking a question here for the first time, I'd like to offer some friendly advice on how to get the most out of your community membership and experience.

First, please see https://community.sap.com/resources/questions-and-answers, as this resource page provides tips for preparing questions that draw responses from our members. Secondly, feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html as well, as that will help you when submitting questions to the community.

Finally, I recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

Accepted Solutions (0)

Answers (0)