Go to https://me.sap.com/app/sappassport, request your certificate and install it in your Browser. Working with the BTP is much more convenient now, as you don’t have to enter your credentials all the time.

Go to https://me.sap.com/app/sappassport, request your certificate and install it in your Browser. Working with the BTP is much more convenient now, as you don’t have to enter your credentials all the time.
Create your script file, make it executeable and add it to your .gitignore as it contains sensitive information:
touch login.sh
chmod +x login.sh
echo login.sh >> .gitignore
Open the file and paste the following:
#! /bin/bash
cf login <<!
myemail@mail.com
mypassword
1
!
With “1” you select your target space. Save your script and run it using:
./login.sh
After some time, it can happen that the default identity provider of the SAP BTP (SAP ID service) is asking for a password change. I don’t know exactly, but it seems to be every 90 days?!
The login process will fail with the following output:
$ ./scripts/login.sh
API endpoint: https://api.cf.eu10.hana.ondemand.com
Email: myemail@mail.com
Password:
Authenticating...
{"error":"invalid_grant","error_description":"User authentication failed: PASSWORD_CHANGE_REQUIRED"}
To change your password, just go to https://account.sap.com or https://accounts.sap.com/, and it should directly open the password change screen.
Update 06.09.2024: The login can now also be done by completely using the cf command.
cf login -a https://api.cf.eu10.hana.ondemand.com -o myOrg -s mySpace -u myEmail@mail.com -p myPassword
Just paste the following string into the URL field when creating a new entry in KeePass. You only have to replace three parameters manually:
The two parameters system
and sysname
have to match exactly the system settings in your SAP Gui.
cmd://sapshcut -maxgui -system=E01 -sysname="SAP Dev System" -client=100 -user={USERNAME} -pw={PASSWORD} -language=DE
With a single click on the URL string or by using the shortcut CTRL + U, the SAP Gui will open and log you in.
You can find out more about the parameters for the sapshcut program, by opening the Windows Power Shell and entering
start sapshcut /?
Of course, you could also log in via command line or via batch script (.bat), but this would require to write/store your password in clear text.
start sapshcut -maxgui -system=E01 -sysname="SAP Dev System" -client=011 -user=testuser -pw=testpassword -language=DE