Skip to Content
Technical Articles
Author's profile photo Krishna Chaitanya Vukkala

Login to SAP Using Python

The Programming Language Python gives you many possibilities to use SAP in different ways.

One of them is Logging into SAP without providing Client Number, User Name, or Password.

You might be surprised how this is possible !!

But, to use this kind of feature you need to maintain Client Number, User Name, passwords, etc in your Python Program.

Let me give you more information on this.

There are few Pre-Requisites before we begin.

  • SAP GUI must be installed in your machine. As you are on SCN site I expect you must already know this 😉 ( If not Click here )
  • Python also must be installed in your machine. How to Install( Click Here)

Once you have these Softwares installed in your machine you can write your program or copy the below code and use it.

Obviously, with few modifications as below 😉

<SID> = You need to mention System SID.

<NUM>= Client Number.

<UserName>= User name through which you wanted to log in to SAP.

<Password>= Maintain your User password.(And Update the password whenever there is a change)

Don’t worry I have copied here the same code as shown in the above screenshot.

import os

import tkinter as tk

WIDTH = 200

HEIGHT = 300

root = tk.Tk()

canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH)


def myClick1():

    <SID> = os.system('start sapshcut.exe -system=<SID> -client=<NUM> -user=<UserName> -pw=<Password>')


def myClick2():

    <SID1> = os.system('start sapshcut.exe -system=<SID> -client=<NUM> -user=<UserName> -pw=<Password>')


button1 = tk.Button(root, text="<SID>", command=myClick1)


button2 = tk.Button(root, text="<SID>", command=myClick2)



Note: Before running the above program you need to make sure the Tkinter is installed on your windows and also adjust the height and width as per your requirement.

I have used Visual Studio to write and execute this code.

The above program directly won’t work it will require a few packages that need to be installed using pip. Before executing the above program you need to install pip install Tkinter ( For more information you can click here )

So here you go, When you run the above program you will get something like below as a GUI PopUp.


When you click on any of the buttons <SID> or whatever you have mentioned that system will connect and opens up with the maintained credentials. So Enjoy 😀

Here you go !!



This is not the end 🙂

You can even use this feature or program for opening any of the URLs in the default browser of your computer, for example, or maybe Monitoring any of the JAVA Portals.

So, to use this you need to include the below:



and Run the Program : will be opened in your default browser :


If you like this or helps you then please hit Like & Comment And Obviously share 🙂

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Kerem Koseoglu
      Kerem Koseoglu

      The SAP oriented value-add of this post is to show that sapshcut.exe can open a GUI window + log in on Windows. This program can be called via any language, terminal command, .bat file, etc... So this is not really about Python.

      Nevertheless, I wonder if you have a similar solution targeting "SAP GUI For Java"?

      Author's profile photo Krishna Chaitanya Vukkala
      Krishna Chaitanya Vukkala
      Blog Post Author

      Hi Kerem,

      I agree with you that this can be called using any programming Language. So I used Python here and how this can be utilised using Trending Programing Language.

      In this blog I have showed you how can we access particular URL’s using this program Tkinter. There are other features where we can explore more how can we automatically login in any URL’s I’ll share another blog how this can be done.

      Author's profile photo Rohit Singh
      Rohit Singh

      @Krishna Chaitanya Vukkala /@Kerem Koseoglu,

      What if SNC logon has been activated on the machine? What modification do we need to make in the above code?

      Author's profile photo Aparna Uppuluri
      Aparna Uppuluri

      Great! Lookingforward to explore what else can be done through Python

      Author's profile photo Anil Kumar Daram
      Anil Kumar Daram

      Great ! Innovative !! Keep it Up Krishna !! Looking forward for more from you !

      Author's profile photo Setiadi Setiadi
      Setiadi Setiadi

      Quite good idea, I am just think how to make the automatic program read the csv or text files from python link with the BAPI for example tcode FB60, I think this program is useful for speed the process  compare with manual entries, my knowledge of python is still a beginner.



      Author's profile photo Rohit Singh
      Rohit Singh

      @Krishna Chaitanya Vukkala /@Kerem Koseoglu,

      What if SNC logon has been activated on the machine? What modification do we need to make in the above code?