Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to find if last user session was terminated unexpectedly? Please help!

gopalkrishna_baliga
Participant
0 Kudos
1,201

I have a custom ABAP report.

There are situations when user was running the program and suddenly his session was terminated due to network issue or system downtime. Then this session should be locked somewhere right?

In the next run of this program i want to check if the user executing the program has any session for the same program locked already.

From which table i can find if the session for the user was already locked?

Please help!

11 REPLIES 11

matt
Active Contributor
0 Kudos
1,027

Then this session should be locked somewhere right?

Maybe. Not always. What exactly do you mean "session locked"?

raymond_giuseppi
Active Contributor
1,027

Did you already look in transaction SM21, System Log, for messages such as 'Delete session & after error &'

1,027

(Locked or logged, that is the question)

For SM04, look at

  • Classes such as cl_system_info, cl_server_info
  • FM such as SSI_SERVER_INFO_GET_SESSIONS
  • Utilities FM starting with TH such as TH_DISPLAY_USER_LIST or TH_SELECT_MODE which wrap system Function such as ThUsrInfo
  • In SM04 for a Web Dynpro, what did you see in 'sessions' in your version

0 Kudos
1,027

If a user has opened a webdynpro(ABAP) and doing table edit. Suddenly network issue happened, Then is there any way to determine that this user is not active? In SM04 the user session still shows "Logged On".

thilakan_t
Participant
0 Kudos
1,027

Check SM12(Lock entries) or SM04 (Sessions). There must be standard FM to get the details.

0 Kudos
1,027

Let me explain better.

When a user say TEST01 runs the ABAP webdynpro in browser then the system creates an entry in SM04 for the user with State "Logged On".

Next Another user TEST02 also runs the same webdynpro then the system again creates an entry for this user in SM04.

So SM04 has now 2 entries

TEST01 Logged On

TEST02 Logged On

After sometime if the TEST01 has some sudden network disconnection then original entry for the user remains in SM04 with state :Logged On".

So SM04 still has 2 entries

TEST01 Looged On <-- this one actually not running the program because his connection was terminated

TEST02 Logged on <-- this one is actually running program currently

Now looking at the SM04 how do i find which user is logged in and currently running the program in reality.

The problem is that both the users have same State value : Logged On.

Is there any other Table where i can get more info of the current state of the user?

Thanks & Regards

Gopal

0 Kudos
1,027

Then SM21 is only option. Check the logs at that time. I don't think of any other tcode for this kind logs.

gopalkrishna_baliga
Participant
0 Kudos
1,027

Let me explain better.

When a user say TEST01 runs the ABAP wendynpro in browser then the system creates an entry in SM04 for the user with State "Logged On".

Next Another user TEST02 also runs the same webdynpro then the system again creates an entry for this user in SM04.

So SM04 has now 2 entries

TEST01 Looged On

TEST02 Logged on

After sometime if the TEST01 has some sudden network disconnection then original entry for the user remains in SM04 with state :Logged On".

So SM04 still has 2 entries

TEST01 Looged On <-- this one actually not running the program because his connection was terminated

TEST02 Logged on <-- this one is actually running program currently

Now looking at the SM04 how do i find which user is logged in and currently running the program in reality.

The problem is that both the users have same State value : Logged On.

Is there any other Table where i can get more info of the current state of the user?

Thanks & Regards

Gopal

gopalkrishna_baliga
Participant
0 Kudos
1,027

If a user has opened a webdynpro(ABAP) and doing table UI edit. Suddenly network issue happened, Then is there any way to determine that this user is not active? In SM04 the user session still shows "Logged On".

Sandra_Rossi
Active Contributor
0 Kudos
1,027

I never ever had to worry about "if last user session was terminated unexpectedly" because any update is automatically rollbacked, leaving a clean database state, all locks are removed, etc.

Why do you have to worry about "if last user session was terminated unexpectedly"?

matt
Active Contributor
0 Kudos
1,027

I'm not sure, but I think the you're saying that a user has an enqueue lock on some data, then their session terminates unexpectedly, which can leave the lock on the data. You're trying to write a program that detects this situation, and thought of using SM04 (or what's behind it) to see if there are enqueue locks but the user isn't actually logged on. But SM04 shows the user logged on.

In which case, I think the answer is - you can't. Because when a user is seen to be logged off, then any enqueued locks are automatically deleted. The whole problem with the unexpected termination is that the backend system doesn't know about it. There's no signal.