Abap program to end specific User’s Program, by sesion/tcode or GUIID

Hello everyone, I’ve seen this posted quite  few times, posted here but it does not seem to work properly for me, and wanted to know what I was doing wrong.

So what I want to do is end a specific users program/session which they have started, it would be great if I could end it by GUI-id but I havnt been able to find any info on doing that. But atleast to be able to do it by session & tcode, this would have to be done via the background, with no user interaction.

What I’ve tried is to get the info on users by
CALL FUNCTION ‘TH_USER_LIST’
  TABLES
    list lt_UINFO
    USRLIST lt_USRINFO
  EXCEPTIONS
    others   1.
 

and then kill the session by
CALL FUNCTION ‘TH_DELETE_USER’
  EXPORTING
    client symandt  ” Current client
    user   =  ls_usrinfobname   ” Username of the session
    tid    =  ls_usrinfotid    ” Session ID (TID) to end
  EXCEPTIONS
    OTHERS 1.

as I’ve seen other people on here say it worked for them, but this ends the users entire session, all their current transaction and not just a specific program or tcode and thus wont work for me.

Does anybody know of a good way to end a users specific transaction/program or guiid?

Scroll to Top