cancel
Showing results for 
Search instead for 
Did you mean: 

Logoff by ABAP

Former Member
0 Kudos

Hello,

I need to program a logoff functionality which is based on ABAP-Logic and not by a user activity like pressing a logoff button.

At the end I will include this function into a ITSMobile Transaction, so it would be also ok to call a Exit URL without opening a additional window.

Any ideas how to do this? I found only coding which is not running at Unicode...

Thanks

Andreas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hello Andreas Adler,

In ITSMobile Transaction, we usually call the ICF service present at /sap/public/bc/icf/logoff. This terminates the SAP AS session from the browser since it is a URL.

However, if you want to do it from ABAP, which would mean in the normal SAP GUI, the best way would be to Exit from the Program as:

     LEAVE PROGRAM.

If you want an alternative, you may try calling the Class Interface: CL_HTTP_EXT_LOGOFF through your ABAP code and see how it works.

Let me know.

Former Member
0 Kudos

Hello Utkarsha,

'LEAVE PROGRAM' I had checked before, this leave the running transaction but not ending the SAPGUI.

How to use CL_HTTP_EXT_LOGOFF? I have - as far as I know - no object where I can use. Maybe i'm not familar enough with ABAP-OO.

Former Member
0 Kudos

Hello Andreas Adler,

If you want to exit from only the current internal session, use the following:

     CALL FUNCTION 'TH_DELETE_MODE'

        EXPORTING

          MODE          = -1.


If you want to terminate the entire user session, use:

     CALL 'SYST_LOGOFF'.


Let me know.

Answers (1)

Answers (1)

former_member569028
Discoverer
0 Kudos

Hi, Andreas,

Please check note 1910057.

You can either have a redirect to the ICF service present at /sap/public/bc/icf/logoff or call the method LOGOFF of current server object of class CL_HTTP_SERVER_NET.

Both of them will support another redirect after logoff.

Add note link Message was edited by: Oisin ONidh ITS SCN Moderator

Former Member
0 Kudos

Thanks Robert,

but I have to capsulate a 'ITSMobile-Program' and to terminate, if the user leaves this by pressing a back button. No way to change the 'ITSMobile'-Program so I can't use 'classical' solutions like the exit url. But the hint by Utkarsha had solved the issue.