Application Development and Automation 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: 
Read only

log off from ABAP Program

Former Member
0 Likes
2,502

I Wonder whether it is possible to write an abap program

which fulfills following requirement.

just like the tcode which is used to log off /nex.

but it closes all sap windows without warning on the same server.

what i want,

i want to write a progam and then create a tcode for that say zex.

on entering that tcode the system close all sap window on the same server except one.

eg:

say i have opened 4 sessions of prd server. and i want to close 3 of them.

then i execute custom tcode say zex. and out of 4 --3 sessions will be closed.

no of sessions to be closed  = total no of open sessions - 1.

dont know whether it is possible>

ur suugesstions wanted.

there are FM present.

THUSRINFO

call 'syst_logoff'.

but none of them suits to my requirement.,

7 REPLIES 7
Read only

Former Member
0 Likes
1,765

is there no one to reply

Read only

Former Member
0 Likes
1,765

Hi Abhishek,

Well in that case the requirement isnt to logoff but to close all the open sessions except one. But how are you going to decide which session has to be open ?

I would suggest to check FM's for closing a session or debug close session to identify how SAP does it.

Thanks,

Best regards,

Prashant

Read only

0 Likes
1,765

The session which will remain open will be that opened at the begning.

say it other way:

at any open session at bottom right corner there displayed:

server name (session No ) client.

eg: dev(1)700.

only session 1 will remain open and all other will be closed.

i tried to debug.

first /h in command box.

and then tcode /nex. but it does not goes in debugging mode rather it exits sap.

Read only

0 Likes
1,765

Hi Abhishek,

You need to switch on System Debugging.

Thanks,

Best regards,

Prashant

Read only

0 Likes
1,765

<< Content Removed >> i first switch on system debugging and then entered tcode /nex. but that is what i am saying instead on entering into debugging mode it directly exits.

all sap sessions closed!

<< Moderator Message : Speak professionally in the forums >>

Message was edited by: Kesavadas Thekkillath

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,765

Get list of modes  and delete specific modes are not easy, you will mostly require use of "forbidden" call system command like ThUsrInfo.

What if you want to try ?

Look at include TSKHINCL for opcode values, perform some where-used on those constants, if unlucky you find SAP report using the system calls, if you are lucky the call is executed in a useful function module (name starting with TH_)

The result could look like following samples,  informative only, neither tested nor intended to be tested...

DATA: tid TYPE utid,

      modes TYPE sy-index,

      mode_list type table of modus with HEADER LINE,

      modus type modus.

* Current session id (Look at TH_USER_INFO)

CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_usr_attr

  ID 'TID' FIELD tid. " Id of current session

* Number of modes (Look at form modus_liste of RSM04000_ALV)

CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_mode_count

  ID 'TID' FIELD tid

  ID 'MODES' FIELD modes. " number of modes

CHECK modes GT 1.

* List of modes with transaction (Look at TH_SELECT_MODE)

*CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_get_mode_list

*    ID 'TID' FIELD tid

*    ID 'MODE_LIST' FIELD  mode_list. " mode list

* Delete a Mode (Look at TH_DELETE_MODE)

CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_delete_mode

     ID 'MODE' FIELD mode.

Try in a sandbox...

Regards,

Raymond

PS: /nex is not an actual transaction, trying to enter in debug mode (even system) in what is probably a C program gives little chance of success...

Read only

Former Member
0 Likes
1,765

Hi,

Did you have a look @ FM TH_DELETE_USER. Unfortunately I could not confirm it on my system because of 'Authority' issue.

Regards

Raju chitale