cancel
Showing results for 
Search instead for 
Did you mean: 

Dynpro application: how to perform some code when user click window close

Former Member
0 Kudos

Hello,

I'm developing dynpro application. This application needs to perform some code when exiting.

I can do that with MODULE xxxxx AT EXIT-COMMAND. But this code can't be performed when user of application click on button closing window (classic R/3 window, not pop-up).

Does anybody know how to bind some code to clicking on button closing window?

Best regards,

Josef Motl

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Josef,

I Think there shud be something not sure..

Coz when you attempt to close all the windows..

it gives you a prompt if the user is sure to log off..

i hope you can check it by doing so..

regards

satesh

Former Member
0 Kudos

Hi Satesh,

yes, this idea inspired me to open this thread..

Regards,

Josef

naimesh_patel
Active Contributor
0 Kudos

Yes Josef,

That's true that system is asking us before leaving from the system. But it happens only on last active window, not for all.

You can try to debug, while opening more than one window and close it .. system will not take you inside. If you activate the system debug, then also it is not allow to stop.

Regards,

Naimesh

Mark useful answers..!

Former Member
0 Kudos

HI Namesh,

you are true..

it asks only for the last window..

which means there is a check if the window being closed is the last one .. whenever you close one..

regards

satesh

Former Member
0 Kudos

Hi Naimesh,

Indeed, I know it happens only on last active window. I also tried to debug, but I'm not still sure that this could be true.. I don't believe that SAP could design this behaviour without possibility to rect to closing of window..

Regards,

Josef Motl

naimesh_patel
Active Contributor
0 Kudos

Hi Josef,

May be there is something, but I haven't seen yet...

I just tried to post on document via FB01, and I pressed close button and window is closed...! System did not give any message or any pop-up...

Regards,

Naimesh

Former Member
0 Kudos

Josef,

Naimesh is correct. If you go into any standard t-code in SAP, make a change, and then close the window... the change is NOT stored (nor is a prompt provided).

I would not call this a "bug" of the SAP system. I would call it a "feature". Perhaps not the BEST feature... but that is what SAP determined was their strategy.

I guess the obvious question - Why would a user not press the SAVE icon first? They may do it ONCE... and lose their change.

They will NEVER do that again.

Answers (2)

Answers (2)

Former Member
0 Kudos

The classic R/3 screen functions such as 'X'(closing window), 'Create New session' 'End Session' etc are kernal functions. I have never tried system debugging, but I am not sure if that can debugged. Even if that is possible, I am not sure if you can use the same code in your logic as they are not for public use.

If your application is a custom application and you are logging only the pages(I hope it meant screens) visited in your application, you can always trap it when the user enters the page which is in your control, rather than to wait until he leaves or closes the page. The moment user enters a page, in the PBO, update the table log. After that whether the user closes the window or exits normally is immaterial.

Srinivas

Former Member
0 Kudos

As far as the prompt that you get when you close the last window is coming from the counter that SAP maintains regarding the number of open sessions(windows). When this counter reaches 1, I guess they have a check to issue a prompt. There was a discussion in this forum a long time back regarding how we can know that session id like SM04. There was no conclusion reached then. Theoritically, let us know you know this id for the session in which the user opened a particular page, then you can see if that session is deleted and then take the necessary action. There are some TH_* function modules that seem to be promising, but I was not able to conclusively achieve the control over a particular session.

See if you can look at SM04 and get an idea. Please do let us know if you find the solution.

Srinivas

Former Member
0 Kudos

Srinivas / Josef,

Any further work on this could be extensive. Seems like a large waste of time in the "grand scheme."

Like Pavlov's dogs... let the user get shocked once. They won't make that mistake a second time.

I'd say move on.

Former Member
0 Kudos

John,

I agree that it is a lot of work. But if you look at Josef's requirement, he is trying to have an audit trail of the pages that a user visits in his application. It is not about saving entries. If a user entered into a page that has sensitive data, then Josef wants to track it for audit purposes. If closing of a window cannot be achieved, then Josef cannot track a user visiting a certain page.

I hope that is what his requirement is.

Srinivas

Former Member
0 Kudos

Josef,

If your req is as Srini describes, there are Basis transaction that scan the system logs that can show you this information.

Can you (re-)clarify your requirement?

Former Member
0 Kudos

Hi Srinivas and John,

So, I'll try to describe my problem more precisely. What I want is exclusive access to something I called "pages". It isn't screens, it is components of my application - it is ALV grid with different contents. This "pages" can be edited (adding and removing to ALV) only by one user at same time. So when user enter "page" I put his user name to visit table, when he leaves I remove his user name. I can do this in every events, but it seems that closing window does trigger no event. Thats really problem for me. Save button means nothing in this case.

Can I say to users "No! Please do not click this cross!" ?

It's ridiculous.

Regards,

Josef

Former Member
0 Kudos

Hearing your requirement now, I see two options since SAP does not support the closing of an SAP session window using the Close button with an underlying event:

1) Train your users not to exit transactions in that way b/c that is not the way the SAP product was build. No other transaction in SAP operates in that way. Why TRY to build your custom app to support it?

OR

2) Purchase a different ERP package that supports the closing of a session window with an event

I'm sure that your company will support Option 1 at this time. They would consider anything else to be ridiculous.

Former Member
0 Kudos

It is that classic scenario where you want to cover all the bases. What if there is an earthquake at the site where the server is installed? What if someone accidentally pulls the plug of the server from the switchboard... what if... what if...

Perhaps we can try using the mastercard advertisement here(I will remove it if I am infringing any copy rights)..

There are certain things "code" cannot do, for everything else there is "ABAP".

Former Member
0 Kudos

Srinivas,

LOL... I love it !!!!

naimesh_patel
Active Contributor
0 Kudos

Hello,

There isn't any event for closing of the window.

Regards,

Naimesh

Former Member
0 Kudos

Naimesh,

are you sure? It seems like huge bug in R/3 system ..

My application maintain table containing binding usernames to attendend "pages". When user leaves, this table must be adjusted..

Are you sure there is no possibility to bind code to closing of window?

Regards,

Josef