cancel
Showing results for 
Search instead for 
Did you mean: 

Executing SAP GUI Script within JavaScript in SAP Easy Cost Planning

0 Kudos

I am trying to execute sap gui script embedded in JavaScript from a SAP form in transaction CKECP

in SAP ERP R/3. For maintaining the code I use transaction CKCM.

However, this sap gui script embedded in JavaScript, seems not to connect withObject("SAPGUI") and sapgui.GetScriptingEngine. Does anyone have an example of gui script code executing from CKECP screen? Or any ideas on why it isn't working? Below is the JavaScript that I tried to apply. Thank you in advance

<html>

<head>

<script language="javascript" type="text/javascript">

function test_sapgui() {

if (typeof(application) == "undefined") {

sapgui = GetObject("SAPGUI");

application = sapgui.GetScriptingEngine;

}

if (typeof(connection) == "undefined") {

connection = application.findById("/app/con[0]");

}

if (typeof(session) == "undefined") {

session = application.findById("/app/con[0]/ses[0]");

}

if (typeof(WScript) != "undefined") {

WScript.connectObject(session, "on");

WScript.connectObject(application, "on");

}

application.findById("/app/con[0]/ses[0]/wnd[0]").maximize();

application.findById("/app/con[0]/ses[0]/wnd[0]/tbar[0]/okcd").text = "/osbwp";

}

</script>

</head>

<body>

<form>

<p><button type="button" onclick="test_sapgui()">Test executing SAP GUI commands</button>

</form>

</body>

</html>

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

@dehmagn Did you find any solution for this? If yes then can you please help me with it?

I am trying to do the same, eliminating VbScript by using JS for SAP dialog so that it can run on edge or chrome browser.