Open SAP GUI from HTML out of your webbrowser

SAP aus Browser aufrufenSome time ago I got into a discussion about whether it is possible to open transactions in the SAP GUI out of the browser. The opinion of the colleagues was unanimous – start SAP GUI from browser is something not be done.

However I have maintained and created a small proof-of-concept. Because it works. Ok, it’s not pretty, but it works. And that’s how to call the SAP GUI from the browser.

sapshcut.exe and what you can do with it

The solution works (among other things) using the sapshcut.exe (short for SAP Shortcut). This .exe file allows to start the SAP GUI parameterized. The possible parameters ranging from user via logon language up to the executed transaction. A complete list of possible parameters can be obtained by calling the sapshcut.exe with the parameter -?. (See screenshots below.)

sapshcut.exe - help from cmd  sapshcut.exe - Command list

To allow a jump from a Web browser into SAP GUI, only the sapshcut.exe with the appropriate parameters must be called. And that is also the reason, why I wrote in the introduction that it is not a nice solution. To run .exe files from the browser, there is only one, fairly “standardized” solution: ActiveX. And it works again – for security reasons – in almost no browser except Internet Explorer. (How could it be otherwise…)

Open SAP from the Internet Explorer

To execute the jump from a Web page into the SAP GUI the following, four-line Javascript function, which can be installed within any web page, is enough.

function openSAPGui(sid, client, user, password, transaction){
    var shell = new ActiveXObject("WScript.Shell");'sapshcut.exe -system="'+sid+'" -client='+client+' -user="'+user+'" -pw="'+password+'" -language=DE -Command="'+transaction+'"');

Theoretically you can even further summarize the whole code, in practice and in terms of reusability you shouldn’t, because the encapsulation within a small javascript function makes sense.

If you do not want to build a test page to include and run the javascript function now, just simply copy the following code, paste it into a text file, save it as [filename] .html and open it in Internet Explorer.

	<script src=""></script>


<input id="transaktion" type="text"></input>
<input id="usr" type="text"></input>
<input id="pass" type="password"></input>
<input id="sid" type="text"></input>
<input id="mand" type="text"></input>

	<button id="go" type="button">Absprung!</button>

			var trans = $('#transaktion').val();
			var usr = $('#usr').val();
			var pass = $('#pass').val();
			var sid = $('#sid').val();
			var mand = $('#mand').val();
			openSAPGui(sid, mand, usr, pass, trans);			
	function openSAPGui(sid, client, user, password, transaction){
		var shell =  new ActiveXObject("WScript.Shell");'sapshcut.exe -system="'+sid+'" -client='+client+' -user="'+user+'" -pw="'+password+'" -language=DE -Command="'+transaction+'"');			

Should you know a more elegant or even cross-browser compatible solution, just tell me! I look forward to your comments and suggestions.

Leave a comment

Please be polite. We appreciate that. Your email address will not be published and required fields are marked