Web Dynpro – Logoff Button

Home / SAP / ABAP Coding / Web Dynpro – Logoff Button

This one turned out to be pretty easy, but it sure did take some effort to get to that point…  I guess that’s the irony of it all.  ha ha ha.  So, here was my goal.  I have a web dynpro application that uses a generic user to login as the default.  Then you login with an internet user.  Now the trick that had me stumped for a while was how do I log off the internet user, and reset the application back to the initial login screen the default user.  So this is my solution for creating a logoff button that would reset the transaction back to my original internet user.

I’m sure this sounds easy to any of you Web Dynpro experts out there, but it had me hunting through textbooks, google and my few Web Dynpro contacts.  Finally came up with the trick…  so here you go.

First, in your main window, you need to create an outbound exit plug.  Be sure to give it a parameter of URL.

I recommend setting a context element to hold the intial URL.  You’ll need it later.

Next, in the main view, give your button or however you want to execute the log off procedure.

Once you call the log off procedure, you simply need to take the initial URL and add ‘?logout_submit=true’ to the end.

Here’s an example:

CONCATENATE lv_e_url ‘?logout_submit=true’ INTO lv_e_url.
data: L_REF_MAIN_WINDOW type ref to IG_XXX.
L_REF_MAIN_WINDOW =   WD_THIS->GET_XXX_CTR( ).
L_REF_MAIN_WINDOW->fire_LOGOFF_EXIT_plg( URL = lv_e_url ).

Note:  XXX is the main window name.  LOGOFF_EXIT is the exit plug name.

See what I mean…  it really is that easy =)  good luck.

 

 

As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,
Mike

2 thoughts on “Web Dynpro – Logoff Button

    1. It is possible I implemented it slightly differently than you, and that’s why it isn’t working. I’m generating a popup window (logout, yes no), and then subscribing to the button Yes. Not sure if that would make a difference. If you manually enter the url that gets concatenated, does it work? I’m curious if perhaps the URL has issues.
      Mike

Leave a Reply

Your email address will not be published. Required fields are marked *