Skip to Content

React to /n command in sapgui

May 23, 2017 at 07:59 AM


avatar image

Hi guys,

I'd like to do some clean-up if the user ends the program by entering a new transaction code in the command field of sapgui with /n. I though module XXX at exit-command would help but alas no the code didn't seem to execute when leaving the program by /n.

Is it possible to react to that at all?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sandra Rossi May 23, 2017 at 08:04 AM

You can't. The program must be written such a way (using the concept of SAP LUW) that the dialog session may stop at any time without doing any harm.

What is your original issue?

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Yeah it is. There is no harm at least not on the DB. But I wanted to clean up some controls. it's not so bad, SAPGui doesn't do it so badly.

Mike Pokraka May 23, 2017 at 10:54 AM

/n is specifically there to immediately abort whatever session/transaction you're in. Do not communicate to the running app, do not pass go, do not collect $200, just quit.

In other words, you should handle it in the same way as the possibility your user might drop the network connection, go to lunch, close SAPGUI, or just bluescreen.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Nice reference to Monopoly there! I wanted to clean up some controls and since I can't use a destructor in ABAP...


Yes that was the intent :-)

The session releases all references and the garbage collector will do the clearing. In some ways the garbage collector is one reason why ABAP doesn't have (need?) destructors.


yes, there was some reuse in some obscure part of my own code which was corrupting memory references (it's a moderately complex thing with 2 different types of controls - the HTML container was the problem - in GUI application). It was complicated but basically SAP is doing everything right and just have to know a bit better what the GUI controls do. But apparently decades of experience will still not suffice.