cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sapshcut: Command line and JavaScript

0 Likes
2,857

Hi everybody,

I'm trying to open a SAPGUI window out of a widget.

Therefore I use sapshcut.

My command line statement is something like this:

start sapshcut.exe -snc_name="p:CN=ISX, O=SAP-AG, C=DE" -sid=ISX -command="*ZDM_WIDGET P_INPUT=915CBF7FD8828F4DAD581B66CA887D3D;" -type=Transaction -max

It works fine so.

But when I want to use the

runCommand

function from JavaScript I get an error popup saying:

Microsoft Visual C++ Library

Buffer overrun detected!

Program C:\Program ...\sapgui.exe

A buffer overrun has been detected which has corrupted the program's internal state.

The program cannot safely continue execution and must now be terminated.

I tried several variants...

var sapgui = "start sapshcut.exe -snc_name="p:CN=ISX, O=SAP-AG, C=DE" -sid=ISX -command="ZDM_WIDGET P_INPUT=915CBF7FD8828F4DAD581B66CA887D3D;" -type=Transaction -max";
runCommand("cmd /C " + sapgui);

and also

runCommand('cmd /C start sapshcut.exe -snc_name="p:CN=ISX, O=SAP-AG, C=DE" -sid=ISX -command="*ZDM_WIDGET P_INPUT=915CBF7FD8828F4DAD581B66CA887D3D;" -type=Transaction -max');

Does anyone have an idea what causes this error or even how I can avoid it?

I get the same error when I insert a wrong parameter in the command line in windows.

But it also works if I just call the transaction like this.

runCommand('cmd /C start sapshcut.exe -snc_name="p:CN=ISX, O=SAP-AG, C=DE" -sid=ISX -command="*ZDM_WIDGET" -type=Transaction -max');

So the problem must lay in the parameter...

Best regards

Tobias

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Likes

I finally fixed the issue.

This one works without any error.


var sapgui = 'C:\Program Files\SAP\FrontEnd\SAPgui\sapshcut.exe -snc_name="p:CN=ISX, O=SAP-AG, C=DE" -sid=ISX -command="*ZDM_WIDGET P_INPUT=915CBF7FD8828F4DAD581B66CA887D3D;" -type=Transaction -max';
	
var shell = COM.createObject("WScript.Shell");
shell.Exec(sapgui);

athavanraja
Active Contributor
0 Likes

did you try the widget linked in the following thread, it uses a similar logic, could give you some ideas

Raja

0 Likes

Hi Raja,

thanks for your reply.

What exactly did you mean?

I looked into this widget but did not find any usage of sapshcut.exe...

BR

Tobias

athavanraja
Active Contributor
0 Likes

sorry for misleading. i thought that it was using sap short cut, but it uses sap gui scripting.

Sorry again.

Regards

Raja