Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to do you stop script execution when using the Scripting API inside a C# app?

I am using the SAP GUI Scripting API 7.10.  My program is written in C#.  I am using the following code (I have removed a lot of code for clarity sake).

SapROTWr.ISapROTWrapper SapROTWrapper = new SapROTWr.CSapROTWrapperClass();

object SapGuilRot = SapROTWrapper.GetROTEntry("SAPGUI");

object engine = SapGuilRot.GetType().InvokeMember("GetScriptingEngine",System.Reflection.BindingFlags.InvokeMethod, null, SapGuilRot, null);

GuiApplication GuiApp = engine as GuiApplication;

GuiConnection connection = GuiApp.Connections.ElementAt(0) as GuiConnection;

GuiSession session = connection.Children.ElementAt(0) as GuiSession;

As soon as the program executes the last statement above, the SAP session indicates via the 'barber pole' that a script is being executed.  Basically, after the above statement my program will look at various text fields and complete it's need for its connection to the SAP scripting engine.  The C# program will continue to run as long as the agent is logged into his/her workstation.  The SAP program will continue to be used by the agent for data entry (they are in a call center).  The 'barder pole' still continues to indicate that a script is being executed.

Is there a way in the SAP GUI Scripting API to stop the 'script' execution?   Basically, my application is not a script and it does not look like the Scripting API was designed to handle this type of application.  The only solution I have discovered so far is to have my program terminate, but this is unacceptable.



Former Member

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question