Any desktop programmer can write a simple script to login via SAP GUI for Java automatically!
If you want to skip instructions and see a sample Python code, check sap_connection.py in my pet project Kutapada.
Step 1: Dynamically create a string with the following format:
conn=<CONNECTION>&clnt=<CLIENT>&user=<USER>&pass=<PASSWORD>&lang=<LANGUAGE>&expert=true
Here is an example:
conn=/H/10.1.3.122/S/3200&clnt=100&user=KEREM&pass=SECRET&lang=TR&expert=true
If you aren’t familiar with that connection string format, check this article.
Step 2: Save this string as a text file with the extension .sapc . Example file name: login.sapc
Step 3: Let your OS open this file, as if the user double-clicked. If your file associations are accurate, SAP GUI for Java will read this file and log in automatically.
Step 4: For security purposes, delete the generated .sapc file. Otherwise, you will be storing your password in an unencrypted text file.
Leave a Reply