cancel
Showing results for 
Search instead for 
Did you mean: 

How to exit from an abap Webdynpro application on click of a button?

Former Member
0 Kudos

Hi,

I have a requirement in which I need to close the window on click of a button.

I tried by declaring a outbound plug in window and writing the following piece of code in the action method of the view.

*----


data lo_view_cntr type ref to if_wd_view_controller.

data lo_win_cntr type ref to if_wd_window_controller.

data: l_parameter_list type wdr_event_parameter_list,

l_parameter type wdr_event_parameter,

l_val type ref to data.

field-symbols: <fs> type any.

lo_view_cntr = wd_this->wd_get_api( ).

lo_win_cntr = lo_view_cntr->get_embedding_window_ctlr( ).

l_parameter-name = 'CLOSE_WINDOW'.

CREATE DATA l_val type string.

ASSIGN l_val->* to <fs>.

<fs> = 'X'.

l_parameter-value = l_val.

INSERT l_parameter INTO TABLE l_parameter_list.

lo_win_cntr->if_wd_view_controller~fire_plug( EXPORTING plug_name = 'EXIT'

parameters = l_parameter_list ).

*----


On click of button, I am getting the following error: "URL parameters specified for an exit or suspend plug, but no URL specified "

Can anyone give some input on why this error is occuring?

Thanks,

Subathra

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

Am getting the error: Parameters of exit plugs and suspend plugs must be of type STRING or TIHTTPNV

I cannot add parameter CLOSE_WINDOW of type WDY_BOOLEAN to an exit plug.

Thanks,

Subathra

uday_gubbala2
Active Contributor
0 Kudos

Hi Subathra,

If you just intend to close your application then you can ommit passing any parameters at all in your exit method. So you would just create an outbound plug (say GO_EXIT), checkmark the "Interface" checkbox & select the Plug Type as "Exit". Your parameters list will be completely empty i.e, no URL/CLOSE_WINDOW.

Now go to the properties tab of your view & add the reference of your window controller to it. Next go to the buttons up on pressing which you would want your window to be closed and place the necessary coding inside it.

METHOD onactionclose_application .
  DATA:   lr_ref TYPE REF TO ig_zuday_close_applicat.
 lr_ref = wd_this->get_zuday_close_applicat_ctr( ).

" Fire Exit Plug
  lr_ref->fire_go_exit_plg( ).
ENDMETHOD.

In the above code snippet I have few things like ig_zuday_close_applicat & get_zuday_close_applicat_ctr. This is because the name of my application is ZUDAY_CLOSE_APPLICAT. You should replace this with the corresponding names of your component & then everything will just work fine.

Regards,

Uday

NOTE: Now that you have defined some parameters for your outbound plug just remove these parameters & then activate just the window alone. If you get any error try to do a activate anyway for the window. Next remove the passage of parameters (URL & CLOSE_WINDOW) while firing the outbound plug.

uday_gubbala2
Active Contributor
0 Kudos

Hi Subathra,

A word of caution though for my suggested approach. If you are thinking of integrating your component in the portal then firing an EXIT plug wouldn't work out. You would have to in that case work with the CLOSE_WINDOW as how suggested by Sourav. Try reading the corresponding information in [here|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/ca3351508f04e7e10000000a42189c/frameset.htm].

Regards,

Uday

Former Member
0 Kudos

Hi friends!

I have read several threads about EXIT_PLUG, and tested a lot of ways.

My problem is that I can't reach to fire the exit plug from my View. I only have access to the outbound plugs defined inside the view. But the exit-plug defined for the window is not accessible.

I've tried to go to Properties of my view to include the component controller (my WINDOW) - but still I have no access to fire my exit_plug.

Please guide me how I can make WD4A to understand that I wanna fire my exit-plug from a button on my view.

best reg

Henrik

Former Member
0 Kudos

Hi,

I need to exit from the application. If I specify the URL of the application which I want to close, then the exit plug of window is fired and it comes and stands in the main page of my application. It shouldn't happen.

Thanks,

Subathra

Former Member
0 Kudos

hi,

You need not to give URL for exiting the application.

Make another parameter " Close_window" type boolean for the outbound window plug.

Make its value as X to close the application.

Refer the link given by me earlier.

Former Member
0 Kudos

Hi Uday,

I have used the same code that you have copy pasted. But then, I was getting an error:"Parameters of exit plugs and suspend plugs must be of type STRING or TIHTTPNV"

So, I changed the type of l_val from c to string. Now that I am getting the error:"URL parameters specified for an exit or suspend plug, but no URL specified "

What change should I do to achieve the exit functionality?

Thanks,

Subathra

uday_gubbala2
Active Contributor
0 Kudos

Hi Subathra,

Specify the parameter type as STRING itself. You would have to pass on the URL of the application which you want to close to this particular method. You can obtain the URL of your component using the CONSTRUCT_WD_URL method. Pass this fetched URL to your exit method. Please go through this [Wiki entry by Suman|https://wiki.sdn.sap.com/wiki/display/Snippets/Snipppets+WebDynproABAP-HowtouseOutboundPlugofa+Window]. It is very well explained in here. Couldn't manage to pull it out earler...

Regards,

Uday

Former Member
0 Kudos

hi ,

for URL of the application

use the method CONSTRUCT_WD_URL of class CL_WD_UTILITIES

CALL METHOD CL_WD_UTILITIES=>CONSTRUCT_WD_URL

EXPORTING

APPLICATION_NAME = 'ur application name'

namespace = 'sap

IMPORTING

OUT_ABSOLUTE_URL = url.

url willl be ur webdynpro application URL

ALSO REFER PAGE 894 IN THE ARTICLE

link:[https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/63a47dd9-0b01-0010-3d8e-de27242bf011&overridelayout=true]

Former Member
0 Kudos

hi,

Refer this thread :

Thanks.

uday_gubbala2
Active Contributor
0 Kudos

You can try go through Sahla's comment in this [thread|;:

I solved the problem in the following way:
(I found this in a previous forum question)
So basically the exit plug is fired, but the setting the CLOSE_WINDOW parameter is necessary!
I didn't do this in my firt trial.

method ONACTIONON_COMPLETE .
data : l_view_cntr type ref to if_wd_view_controller,
l_win_cntr type ref to if_wd_window_controller,
l_window type ref to if_wd_window,
l_parameter_list type wdr_event_parameter_list,
l_parameter type wdr_event_parameter,
l_val type ref to data.
field-symbols <fs> type any.

l_view_cntr = wd_this->wd_get_api( ).
l_win_cntr = l_view_cntr->get_embedding_window_ctlr( ).
l_parameter-name = 'CLOSE_WINDOW'.

create data l_val type c.
assign l_val->* to <fs>.
<fs> = 'X'.
l_parameter-value = l_val.
insert l_parameter into table l_parameter_list.
l_win_cntr->if_wd_view_controller~fire_plug(
exporting plug_name = 'EXIT_PLUG'
parameters = l_parameter_list ).
endmethod.

Former Member
0 Kudos

Hi .

Where to Define the 'EXIT_PLUG' ? is it in the Outbound Plugs of Window Or View ??

Suppose Example If i click the Exit button on the View Do I need to Write the Coding in the Exit_plug of that View ?

Please Suggest

Thanks In Advance

Kishore.

uday_gubbala2
Active Contributor
0 Kudos

Hi Subathra,

This particular functionality has been discussed many times earlier in the forum. You need to work with a concept called [Exit Plug|http://help.sap.com/saphelp_nw70/helpdata/en/45/1bc575ba064574e10000000a114a6b/frameset.htm] for realizing this functionality.

Regards,

Uday